Facebook Graph Search has given the Graph Database community a simpler way to explain what it is we do and why it matters. I wanted to drive the point home by building a proof of concept of how you could do this with Neo4j.
34. My friends who like cheese
START me=node:Users(name=‘Max’)
thing=node:Things(name=‘Cheese’)
MATCH me -[:friends]-> people -[:like]-> thing
RETURN people
Tuesday, June 18, 13
36. My friends who like cheese
START me=node:Users(name=‘Max’)
thing=node:Things(name=‘Cheese’)
MATCH me -[:friends]-> people,
people -[:like]-> thing
RETURN people
Tuesday, June 18, 13
38. My friends who like ?
START me=node({me}),
thing=node:Things({thing})
MATCH me -[:friends]-> people,
people -[:like]-> thing
RETURN people
Params :{“me”: 1, “thing”: “name: cheese”}
Tuesday, June 18, 13
40. My friends who like ? and ?
START me=node({me}),
thing1=node:Things({thing1}),
thing2=node:Things({thing2})
MATCH me -[:friends]-> people,
people -[:like]-> thing1,
people -[:like]-> thing2
RETURN people
Params :{“me”: 1, “thing1”: “name: cheese”,
“thing2”: “name: wine”}
Tuesday, June 18, 13
42. People who like ? and ?
START thing1=node:Things({thing1}),
thing2=node:Things({thing2})
MATCH people -[:like]-> thing1,
people -[:like]-> thing2
RETURN people
Params :{“thing1”: “name: cheese”,
“thing2”: “name: wine”}
Tuesday, June 18, 13
43. I need to build a
Cypher Query
Tuesday, June 18, 13
44. SEMR
✦ Gateway drug to NLP
✦ 4 years old
✦ Didn’t work on my Mac
✦ Pointed me to Treetop
Tuesday, June 18, 13
45. Treetop
✦ Create a Grammar by
making some Rules
✦ Turn expression into
Syntax Tree
✦ Build custom Syntax Nodes
✦ Prune the tree
✦ to_cypher
Tuesday, June 18, 13