[prev] 132 [next]

Example Graph Queries (cont)

Example: Given names of people with a sibling called "Tom"

SPARQL:

PREFIX p: <http://www.people.org/>
SELECT ?N
WHERE { ?X p:type p:Person . ?X p:given ?N .
        ?X p:sibling ?Y . ?Y p:given "Tom"  }

Cypher:

MATCH (person:Person)-[:sibling]-(tom:Person)
WHERE tom.given="Tom"
RETURN person.given