---
title: "Knowledge Graphs | Use Cases | SurrealDB"
description: "Ontological modelling with schema-as-ontology. Rich edges, vector search alongside structured data, and graph traversal in SurrealQL."
url: https://surrealdb.com/use-cases/knowledge-graphs
---

# Knowledge graphs, natively

Ontological modelling with schema-as-ontology. Rich edges, vector search alongside structured data, and graph traversal - all in SurrealQL.

[Start free with SurrealDB](https://studio.surrealdb.com/current/instances/deploy) [View documentation](https://surrealdb.com/docs/what-is-surrealdb)

1. ![Babcock](https://surrealdb.com/assets/static/babcock.lo4rnVg1.svg)
2. ![ING](https://surrealdb.com/assets/static/ing.X3I6S3_V.svg)
3. ![British Airways](https://surrealdb.com/assets/static/british-airways.KEsZiwV-.svg)
4. ![Nvidia](https://surrealdb.com/assets/static/nvidia.DaIEuMil.svg)
5. ![Apple](https://surrealdb.com/assets/static/apple.D5pq4flY.svg)
6. ![SpaceX](https://surrealdb.com/assets/static/spacex.CQJEk-IL.svg)
7. ![Samsung](https://surrealdb.com/assets/static/samsung.CH-vQgnb.svg)
8. ![adidas](https://surrealdb.com/assets/static/adidas.DdTC5qhk.svg)
9. ![Tencent](https://surrealdb.com/assets/static/tencent.paQmLxyy.svg)
10. ![Alibaba](https://surrealdb.com/assets/static/alibaba.B16idgfM.svg)
11. ![PolyAI](https://surrealdb.com/assets/static/poly-ai.c3w_fAg6.svg)
12. ![Later](https://surrealdb.com/assets/static/later.Ds736jFO.svg)
13. ![Verizon](https://surrealdb.com/assets/static/verizon.BI7CajdX.svg)
14. ![Liberty Mutual](https://surrealdb.com/assets/static/liberty-mutual.B7qOU1pd.svg)
15. ![Walmart](https://surrealdb.com/assets/static/walmart.BjDg_Sr8.svg)
16. ![Carrier](https://surrealdb.com/assets/static/carrier.D21gC6NX.svg)
17. ![Saks Fifth Avenue](https://surrealdb.com/assets/static/saks-fifth-avenue.COIDpLSb.svg)
18. ![San Francisco Compute Company](https://surrealdb.com/assets/static/sfcc.B7jlImq4.svg)
19. ![Shield AI](https://surrealdb.com/assets/static/shield-ai.pINZ0KJr.svg)
20. ![Wix](https://surrealdb.com/assets/static/wix.DvHhmoBi.svg)

ONTOLOGICAL MODELLING

## 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 modelling layer, no translation between conceptual models and physical storage.

```
1-- Define an ontology directly in the schema2DEFINE TABLE person SCHEMAFULL;3DEFINE FIELD name ON person TYPE string;4DEFINE FIELD role ON person TYPE string;56DEFINE TABLE knows SCHEMAFULL TYPE RELATION FROM person TO person;7DEFINE FIELD since ON knows TYPE datetime;8DEFINE FIELD confidence ON knows TYPE float;9DEFINE FIELD context ON knows TYPE string;
```

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 metadata2RELATE person:jaime->knows->person:sarah SET3	since = d"2020-03-15",4	confidence = 0.95,5	context = "worked together at Acme Corp";67-- Traverse with filters on edge properties8SELECT ->knows[WHERE confidence > 0.9]->person.name AS trusted_contacts9FROM person: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.

OPERATIONAL KNOWLEDGE GRAPHS

## Digital twins as living knowledge graphs

When a knowledge graph models a physical or operational system, it becomes a digital twin: assets and dependencies as nodes and edges, configuration and documents as attributes, telemetry as time-indexed values, and embeddings for semantic recall over unstructured context. SurrealDB lets all of these coexist in one transactional engine, so the same ontology powers both the static knowledge graph and the live twin reading from it. Learn more about [digital twins](https://surrealdb.com/use-cases/digital-twins).

FREQUENTLY ASKED QUESTIONS

## Knowledge graphs

How does SurrealDB compare to Neo4j for knowledge graphs?

Can I import existing ontologies?

GET STARTED

## Build knowledge graphs with SurrealDB

Ontological modelling, rich edges, vector search alongside structured data - all in one database.

![Samsung](https://surrealdb.com/assets/static/4c58b81e7b3c9466.C_Hv0eml.svg)![NVIDIA](https://surrealdb.com/assets/static/nvidia.DaIEuMil.svg)![Apple](https://surrealdb.com/assets/static/f7dc2519e0d212bc.Cn8MYAK7.svg)![Verizon](https://surrealdb.com/assets/static/18b99996c689000f.B5PQ-nI9.svg)![Tencent](https://surrealdb.com/assets/static/401d8346058682c8.DqM87mst.svg)

SOC 2 Type 2

GDPR

Cyber Essentials Plus

ISO 27001

[Start free with SurrealDB](https://studio.surrealdb.com/current/instances/deploy) [View documentation](https://surrealdb.com/docs/what-is-surrealdb)

```json
{"@context":"https://schema.org","@type":"Organization","name":"SurrealDB","url":"https://surrealdb.com","logo":"https://surrealdb.com/assets/static/logo.BG7_TG2b.svg","description":"SurrealDB is the unified data layer for AI. A multi-model database for documents, graphs, vectors, and time-series.","foundingDate":"2022","hasCertification":[{"@type":"Certification","name":"SOC 2 Type 2"},{"@type":"Certification","name":"GDPR"},{"@type":"Certification","name":"Cyber Essentials Plus"},{"@type":"Certification","name":"ISO 27001"}],"owns":[{"@type":"SoftwareApplication","name":"SurrealDB","url":"https://surrealdb.com/surrealdb"},{"@type":"SoftwareApplication","name":"Agent Memory","url":"https://surrealdb.com/agent-memory"}],"knowsAbout":["multi-model databases","document databases","graph databases","vector search","time-series databases","SurrealQL","Agent Memory","real-time databases","embedded databases","context layer","graph ontology","distributed database","knowledge graphs","distributed transaction protocols","highly-scalable databases"],"sameAs":["https://www.wikidata.org/wiki/Q124316308","https://github.com/surrealdb/surrealdb","https://twitter.com/surrealdb","https://www.youtube.com/@surrealdb","https://www.linkedin.com/company/surrealdb","https://discord.gg/surrealdb","https://www.reddit.com/r/surrealdb","https://www.instagram.com/surrealdb","https://medium.com/surrealdb","https://dev.to/surrealdb"]}
```

```json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://surrealdb.com"},{"@type":"ListItem","position":2,"name":"Knowledge graphs","item":"https://surrealdb.com/use-cases/knowledge-graphs"}]}
```

```json
{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"How does SurrealDB compare to Neo4j for knowledge graphs?","acceptedAnswer":{"@type":"Answer","text":"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."}},{"@type":"Question","name":"Can I import existing ontologies?","acceptedAnswer":{"@type":"Answer","text":"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."}}]}
```
