Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

Merge pull request #284 from rudycelekli/fix/rdf-file-document-base-signed-20261006

FABIOTESS947fc38e8b1c
diff --cc CHANGELOG.md
index a2ab3840,e9259f7b..f4509f06
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -6,12 -6,7 +6,13 @@@ All notable changes to Open Ontologies
### Fixed
+- Keep the last active ontology intact when parsing a replacement source, cache, or refresh fails; publish successful replacements in one graph transaction.
+- Bound wildcard repository filtering to pattern/filename pairs so repeated stars cannot stall `onto_repo_list`.
+- Sanitize quotes and ASCII control bytes in mapped IRI components so valid structured data does not fail RDF ingestion.
+- Scope deterministic synthetic row identifiers to the original source stem,
+ preserving distinct subjects across sheets and class overrides. Encode source
+ names losslessly; identical stems require distinct base IRIs.
+ - Keep original Turtle error line numbers when applying a local document base.
### Added
@@@ -55,32 -50,10 +56,36 @@@
### Fixed
+- XML ingest preserves CDATA and text split by comments or CDATA boundaries,
+ and rejects undecodable entities rather than loading a silently empty value.
+ Whitespace normalization applies once to the completed field.
+- Explicit ingest formats are honored by the local CLI and the MCP ingest/map
+ tools rather than silently falling back to filename detection. Omitted formats
+ retain extension detection, and unsupported explicit formats return an error.
+- Read extraction-scaffold metadata and mapping-generator declarations from
+ every loaded graph, so TriG and N-Quads retain the same discovered classes,
+ properties, typed extraction checks, and prompt fields as Turtle schemas.
+- Materialize documented row-number identifiers in batch and MCP induction
+ when no input column identifies the rows. Choose an unused internal field so
+ existing `__row` data remains a property instead of merging different rows.
+
+- Render XLSX numeric calendar cells as ISO dateTime values instead of Excel
+ serial numbers, respecting the workbook's 1900 or 1904 calendar. Duration
+ cells retain their existing representation; calendar cells do not distinguish
+ date-only values from midnight dateTimes.
+- Parquet ingest formats each non-primitive cell with Arrow's value formatter,
+ preserving date and decimal lexical values instead of embedding a debug dump
+ of the complete column in every row. Formatting errors fail the import.
+- Preserve XLSX header and Parquet schema order during induction so the first
+ filled, unique column remains the identifier candidate, as it is for CSV.
+- Compare canonical blank node identities in ontology diffs, so unchanged
+ anonymous restrictions do not appear as added and removed triples. Anonymous
+ structure remains visible when it changes; canonical IDs can shift under edits.
+
+ - Validate relative RDF references against the local document base, matching
+ loading, conversion, and linting. Encode local file URLs so RDF files under paths with
+ spaces, percent signs, or fragment characters resolve relative references
+ correctly; explicit Turtle and XML bases retain priority.
- **The embedding model is loaded once per process rather than once per HTTP
session** (#262). The HTTP arm hands the same server constructor to
diff --cc src/graph.rs
index 4180a1a5,b49f0f7b..f7b85184
--- a/src/graph.rs
+++ b/src/graph.rs
@@@ -306,34 -291,22 +306,29 @@@ impl GraphStore
// it, any file using relative IRIs fails to parse at all, which is
// most published RDF/XML: LUBM's generated data would not load a
// single triple before this.
- let base = std::fs::canonicalize(path)
- .ok()
- .and_then(|abs| abs.to_str().map(|s| format!("file://{s}")));
+ let base = Self::file_base_iri(path);
// All or nothing: see load_turtle (issue #93).
let mut parser = RdfParser::from_format(format);
- if let Some(p) = base
- .as_ref()
- .and_then(|b| parser.clone().with_base_iri(b).ok())
- {
- parser = p;
+ if let Some(base) = base {
+ parser = parser.with_base_iri(base)?;
}
- let quads: Vec<_> = parser
- .for_reader(reader)
- .collect::<Result<_, _>>()?;
- // Report triples actually added, not parse events. The store is a set, so
- // re-inserting a statement it already holds changes nothing and must not be
- // counted as a load.
- let before = store.len().unwrap_or(0);
- // Atomic for the reason given on the first loader above.
- let mut txn = store.start_transaction()?;
- for quad in &quads {
+ let quads: Vec<_> = parser.for_reader(reader).collect::<Result<_, _>>()?;
+ self.store_parsed_quads(&quads, replace)
+ }
+
+ fn store_parsed_quads(&self, quads: &[Quad], replace: bool) -> anyhow::Result<usize> {
+ let before = if replace {
+ 0
+ } else {
+ self.store.len().unwrap_or(0)
+ };
+ let mut txn = self.store.start_transaction()?;
+ if replace {
+ // Clear and insert share one transaction: failed parsing never clears
+ // the old graph, and readers cannot observe an empty intermediate graph.
+ txn.clear()?;
+ }
+ for quad in quads {
txn.insert(quad);
}
txn.commit()?;