Skip to content

Lesson 3 Pattern Matching

Kevin Gómez edited this page Sep 3, 2020 · 15 revisions

Have a look at the Wiki pages of Gradoop - Query for further details about this operator.

LDBC Schema

Task 1 - Friendship Graph

  • 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

Task 2 - Locations

  • Find all entities that are located in Bangkok
Solution
  "MATCH ()-[:isLocatedIn]->(c:city) WHERE c.name=\"Bangkok\""

Task 3 - Construct

  • 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)"
Clone this wiki locally