Ontological modeling with schema-as-ontology. Rich edges, vector search alongside structured data, and graph traversal - all in SurrealQL.
ONTOLOGICAL MODELING
Your schema is your ontology
In SurrealDB, tables define entity types and typed relations define relationship types. Your database schema maps directly to your domain ontology. No separate modeling layer, no translation between conceptual models and physical storage.
1-- Define an ontology directly in the schema 2DEFINETABLEpersonSCHEMAFULL; 3DEFINEFIELDnameONpersonTYPEstring; 4DEFINEFIELDroleONpersonTYPEstring; 5 6DEFINETABLEknowsSCHEMAFULLTYPERELATIONFROMpersonTOperson; 7DEFINEFIELDsinceONknowsTYPEdatetime; 8DEFINEFIELDconfidenceONknowsTYPEfloat; 9DEFINEFIELDcontextONknowsTYPEstring;
RICH EDGES
Relationships as documents
Edges in SurrealDB are full documents - they carry properties, timestamps, confidence scores, and metadata. Relationships are first-class citizens, not just pointers between nodes.
1-- Create a relationship with rich metadata 2RELATEperson:jaime->knows->person:sarahSET 3since=d"2020-03-15", 4confidence=0.95, 5context="worked together at Acme Corp"; 6 7-- Traverse with filters on edge properties 8SELECT->knows[WHEREconfidence>0.9]->person.nameAStrusted_contacts 9FROMperson:jaime;
HYBRID SEARCH
Vector search alongside structured data
Store embeddings alongside their source entities. Combine vector similarity with graph traversal and structured filters in a single SurrealQL query. Semantic relevance meets structural precision.
Co-located embeddings
Vectors live alongside the entities they represent. No separate vector store, no ID mapping, no sync jobs.
Hybrid queries
Combine cosine similarity, graph traversal, full-text search, and structured filters in one statement.
Knowledge enrichment
Use vector similarity to discover connections, then materialise them as graph edges for future traversal.
SurrealDB provides native graph capabilities alongside documents, vectors, full-text search, and time-series in one engine. Neo4j is a dedicated graph database that requires separate systems for other data models. SurrealDB eliminates the need to synchronise between a graph database and other stores.
SurrealDB's schema-as-ontology approach means you define your ontology directly in SurrealQL schema definitions. Existing ontologies can be mapped to SurrealDB table and relation definitions.
GET STARTED
Build knowledge graphs with SurrealDB
Ontological modeling, rich edges, vector search alongside structured data - all in one database.