4 ms·
Why is similar to SQL but different, wouldn't be better to add the MATCH parameter to SELECT on good old SQL? From https://en.wikipedia.org/wiki/Cypher_Query_L
by dmoreno 11y ago
Why is similar to SQL but different, wouldn't be better to add the MATCH parameter to SELECT on good old SQL?
From https://en.wikipedia.org/wiki/Cypher_Query_Language https://en.wikipedia.org/wiki/Cypher_Query_Language:
MATCH (charlie:Person { name:'Charlie Sheen' })-[:ACTED_IN]-(movie:Movie)
RETURN movie
to
SELECT movie
FROM Movie movie, Person person
WHERE person.name = 'Charlie Sheen'
MATCH person-[:ACTED_IN]->movie;
- jakewins 11y agoWhile Cypher borrows a lot of (good) ideas from SQL, the two languages are fundamentally different in their underlying model. SQL deals with Relational Algebra, while Cypher deals with Graph Theory. For that pattern to work in SQL, your SQL engine would need to be able to view its relations (tables) as a graph. I'm not smart enough to sort this out in my head, but my instinct tells me that it's better to have the two models separate, mixing them in one query seems like a recipe for confusion.
- okram 11y agoThis is an exact replica in Gremlin3: g.V().has("name","Charlie Sheen"). as("person").out("actedIn").as("movie"). select("movie") However, this can be expressed in a much simpler form as you don't need all the variables. Simply do: g.V().has("name","Charlie Sheen").out("actedIn")
- cheerfulstoic 11y agoSometimes you do need the labels, depending on what you're trying to query for. If, for example, a person could have acted in both plays and movies, sometimes you might want one or the other specifically.