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
fix(drift): ignore blank nodes in vocabulary diff (#14)
Jason Smith82accd512032
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f8358d8b..9d556ae8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -13,6 +13,9 @@ All notable changes to Open Ontologies are documented here.- **`SchemaIntrospector::sql_to_xsd` extended** to handle DuckDB-native types (HUGEINT, U{TINY,SMALL,}INT, DOUBLE, parameterised DECIMAL/VARCHAR, DATETIME, UUID, TIME).- New tests: `tests/sqlsource_test.rs` (driver detection, no features required) and `tests/duckdb_test.rs` (introspection + query → row extraction, gated by the `duckdb` feature).+### Fixed+- **`onto_drift` ignores blank nodes**. Pizza-style ontologies (and any OWL with restriction classes) use anonymous blank-node restriction classes that get freshly reminted on every parse. Two snapshots of the same file would show ~40 added + ~40 removed bnodes plus a Cartesian product of confidence-scored "renames" between them, drowning real entity changes in noise. The vocabulary extractor now filters `_:`-prefixed IRIs from both class- and property-gather loops.+### Documentation- `docs/data-pipeline.md` rewritten to cover both file-based and SQL-based ingest paths, the supported connection-string forms, federation examples (Parquet on S3 + Postgres scanner + remote CSV in one query), and a build matrix for the new feature flags.- `SKILL.md`, `skills/ontology-engineering/SKILL.md`, `skills/ontology-engineer.md`, and `CLAUDE.md` Tool Reference tables expanded to cover the SQL backbone tools and previously-missing tools (`onto_status`, `onto_marketplace`, `onto_unload`, `onto_recompile`, `onto_cache_status`, `onto_cache_list`, `onto_cache_remove`, `onto_repo_list`, `onto_repo_load`, `onto_embed`, `onto_search`, `onto_similarity`, `onto_dl_explain`, `onto_dl_check`, `onto_import_schema`, `onto_sql_ingest`).diff --git a/src/drift.rs b/src/drift.rsindex 1465c149..26409038 100644--- a/src/drift.rs+++ b/src/drift.rs@@ -170,10 +170,15 @@ impl DriftDetector {fn extract_vocabulary(&self, store: &GraphStore) -> HashMap<String, VocabEntry> {let mut vocab = HashMap::new();+ // Drop blank nodes — they're anonymous restriction classes etc.+ // and get fresh IDs on every reparse, so they generate spurious+ // add/remove/rename noise between two snapshots of the same file.+ let is_named = |iri: &str| !iri.starts_with("_:");+// Classeslet class_query = "SELECT DISTINCT ?c WHERE { ?c a <http://www.w3.org/2002/07/owl#Class> }";if let Ok(json) = store.sparql_select(class_query) {- for iri in parse_iris(&json, "c") {+ for iri in parse_iris(&json, "c").into_iter().filter(|i| is_named(i)) {vocab.entry(iri.clone()).or_insert_with(|| VocabEntry {iri,kind: "class".to_string(),@@ -190,7 +195,7 @@ impl DriftDetector {{ ?p a <http://www.w3.org/2002/07/owl#DatatypeProperty> } \}";if let Ok(json) = store.sparql_select(prop_query) {- for iri in parse_iris(&json, "p") {+ for iri in parse_iris(&json, "p").into_iter().filter(|i| is_named(i)) {vocab.entry(iri.clone()).or_insert_with(|| VocabEntry {iri,kind: "property".to_string(),