How it looks
Given triples such asuser:ethan schema:worksAt org:wazoo, query for all
employees:
SPARQL vs. vector search
| Dimension | SPARQL | Vector search |
|---|---|---|
| Precision | Exact, deterministic | Approximate, probabilistic |
| Best for | Structured relationships | Semantic similarity |
| Output | Verified facts | Ranked candidates |
Limits of stateless RAG
In traditional RAG, you chunk and embed text for retrieval based on semantic similarity. This works for static information but fails to capture relationship dynamics or state changes.The evolving fact
- Monday: “I am working on Project Apollo.”
- Wednesday: “I am pausing Apollo to focus on Project Hermes.”
- Friday: “What am I working on?”
Stateful memory
Worlds maintains a living knowledge graph. Instead of storing raw text, it extracts meaning as triples, namely subject → predicate → object. When facts change, Worlds updates specific graph relationships. This resolves contradictions at the data layer rather than relying on LLM reasoning.RAG vs Worlds

| Feature | Traditional RAG | Worlds |
|---|---|---|
| Search | Semantic similarity | Hybrid, combining semantic and relational |
| State | Stateless | Stateful, resolving contradictions |
| Inference | Hallucination-prone | Deterministic reasoning |
| Structure | Unstructured chunks | Knowledge primitives, namely items and triples |
Implementing graph RAG
To implement graph RAG with Worlds, follow the ingestion pipeline to transform your unstructured data into a queryable graph. Ontology RAG uses rigid, predefined schemas to guide agentic reasoning and data retrieval. This ensures your agents operate within a well-defined conceptual boundary.Grounding agents in ontologies
By usingdiscover-schema, your agent can retrieve the available classes and
properties of a world before attempting to query it.
- Discovery: Agent retrieves the world’s ontology.
- Mapping: Agent maps the user’s natural language request to specific RDF classes and predicates.
- Querying: Agent executes precise SPARQL queries instead of depending solely on vector similarity.
Why use ontology RAG?
Deep learning feeds unstructured data into neural networks, hoping models infer ground truth. By contrast, neuro-symbolic AI in Worlds explicitly grounds language models in semantic structures. Steering models into a predefined ontology provides the strict context needed to map semantic intent to logical execution.- Complex logic: If user A is the parent of B, and B is the parent of C, vector search cannot reliably infer A is the grandparent of C based on text similarity. SPARQL and a defined ontology deterministically execute the precise logic to traverse the graph and return the grandparent.
- Zero hallucination: Agents only use terms that actually exist in the world’s schema.
- Deterministic reliability: Ensure the agent’s mental model strictly matches the actual data structure.
Architecture
While agents interact with Worlds abstractly, the platform manages the underlying RDF data through a pipeline.RDF blob handling
The system manages RDF data through several core utilities:- N3 utility: Provides functions to convert between RDF blobs, such as N-Quads strings, and in-memory N3 stores.
- SPARQL utility: Executes SPARQL queries using the Comunica engine over an
N3 store.
Comunica is an open-source SPARQL query engine built for the web. It handles large RDF data sources efficiently.
RDF patching
Centralized in the core patch service, the system processes mutations for the world database:- Deterministic identification: Skolemizes and hashes each quad to a unique triple ID.
- Relational storage: Upserts the resulting triples into
the
triplestable. - Semantic indexing: Chunks and embeds literal values for hybrid search.
- Triggers: SQL triggers synchronize
rdf:typerelations to theentity_typestable.
SPARQL execution pipeline
When you execute a SPARQL query via the API, the system follows this pipeline:- Loads the world metadata from the main database.
- Resolves the world-specific database client via
databaseManager.get(worldId). - Executes
handlePatchwith a handler that applies updates to the world client.The specific world ID to target for the patch context.The array of RDF Quads representing the changes to be applied. - Executes the SPARQL query over the resulting RDF blob.
- Updates the world metadata in the main database if the blob changed during a SPARQL update.