Skip to main content

Cypher

Cypher is a query language that allows you to query graph database. Like SPARQL, Cypher query language reflects the semantic nature of triples but does so with its own unique syntax and formatting. Due to this similarity, Cypher can also be thought of as a set of sentences with blanks in them. The graph database will take this query and find every set of matching statements that correctly fills in those blanks.

Examples​

  • The following query tells the database to search for all Person nodes that are connected to Movie nodes through a relationship of ACTED_IN. It further narrows the Movie nodes to only ones where the title property starts with the letter “t.” Finally, it tells the database to return all of this information as two columns: the movie.title in one (title) and all of the actor names (cast) together in a second and to order this list alphabetically by title.
MATCH (actor:Person)-[:ACTED_IN]->(movie:Movie)
WHERE movie.title STARTS WITH "T"
RETURN movie.title AS title, collect(actor.name) AS cast
ORDER BY title;

Further Resources​