An open-source knowledge graph for traceable AI decisions Semantica, an open-source knowledge graph platform, provides deterministic reasoning, context graphs, and W3C PROV-O provenance to make AI decisions auditable and explainable, targeting regulated enterprises in finance, healthcare, and government. The platform, installable via pip, integrates with Databricks and Snowflake and requires no LLM for graph construction or reasoning. Ingest your enterprise data, extract what matters, build a Context Graph and knowledge graph KG , and run graph analytics and causal reasoning over all of it, with full decision provenance baked in. Explainable, traceable, and trustworthy by design. Decision Intelligence · Context Management · Deterministic Reasoning · Ontology Management · Knowledge Modeling · End-to-End Traceability Open Source · Self-Hostable · Auditable · Governed · Zero Vendor Lock-In Polyglot Graph Storage · RDF & LPG Support · W3C Standards · Interoperable pip install semantica Most AI agents act without a trail. They store embeddings, not meaning: context that can't be explained, decisions that can't be audited. In lending, that gap is a compliance exposure, not an inconvenience: an underwriting agent's approval has to survive a regulator's "why" months later. Semantica sits underneath your LLM, vector store, and agent framework as a deterministic infrastructure layer: no LLM required for graph construction, reasoning, or provenance. Who it's for: AI/ML platform teams shipping agents that make consequential decisions and need structured, queryable context built from fragmented raw data, not just a vector index Data platform teams on Databricks or Snowflake who need to turn tables already sitting in Unity Catalog or a Snowflake warehouse into a governed, lineage-tracked knowledge graph, without exporting that data to a third-party SaaS first Compliance, risk, and audit teams who need a straight answer to "why did the AI do that?" in a format a regulator will actually accept Regulated enterprises finance, healthcare, legal, government, defense that can't ship a black box, and can't send their data to someone else's SaaS to get one Platform and infra engineers who want the KG, reasoning, and provenance stack self-hosted and swappable, not locked to one vendor's backend Data and knowledge engineers building a KG from messy, multi-source data: entities and relationships get extracted, conflicting or contradictory facts are flagged instead of silently overwritten, and duplicates are merged before they turn into noise Quick Start · · Architecture architecture · What You Get what-semantica-gives-you · Why Semantica why-semantica · Decision Intelligence decision-intelligence · Context Graphs context-graphs · Recipe: Audit Trail recipe-audit-trail-for-a-regulated-decision · Module Reference module-reference · Integrations integrations · CLI cli · Performance performance Install installation Context Graphs: A structured, queryable graph of everything your agent knows, decides, and reasons about Decision Intelligence: Every decision is a first-class object: traceable, searchable by precedent, and causally linked AI Governance & Ontology: SHACL constraints, conflict detection, compliance rules, OWL generation, and SKOS vocabulary management with a visual editor Full Auditability: W3C PROV-O provenance on every fact, with audit trails exportable to JSON, CSV, or RDF Deterministic Reasoning: Forward chaining, Rete network, Datalog, and SPARQL with fully explainable paths, not black boxes Knowledge Pipeline: Multi-source ingestion, entity-aware chunking, NER/relation/event extraction, and knowledge graph construction, with semantic deduplication and provenance-preserving merges throughout Enterprise Data Platforms: Native connectors for Databricks Unity Catalog + Delta Lake, PAT/OAuth M2M auth, catalog/schema/table/lineage introspection and Snowflake warehouse/database/schema, key-pair and OAuth auth , so tables already living in your lakehouse or warehouse become graph nodes with provenance, not another export/import hop Graph Analytics: Centrality, community detection, link prediction, and shortest-path queries over the graph you just built Polyglot Graph Storage: Native RDF embedded Oxigraph, Blazegraph, Apache Jena, Eclipse RDF4J via SPARQL and Labeled Property Graphs Neo4j, FalkorDB, Apache AGE, AWS Neptune via Cypher , plus vector stores, all swappable without touching your code Visualization: Explore any graph, ontology, or timeline in an interactive browser workbench Drop-in Integrations: Native Agno support, a full-featured MCP server, a comprehensive CLI, a REST API, and plugins across major editors | Vector DB + RAG | Plain LLM Memory | Semantica | | |---|---|---|---| Recall method | Embedding similarity | Token window | Graph traversal + semantic search | Decision history | Not stored | Not stored | First-class queryable objects | Provenance | None | None | W3C PROV-O, source-linked | Reasoning | None | Black box | Forward chain, Rete, Datalog, SPARQL | Conflict detection | Silent overwrite | Silent overwrite | Detected, flagged, resolved | Time travel | No | No | Point-in-time graph snapshots | Compliance export | None | None | PROV-O, SHACL, OWL, RDF | Policy enforcement | None | None | Built-in rule engine + SHACL | Entity resolution | No | No | Blocking + semantic deduplication | Multi-agent context | Separate per agent | Separate per agent | Single shared intelligence layer | Semantica complements your existing stack rather than replacing it. Keep your LLM, vector store, and agent framework exactly as they are; Semantica adds the decision records, causal reasoning, provenance, ontology governance, conflict detection, and audit trails on top. The reasoning engines, KG construction, and provenance layer are fully deterministic; no LLM is required to use them. pip install semantica python from semantica.context import ContextGraph graph = ContextGraph advanced analytics=True Every agent decision becomes a queryable, auditable knowledge node decision id = graph.record decision category="vendor selection", scenario="Choose cloud provider for HIPAA workload", reasoning="AWS offers BAA, mature HIPAA tooling, and existing team expertise", outcome="selected aws", confidence=0.93, Ask "why did this happen?" and get a real, structured answer chain = graph.trace decision chain decision id full causal ancestry similar = graph.find similar decisions "cloud vendor", max results=5 precedents impact = graph.analyze decision impact decision id downstream influence map compliant = graph.check decision rules {"category": "vendor selection"} policy gate Verify your install in 5 seconds: semantica doctor Python 3.11.9 pass semantica 0.6.5 pass faiss vector store pass Config file pass ~/.semantica/config.yaml If Semantica solves a real problem for you, a star helps others find it. Semantica is a real end-to-end pipeline, not a single library with a marketing name. Every stage below is a shipping module, independently importable: Sources → Ingest → Parse → Normalize → Split → Extract → Conflict Detection → Deduplication → Knowledge Graph → Ontology · Reasoning · Provenance · Decisions → Enriched KG → Vector Store + Polyglot Graph Store RDF & LPG → Export / Visualize / REST · MCP · CLI Ingest: files, web, databases, enterprise data platforms Databricks, Snowflake , cloud Google Drive, Elasticsearch , streams Kafka, Kinesis , Git, email, MCP Parse → Normalize → Split: document parsing, text/entity/date normalization, GraphRAG-native entity-aware chunking Extract → Conflict Detection → Deduplication: NER, relations, events, triplets; conflicting facts flagged and resolved before they merge Knowledge Graph: GraphBuilder constructs the graph; bi-temporal facts and full graph analytics centrality, communities, link prediction run on top of it Ontology · Reasoning · Provenance · Decisions: the intelligence layer sitting on the KG, with SHACL/OWL governance, Rete/Datalog/SPARQL inference, W3C PROV-O lineage, and first-class decision records Storage: polyglot by design, with RDF triple stores embedded Oxigraph, Blazegraph, Apache Jena, Eclipse RDF4J , Labeled Property Graphs Neo4j, FalkorDB, Apache AGE, AWS Neptune , and vector stores, all swappable without touching your code Outputs: export RDF, OWL, Parquet, Cypher, JSON-LD , interactive visualization, and access via REST API, MCP server, or CLI → Full Mermaid diagrams for the pipeline and the decision intelligence lifecycle Decision Intelligence turns every AI choice from an ephemeral inference into a permanent, auditable, queryable record. It answers "what did your AI decide, why, and what happened next?" : the question regulators and enterprise risk teams ask with increasing urgency. In Semantica, a decision is not a log line. It is a first-class graph node with a full lifecycle. In regulated domains, every AI decision must be traceable to a source and defensible to an auditor: record decision creates a permanent, structured record exportable as W3C PROV-O, the format most compliance frameworks accept for regulator submission. record decision → stored as a graph node with full structured context add causal relationship → linked to upstream causes and downstream effects find similar decisions → semantic precedent search across all past decisions trace decision chain → full causal ancestry back to root causes analyze decision impact → downstream influence map - everything this decision affected check decision rules → policy compliance gate against configurable rule sets export / audit trail → W3C PROV-O, CSV, or JSON for regulator submission python from semantica.context import ContextGraph graph = ContextGraph advanced analytics=True Record decisions with full structured context app id = graph.record decision category="credit application", scenario="Personal loan, $85k income, 31% DTI, 3yr employment", reasoning="Income meets threshold; employment stable; no adverse credit events", outcome="proceed to underwriting", confidence=0.88, metadata={"applicant id": "A-7291"}, uw id = graph.record decision category="loan underwriting", scenario="Underwriting review for A-7291", reasoning="DTI within policy; clean 36-month credit history", outcome="approved", confidence=0.94, rate id = graph.record decision category="interest rate", scenario="Rate assignment for approved loan A-7291", outcome="rate set 8.9pct", reasoning="Prime + 2.4% based on risk tier B2", confidence=0.99, Build the auditable causal chain - relationship type must be one of CAUSED, INFLUENCED, or PRECEDENT FOR graph.add causal relationship app id, uw id, relationship type="CAUSED" graph.add causal relationship uw id, rate id, relationship type="INFLUENCED" Query the intelligence chain = graph.trace decision chain rate id similar = graph.find similar decisions "personal loan approval, 31% DTI", max results=5 impact = graph.analyze decision impact uw id compliant = graph.check decision rules {"category": "loan underwriting", "confidence": 0.94} insights = graph.get decision insights A Context Graph is the structured memory layer that traditional RAG is missing. Instead of flat embeddings that answer "what is similar?" , a Context Graph answers "what is connected, why, and how?" Every entity, relationship, decision, and fact is a first-class node, queryable by graph traversal. Entities link to source documents, decisions link to evidence and consequences, facts carry full provenance, and conflicts are detected, not silently overwritten. python from semantica.context import ContextGraph, AgentContext from semantica.vector store import VectorStore graph = ContextGraph advanced analytics=True Add nodes with typed properties graph.add node "acme corp", "Organization", name="Acme Corp", industry="SaaS" graph.add node "alice chen", "Person", name="Alice Chen", role="CTO" graph.add node "contract 001", "Contract", value=2 400 000, currency="USD" Add typed, weighted edges extra kwargs become edge metadata graph.add edge "alice chen", "acme corp", edge type="works for", since="2019-03-01" graph.add edge "acme corp", "contract 001", edge type="party to", signed="2024-01-15" BFS traversal - hop through the graph from any node neighbors = graph.get neighbors "acme corp", hops=2 Point-in-time snapshot - the graph as it existed on any past date snapshot = graph.state at "2024-01-01" AgentContext - high-level API for agent memory workflows vs = VectorStore backend="faiss" ctx = AgentContext vector store=vs, knowledge graph=graph ctx.store "Alice approved the Acme renewal in Q1 2024", conversation id="conv 001" retrieved = ctx.retrieve "who approved the Acme contract?" Why graph over embeddings: traversal finds connections embeddings miss a person 3 hops from a contract ; every node carries provenance so you can always ask "where did this come from?" ; conflicts are flagged before they corrupt your knowledge base; point-in-time snapshots let you replay history without reprocessing. The flagship pattern: record a causally-linked decision chain, attach provenance to every entity, and export a regulator-ready audit trail. python from semantica.context import ContextGraph from semantica.provenance import ProvenanceManager from semantica.export import RDFExporter graph = ContextGraph advanced analytics=True prov = ProvenanceManager storage path="./audit.db" Record the decision chain d1 = graph.record decision category="drug interaction check", scenario="Patient P-4821: warfarin + amiodarone co-prescribed", reasoning="Amiodarone potentiates warfarin's anticoagulant effect", outcome="flag for review", confidence=0.91, d2 = graph.record decision category="dosage adjustment", scenario="INR monitoring plan for P-4821", reasoning="Reduce warfarin dose per interaction severity; recheck INR in 5 days", outcome="dose reduced 30pct", confidence=0.87, relationship type must be one of CAUSED, INFLUENCED, or PRECEDENT FOR graph.add causal relationship d1, d2, relationship type="CAUSED" Track provenance for every entity prov.track entity "patient P4821", source="ehr/medication orders 2024.json", metadata={"extractor": "NamedEntityRecognizer"} Export W3C PROV-O for regulator submission - RDFExporter expects {"entities": ... , "relationships": ... }, so map ContextGraph.to dict 's {"nodes": ... , "edges": ... } shape onto it first graph dict = graph.to dict kg = { "entities": {"id": n "id" , "type": n "type" , "text": n "content" } for n in graph dict "nodes" , "relationships": {"source id": e "source" , "target id": e "target" , "type": e "type" } for e in graph dict "edges" , } RDFExporter .export kg, "audit trail.ttl", format="turtle" More recipes GraphRAG pipelines, an AML rules engine, ontology-to-KG in one pass are in More Recipes below. Every module below is independently importable, with working code samples verified against the current source tree; use one or all of them. | Module | What it does | |---|---| semantica.ingest | semantica.semantic extract semantica.kg semantica.reasoning semantica.vector store semantica.split semantica.provenance semantica.ontology semantica.conflicts semantica.deduplication semantica.normalize semantica.pipeline semantica.export semantica.visualization Temporal Intelligence temporal-intelligence-bi-temporal-graphs--time-travel Multi-Agent Agno multi-agent-shared-context-with-agno ↓ Expand Module Reference below for every module's working example, or jump to More Recipes more-recipes , the full Integrations integrations matrix, MCP tool list mcp-server , and REST endpoints rest-api . Expand any module below for its runnable example. semantica.ingest : Multi-Source Ingestion semantica.ingest Ingest from files, web, databases, APIs, streams, email, Git repos, Parquet, Databricks, Snowflake, or MCP servers, all through a unified interface. python from semantica.ingest import FileIngestor, WebIngestor, ParquetIngestor, DBIngestor Ingest an entire directory of contracts PDF, DOCX, HTML, TXT docs = FileIngestor .ingest directory "./contracts/", recursive=True Ingest live web content with robots.txt compliance pages = WebIngestor .ingest url "https://example.com/reports/annual-2024.html" Ingest structured data from Parquet with Snappy compression records = ParquetIngestor .ingest "./data/transactions.parquet" Ingest from a SQL database - specify which tables to pull rows = DBIngestor .ingest database connection string="postgresql://user:pass@localhost/mydb", include tables= "customer events" , max rows per table=50 000, Enterprise data platforms - pull tables straight out of your lakehouse or warehouse, with lineage, instead of exporting to CSV first from semantica.ingest import DatabricksIngestor, SnowflakeIngestor pip install "semantica db-databricks " databricks = DatabricksIngestor host="https://adb-xxx.azuredatabricks.net", token="dapi-xxxxxxxx", or client id/client secret for OAuth M2M http path="/sql/1.0/warehouses/xxxxxxxx", catalog="main", customers = databricks.ingest table "customers", limit=10 000 sales = databricks.ingest query "SELECT FROM sales WHERE region = 'EMEA'" table lineage = databricks.get table lineage "customers", catalog="main", schema="default" Unity Catalog lineage pip install semantica db-snowflake snowflake = SnowflakeIngestor account="myaccount", user="myuser", password="mypassword", or private key=... for key-pair; use authenticator="oauth", token=... for OAuth warehouse="COMPUTE WH", database="MYDB", orders = snowflake.ingest table "ORDERS", limit=10 000 Security Note:Never hardcode credentials token , password , private key in production code; pass them via environment variables e.g., DATABRICKS TOKEN , SNOWFLAKE PASSWORD or a secrets manager. Supported sources: Local files PDF, DOCX, PPTX, HTML, TXT, CSV, JSON, YAML, Excel, XML · Web pages · RSS/Atom feeds · REST APIs · Databases PostgreSQL, MySQL, SQLite, Oracle, SQL Server · Parquet datasets · Databricks Unity Catalog + Delta Lake · Snowflake · Git repositories · Email IMAP/POP3 · Message streams Kafka, RabbitMQ, Kinesis, Pulsar · MCP resources · Apache Arrow/Feather/IPC ArrowIngestor DuckDB, Elasticsearch, Google Drive, HuggingFace, MongoDB, and Pandas ingestion also ship DuckDBIngestor , ElasticIngestor , GDriveIngestor , HuggingFaceIngestor , MongoIngestor , PandasIngestor but aren't re-exported from the top-level semantica.ingest namespace yet — import them directly: from semantica.ingest.duckdb ingestor import DuckDBIngestor . semantica.semantic extract : NER, Relations, Events, Triplets semantica.semantic extract Extract structured knowledge from raw text in one pass. from semantica.semantic extract import NamedEntityRecognizer, RelationExtractor, EventDetector, TripletExtractor, text = """ Anthropic CEO Dario Amodei announced a $7.3B Series E funding round in partnership with Google and Spark Capital, valuing the company at $61.5B as of Q4 2024. """ Named entity recognition with confidence thresholding ner = NamedEntityRecognizer confidence threshold=0.7 entities = ner.extract entities text → Entity name="Dario Amodei", type="PERSON" , Entity name="Anthropic", type="ORG" , Entity name="Google", type="ORG" , Entity name="$7.3B", type="MONEY" , ... Relationship extraction - bidirectional support rel extractor = RelationExtractor confidence threshold=0.6, bidirectional=True relations = rel extractor.extract relations text, entities=entities → Relation subject="Dario Amodei", predicate="ceo of", object="Anthropic" , Relation subject="Anthropic", predicate="raised", object="$7.3B Series E" , ... Event detection with temporal processing events = EventDetector extract participants=True, extract time=True .detect events text → Event type="FUNDING", participants= "Anthropic","Google","Spark Capital" , amount="$7.3B", date="Q4 2024" RDF triplets with optional provenance metadata triplets = TripletExtractor include temporal=True, include provenance=True .extract triplets text → "Anthropic", "valuation", "$61.5B" , "Dario Amodei", "is ceo of", "Anthropic" , ... Batch processing across many documents uses ner.process batch ... , not a per-call extract entities batch on the facade class. semantica.kg : Knowledge Graph Construction & Analysis semantica.kg Build a production knowledge graph from documents and run graph algorithms over it. python from semantica.ingest import FileIngestor from semantica.kg import GraphBuilder, GraphAnalyzer, CentralityCalculator, CommunityDetector, PathFinder, LinkPredictor, BiTemporalFact, from datetime import datetime Build KG - merge duplicate entities, track temporal edges sources = FileIngestor .ingest directory "./contracts/", recursive=True kg = GraphBuilder merge entities=True, enable temporal=True .build sources Graph analytics analyzer = GraphAnalyzer analysis = analyzer.analyze graph kg full graph metrics centrality = CentralityCalculator degree = centrality.calculate degree centrality kg most-connected entities betweenness = centrality.calculate betweenness centrality kg communities = CommunityDetector .detect communities kg, method="louvain" natural clusters path = PathFinder .find shortest path kg, "alice chen", "contract 001" predictions = LinkPredictor .predict links kg, top k=10 relationship predictions Bi-temporal facts - track valid time vs. recorded time independently fact = BiTemporalFact valid from=datetime 2024, 3, 1 , valid until=datetime 2025, 1, 1 , recorded at=datetime 2024, 3, 5 , semantica.reasoning : Forward Chaining, Rete, Datalog, SPARQL semantica.reasoning Run explainable rule-based inference, not a black box. python from semantica.reasoning import ReteEngine, Rule, Fact, RuleType rete = ReteEngine rete.build network Rule rule id="aml flag", name="Flag high-risk transactions", conditions= {"field": "amount", "operator": " ", "value": 10 000}, {"field": "country", "operator": "in", "value": "IR", "KP", "SY" }, , conclusion="flag for compliance review", rule type=RuleType.IMPLICATION, , Rule rule id="velocity check", name="Flag rapid sequential transfers", conditions= {"field": "transfers in 1h", "operator": " ", "value": 5}, {"field": "total amount", "operator": " ", "value": 50 000}, , conclusion="flag velocity breach", rule type=RuleType.IMPLICATION, , rete.add fact Fact "tx 001", "transaction", {"amount": 15 000, "country": "IR"} flagged = rete.match patterns → {"rule": "aml flag", "matched facts": "tx 001" , "conclusion": "flag for compliance review"} Current limitation: ReteEngine 's alpha-node condition matcher is intentionally simple in this release — validate match patterns output against your actual rule set before wiring it into a production compliance gate; more selective condition evaluation is on the roadmap. Recursive Datalog - natural language for graph queries from semantica.reasoning import DatalogReasoner engine = DatalogReasoner engine.add fact "parent tom, bob " engine.add fact "parent bob, ann " engine.add fact "parent ann, pat " engine.add rule "ancestor X, Y :- parent X, Y ." engine.add rule "ancestor X, Z :- parent X, Y , ancestor Y, Z ." ancestors = engine.query "ancestor tom, ?X " → {"X": "bob"}, {"X": "ann"}, {"X": "pat"} Explainable reasoning - trace the path, not just the answer from semantica.reasoning import ExplanationGenerator, Reasoner reasoner = Reasoner reasoner.add fact "parent tom, bob " reasoner.add rule "ancestor X, Y :- parent X, Y " result = reasoner.forward chain explainer = ExplanationGenerator explanation = explainer.generate explanation result → Explanation conclusion="...", steps= ReasoningStep ... , justification=Justification ... semantica.vector store : Hybrid & Filtered Semantic Search semantica.vector store Drop-in vector store with multiple backends, hybrid search, and decision-aware retrieval. python from semantica.vector store import VectorStore, HybridSearch In-memory backend shown here: HybridSearch and explain decision work out of the box. Swap backend="qdrant" / "weaviate" / "milvus" / "pinecone" / "pgvector" / "faiss" once you scale past a single process — search and store decision work identically on all of them. vs = VectorStore backend="inmemory", dimension=1536 Store a decision with scenario description and outcome vs.store decision scenario="Personal loan A-7291, $85k income, 31% DTI, 3yr employment", outcome="approved", confidence=0.94, category="loan underwriting", Semantic similarity search results = vs.search query="personal loan approval with low DTI", limit=10, Hybrid search - dense + sparse retrieval in one pass with RRF fusion hs = HybridSearch vector store=vs hits = hs.search "high-risk transactions 2024" Explain why a decision was retrieved explanation = vs.explain decision results 0 "id" Backends: faiss · qdrant · weaviate · milvus · pinecone · pgvector · sqlite · inmemory semantica.split : GraphRAG-Native Document Chunking semantica.split KG-aware splitting that preserves entity boundaries, relation triplets, and ontology concepts, essential for GraphRAG pipelines. python from semantica.split import TextSplitter, EntityAwareChunker, RelationAwareChunker text = open "contracts/master agreement.txt" .read Standard recursive chunking chunks = TextSplitter method="recursive", chunk size=1000, chunk overlap=200 .split text Entity-aware chunking - never splits a named entity across chunks GraphRAG chunks = TextSplitter method="entity aware", ner method="llm", chunk size=1000 .split text Relation-aware chunking - preserves subject, predicate, object triplets intact chunks = RelationAwareChunker chunk size=1000, preserve triplets=True .chunk text Graph-based chunking - uses centrality to find natural community boundaries chunks = TextSplitter method="graph based", chunk size=1000 .split text Hierarchical chunking - multi-level section → paragraph → sentence chunks = TextSplitter method="hierarchical", levels= "section", "paragraph" .split text Supported methods: recursive · token · sentence · paragraph · semantic transformer · entity aware · relation aware · graph based · ontology aware · hierarchical · community detection · centrality based · llm semantica.provenance : W3C PROV-O Lineage semantica.provenance Every fact is linked to its source. No black boxes, no mystery outputs. python from semantica.provenance import ProvenanceManager prov = ProvenanceManager storage path="./provenance.db" Track where every entity came from prov.track entity entity id="acme corp", source="contracts/acme master agreement 2024.pdf", metadata={"page": 1, "confidence": 0.97, "extractor": "NamedEntityRecognizer"}, Track a relationship's provenance - entity linkage travels in metadata prov.track relationship relationship id="alice works for acme", source="hr records/employees q1 2024.csv", metadata={"source entity id": "alice chen", "target entity id": "acme corp"}, Answer "where did this come from?" lineage = prov.get lineage "acme corp" trail = prov.trace lineage "alice chen" full ancestor chain entry = prov.get provenance "acme corp" semantica.ontology : OWL Generation, SHACL Validation semantica.ontology Generate ontologies from data, validate shapes, and manage your vocabulary. python from semantica.ontology import OntologyGenerator, OntologyValidator data = { "entities": {"id": "acme corp", "type": "Organization", "industry": "SaaS", "founded": 2012}, {"id": "alice chen", "type": "Person", "role": "CTO", "since": 2019}, , "relationships": {"source": "alice chen", "target": "acme corp", "type": "works for"}, , } gen = OntologyGenerator base uri="https://semantica.dev/ontology/" ontology = gen.generate ontology data classes = gen.infer classes data props = gen.infer properties data, classes optimized = gen.optimize ontology ontology Validate against SHACL shapes validator = OntologyValidator report = validator.validate ontology → ValidationResult valid=True, consistent=True, satisfiable=True, errors= , warnings= semantica.conflicts : Conflict Detection & Resolution semantica.conflicts Detect and resolve conflicting facts from multiple sources before they corrupt your knowledge base. python from semantica.conflicts import ConflictDetector, ConflictResolver, SourceTracker entities from source a = {"id": "alice chen", "role": "CTO", "salary": 250 000, "start date": "2019-03-01"}, entities from source b = {"id": "alice chen", "role": "VP Eng", "salary": 275 000, "start date": "2019-03-01"}, Detect all conflict types: value, type, relationship, temporal, logical detector = ConflictDetector conflicts = detector.detect conflicts entities from source a + entities from source b → Conflict entity="alice chen", field="role", values= "CTO","VP Eng" , severity="HIGH" , Conflict entity="alice chen", field="salary", values= 250000,275000 , severity="MEDIUM" Resolve using multiple strategies resolver = ConflictResolver resolved = resolver.resolve conflicts conflicts, strategy="credibility weighted" weighted by source trust resolved = resolver.resolve conflicts conflicts, strategy="most recent" prefer most recent resolved = resolver.resolve conflicts conflicts, strategy="voting" majority wins Track source credibility over time tracker = SourceTracker tracker.register source "source a", source type="document", credibility score=0.85 tracker.register source "source b", source type="document", credibility score=0.72 semantica.deduplication : Entity Resolution at Scale semantica.deduplication Block, cluster, and merge duplicates with semantic similarity. python from semantica.deduplication import DuplicateDetector, EntityMerger entities = {"id": "e1", "name": "Acme Corporation", "domain": "acme.com"}, {"id": "e2", "name": "Acme Corp.", "domain": "acme.com"}, {"id": "e3", "name": "ACME Corp", "domain": "acme.co"}, {"id": "e4", "name": "Globex Industries", "domain": "globex.com"}, detector = DuplicateDetector similarity threshold=0.75, use clustering=True candidates = detector.detect duplicates entities groups = detector.detect duplicate groups entities → DuplicateGroup entities= "e1","e2","e3" , confidence=0.91, strategy="semantic+blocking" merger = EntityMerger preserve provenance=True ops = merger.merge duplicates entities, strategy="keep most complete" history = merger.get merge history semantica.normalize : Data Normalization & Cleaning semantica.normalize Standardize text, entities, dates, numbers, and encodings before building your knowledge graph. from semantica.normalize import TextNormalizer, EntityNormalizer, DateNormalizer, NumberNormalizer, DataCleaner, Unicode, whitespace, casing, HTML tags, smart quotes text = TextNormalizer .normalize " Acme Corp.'s Q4 report... " → "Acme Corp.'s Q4 report..." Alias resolution + entity disambiguation with confidence scores canonical = EntityNormalizer .normalize entity "ACME Corp." → NormalizedEntity canonical="Acme Corporation", type="Organization", confidence=0.91 Natural language date parsing with timezone conversion dt = DateNormalizer .normalize date "3 weeks ago" → datetime 2026, 7, 1, tzinfo=UTC Unit conversion and currency normalization price = NumberNormalizer .normalize number "$1.25M USD" → NormalizedNumber value=1 250 000, currency="USD" Deduplicate, validate, and impute missing values across a dataset clean = DataCleaner .clean data records, remove duplicates=True, handle missing=True semantica.pipeline : Pipeline DSL semantica.pipeline Compose ingestion, extraction, and graph-building into a declarative, parallel pipeline. python from semantica.pipeline import PipelineBuilder, ExecutionEngine builder = PipelineBuilder add step returns the created PipelineStep, not the builder, so these don't chain builder.add step "ingest", step type="ingest", source="./contracts/", recursive=True builder.add step "extract", step type="ner extract" builder.add step "relations", step type="relation extract" builder.add step "build kg", step type="kg build", merge entities=True builder.add step "deduplicate", step type="deduplicate", threshold=0.75 builder.add step "export", step type="export", format="turtle", output="kg.ttl" connect steps and set parallelism return the builder, so these do chain pipeline = builder .connect steps "ingest", "extract" .connect steps "extract", "relations" .connect steps "relations", "build kg" .connect steps "build kg", "deduplicate" .connect steps "deduplicate", "export" .set parallelism 4 .build name="contracts pipeline" engine = ExecutionEngine result = engine.execute pipeline pipeline status = engine.get pipeline status pipeline.name progress = engine.get progress pipeline.name Temporal Intelligence : Bi-Temporal Graphs & Time Travel Track when facts were true in the world vs. when they were recorded , and query either axis. python from semantica.context import ContextGraph from semantica.kg import BiTemporalFact, TemporalGraphQuery, TemporalNormalizer, from datetime import datetime graph = ContextGraph advanced analytics=True graph.add node "alice chen", "Person", role="VP Engineering" graph.add node "acme corp", "Organization", valuation=1 200 000 000 A temporally-bounded edge - valid from/valid until define when it held true graph.add edge "alice chen", "acme corp", edge type="works for", valid from="2024-03-01T00:00:00", valid until="2025-01-01T00:00:00", Point-in-time snapshots - replay history without reprocessing snapshot 2023 = graph.state at "2023-06-01" snapshot 2024 = graph.state at "2024-01-01" Bi-temporal facts - valid time is when true in the world; recorded at is when you learned about it fact = BiTemporalFact valid from=datetime 2024, 3, 1 , valid until=datetime 2025, 1, 1 , recorded at=datetime 2024, 3, 5 , Query facts valid within a time window - query time range expects {"relationships": ... } with source id/target id keys, which differs from ContextGraph.to dict 's {"nodes", "edges"} shape, so map it first graph dict = graph.to dict kg relationships = { "relationships": { e, "source id": e "source" , "target id": e "target" } for e in graph dict "edges" } tq = TemporalGraphQuery facts in window = tq.query time range kg relationships, query="valid facts", start time="2024-01-01", end time="2024-12-31" Normalize natural language temporal expressions - returns a start, end range norm = TemporalNormalizer start, end = norm.normalize "last quarter" semantica.export : RDF, OWL, Parquet, Cypher, JSON-LD semantica.export Export to any format required by regulators, graph databases, or downstream systems. from semantica.export import RDFExporter, JSONExporter, ParquetExporter, LPGExporter, ReportGenerator, kg = {"entities": ... , "relationships": ... } rdf = RDFExporter turtle str = rdf.export to rdf kg, format="turtle" returns string jsonld str = rdf.export to rdf kg, format="json-ld" rdf.export kg, "kg audit.ttl", format="turtle" rdf.export kg, "kg audit.jsonld", format="json-ld" rdf.export kg, "kg audit.nt", format="n-triples" Columnar analytics - Snappy-compressed Parquet writes kg snapshot entities.parquet and kg snapshot relationships.parquet ParquetExporter compression="snappy" .export knowledge graph kg, "kg snapshot" JSON knowledge graph JSONExporter .export knowledge graph kg, "kg.json" Neo4j / Memgraph Cypher statements for graph database import LPGExporter .export kg, "kg import.cypher" Human-readable HTML report ReportGenerator .generate report {"title": "KG Audit Report", "summary": "Weekly ingestion summary", "metrics": {"entities": len kg "entities" }}, file path="audit report.html", format="html", semantica.visualization : Interactive Graph Workbench semantica.visualization Render force-directed graphs, community maps, ontology hierarchies, and temporal dashboards. from semantica.visualization import KGVisualizer, OntologyVisualizer, EmbeddingVisualizer, TemporalVisualizer, import numpy as np kg = {"entities": ... , "relationships": ... } Interactive force-directed graph opens in browser viz = KGVisualizer layout="force", color scheme="default" viz.visualize network kg, output="interactive", file path="kg.html" viz.visualize communities kg, communities, output="interactive" viz.visualize centrality kg, centrality, centrality type="degree" viz.visualize entity types kg, output="html", file path="entity types.html" Ontology class hierarchy OntologyVisualizer .visualize hierarchy ontology, output="interactive" 2D embedding projection UMAP / t-SNE / PCA EmbeddingVisualizer .visualize 2d projection embeddings=np.array ... , labels= "entity a", "entity b" , method="umap", Timeline scrubber - watch the graph evolve TemporalVisualizer .visualize timeline kg, output="interactive" Multi-Agent Shared Context with Agno One shared intelligence layer. All agents read and write to the same context graph. python pip install semantica agno from agno.agent import Agent from agno.team import Team from agno.models.anthropic import Claude from semantica.context import ContextGraph from semantica.vector store import VectorStore from integrations.agno import AgnoSharedContext, AgnoDecisionKit, AgnoKGToolkit shared = AgnoSharedContext vector store=VectorStore backend="faiss" , knowledge graph=ContextGraph advanced analytics=True , decision tracking=True, researcher = Agent name="Researcher", model=Claude id="claude-sonnet-4-5" , memory=shared.bind agent "researcher" , tools= AgnoKGToolkit context=shared , analyst = Agent name="Analyst", model=Claude id="claude-sonnet-4-5" , memory=shared.bind agent "analyst" , tools= AgnoDecisionKit context=shared , team = Team agents= researcher, analyst , mode="coordinate" Researcher's findings are instantly available to the Analyst - no copy, no sync → runnable notebooks in the cookbook https://github.com/semantica-agi/semantica/tree/main/cookbook , each self-contained and runnable in under 5 minutes The flagship audit-trail recipe is above recipe-audit-trail-for-a-regulated-decision . Here are three more common patterns. End-to-End GraphRAG Pipeline python from semantica.ingest import FileIngestor from semantica.split import TextSplitter from semantica.semantic extract import NamedEntityRecognizer, RelationExtractor from semantica.kg import GraphBuilder from semantica.vector store import VectorStore, HybridSearch from semantica.context import AgentContext 1. Ingest docs = FileIngestor .ingest directory "./docs/", recursive=True 2. Entity-aware chunking - never splits an entity across a chunk boundary splitter = TextSplitter method="entity aware", chunk size=1000 chunks = splitter.split doc "text" for doc in docs 3. Extract entities and relations ner = NamedEntityRecognizer confidence threshold=0.7 rel ext = RelationExtractor confidence threshold=0.6 entities = ner.extract entities chunk for chunk group in chunks for chunk in chunk group 4. Build KG kg = GraphBuilder merge entities=True, enable temporal=True .build docs 5. Hybrid retrieval vs = VectorStore backend="inmemory" ctx = AgentContext vector store=vs, knowledge graph=kg ctx.store "Alice approved the Acme renewal in Q1 2024", conversation id="c1" results = HybridSearch vector store=vs .search "who approved the renewal?" AML Rules Engine python from semantica.reasoning import ReteEngine, Rule, Fact, RuleType rete = ReteEngine rete.build network Rule rule id="sanctions check", name="Flag sanctioned-country transactions", conditions= {"field": "amount", "operator": " ", "value": 10 000}, {"field": "country", "operator": "in", "value": "IR", "KP", "SY", "CU" }, , conclusion="flag for compliance review", rule type=RuleType.IMPLICATION, , Run the rule across a batch of incoming transactions, not just one for tx in Fact "tx 101", "transaction", {"amount": 25 000, "country": "IR"} , Fact "tx 102", "transaction", {"amount": 4 500, "country": "DE"} , Fact "tx 103", "transaction", {"amount": 60 000, "country": "KP"} , : rete.add fact tx flagged = rete.match patterns Same condition-matcher caveat as above semanticareasoning-forward-chaining-rete-datalog-sparql applies — validate against your rule set before production use. Ontology-to-Knowledge-Graph in One Pass python from semantica.ingest import FileIngestor from semantica.semantic extract import NamedEntityRecognizer, RelationExtractor from semantica.kg import GraphBuilder from semantica.ontology import OntologyGenerator, OntologyValidator from semantica.export import RDFExporter sources = FileIngestor .ingest directory "./contracts/" ner = NamedEntityRecognizer confidence threshold=0.7 entities = ner.process batch s "text" for s in sources kg = GraphBuilder merge entities=True .build sources gen = OntologyGenerator base uri="https://myco.dev/ontology/" ont = gen.generate ontology {"entities": entities 0 , "relationships": } report = OntologyValidator .validate ont if report.valid: RDFExporter .export {"entities": entities 0 }, "ontology.ttl", format="turtle" | Capability | Highlights | |---|---| Context Graphs | Queryable graph of entities, decisions, relationships; causal links; cross-graph navigation | Decision Intelligence | record decision · trace decision chain · find similar decisions · analyze decision impact · check decision rules | Temporal Intelligence | Point-in-time snapshots · Allen interval algebra 13 relations · TemporalNormalizer · bi-temporal provenance | Distance Intelligence | N×N semantic distance matrices · ego-mode visualization · distance bands · embedding cache | Semantic Extraction | NER · relation extraction · event detection · triplet generation · coreference | Reasoning Engines | Forward chaining · Rete · deductive · abductive · SPARQL · Datalog with explainable output | GraphRAG Chunking | Entity-aware · relation-aware · graph-based · ontology-aware · community-detection chunking | Conflict Detection | Value / type / relationship / temporal / logical conflicts · multiple resolution strategies | Provenance | W3C PROV-O · every fact traced to source · audit log export JSON/CSV/RDF | Ontology Hub | SHACL Studio · visual editor · cross-ontology alignments · health dashboard | Vector Store | FAISS · Pinecone · Weaviate · Qdrant · Milvus · PgVector · hybrid + filtered search | Graph Databases LPG | Neo4j · FalkorDB · Apache AGE · AWS Neptune | Triple Stores RDF | Oxigraph embedded · Blazegraph · Apache Jena · Eclipse RDF4J · unified TripletStore interface · SPARQL query & bulk load | Enterprise Data Platforms | Databricks DatabricksIngestor : Unity Catalog + Delta Lake, PAT/OAuth M2M, table/query ingestion, catalog/schema/table/lineage introspection · Snowflake SnowflakeIngestor : warehouse/database/schema, password/key-pair/OAuth auth | LLM Providers | All already supported today: OpenAI GPT-4o, o1, o3 · Anthropic Claude · Google Gemini · Mistral · Meta Llama · Groq · Cohere · Azure OpenAI · AWS Bedrock · Ollama · DeepSeek · Perplexity · Together AI · Fireworks AI · Replicate · HuggingFace · via semantica.llms and LiteLLM | Benchmarks from v0.5.0 on a 118,000-node production graph: | Operation | Before | After | Improvement | |---|---|---|---| | Node search 118k nodes | 24 ms | 0.004 ms | 6,000× faster | | Embedding cache hit | cold load | revision-based cache | 10× throughput | | Semantic deduplication | baseline | optimized candidate gen | 6.98× faster | | Candidate generation | baseline | blocking strategy | 63.6% faster | Measured on a 118,000-node production graph AMD EPYC, 64 GB RAM ; the deduplication/candidate-generation figures are historical measurements recorded in CHANGELOG.md rather than an automated tests/ assertion. Results vary by hardware, dataset topology, and backend selection — run pytest tests/vector store/test performance benchmarks.py -s to measure your own data. Every capability is available from the terminal. The CLI ships with the package, no separate install required. pip install semantica semantica startup dashboard semantica doctor health check semantica --help full grouped command reference Start with semantica , verify with doctor , build a graph, and explore the command groups from one terminal. Command groups: ingest · parse · extract · kg · reason · decision · temporal · provenance · ontology · embed · deduplicate · validate · export · visualize · pipeline · server · explorer · mcp · doctor · shell · init · watch Native plugin bundles for Claude Code, Cursor, Codex, Windsurf, Cline, Continue, VS Code, and OpenClaw; a full-featured MCP server for any MCP-compatible client; a comprehensive REST API; and first-class Agno support for multi-agent shared context. Every major LLM provider is already supported via semantica.llms and LiteLLM: OpenAI, Anthropic, Gemini, Mistral, Llama, Groq, Cohere, Azure, Bedrock, Ollama, DeepSeek, HuggingFace, and more. MCP setup takes 30 seconds — see MCP Server mcp-server below. Full integrations matrix editors, MCP clients, REST clients, agentic frameworks | Native Plugin Bundle | MCP Server + Plugin | |||||| |---|---|---|---|---|---|---|---| Claude CodeSkills · agents · hooks | CursorSkills · agents | Codex CLISkills · agents | Windsurf | Cline | Continue | VS Code | OpenClawMCP + | | MCP Server | REST API | |||||| Claude DesktopMCP server | GitHub CopilotREST API | Roo CodeREST API | GooseREST API | Kilo CodeREST API | AiderREST API | Amazon QREST API | ZedREST API | Connect any MCP-compatible client Claude Desktop, Windsurf, Cline, VS Code in 30 seconds: python -m semantica.mcp server or via the installed entry point semantica-mcp { "mcpServers": { "semantica": { "command": "python", "args": "-m", "semantica.mcp server" } } } Tools exposed over MCP: | Tool | What it does | |---|---| extract entities | NER on any text | extract relations | Relation extraction | record decision | Persist a decision node | query decisions | Search decision history | find precedents | Semantic precedent lookup | get causal chain | Full causal ancestry | add entity | Add a KG node | add relationship | Add a KG edge | run reasoning | Execute rule set | get graph analytics | Centrality, communities | export graph | Export to RDF/JSON/Parquet | get graph summary | Graph statistics | Start the backend python -m semantica.server port 8000 Extract entities & relations via REST curl -X POST http://localhost:8000/api/enrich/extract \ -H "Content-Type: application/json" \ -d '{"text": "Apple CEO Tim Cook announced record earnings."}' List recorded decisions curl "http://localhost:8000/api/decisions?category=vendor selection" Query the knowledge graph curl "http://localhost:8000/api/graph/node/acme corp/neighbors?depth=2" REST endpoints span: enrich extract · graph · decisions · reasoning · provenance · ontology · embeddings · search · export · pipeline · temporal · deduplication Domain skills: extract · ingest · query · ontology · validate · deduplicate · embed · reason · decision · causal · temporal · provenance · policy · explain · export · change · visualize Specialized agents: kg-assistant · decision-advisor · explainability Bundles for Claude Code, Cursor, Codex, Windsurf, Cline, Continue, VS Code, and OpenClaw in plugins/ /semantica-agi/semantica/blob/main/plugins . A browser-based graph workbench. Pan and zoom live graphs, scrub the timeline, review every decision's causal chain, resolve duplicates, and author your ontology visually. Built on React 19 + Sigma.js. | Workspace | What you can do | |---|---| Knowledge Graph | Live Sigma.js canvas with ForceAtlas2 layout, Ego Mode, semantic distance heatmap | Timeline | Scrub through temporal events and watch the graph evolve | Decisions | Browse the causal chain behind every recorded decision | Registry | Live audit log of every graph mutation | Entity Resolution | Review and merge duplicates | Ontology Hub | SHACL Studio, visual editor, cross-ontology alignments, SKOS browser | Lineage | W3C PROV-O provenance visualization for any entity | Quickest way to start no Node.js required : pip install "semantica explorer " semantica-explorer --graph my graph.json Dashboard opens at http://127.0.0.1:8000 For contributor / dev-server setup: explorer/README.md: Local Setup Guide /semantica-agi/semantica/blob/main/explorer/README.md Security release — upgrading is strongly recommended. Fixes for 5 externally-reported vulnerabilities in the Explorer API and graph/triplet store backends, plus a CodeQL-flagged ReDoS: Missing authentication on all Explorer API routes GHSA-j4mq-hprp-987v, Critical : every route now requires SEMANTICA API KEY , fails closed 503 rather than open when unconfigured SSRF via redirect bypass in ontology URL fetching GHSA-8c7v-62gr-hj6g, High : redirect targets are now re-validated at every hop and the connection is pinned to the validated address, closing a DNS check-then-use race Cypher injection via unvalidated node labels and property keys GHSA-482h-hw99-h62p, Critical : Neptune, Neo4j, and FalkorDB now sanitize every label/relationship-type/property-key interpolation site SPARQL injection via unvalidated triplet IRIs GHSA-8vgg-8mr4-r236, Critical : Blazegraph, RDF4J, and Jena now validate subject/predicate/object IRIs before interpolation Missing Origin validation on the WebSocket handshake GHSA-4643-wpgq-w329, Moderate, anonymous-mode only : /ws/graph-updates now checks Origin against the same allowlist CORSMiddleware enforces for HTTP Polynomial ReDoS in SPARQL query validation CodeQL py/polynomial-redos : fixed a backtracking regex in the Explorer's SPARQL route Also includes: embedded Oxigraph backend for TripletStore , PROV-O trust/spec completeness for ProvenanceManager , and the Altair Anzo triplet store backend. → Full release notes /semantica-agi/semantica/blob/main/RELEASE NOTES.md · Changelog /semantica-agi/semantica/blob/main/CHANGELOG.md Semantica is designed for environments where AI outputs must be explainable, auditable, and defensible, and where the data itself can't leave your infrastructure. Self-hostable with zero vendor lock-in, it's built as much for organizations handling confidential or classified data as for regulated industries chasing an audit trail: Finance: Loan underwriting audit trails, fraud detection, AML compliance, regulatory risk knowledge graphs Healthcare: Clinical decision support, drug interaction graphs, and patient safety audit trails Legal: Evidence-backed research, contract analysis, case law reasoning, and privilege tracking Government & Defense: Policy decision records, classified information governance, and regulatory reporting, fully self-hosted with no data leaving your perimeter Law Enforcement: Case linkage, evidence provenance chains, and investigative knowledge graphs that hold up under legal scrutiny Cybersecurity: Threat attribution, incident response timelines, and IOC provenance tracking Autonomous Systems: Decision logs, safety validation, and explainable AI for certification pip install semantica core pip install semantica all everything pip install semantica agno Agno multi-agent integration pip install semantica llm-litellm OpenAI, Anthropic, Gemini, Mistral, Llama, Groq, Cohere, Bedrock, Ollama, DeepSeek, and more pip install semantica graph-neo4j Neo4j graph store LPG pip install semantica graph-falkordb FalkorDB graph store LPG pip install semantica graph-apache-age Apache AGE graph store LPG pip install semantica graph-amazon-neptune AWS Neptune graph store LPG pip install semantica tripletstore-oxigraph Embedded in-memory/on-disk RDF store RDF triple stores Blazegraph, Apache Jena, Eclipse RDF4J need no extra: semantica.triplet store talks SPARQL over HTTP using the core requests dependency pip install semantica vectorstore-qdrant Qdrant vector store pip install semantica vectorstore-pinecone Pinecone vector store pip install semantica db-snowflake Snowflake pip install semantica db-databricks Databricks SDK + SQL connector pip install semantica ingest-parquet Parquet / PyArrow pip install semantica ingest-arrow Apache Arrow, Feather, IPC pip install semantica viz HTML interactive visualization pip install semantica watch Directory file watcher pip install semantica explorer Knowledge Explorer dashboard For production deployments, use Docker or Kubernetes rather than a local pip install . Set SEMANTICA SECRET KEY , configure a persistent LPG graph store Neo4j / FalkorDB / Apache AGE / AWS Neptune and/or RDF triple store Blazegraph / Apache Jena / Eclipse RDF4J , and point the vector store at a hosted backend Qdrant / Pinecone . See ARCHITECTURE.md /semantica-agi/semantica/blob/main/ARCHITECTURE.md for the full deployment topology. From source git clone https://github.com/semantica-agi/semantica.git cd semantica && pip install -e ". dev " && pytest tests/ On-premises deployment · Private cloud · Custom domain implementations · SLA-backed support · Professional services for regulated industries finance, healthcare, legal, government . getsemantica.ai for enterprise solutions and pricing. Discord | | GitHub Discussions Q&A and feature requests https://github.com/semantica-agi/semantica/discussions GitHub Issues Bug reports https://github.com/semantica-agi/semantica/issues Documentation docs.getsemantica.ai https://docs.getsemantica.ai/ Cookbook Runnable Jupyter notebooks https://github.com/semantica-agi/semantica/tree/main/cookbook Changelog CHANGELOG.md /semantica-agi/semantica/blob/main/CHANGELOG.md · Release Notes /semantica-agi/semantica/blob/main/RELEASE NOTES.md All contributions are welcome: bug fixes, features, tests, and documentation. - Fork the repo and create a branch pip install -e ". dev " - Write tests alongside your changes pytest tests/ - Open a PR and tag @KaifAhmad1 for review See CONTRIBUTING.md /semantica-agi/semantica/blob/main/CONTRIBUTING.md for full guidelines.