Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
Merge remote-tracking branch 'origin/main' into fix/mcp-lint-diff-read-any-format
Vishal Habibae5990a772bc
diff --cc src/graph.rsindex c64b7f1b,23683cda..6615780a--- a/src/graph.rs+++ b/src/graph.rs@@@ -321,19 -353,22 +353,39 @@@ impl GraphStore/// syntax reader existed each of those called the RDF parser directly, and/// adding a format meant finding all of them.fn parse_document(path: &str, content: &str) -> anyhow::Result<Vec<Quad>> {- Self::parse_document_with_base(path, content, Self::file_base_iri(path))+ Ok(Self::parse_document_with_prefixes(path, content)?.0)}+ /// [`Self::parse_document`], keeping the prefixes the parser saw.+ fn parse_document_with_prefixes(+ path: &str,+ content: &str,++ ) -> anyhow::Result<ParsedDocument> {++ Self::parse_document_with_base_and_prefixes(path, content, Self::file_base_iri(path))++ }++++ /// [`Self::parse_document`] with an explicit base IRI for relative IRIs.+ fn parse_document_with_base(+ path: &str,+ content: &str,+ base: Option<String>,+ ) -> anyhow::Result<Vec<Quad>> {++ Ok(Self::parse_document_with_base_and_prefixes(path, content, base)?.0)++ }++++ fn parse_document_with_base_and_prefixes(++ path: &str,++ content: &str,++ base: Option<String>,+ ) -> anyhow::Result<ParsedDocument> {match Self::detect_source_format(path, content) {- SourceFormat::OwlFunctional => Ok(crate::ofn::parse(content)?- .into_iter()- .map(|t| t.in_graph(GraphName::DefaultGraph))- .collect()),+ SourceFormat::OwlFunctional => Ok((+ crate::ofn::parse(content)?+ .into_iter()+ .map(|t| t.in_graph(GraphName::DefaultGraph))+ .collect(),+ crate::ofn::declared_prefixes(content),+ )),SourceFormat::Rdf(format) => {// A document's own location is its default base, per RFC 3986.// Without it, any file using relative IRIs fails to parse at@@@ -341,12 -376,19 +393,19 @@@// would not load a single triple before this. OFN needs none:// its grammar admits only absolute IRIs.let mut parser = RdfParser::from_format(format);- if let Some(base) = Self::file_base_iri(path) {+ if let Some(base) = base {parser = parser.with_base_iri(base)?;}- Ok(parser- .for_reader(Cursor::new(content.as_bytes()))- .collect::<Result<_, _>>()?)+ let mut reader = parser.for_reader(Cursor::new(content.as_bytes()));+ let mut quads = Vec::new();+ for quad in &mut reader {+ quads.push(quad?);+ }+ let prefixes = reader+ .prefixes()+ .map(|(name, iri)| (name.to_string(), iri.to_string()))+ .collect();+ Ok((quads, prefixes))}}}