-
Notifications
You must be signed in to change notification settings - Fork 0
Lesson 3 Pattern Matching
Christopher Rost edited this page Sep 4, 2020
·
15 revisions
Have a look at the Wiki pages of Gradoop - Query for further details about this operator.
All labels start with a lowercase letter in our dataset, so please use 'person' instead of 'Person' in your tasks.
- Find all persons that know "John Jones".
Solution
"MATCH (p1:person)-[:knows]->(p2:person) WHERE p2.firstName=\"John\" AND p2.lastName=\"Jones\""
How many persons know him? Answer: 2
- Find all entities that are located in Bangkok
Solution
"MATCH ()-[:isLocatedIn]->(c:city) WHERE c.name=\"Bangkok\""
- Find all Persons that are creators of Posts located in "Senegal"
- Posts should not be in the result set (use construct pattern)
- See the documentation about construct pattern here
Solution
"MATCH (p:person)<-[:hasCreator]-(:post)-[:isLocatedIn]->(co:country) WHERE co.name=\"Senegal\"",
"(p)-[e_new:isLocatedIn]->(co)"