This document discusses using graph databases like Neo4j to solve problems that are difficult for relational databases. It provides examples of how graph databases are used in applications like social networks, fraud detection, and recommendations. It also describes how Neo4j works, including its data model of nodes and relationships, and query language Cypher. Finally, it mentions the neo4j_connector module that allows Drupal sites to integrate with Neo4j for more complex queries and relationships between content.
42. • MATCH (n)-[r]->(m)
• MATCH (n:USER)-[:EAT]->(m:FOOD)
• MATCH p = (n)--(m)
• MATCH (n{name:’Jim’})-[r]->(m)
• MATCH (o)-->(n)<-[*1..3]-(m)
• MATCH [:TRAVEL{by:”bus”}]->(n)
47. I want a good party this Friday.
Show me my foaf who has at least 20 close
friends - so I can avoid awkward parties.
And they don’t know my ex.
48. START n=node(12)
MATCH
p = (n)-[:FRIEND*]->(m),
(m)<-[:FRIEND*1..2]-(o)
WHERE
any(p IN collect(o) WHERE p.name != ‘Liz’)
WITH count(o) AS total
WHERE total >= 20
RETURN m.name, p, total, collect(o)