3 ms·
This may not be a canonical application of a data model, but expressing graph queries using "Cypher", the graph query language invented by Neo4j, is very intuit
by stergios 8y ago
This may not be a canonical application of a data model, but expressing graph queries using "Cypher", the graph query language invented by Neo4j, is very intuitive to my mind. I find the use of ASCII art to help visualize the relationships welcome.
For example, say we have a graph of movies, actors, reviewers, producers, etc. Here's Cypher query that returns the names of people who reviewed movies and the actors in these movies
MATCH (r:Person)-[rev:REVIEWED]->(m:Movie)<-[:ACTED_IN]-(a:Person)
RETURN DISTINCT r.name AS Reviewer, m.title AS Title,
m.released AS Year, rev.rating AS Rating,
collect(a.name) AS Actors
Another example: You want to know what actors acted in movies in the decade starting with the year 1990
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE 1990 <= m.released <= 1999
RETURN m.released, collect(m.title) as titles, collect(p.name) as actors
ORDER BY m.released