Build a knowledge graph from scratch using Neumann's graph engine. By the end, you will have nodes representing people and topics, edges showing relationships, and queries that traverse the graph.
- Neumann installed (Installation)
- A running Neumann shell
neumann --wal-dir ./knowledge-graph-dataYou should see the neumann> prompt.
Create nodes for people and topics:
NODE CREATE person { name: 'Alice', role: 'engineer' }
NODE CREATE person { name: 'Bob', role: 'designer' }
NODE CREATE person { name: 'Carol', role: 'manager' }
NODE CREATE topic { name: 'machine-learning' }
NODE CREATE topic { name: 'user-experience' }
NODE CREATE topic { name: 'project-planning' }Verify the nodes exist:
NODE LISTYou should see 6 nodes with their auto-assigned IDs.
Connect people to their expertise topics:
EDGE CREATE 'node:1' -> 'node:4' : expert_in
EDGE CREATE 'node:1' -> 'node:5' : interested_in
EDGE CREATE 'node:2' -> 'node:5' : expert_in
EDGE CREATE 'node:3' -> 'node:6' : expert_in
EDGE CREATE 'node:3' -> 'node:4' : interested_inConnect people to each other:
EDGE CREATE 'node:1' -> 'node:2' : collaborates_with
EDGE CREATE 'node:2' -> 'node:3' : reports_to
EDGE CREATE 'node:1' -> 'node:3' : reports_toFind all of Alice's connections:
TRAVERSE FROM 'node:1' DEPTH 1 DIRECTION OUTGOINGFind the shortest path between Alice and a topic:
PATH FROM 'node:1' TO 'node:6'Find who is connected to machine-learning:
TRAVERSE FROM 'node:4' DEPTH 1 DIRECTION INCOMINGUpdate a node with additional properties:
NODE UPDATE 'node:1' SET experience_years = 5Create a table to store project metadata alongside the graph:
CREATE TABLE projects (
id INT PRIMARY KEY,
name TEXT NOT NULL,
status TEXT,
lead_node TEXT
);
INSERT INTO projects VALUES (1, 'ML Pipeline', 'active', 'node:1');
INSERT INTO projects VALUES (2, 'Design System', 'active', 'node:2');Now you can query both relational and graph data:
SELECT * FROM projects WHERE status = 'active';
TRAVERSE FROM 'node:1' DEPTH 2 DIRECTION OUTGOINGYou should see:
- 6 nodes (3 people, 3 topics)
- 8 edges (5 expertise, 3 collaboration)
- 2 projects in the relational table
- Traversal results showing connected nodes and edges
- Graph Traversals -- advanced traversal patterns
- Vector Search with Filtering -- add embeddings to your knowledge graph
- Use Cases -- more application patterns