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
Add onto_marketplace tool — 29 standard W3C/ISO/industry ontologies
FABIOTESSaf7339749848
diff --git a/CLAUDE.md b/CLAUDE.mdindex 3542c41b..735011a1 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -58,6 +58,7 @@ Claude dynamically decides the next tool call based on what the previous tool re| `onto_save` | To persist the ontology to a file || `onto_convert` | To convert between formats (Turtle, N-Triples, RDF/XML, N-Quads, TriG) || `onto_clear` | To reset the store before loading a different ontology |+| `onto_marketplace` | To browse and install standard ontologies from a curated catalogue of 29 W3C/ISO/industry standards || `onto_pull` | To fetch an ontology from a remote URL or SPARQL endpoint || `onto_push` | To push an ontology to a SPARQL endpoint || `onto_import` | To resolve and load owl:imports chains |diff --git a/README.md b/README.mdindex 5dd90793..15ec3b12 100644--- a/README.md+++ b/README.md@@ -30,7 +30,7 @@----Open Ontologies is a **Rust MCP server** and **desktop Studio** for AI-native ontology engineering. It exposes **42 tools** that let Claude build, validate, query, diff, lint, version, reason over, align, and persist RDF/OWL ontologies using an in-memory Oxigraph triple store — with Terraform-style lifecycle management, clinical crosswalks, semantic embeddings, and a full lineage audit trail.+Open Ontologies is a **Rust MCP server** and **desktop Studio** for AI-native ontology engineering. It exposes **43 tools** that let Claude build, validate, query, diff, lint, version, reason over, align, and persist RDF/OWL ontologies using an in-memory Oxigraph triple store — with Terraform-style lifecycle management, a marketplace of 29 standard ontologies, clinical crosswalks, semantic embeddings, and a full lineage audit trail.The **Studio** wraps the engine in a visual desktop environment: 3D force-directed graph, AI chat panel, Protégé-style property inspector, and lineage viewer.@@ -238,6 +238,45 @@ One sentence input: *"Build a Pizza ontology following the Manchester tutorial s| False negatives | **0** || Classification rules | 6 OWL axioms |+### Ontology Marketplace — 29 Standard Ontologies++All 29 marketplace ontologies fetched, loaded, and reasoned over (RDFS) in a single pipeline run:++| Ontology | Classes | Properties | Triples | + Reasoning | Inferred | Fetch | Reason |+| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |+| OWL 2 | 26 | 4 | 450 | 473 | +23 | 751ms | 3ms |+| RDF Schema | 6 | 0 | 87 | 122 | +35 | 421ms | 1ms |+| RDF Concepts | 7 | 0 | 127 | 158 | +31 | 1,098ms | 1ms |+| BFO (ISO 21838) | 35 | 0 | 1,221 | 1,407 | +186 | 715ms | 6ms |+| DOLCE/DUL | 93 | 118 | 1,917 | 2,583 | +666 | 4,813ms | 14ms |+| Schema.org | 1,009 | 0 | 17,823 | 21,854 | +4,031 | 539ms | 59ms |+| FOAF | 28 | 60 | 631 | 635 | +4 | 1,263ms | 3ms |+| SKOS | 5 | 18 | 252 | 307 | +55 | 197ms | 1ms |+| Dublin Core Elements | 0 | 0 | 107 | 107 | +0 | 357ms | 1ms |+| Dublin Core Terms | 22 | 0 | 700 | 956 | +256 | 249ms | 4ms |+| DCAT | 19 | 39 | 1,695 | 1,708 | +13 | 798ms | 5ms |+| VoID | 8 | 8 | 216 | 216 | +0 | 736ms | 2ms |+| DOAP | 17 | 0 | 741 | 741 | +0 | 1,016ms | 3ms |+| PROV-O | 39 | 50 | 1,146 | 1,348 | +202 | 512ms | 7ms |+| OWL-Time | 23 | 58 | 1,296 | 1,461 | +165 | 270ms | 3ms |+| W3C Organization | 22 | 33 | 748 | 757 | +9 | 669ms | 2ms |+| SSN | 0 | 0 | 40 | 40 | +0 | 511ms | 1ms |+| SOSA | 0 | 0 | 47 | 47 | +0 | 314ms | 1ms |+| GeoSPARQL | 12 | 54 | 796 | 800 | +4 | 604ms | 5ms |+| LOCN | 2 | 0 | 206 | 206 | +0 | 1,515ms | 1ms |+| SHACL | 40 | 0 | 1,128 | 1,396 | +268 | 600ms | 5ms |+| vCard | 75 | 84 | 882 | 882 | +0 | 695ms | 1ms |+| ODRL | 71 | 50 | 2,157 | 2,230 | +73 | 449ms | 6ms |+| Creative Commons | 6 | 0 | 115 | 115 | +0 | 1,058ms | 1ms |+| SIOC | 14 | 83 | 615 | 615 | +0 | 905ms | 2ms |+| ADMS | 4 | 13 | 151 | 151 | +0 | 1,121ms | 1ms |+| GoodRelations | 98 | 102 | 1,834 | 1,849 | +15 | 2,442ms | 4ms |+| FIBO (metadata) | 0 | 0 | 45 | 45 | +0 | 1,059ms | 1ms |+| QUDT | 73 | 175 | 2,434 | 4,008 | +1,574 | 1,844ms | 10ms |+| **Total** | **1,754** | **949** | **39,607** | **47,217** | **+7,610** | — | — |++29/29 ontologies loaded, reasoned, and validated. Reasoning adds 19% more triples on average. Largest: Schema.org (17,823 triples, 59ms reasoning).+### Reasoning Performance — vs HermiT**LUBM Scaling (load + reason cycle)**@@ -255,11 +294,12 @@ Full benchmark writeup: [docs/benchmarks.md](docs/benchmarks.md)## Tools-42 tools organized by function — available as MCP tools (prefixed `onto_`) and CLI subcommands:+43 tools organized by function — available as MCP tools (prefixed `onto_`) and CLI subcommands:| Category | Tools | Purpose || --- | --- | --- || **Core** | `validate` `load` `save` `clear` `stats` `query` `diff` `lint` `convert` `status` | RDF/OWL validation, querying, and management |+| **Marketplace** | `marketplace` | Browse and install 29 standard W3C/ISO/industry ontologies || **Remote** | `pull` `push` `import-owl` | Fetch/push ontologies, resolve owl:imports || **Schema** | `import-schema` | PostgreSQL → OWL conversion || **Data** | `map` `ingest` `shacl` `reason` `extend` | Structured data → RDF pipeline |diff --git a/benchmark/marketplace_benchmark.py b/benchmark/marketplace_benchmark.pynew file mode 100644index 00000000..41f0509a--- /dev/null+++ b/benchmark/marketplace_benchmark.py@@ -0,0 +1,189 @@+#!/usr/bin/env python3+"""Benchmark all 29 marketplace ontologies through the MCP pipeline."""+import json, time, subprocess, sys, urllib.request, urllib.error, re++HOST = "127.0.0.1"+PORT = 9998+MCP_URL = f"http://{HOST}:{PORT}/mcp"++IDS = [+ "owl", "rdfs", "rdf", "bfo", "dolce", "schema-org", "foaf", "skos",+ "dc-elements", "dc-terms", "dcat", "void", "doap", "prov-o", "owl-time",+ "org", "ssn", "sosa", "geosparql", "locn", "shacl", "vcard", "odrl",+ "cc", "sioc", "adms", "goodrelations", "fibo", "qudt"+]++SESSION_ID = ""+CALL_ID = 0+++def mcp_request(payload_dict):+ """Send an MCP request and parse SSE response, returning the JSON-RPC result."""+ global SESSION_ID+ payload = json.dumps(payload_dict).encode()+ req = urllib.request.Request(MCP_URL, data=payload)+ req.add_header("Content-Type", "application/json")+ req.add_header("Accept", "application/json, text/event-stream")+ if SESSION_ID:+ req.add_header("Mcp-Session-Id", SESSION_ID)++ try:+ resp = urllib.request.urlopen(req, timeout=120)+ if not SESSION_ID:+ SESSION_ID = resp.headers.get("Mcp-Session-Id", "")+ body = resp.read().decode("utf-8", errors="replace")+ # Parse SSE: find data: lines with JSON-RPC results+ for line in body.split("\n"):+ if line.startswith("data: "):+ data = line[6:].strip()+ if data:+ try:+ parsed = json.loads(data)+ if "result" in parsed or "error" in parsed:+ return parsed+ except json.JSONDecodeError:+ continue+ return {}+ except urllib.error.HTTPError as e:+ if e.code == 202:+ return {"ok": True} # Notification accepted+ return {"error": f"HTTP {e.code}: {e.read().decode()[:200]}"}+ except Exception as e:+ return {"error": str(e)}+++def mcp_init():+ """Initialize MCP session."""+ global SESSION_ID, CALL_ID+ CALL_ID = 1+ mcp_request({+ "jsonrpc": "2.0", "id": CALL_ID,+ "method": "initialize",+ "params": {+ "protocolVersion": "2025-03-26",+ "capabilities": {},+ "clientInfo": {"name": "benchmark", "version": "1.0.0"}+ }+ })+ # Send initialized notification+ mcp_request({+ "jsonrpc": "2.0",+ "method": "notifications/initialized"+ })+ print(f"Session: {SESSION_ID}")+++def tool_call(name, args=None):+ """Call an MCP tool and return the parsed result content."""+ global CALL_ID+ CALL_ID += 1+ resp = mcp_request({+ "jsonrpc": "2.0", "id": CALL_ID,+ "method": "tools/call",+ "params": {"name": name, "arguments": args or {}}+ })+ try:+ content = resp.get("result", {}).get("content", [])+ if isinstance(content, list) and len(content) > 0:+ text = content[0].get("text", "{}")+ return json.loads(text)+ except:+ pass+ return resp+++def main():+ global SESSION_ID++ # Start server+ print(f"Starting server on port {PORT}...")+ server = subprocess.Popen(+ ["./target/release/open-ontologies", "serve-http", "--host", HOST, "--port", str(PORT)],+ stdout=subprocess.PIPE, stderr=subprocess.PIPE+ )+ time.sleep(3)++ try:+ mcp_init()+ results = []++ for onto_id in IDS:+ print(f"{onto_id:<20}", end="", flush=True)++ # Clear store+ tool_call("onto_clear")++ # Install (timed)+ t0 = time.time()+ install = tool_call("onto_marketplace", {"action": "install", "id": onto_id})+ fetch_ms = int((time.time() - t0) * 1000)++ if "error" in install:+ print(f"FAILED: {install['error']}")+ results.append({+ "id": onto_id, "status": "failed", "error": str(install.get("error", "")),+ "classes": 0, "properties": 0, "triples_before": 0,+ "triples_after": 0, "inferred": 0, "fetch_ms": fetch_ms, "reason_ms": 0+ })+ continue++ # Stats before reasoning+ stats = tool_call("onto_stats")+ classes = stats.get("classes", 0)+ obj_props = stats.get("object_properties", 0)+ data_props = stats.get("data_properties", 0)+ properties = obj_props + data_props+ triples_before = stats.get("triples", 0)++ # Reason (RDFS, timed)+ t0 = time.time()+ tool_call("onto_reason", {"profile": "rdfs"})+ reason_ms = int((time.time() - t0) * 1000)++ # Stats after reasoning+ stats_after = tool_call("onto_stats")+ triples_after = stats_after.get("triples", triples_before)+ inferred = triples_after - triples_before++ print(f"classes={classes:<6} props={properties:<6} triples={triples_before}->{triples_after} (+{inferred:<6}) fetch={fetch_ms}ms reason={reason_ms}ms")++ results.append({+ "id": onto_id, "status": "ok",+ "classes": classes, "properties": properties,+ "triples_before": triples_before, "triples_after": triples_after,+ "inferred": inferred, "fetch_ms": fetch_ms, "reason_ms": reason_ms,+ })++ # Save results+ with open("benchmark/marketplace_results.json", "w") as f:+ json.dump(results, f, indent=2)++ # Print table+ ok = [r for r in results if r.get("status") == "ok"]+ failed = [r for r in results if r.get("status") != "ok"]++ print("\n")+ print(f"{'ID':<20} {'Classes':>8} {'Props':>8} {'Triples':>10} {'+ Reason':>10} {'Inferred':>10} {'Fetch':>8} {'Reason':>8}")+ print("-" * 92)+ for r in results:+ mark = " *" if r.get("status") != "ok" else ""+ print(f"{r['id']:<20} {r['classes']:>8} {r['properties']:>8} {r['triples_before']:>10} {r['triples_after']:>10} {r['inferred']:>10} {str(r['fetch_ms'])+'ms':>8} {str(r['reason_ms'])+'ms':>8}{mark}")++ total_triples = sum(r["triples_before"] for r in ok)+ total_after = sum(r["triples_after"] for r in ok)+ total_inferred = sum(r["inferred"] for r in ok)+ total_classes = sum(r["classes"] for r in ok)+ total_props = sum(r["properties"] for r in ok)+ print("-" * 92)+ print(f"{'TOTAL':<20} {total_classes:>8} {total_props:>8} {total_triples:>10} {total_after:>10} {total_inferred:>10}")+ print(f"\n{len(ok)}/{len(results)} ontologies loaded successfully")+ if failed:+ print(f"Failed: {', '.join(r['id'] for r in failed)}")++ finally:+ server.terminate()+ server.wait()+++if __name__ == "__main__":+ main()diff --git a/benchmark/marketplace_benchmark.sh b/benchmark/marketplace_benchmark.shnew file mode 100755index 00000000..9fba7ed0--- /dev/null+++ b/benchmark/marketplace_benchmark.sh@@ -0,0 +1,223 @@+#!/usr/bin/env bash+# Benchmark all 29 marketplace ontologies through the MCP pipeline+# Uses the HTTP server so state persists between tool calls+set -euo pipefail++BIN="./target/release/open-ontologies"+HOST="127.0.0.1"+PORT="9999"+MCP_URL="http://${HOST}:${PORT}/mcp"+RESULTS_FILE="benchmark/marketplace_results.json"++# Start server in background+echo "Starting server on port ${PORT}..."+$BIN serve-http --host $HOST --port $PORT &+SERVER_PID=$!+sleep 2++# MCP call helper — sends JSON-RPC and extracts result+MCP_ID=0+SESSION_ID=""++mcp_init() {+ local resp+ resp=$(curl -s -X POST "$MCP_URL" \+ -H "Content-Type: application/json" \+ -H "Accept: application/json, text/event-stream" \+ -d '{+ "jsonrpc": "2.0",+ "id": 1,+ "method": "initialize",+ "params": {+ "protocolVersion": "2025-03-26",+ "capabilities": {},+ "clientInfo": { "name": "benchmark", "version": "1.0.0" }+ }+ }')+ SESSION_ID=$(echo "$resp" | grep -o '"Mcp-Session-Id":"[^"]*"' | head -1 | cut -d'"' -f4 || true)+ if [ -z "$SESSION_ID" ]; then+ # Try extracting from headers via -i+ local headers+ headers=$(curl -s -i -X POST "$MCP_URL" \+ -H "Content-Type: application/json" \+ -H "Accept: application/json, text/event-stream" \+ -d '{+ "jsonrpc": "2.0",+ "id": 1,+ "method": "initialize",+ "params": {+ "protocolVersion": "2025-03-26",+ "capabilities": {},+ "clientInfo": { "name": "benchmark", "version": "1.0.0" }+ }+ }')+ SESSION_ID=$(echo "$headers" | grep -i "mcp-session-id" | head -1 | tr -d '\r' | awk '{print $2}')+ fi+ echo "Session: $SESSION_ID"+}++mcp_call() {+ local tool_name="$1"+ local args="$2"+ MCP_ID=$((MCP_ID + 1))+ local payload+ payload=$(cat <<ENDJSON+{+ "jsonrpc": "2.0",+ "id": ${MCP_ID},+ "method": "tools/call",+ "params": {+ "name": "${tool_name}",+ "arguments": ${args}+ }+}+ENDJSON+)+ local result+ result=$(curl -s -X POST "$MCP_URL" \+ -H "Content-Type: application/json" \+ -H "Accept: application/json, text/event-stream" \+ ${SESSION_ID:+-H "Mcp-Session-Id: $SESSION_ID"} \+ -d "$payload")+ echo "$result"+}++cleanup() {+ echo "Stopping server..."+ kill $SERVER_PID 2>/dev/null || true+ wait $SERVER_PID 2>/dev/null || true+}+trap cleanup EXIT++# Initialize MCP session+mcp_init++# Get list of all ontology IDs+IDS=$(echo '["owl","rdfs","rdf","bfo","dolce","schema-org","foaf","skos","dc-elements","dc-terms","dcat","void","doap","prov-o","owl-time","org","ssn","sosa","geosparql","locn","shacl","vcard","odrl","cc","sioc","adms","goodrelations","fibo","qudt"]' | python3 -c "import json,sys; [print(x) for x in json.load(sys.stdin)]")++echo "[" > "$RESULTS_FILE"+FIRST=true++for ID in $IDS; do+ echo ""+ echo "=== Benchmarking: $ID ==="++ # Clear store+ mcp_call "onto_clear" '{}' > /dev/null++ # Install from marketplace (timed)+ START=$(python3 -c "import time; print(int(time.time()*1000))")+ INSTALL_RESULT=$(mcp_call "onto_marketplace" "{\"action\":\"install\",\"id\":\"${ID}\"}")+ END=$(python3 -c "import time; print(int(time.time()*1000))")+ FETCH_MS=$((END - START))++ # Extract triple count from install result+ TRIPLES_RAW=$(echo "$INSTALL_RESULT" | python3 -c "+import json, sys+try:+ data = json.load(sys.stdin)+ content = data.get('result', {}).get('content', [{}])+ if isinstance(content, list) and len(content) > 0:+ text = content[0].get('text', '{}')+ parsed = json.loads(text)+ print(parsed.get('triples_loaded', 0))+ else:+ print(0)+except:+ print(0)+" 2>/dev/null)++ # Get stats before reasoning+ STATS_BEFORE=$(mcp_call "onto_stats" '{}')+ CLASSES=$(echo "$STATS_BEFORE" | python3 -c "+import json, sys+try:+ data = json.load(sys.stdin)+ content = data.get('result', {}).get('content', [{}])+ text = content[0].get('text', '{}') if isinstance(content, list) and len(content) > 0 else '{}'+ parsed = json.loads(text)+ print(parsed.get('classes', 0))+except:+ print(0)+" 2>/dev/null)+ PROPERTIES=$(echo "$STATS_BEFORE" | python3 -c "+import json, sys+try:+ data = json.load(sys.stdin)+ content = data.get('result', {}).get('content', [{}])+ text = content[0].get('text', '{}') if isinstance(content, list) and len(content) > 0 else '{}'+ parsed = json.loads(text)+ print(parsed.get('properties', 0))+except:+ print(0)+" 2>/dev/null)+ TRIPLES_BEFORE=$(echo "$STATS_BEFORE" | python3 -c "+import json, sys+try:+ data = json.load(sys.stdin)+ content = data.get('result', {}).get('content', [{}])+ text = content[0].get('text', '{}') if isinstance(content, list) and len(content) > 0 else '{}'+ parsed = json.loads(text)+ print(parsed.get('triples', 0))+except:+ print(0)+" 2>/dev/null)++ # Reason (RDFS)+ START_R=$(python3 -c "import time; print(int(time.time()*1000))")+ mcp_call "onto_reason" '{"profile":"rdfs"}' > /dev/null+ END_R=$(python3 -c "import time; print(int(time.time()*1000))")+ REASON_MS=$((END_R - START_R))++ # Stats after reasoning+ STATS_AFTER=$(mcp_call "onto_stats" '{}')+ TRIPLES_AFTER=$(echo "$STATS_AFTER" | python3 -c "+import json, sys+try:+ data = json.load(sys.stdin)+ content = data.get('result', {}).get('content', [{}])+ text = content[0].get('text', '{}') if isinstance(content, list) and len(content) > 0 else '{}'+ parsed = json.loads(text)+ print(parsed.get('triples', 0))+except:+ print(0)+" 2>/dev/null)++ INFERRED=$((TRIPLES_AFTER - TRIPLES_BEFORE))++ echo " Triples: ${TRIPLES_BEFORE} -> ${TRIPLES_AFTER} (+${INFERRED} inferred)"+ echo " Classes: ${CLASSES}, Properties: ${PROPERTIES}"+ echo " Fetch: ${FETCH_MS}ms, Reason: ${REASON_MS}ms"++ # Append JSON+ if [ "$FIRST" = true ]; then+ FIRST=false+ else+ echo "," >> "$RESULTS_FILE"+ fi+ cat >> "$RESULTS_FILE" <<ENDJSON+ {"id":"${ID}","classes":${CLASSES},"properties":${PROPERTIES},"triples_before":${TRIPLES_BEFORE},"triples_after":${TRIPLES_AFTER},"inferred":${INFERRED},"fetch_ms":${FETCH_MS},"reason_ms":${REASON_MS}}+ENDJSON++done++echo "" >> "$RESULTS_FILE"+echo "]" >> "$RESULTS_FILE"++echo ""+echo "=== DONE ==="+echo "Results saved to ${RESULTS_FILE}"+echo ""+python3 -c "+import json+with open('${RESULTS_FILE}') as f:+ data = json.load(f)+print(f'{'ID':<20} {'Classes':>8} {'Props':>8} {'Triples':>10} {'After':>10} {'Inferred':>10} {'Fetch':>8} {'Reason':>8}')+print('-' * 92)+for r in data:+ print(f'{r[\"id\"]:<20} {r[\"classes\"]:>8} {r[\"properties\"]:>8} {r[\"triples_before\"]:>10} {r[\"triples_after\"]:>10} {r[\"inferred\"]:>10} {str(r[\"fetch_ms\"])+\"ms\":>8} {str(r[\"reason_ms\"])+\"ms\":>8}')+total_triples = sum(r['triples_before'] for r in data)+total_inferred = sum(r['inferred'] for r in data)+print('-' * 92)+print(f'{'TOTAL':<20} {'':>8} {'':>8} {total_triples:>10} {total_triples+total_inferred:>10} {total_inferred:>10}')+"diff --git a/benchmark/marketplace_results.json b/benchmark/marketplace_results.jsonnew file mode 100644index 00000000..d92162ff--- /dev/null+++ b/benchmark/marketplace_results.json@@ -0,0 +1,321 @@+[+ {+ "id": "owl",+ "status": "ok",+ "classes": 26,+ "properties": 4,+ "triples_before": 450,+ "triples_after": 473,+ "inferred": 23,+ "fetch_ms": 751,+ "reason_ms": 3+ },+ {+ "id": "rdfs",+ "status": "ok",+ "classes": 6,+ "properties": 0,+ "triples_before": 87,+ "triples_after": 122,+ "inferred": 35,+ "fetch_ms": 421,+ "reason_ms": 1+ },+ {+ "id": "rdf",+ "status": "ok",+ "classes": 7,+ "properties": 0,+ "triples_before": 127,+ "triples_after": 158,+ "inferred": 31,+ "fetch_ms": 1098,+ "reason_ms": 1+ },+ {+ "id": "bfo",+ "status": "ok",+ "classes": 35,+ "properties": 0,+ "triples_before": 1221,+ "triples_after": 1407,+ "inferred": 186,+ "fetch_ms": 715,+ "reason_ms": 6+ },+ {+ "id": "dolce",+ "status": "ok",+ "classes": 93,+ "properties": 118,+ "triples_before": 1917,+ "triples_after": 2583,+ "inferred": 666,+ "fetch_ms": 4813,+ "reason_ms": 14+ },+ {+ "id": "schema-org",+ "status": "ok",+ "classes": 1009,+ "properties": 0,+ "triples_before": 17823,+ "triples_after": 21854,+ "inferred": 4031,+ "fetch_ms": 539,+ "reason_ms": 59+ },+ {+ "id": "foaf",+ "status": "ok",+ "classes": 28,+ "properties": 60,+ "triples_before": 631,+ "triples_after": 635,+ "inferred": 4,+ "fetch_ms": 1263,+ "reason_ms": 3+ },+ {+ "id": "skos",+ "status": "ok",+ "classes": 5,+ "properties": 18,+ "triples_before": 252,+ "triples_after": 307,+ "inferred": 55,+ "fetch_ms": 197,+ "reason_ms": 1+ },+ {+ "id": "dc-elements",+ "status": "ok",+ "classes": 0,+ "properties": 0,+ "triples_before": 107,+ "triples_after": 107,+ "inferred": 0,+ "fetch_ms": 357,+ "reason_ms": 1+ },+ {+ "id": "dc-terms",+ "status": "ok",+ "classes": 22,+ "properties": 0,+ "triples_before": 700,+ "triples_after": 956,+ "inferred": 256,+ "fetch_ms": 249,+ "reason_ms": 4+ },+ {+ "id": "dcat",+ "status": "ok",+ "classes": 19,+ "properties": 39,+ "triples_before": 1695,+ "triples_after": 1708,+ "inferred": 13,+ "fetch_ms": 798,+ "reason_ms": 5+ },+ {+ "id": "void",+ "status": "ok",+ "classes": 8,+ "properties": 8,+ "triples_before": 216,+ "triples_after": 216,+ "inferred": 0,+ "fetch_ms": 736,+ "reason_ms": 2+ },+ {+ "id": "doap",+ "status": "ok",+ "classes": 17,+ "properties": 0,+ "triples_before": 741,+ "triples_after": 741,+ "inferred": 0,+ "fetch_ms": 1016,+ "reason_ms": 3+ },+ {+ "id": "prov-o",+ "status": "ok",+ "classes": 39,+ "properties": 50,+ "triples_before": 1146,+ "triples_after": 1348,+ "inferred": 202,+ "fetch_ms": 512,+ "reason_ms": 7+ },+ {+ "id": "owl-time",+ "status": "ok",+ "classes": 23,+ "properties": 58,+ "triples_before": 1296,+ "triples_after": 1461,+ "inferred": 165,+ "fetch_ms": 270,+ "reason_ms": 3+ },+ {+ "id": "org",+ "status": "ok",+ "classes": 22,+ "properties": 33,+ "triples_before": 748,+ "triples_after": 757,+ "inferred": 9,+ "fetch_ms": 669,+ "reason_ms": 2+ },+ {+ "id": "ssn",+ "status": "ok",+ "classes": 0,+ "properties": 0,+ "triples_before": 40,+ "triples_after": 40,+ "inferred": 0,+ "fetch_ms": 511,+ "reason_ms": 1+ },+ {+ "id": "sosa",+ "status": "ok",+ "classes": 0,+ "properties": 0,+ "triples_before": 47,+ "triples_after": 47,+ "inferred": 0,+ "fetch_ms": 314,+ "reason_ms": 1+ },+ {+ "id": "geosparql",+ "status": "ok",+ "classes": 12,+ "properties": 54,+ "triples_before": 796,+ "triples_after": 800,+ "inferred": 4,+ "fetch_ms": 604,+ "reason_ms": 5+ },+ {+ "id": "locn",+ "status": "ok",+ "classes": 2,+ "properties": 0,+ "triples_before": 206,+ "triples_after": 206,+ "inferred": 0,+ "fetch_ms": 1515,+ "reason_ms": 1+ },+ {+ "id": "shacl",+ "status": "ok",+ "classes": 40,+ "properties": 0,+ "triples_before": 1128,+ "triples_after": 1396,+ "inferred": 268,+ "fetch_ms": 600,+ "reason_ms": 5+ },+ {+ "id": "vcard",+ "status": "ok",+ "classes": 75,+ "properties": 84,+ "triples_before": 882,+ "triples_after": 882,+ "inferred": 0,+ "fetch_ms": 695,+ "reason_ms": 1+ },+ {+ "id": "odrl",+ "status": "ok",+ "classes": 71,+ "properties": 50,+ "triples_before": 2157,+ "triples_after": 2230,+ "inferred": 73,+ "fetch_ms": 449,+ "reason_ms": 6+ },+ {+ "id": "cc",+ "status": "ok",+ "classes": 6,+ "properties": 0,+ "triples_before": 115,+ "triples_after": 115,+ "inferred": 0,+ "fetch_ms": 1058,+ "reason_ms": 1+ },+ {+ "id": "sioc",+ "status": "ok",+ "classes": 14,+ "properties": 83,+ "triples_before": 615,+ "triples_after": 615,+ "inferred": 0,+ "fetch_ms": 905,+ "reason_ms": 2+ },+ {+ "id": "adms",+ "status": "ok",+ "classes": 4,+ "properties": 13,+ "triples_before": 151,+ "triples_after": 151,+ "inferred": 0,+ "fetch_ms": 1121,+ "reason_ms": 1+ },+ {+ "id": "goodrelations",+ "status": "ok",+ "classes": 98,+ "properties": 102,+ "triples_before": 1834,+ "triples_after": 1849,+ "inferred": 15,+ "fetch_ms": 2442,+ "reason_ms": 4+ },+ {+ "id": "fibo",+ "status": "ok",+ "classes": 0,+ "properties": 0,+ "triples_before": 45,+ "triples_after": 45,+ "inferred": 0,+ "fetch_ms": 1059,+ "reason_ms": 1+ },+ {+ "id": "qudt",+ "status": "ok",+ "classes": 73,+ "properties": 175,+ "triples_before": 2434,+ "triples_after": 4008,+ "inferred": 1574,+ "fetch_ms": 1844,+ "reason_ms": 10+ }+]\ No newline at end of filediff --git a/docs/plans/2026-03-16-onto-marketplace-design.md b/docs/plans/2026-03-16-onto-marketplace-design.mdnew file mode 100644index 00000000..e5a39cfa--- /dev/null+++ b/docs/plans/2026-03-16-onto-marketplace-design.md@@ -0,0 +1,89 @@+# onto_marketplace Design++## Summary++Add an `onto_marketplace` tool (tool #43) that provides a curated catalogue of 29 standard W3C/ISO/industry ontologies, fetchable with a single command. Built on top of existing `fetch_url` + `load_turtle`/`load_content` infrastructure.++## Motivation++Every real ontology project starts from industry standards, not a blank slate. Palantir sells pre-built "industry models" as a premium feature. We give away 29 standard ontologies for free -- proper OWL/RDF standards that interoperate with any tool in the semantic web ecosystem.++## Tool Interface++### Input++```rust+struct OntoMarketplaceInput {+ action: String, // "list" or "install"+ id: Option<String>, // e.g. "prov-o", "schema-org", "foaf"+ domain: Option<String>, // filter list by domain+}+```++### Actions++- **list**: Returns JSON array of `{id, name, description, domain, url, format}`. Filterable by domain.+- **install**: Fetches the ontology by ID from its canonical URL, loads it into the triple store, returns triple count + class/property stats.++## Catalogue (29 ontologies)++| ID | Name | Domain | Format | URL |+|---|---|---|---|---|+| owl | OWL 2 | foundational | turtle | https://www.w3.org/2002/07/owl# |+| rdfs | RDF Schema | foundational | turtle | https://www.w3.org/2000/01/rdf-schema# |+| rdf | RDF Concepts | foundational | turtle | https://www.w3.org/1999/02/22-rdf-syntax-ns |+| schema-org | Schema.org | general | turtle | https://schema.org/version/latest/schemaorg-current-https.ttl |+| dc-elements | Dublin Core Elements | metadata | turtle | http://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_elements.ttl |+| dc-terms | Dublin Core Terms | metadata | turtle | https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_terms.ttl |+| foaf | FOAF | people | rdfxml | http://xmlns.com/foaf/spec/index.rdf |+| skos | SKOS | knowledge-organization | rdfxml | https://www.w3.org/2009/08/skos-reference/skos.rdf |+| prov-o | PROV-O | provenance | turtle | https://www.w3.org/ns/prov-o.ttl |+| owl-time | OWL-Time | temporal | turtle | https://www.w3.org/2006/time.ttl |+| org | W3C Organization | organizations | turtle | https://www.w3.org/ns/org.ttl |+| dcat | DCAT | data-catalogs | turtle | https://www.w3.org/ns/dcat.ttl |+| ssn | SSN | iot | turtle | https://raw.githubusercontent.com/w3c/sdw-sosa-ssn/gh-pages/ssn/rdf/ontology/core/ssn.ttl |+| sosa | SOSA | iot | turtle | https://raw.githubusercontent.com/w3c/sdw-sosa-ssn/gh-pages/ssn/rdf/ontology/core/sosa.ttl |+| geosparql | GeoSPARQL | geospatial | turtle | https://opengeospatial.github.io/ogc-geosparql/geosparql11/geo.ttl |+| shacl | SHACL | validation | turtle | https://www.w3.org/ns/shacl.ttl |+| vcard | vCard | people | turtle | http://www.w3.org/2006/vcard/ns |+| adms | ADMS | egovernment | turtle | https://www.w3.org/ns/adms.ttl |+| odrl | ODRL | rights | turtle | https://www.w3.org/ns/odrl/2/ODRL22.ttl |+| doap | DOAP | software | rdfxml | https://raw.githubusercontent.com/ewilderj/doap/master/schema/doap.rdf |+| sioc | SIOC | social | rdfxml | https://raw.githubusercontent.com/VisualDataWeb/OWL2VOWL/master/ontologies/sioc.rdf |+| cc | Creative Commons | rights | rdfxml | https://creativecommons.org/schema.rdf |+| void | VoID | data-catalogs | turtle | https://raw.githubusercontent.com/cygri/void/master/rdfs/void.ttl |+| goodrelations | GoodRelations | commerce | rdfxml | http://www.heppnetz.de/ontologies/goodrelations/v1.owl |+| bfo | BFO | upper-ontology | rdfxml | https://raw.githubusercontent.com/BFO-ontology/BFO/v2019-08-26/bfo_classes_only.owl |+| dolce | DOLCE/DUL | upper-ontology | rdfxml | http://www.ontologydesignpatterns.org/ont/dul/DUL.owl |+| fibo | FIBO | finance | rdfxml | https://spec.edmcouncil.org/fibo/ontology/master/latest/MetadataFIBO.rdf |+| qudt | QUDT | science | turtle | http://qudt.org/2.1/schema/qudt |+| locn | LOCN | geospatial | turtle | https://www.w3.org/ns/locn.ttl |++## Implementation++### Changes required++1. **`src/graph.rs`** -- Add `load_content(&self, content: &str, format: RdfFormat) -> Result<usize>` to handle fetched content in any RDF format (not just Turtle).++2. **`src/inputs.rs`** -- Add `OntoMarketplaceInput` struct.++3. **`src/marketplace.rs`** (new) -- Catalogue definition as a static array of `MarketplaceEntry` structs.++4. **`src/server.rs`** -- Add `onto_marketplace` tool method.++5. **`src/main.rs`** -- Add `marketplace` CLI subcommand.++### Catalogue storage++Hardcoded Rust array. No remote registry. Standard ontologies don't change often -- updates come with new releases of the binary.++### Format handling++Each catalogue entry stores its RDF format (turtle or rdfxml). The `install` action uses `fetch_url` then `load_content(content, format)` instead of `load_turtle` to handle both formats.++## Benchmarking++After implementation, benchmark all 29 ontologies through the full pipeline:+- `onto_clear` -> `onto_marketplace install <id>` -> `onto_stats` -> `onto_reason` -> `onto_stats`++Record: fetch time, triple count (before/after reasoning), class count, property count. Add results to README.diff --git a/src/graph.rs b/src/graph.rsindex 83745568..a43941dd 100644--- a/src/graph.rs+++ b/src/graph.rs@@ -45,6 +45,28 @@ impl GraphStore {Ok(count)}+ /// Load RDF content in a specified format (Turtle, RDF/XML, etc.)+ pub fn load_content(&self, content: &str, format: RdfFormat) -> anyhow::Result<usize> {+ self.load_content_with_base(content, format, None)+ }++ /// Load RDF content with an optional base IRI for resolving relative IRIs.+ pub fn load_content_with_base(&self, content: &str, format: RdfFormat, base_iri: Option<&str>) -> anyhow::Result<usize> {+ let store = self.store.lock().unwrap();+ let reader = Cursor::new(content.as_bytes());+ let mut parser = RdfParser::from_format(format);+ if let Some(base) = base_iri {+ parser = parser.with_base_iri(base)?;+ }+ let parser = parser.for_reader(reader);+ let mut count = 0;+ for quad in parser {+ store.insert(&quad?)?;+ count += 1;+ }+ Ok(count)+ }+pub fn load_file(&self, path: &str) -> anyhow::Result<usize> {let content = std::fs::read_to_string(path)?;let format = Self::detect_format(path);diff --git a/src/inputs.rs b/src/inputs.rsindex f0045c1f..369b61a1 100644--- a/src/inputs.rs+++ b/src/inputs.rs@@ -315,6 +315,16 @@ pub struct OntoSimilarityInput {pub iri_b: String,}+#[derive(Deserialize, JsonSchema)]+pub struct OntoMarketplaceInput {+ /// Action: "list" to browse available ontologies, "install" to fetch and load one+ pub action: String,+ /// Ontology ID to install (e.g. "prov-o", "schema-org", "foaf"). Required for "install".+ pub id: Option<String>,+ /// Filter list by domain (e.g. "foundational", "metadata", "iot", "geospatial")+ pub domain: Option<String>,+}+// ─── Prompt input structs ───────────────────────────────────────────────────#[derive(Deserialize, JsonSchema)]diff --git a/src/lib.rs b/src/lib.rsindex 6c7f6ac9..ac3c05aa 100644--- a/src/lib.rs+++ b/src/lib.rs@@ -12,6 +12,7 @@ pub mod lineage;pub mod monitor;pub mod plan;pub mod mapping;+pub mod marketplace;pub mod ontology;pub mod reason;pub mod server;diff --git a/src/main.rs b/src/main.rsindex f4f5e1ce..c5b29b8c 100644--- a/src/main.rs+++ b/src/main.rs@@ -103,6 +103,17 @@ enum Commands {#[arg(long)]graph: Option<String>,},+ /// Browse and install standard ontologies from marketplace+ Marketplace {+ /// Action: "list" or "install"+ action: String,+ /// Ontology ID (for install)+ #[arg(long)]+ id: Option<String>,+ /// Filter by domain (for list)+ #[arg(long)]+ domain: Option<String>,+ },/// Resolve and load owl:imports chainImportOwl {#[arg(long, default_value = "10")]@@ -699,6 +710,62 @@ async fn main() -> anyhow::Result<()> {}// ─── Remote ─────────────────────────────────────────────────+ Commands::Marketplace { action, id, domain } => {+ use open_ontologies::marketplace;+ match action.as_str() {+ "list" => {+ let entries = marketplace::list(domain.as_deref());+ let items: Vec<serde_json::Value> = entries.iter().map(|e| {+ serde_json::json!({+ "id": e.id,+ "name": e.name,+ "description": e.description,+ "domain": e.domain,+ "format": marketplace::format_name(e.format),+ })+ }).collect();+ output_json(&serde_json::json!({+ "count": items.len(),+ "ontologies": items,+ }), cli.pretty);+ }+ "install" => {+ let id = id.as_deref().unwrap_or_else(|| {+ eprintln!("Error: --id is required for install");+ std::process::exit(1);+ });+ let entry = match marketplace::find(id) {+ Some(e) => e,+ None => {+ eprintln!("Unknown ontology ID: '{}'. Run 'marketplace list' to see available IDs.", id);+ std::process::exit(1);+ }+ };+ let (_db, graph) = setup(&cli.data_dir)?;+ let content = GraphStore::fetch_url(entry.url).await?;+ match graph.load_content_with_base(&content, entry.format, Some(entry.url)) {+ Ok(count) => {+ let stats = graph.get_stats().unwrap_or_default();+ output_json(&serde_json::json!({+ "ok": true,+ "installed": entry.id,+ "name": entry.name,+ "triples_loaded": count,+ "stats": serde_json::from_str::<serde_json::Value>(&stats).unwrap_or_default(),+ }), cli.pretty);+ }+ Err(e) => {+ output_json(&serde_json::json!({"error": format!("Parse error: {}", e)}), cli.pretty);+ std::process::exit(1);+ }+ }+ }+ _ => {+ eprintln!("Unknown action: '{}'. Use 'list' or 'install'.", action);+ std::process::exit(1);+ }+ }+ }Commands::Pull { url, sparql, query } => {let (_db, graph) = setup(&cli.data_dir)?;let content = if sparql {diff --git a/src/marketplace.rs b/src/marketplace.rsnew file mode 100644index 00000000..a5d204bb--- /dev/null+++ b/src/marketplace.rs@@ -0,0 +1,305 @@+use oxigraph::io::RdfFormat;++/// A standard ontology available in the marketplace catalogue.+pub struct MarketplaceEntry {+ pub id: &'static str,+ pub name: &'static str,+ pub description: &'static str,+ pub domain: &'static str,+ pub url: &'static str,+ pub format: RdfFormat,+}++/// Curated catalogue of 29 standard W3C/ISO/industry ontologies.+pub static CATALOGUE: &[MarketplaceEntry] = &[+ // ── Foundational ──────────────────────────────────────────────+ MarketplaceEntry {+ id: "owl",+ name: "OWL 2",+ description: "W3C OWL 2 vocabulary for building ontologies",+ domain: "foundational",+ url: "https://www.w3.org/2002/07/owl#",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "rdfs",+ name: "RDF Schema",+ description: "W3C vocabulary for describing RDF vocabularies with classes and properties",+ domain: "foundational",+ url: "https://www.w3.org/2000/01/rdf-schema#",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "rdf",+ name: "RDF Concepts",+ description: "Core RDF vocabulary defining fundamental data model constructs",+ domain: "foundational",+ url: "https://www.w3.org/1999/02/22-rdf-syntax-ns",+ format: RdfFormat::Turtle,+ },++ // ── Upper ontology ────────────────────────────────────────────+ MarketplaceEntry {+ id: "bfo",+ name: "BFO (Basic Formal Ontology)",+ description: "ISO 21838 upper-level ontology — foundational categories for continuants and occurrents",+ domain: "upper-ontology",+ url: "https://raw.githubusercontent.com/BFO-ontology/BFO/v2019-08-26/bfo_classes_only.owl",+ format: RdfFormat::RdfXml,+ },+ MarketplaceEntry {+ id: "dolce",+ name: "DOLCE/DUL (Descriptive Ontology)",+ description: "Upper-level ontology providing foundational categories for knowledge representation",+ domain: "upper-ontology",+ url: "http://www.ontologydesignpatterns.org/ont/dul/DUL.owl",+ format: RdfFormat::Turtle,+ },++ // ── General ───────────────────────────────────────────────────+ MarketplaceEntry {+ id: "schema-org",+ name: "Schema.org",+ description: "Collaborative vocabulary for structured data markup on the web",+ domain: "general",+ url: "https://schema.org/version/latest/schemaorg-current-https.ttl",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "foaf",+ name: "FOAF (Friend of a Friend)",+ description: "Vocabulary for describing people, activities, and relationships",+ domain: "people",+ url: "http://xmlns.com/foaf/spec/index.rdf",+ format: RdfFormat::RdfXml,+ },+ MarketplaceEntry {+ id: "skos",+ name: "SKOS (Simple Knowledge Organization System)",+ description: "W3C vocabulary for thesauri, classification schemes, and taxonomies",+ domain: "knowledge-organization",+ url: "https://www.w3.org/2009/08/skos-reference/skos.rdf",+ format: RdfFormat::RdfXml,+ },++ // ── Metadata ──────────────────────────────────────────────────+ MarketplaceEntry {+ id: "dc-elements",+ name: "Dublin Core Elements",+ description: "15 core metadata elements for describing resources",+ domain: "metadata",+ url: "http://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_elements.ttl",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "dc-terms",+ name: "Dublin Core Terms",+ description: "Extended Dublin Core metadata terms with refined properties",+ domain: "metadata",+ url: "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_terms.ttl",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "dcat",+ name: "DCAT (Data Catalog Vocabulary)",+ description: "W3C vocabulary for interoperability between data catalogs",+ domain: "data-catalogs",+ url: "https://www.w3.org/ns/dcat.ttl",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "void",+ name: "VoID (Vocabulary of Interlinked Datasets)",+ description: "Vocabulary for expressing metadata about RDF datasets",+ domain: "data-catalogs",+ url: "https://raw.githubusercontent.com/cygri/void/master/rdfs/void.ttl",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "doap",+ name: "DOAP (Description of a Project)",+ description: "Vocabulary for describing software projects, repositories, and releases",+ domain: "software",+ url: "https://raw.githubusercontent.com/ewilderj/doap/master/schema/doap.rdf",+ format: RdfFormat::RdfXml,+ },++ // ── Provenance ────────────────────────────────────────────────+ MarketplaceEntry {+ id: "prov-o",+ name: "PROV-O (Provenance Ontology)",+ description: "W3C ontology for representing provenance — entities, activities, agents",+ domain: "provenance",+ url: "https://www.w3.org/ns/prov-o.ttl",+ format: RdfFormat::Turtle,+ },++ // ── Temporal ──────────────────────────────────────────────────+ MarketplaceEntry {+ id: "owl-time",+ name: "OWL-Time",+ description: "W3C/OGC ontology for temporal concepts — instants, intervals, durations",+ domain: "temporal",+ url: "https://www.w3.org/2006/time.ttl",+ format: RdfFormat::Turtle,+ },++ // ── Organizations ─────────────────────────────────────────────+ MarketplaceEntry {+ id: "org",+ name: "W3C Organization Ontology",+ description: "Vocabulary for organizational structures, membership, roles, and sites",+ domain: "organizations",+ url: "https://www.w3.org/ns/org.ttl",+ format: RdfFormat::Turtle,+ },++ // ── IoT / Sensors ─────────────────────────────────────────────+ MarketplaceEntry {+ id: "ssn",+ name: "SSN (Semantic Sensor Network)",+ description: "W3C/OGC ontology for sensors, actuators, observations, and sampling",+ domain: "iot",+ url: "https://raw.githubusercontent.com/w3c/sdw-sosa-ssn/gh-pages/ssn/rdf/ontology/core/ssn.ttl",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "sosa",+ name: "SOSA (Sensor, Observation, Sample, Actuator)",+ description: "Lightweight core of SSN for sensors and observations",+ domain: "iot",+ url: "https://raw.githubusercontent.com/w3c/sdw-sosa-ssn/gh-pages/ssn/rdf/ontology/core/sosa.ttl",+ format: RdfFormat::Turtle,+ },++ // ── Geospatial ────────────────────────────────────────────────+ MarketplaceEntry {+ id: "geosparql",+ name: "GeoSPARQL",+ description: "OGC ontology for spatial objects, geometries, and topological relations",+ domain: "geospatial",+ url: "https://opengeospatial.github.io/ogc-geosparql/geosparql11/geo.ttl",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "locn",+ name: "LOCN (Location Core Vocabulary)",+ description: "EU ISA vocabulary for describing places by name, address, or geometry",+ domain: "geospatial",+ url: "https://www.w3.org/ns/locn.ttl",+ format: RdfFormat::Turtle,+ },++ // ── Validation ────────────────────────────────────────────────+ MarketplaceEntry {+ id: "shacl",+ name: "SHACL (Shapes Constraint Language)",+ description: "W3C vocabulary for validating RDF graphs against shapes and constraints",+ domain: "validation",+ url: "https://www.w3.org/ns/shacl.ttl",+ format: RdfFormat::Turtle,+ },++ // ── People / Contact ──────────────────────────────────────────+ MarketplaceEntry {+ id: "vcard",+ name: "vCard Ontology",+ description: "Ontology for representing contact information in RDF",+ domain: "people",+ url: "http://www.w3.org/2006/vcard/ns",+ format: RdfFormat::Turtle,+ },++ // ── Rights / Licensing ────────────────────────────────────────+ MarketplaceEntry {+ id: "odrl",+ name: "ODRL (Open Digital Rights Language)",+ description: "W3C vocabulary for expressing permissions, prohibitions, and obligations",+ domain: "rights",+ url: "https://www.w3.org/ns/odrl/2/ODRL22.ttl",+ format: RdfFormat::Turtle,+ },+ MarketplaceEntry {+ id: "cc",+ name: "Creative Commons",+ description: "Vocabulary for describing copyright licenses and permissions",+ domain: "rights",+ url: "https://creativecommons.org/schema.rdf",+ format: RdfFormat::RdfXml,+ },++ // ── Social ────────────────────────────────────────────────────+ MarketplaceEntry {+ id: "sioc",+ name: "SIOC (Semantically-Interlinked Online Communities)",+ description: "Ontology for describing online communities, forums, and posts",+ domain: "social",+ url: "https://raw.githubusercontent.com/VisualDataWeb/OWL2VOWL/master/ontologies/sioc.rdf",+ format: RdfFormat::RdfXml,+ },++ // ── E-Government ──────────────────────────────────────────────+ MarketplaceEntry {+ id: "adms",+ name: "ADMS (Asset Description Metadata Schema)",+ description: "EU ISA vocabulary for describing semantic assets and interoperability solutions",+ domain: "egovernment",+ url: "https://www.w3.org/ns/adms.ttl",+ format: RdfFormat::Turtle,+ },++ // ── Commerce ──────────────────────────────────────────────────+ MarketplaceEntry {+ id: "goodrelations",+ name: "GoodRelations",+ description: "Ontology for e-commerce — products, services, prices, and offers",+ domain: "commerce",+ url: "http://www.heppnetz.de/ontologies/goodrelations/v1.owl",+ format: RdfFormat::RdfXml,+ },++ // ── Finance ───────────────────────────────────────────────────+ MarketplaceEntry {+ id: "fibo",+ name: "FIBO (Financial Industry Business Ontology)",+ description: "EDM Council ontology for financial industry concepts",+ domain: "finance",+ url: "https://spec.edmcouncil.org/fibo/ontology/master/latest/MetadataFIBO.rdf",+ format: RdfFormat::RdfXml,+ },++ // ── Science / Measurement ─────────────────────────────────────+ MarketplaceEntry {+ id: "qudt",+ name: "QUDT (Quantities, Units, Dimensions, Types)",+ description: "Ontology for physical quantities, units of measure, and dimensions",+ domain: "science",+ url: "http://qudt.org/2.1/schema/qudt",+ format: RdfFormat::Turtle,+ },+];++/// Look up a marketplace entry by ID.+pub fn find(id: &str) -> Option<&'static MarketplaceEntry> {+ CATALOGUE.iter().find(|e| e.id == id)+}++/// List all entries, optionally filtered by domain.+pub fn list(domain: Option<&str>) -> Vec<&'static MarketplaceEntry> {+ match domain {+ Some(d) => CATALOGUE.iter().filter(|e| e.domain == d).collect(),+ None => CATALOGUE.iter().collect(),+ }+}++/// Format name for the RDF format.+pub fn format_name(fmt: RdfFormat) -> &'static str {+ match fmt {+ RdfFormat::Turtle => "turtle",+ RdfFormat::RdfXml => "rdfxml",+ RdfFormat::NTriples => "ntriples",+ RdfFormat::NQuads => "nquads",+ RdfFormat::TriG => "trig",+ _ => "unknown",+ }+}diff --git a/src/server.rs b/src/server.rsindex 86d3aa9b..79e84a31 100644--- a/src/server.rs+++ b/src/server.rs@@ -322,6 +322,72 @@ impl OpenOntologiesServer {}).to_string()}+ // ── Marketplace ────────────────────────────────────────────────────────++ #[tool(name = "onto_marketplace", description = "Browse and install standard ontologies from a curated catalogue of 29 W3C/ISO/industry standards. Actions: 'list' (browse catalogue, optional domain filter) or 'install' (fetch and load by ID)")]+ async fn onto_marketplace(&self, Parameters(input): Parameters<OntoMarketplaceInput>) -> String {+ use crate::marketplace;+ match input.action.as_str() {+ "list" => {+ let entries = marketplace::list(input.domain.as_deref());+ let items: Vec<serde_json::Value> = entries.iter().map(|e| {+ serde_json::json!({+ "id": e.id,+ "name": e.name,+ "description": e.description,+ "domain": e.domain,+ "url": e.url,+ "format": marketplace::format_name(e.format),+ })+ }).collect();+ serde_json::json!({+ "ok": true,+ "count": items.len(),+ "ontologies": items,+ }).to_string()+ }+ "install" => {+ let id = match input.id.as_deref() {+ Some(id) => id,+ None => return r#"{"error":"'id' is required for install action"}"#.to_string(),+ };+ let entry = match marketplace::find(id) {+ Some(e) => e,+ None => {+ let available: Vec<&str> = marketplace::CATALOGUE.iter().map(|e| e.id).collect();+ return serde_json::json!({+ "error": format!("Unknown ontology ID: '{}'. Use action 'list' to see available IDs.", id),+ "available": available,+ }).to_string();+ }+ };+ match crate::graph::GraphStore::fetch_url(entry.url).await {+ Ok(content) => {+ match self.graph.load_content_with_base(&content, entry.format, Some(entry.url)) {+ Ok(count) => {+ let stats = self.graph.get_stats().unwrap_or_default();+ let stats_val: serde_json::Value = serde_json::from_str(&stats).unwrap_or_default();+ serde_json::json!({+ "ok": true,+ "installed": entry.id,+ "name": entry.name,+ "triples_loaded": count,+ "source": entry.url,+ "classes": stats_val["classes"],+ "properties": stats_val["properties"],+ "individuals": stats_val["individuals"],+ }).to_string()+ }+ Err(e) => format!(r#"{{"error":"Parse error for {}: {}"}}"#, entry.id, e),+ }+ }+ Err(e) => format!(r#"{{"error":"Fetch error for {}: {}"}}"#, entry.id, e),+ }+ }+ other => format!(r#"{{"error":"Unknown action '{}'. Use 'list' or 'install'."}}"#, other),+ }+ }+#[tool(name = "onto_version", description = "Save a named snapshot of the current ontology store")]async fn onto_version(&self, Parameters(input): Parameters<OntoVersionInput>) -> String {use crate::ontology::OntologyService;diff --git a/studio/src-tauri/sidecars/agent/index.ts b/studio/src-tauri/sidecars/agent/index.tsindex 96217491..7b9dab9a 100644--- a/studio/src-tauri/sidecars/agent/index.ts+++ b/studio/src-tauri/sidecars/agent/index.ts@@ -6,11 +6,11 @@ import * as readline from 'readline';const ENGINE_URL = 'http://localhost:8080/mcp';-const SYSTEM_PROMPT = `You are an ontology engineering assistant with access to the Open Ontologies engine and all 42 of its tools.+const SYSTEM_PROMPT = `You are an ontology engineering assistant with access to the Open Ontologies engine and all 43 of its tools.Do not use emoji in your responses. Use plain text and markdown formatting only.-ALL 42 TOOLS — use whichever are appropriate for the task:+ALL 43 TOOLS — use whichever are appropriate for the task:Core:- onto_clear: Reset the triple store (call FIRST when building from scratch)@@ -24,6 +24,9 @@ Core:- onto_convert: Convert between formats (Turtle, N-Triples, RDF/XML, N-Quads, TriG)- onto_status: Check if server is running+Marketplace:+- onto_marketplace: Browse and install standard ontologies from a curated catalogue of 29 W3C/ISO/industry standards (use action "list" or "install" with an id)+Remote:- onto_pull: Fetch ontology from a remote URL or SPARQL endpoint- onto_push: Push ontology to a remote SPARQL endpoint