.
This commit is contained in:
+1
-1
@@ -419,7 +419,7 @@ impl Publisher {
|
||||
Message::SaveGraph(overwrite) => {
|
||||
let client = self.http_client.clone();
|
||||
let options = SerializationOptions::from_format(RdfFormat::Turtle)
|
||||
.with_filter(self.ontology.exclude_read_only_predicate());
|
||||
.with_filter(self.ontology.exclude_read_only());
|
||||
let request = self
|
||||
.document
|
||||
.to_update(options)
|
||||
|
||||
+11
-10
@@ -351,17 +351,9 @@ impl Ontology {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn is_read_only<'a>(&self, triple: impl Into<TripleRef<'a>>) -> bool {
|
||||
fn is_read_only_impl<'a>(iri_info: &HashMap<NamedNode, IriInformation>, triple: impl Into<TripleRef<'a>>) -> bool {
|
||||
let triple = triple.into();
|
||||
self.iri_info
|
||||
.get(&triple.predicate.into_owned())
|
||||
.map(|info| info.read_only)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn exclude_read_only_predicate(&self) -> impl Fn(TripleRef<'_>) -> bool + 'static {
|
||||
let iri_info = self.iri_info.clone();
|
||||
move |triple| match (triple.predicate, triple.object) {
|
||||
match (triple.predicate, triple.object) {
|
||||
(rdf::TYPE, TermRef::NamedNode(node)) => iri_info
|
||||
.get(&node.into_owned())
|
||||
.map(|info| info.read_only)
|
||||
@@ -373,6 +365,15 @@ impl Ontology {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn exclude_read_only(&self) -> impl Fn(TripleRef<'_>) -> bool + 'static {
|
||||
let iri_info = self.iri_info.clone();
|
||||
move |triple| { Self::is_read_only_impl(&iri_info, triple) }
|
||||
}
|
||||
|
||||
pub fn is_read_only<'a>(&self, triple: impl Into<TripleRef<'a>>) -> bool {
|
||||
Self::is_read_only_impl(&self.iri_info, triple)
|
||||
}
|
||||
|
||||
pub fn subclass_of(&self, class: NamedNodeRef<'_>) -> impl Iterator<Item = NamedNode> {
|
||||
let query = SparqlEvaluator::new()
|
||||
.parse_query(
|
||||
|
||||
Reference in New Issue
Block a user