.
This commit is contained in:
+1
-1
@@ -419,7 +419,7 @@ impl Publisher {
|
|||||||
Message::SaveGraph(overwrite) => {
|
Message::SaveGraph(overwrite) => {
|
||||||
let client = self.http_client.clone();
|
let client = self.http_client.clone();
|
||||||
let options = SerializationOptions::from_format(RdfFormat::Turtle)
|
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
|
let request = self
|
||||||
.document
|
.document
|
||||||
.to_update(options)
|
.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();
|
let triple = triple.into();
|
||||||
self.iri_info
|
match (triple.predicate, triple.object) {
|
||||||
.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) {
|
|
||||||
(rdf::TYPE, TermRef::NamedNode(node)) => iri_info
|
(rdf::TYPE, TermRef::NamedNode(node)) => iri_info
|
||||||
.get(&node.into_owned())
|
.get(&node.into_owned())
|
||||||
.map(|info| info.read_only)
|
.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> {
|
pub fn subclass_of(&self, class: NamedNodeRef<'_>) -> impl Iterator<Item = NamedNode> {
|
||||||
let query = SparqlEvaluator::new()
|
let query = SparqlEvaluator::new()
|
||||||
.parse_query(
|
.parse_query(
|
||||||
|
|||||||
Reference in New Issue
Block a user