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(query): render native SELECT rows in human output
Rudy Celekli61ce7f3ac840
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6646495d..c2a63cf8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,7 @@ All notable changes to Open Ontologies are documented here.### Fixed+- Render native SELECT rows as tables with `--human`, including empty results, while preserving JSON output and standard SPARQL binding rendering.- 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.diff --git a/src/output.rs b/src/output.rsindex c0046ecd..b8d3b83c 100644--- a/src/output.rs+++ b/src/output.rs@@ -16,10 +16,7 @@ pub fn render_human_for(command: Option<&str>, value: &Value) -> String {}match command {Some("query") => {- let bindings = value- .get("results")- .and_then(|r| r.get("bindings"))- .and_then(|b| b.as_array());+ let bindings = sparql_rows(value);match bindings {Some(b) => {let vars: Vec<&str> = value@@ -50,11 +47,7 @@ pub fn render_human(value: &Value) -> String {}// SPARQL query results- if let Some(bindings) = value- .get("results")- .and_then(|r| r.get("bindings"))- .and_then(|b| b.as_array())- {+ if let Some(bindings) = sparql_rows(value) {let vars: Vec<&str> = value.get("variables").and_then(|v| v.as_array())@@ -238,6 +231,18 @@ pub fn render_human(value: &Value) -> String {serde_json::to_string_pretty(value).unwrap_or_else(|_| value.to_string())}+/// Accept the native store's flat rows as well as SPARQL binding objects.+/// Native SELECT results always carry variables; an unrelated results array+/// must still fall back to its existing rendering.+fn sparql_rows(value: &Value) -> Option<&Vec<Value>> {+ let results = value.get("results")?;+ if let Some(bindings) = results.get("bindings").and_then(Value::as_array) {+ return Some(bindings);+ }+ value.get("variables")?.as_array()?;+ results.as_array()+}+fn render_stats(value: &Value) -> String {let triples = value.get("triples").and_then(|v| v.as_u64()).unwrap_or(0);let classes = value.get("classes").and_then(|v| v.as_u64()).unwrap_or(0);@@ -264,8 +269,8 @@ fn render_sparql_table(vars: &[&str], bindings: &[Value]) -> String {let cell = row.get(var).and_then(|v| {- v.get("value")- .and_then(|v| v.as_str())+ v.as_str()+ .or_else(|| v.get("value").and_then(Value::as_str)).map(|s| s.to_string())}).unwrap_or_default();