← Home

How Graph Databases Work

Graph databases store data as RDF triples — subject, predicate, object. SPARQL queries traverse these relationships systematically. Click "Run Query" to watch SPARQL find the great-grandfathers of people named "John" by following :hasFather edges three hops deep.

SELECT ?person ?greatgrandfather
WHERE {
  ?person :hasName "John" .
  ?person :hasFather ?father .
  ?father :hasFather ?grandfather .
  ?grandfather :hasFather ?greatgrandfather .
}
The query engine scans all triples for :hasName "John", binding each match to ?person. Then it follows :hasFather edges three times, binding each hop to a new variable. The traversal is deterministic and exact — it requires a literal match on "John", not approximate similarity.
Click "Run Query" to execute the SPARQL query
SPARQL finds great-grandfathers perfectly — but only for people named exactly "John". It won't match "Jean", "Johan", "Juan", or "Jon" unless you write separate queries for each. Graph databases have no concept of semantic similarity. If the data uses "Jonathan" instead of "John", the query returns nothing.