From d6b54137e1081d468eb7be65252a47362f771e59406947f2758480390ea82b86 Mon Sep 17 00:00:00 2001 From: Alex Wied <543423+centromere@users.noreply.github.com> Date: Wed, 10 Jun 2026 14:16:25 -0400 Subject: [PATCH] . --- publish/src/app.rs | 2 +- publish/src/rdf/ontology.rs | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/publish/src/app.rs b/publish/src/app.rs index 589df19..42a4af2 100644 --- a/publish/src/app.rs +++ b/publish/src/app.rs @@ -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) diff --git a/publish/src/rdf/ontology.rs b/publish/src/rdf/ontology.rs index 5a798f5..32a0e38 100644 --- a/publish/src/rdf/ontology.rs +++ b/publish/src/rdf/ontology.rs @@ -351,17 +351,9 @@ impl Ontology { }) } - pub fn is_read_only<'a>(&self, triple: impl Into>) -> bool { + fn is_read_only_impl<'a>(iri_info: &HashMap, triple: impl Into>) -> 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>) -> bool { + Self::is_read_only_impl(&self.iri_info, triple) + } + pub fn subclass_of(&self, class: NamedNodeRef<'_>) -> impl Iterator { let query = SparqlEvaluator::new() .parse_query(