Intro to Mutating Cypher
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Intro to Mutating Cypher

on

  • 2,169 views

 

Statistics

Views

Total Views
2,169
Views on SlideShare
2,163
Embed Views
6

Actions

Likes
0
Downloads
33
Comments
0

2 Embeds 6

http://coderwall.com 4
http://www.twylah.com 2

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • There existed a number of different ways to query a graph database. This one aims to make querying easy, and to produce queries that are readable. We looked at alternatives - SPARQL, SQL, Gremlin and other...

Intro to Mutating Cypher Presentation Transcript

  • 1. Cypher Query Language Chicago Graph Database Meet-Up Max De Marzi
  • 2. What is Cypher?• Graph Query Language for Neo4j• Aims to make querying simple
  • 3. Design Decisions Pattern matching A B C
  • 4. Design Decisions Pattern matching
  • 5. Design Decisions Pattern matching
  • 6. Design Decisions Pattern matching
  • 7. Design Decisions Pattern matching
  • 8. Design Decisions ASCII-art patterns () --> ()
  • 9. Design Decisions Directed relationship A B (A) --> (B)
  • 10. Design Decisions Undirected relationship A B (A) -- (B)
  • 11. Design Decisions specific relationships LOVES A B A -[:LOVES]-> B
  • 12. Design Decisions Joined paths A B C A --> B --> C
  • 13. Design Decisions multiple paths A B C A --> B --> C, A --> C A --> B --> C <-- A
  • 14. Design Decisions Variable length paths A B A B A B ... A -[*]-> B
  • 15. Design Decisions Optional relationships A B A -[?]-> B
  • 16. Mutating Cypher New in Neo4j 1.8
  • 17. Create NodesCREATE turtle1 = {name : Donatello}, turtle2 = {name : ‘Michelangelo}, Cypher turtle3 = {name : ‘Raphael}, turtle4 = {name : ‘Leonardo} The Ninja Turtles
  • 18. Create RelationshipsSTART t1 = node(1), t2 = node(2), t3 = node(3), t4 = node(4)CREATE s = {name: ‘Splinter’ }, t1-[r:DISCIPLE]->s, Cypher t2-[r:DISCIPLE]->s, t3-[r:DISCIPLE]->s, t4-[r:DISCIPLE]->s The Ninja Turtles are disciples of Splinter
  • 19. Delete NodesSTART  s = node:nodes(name = ‘Shredder’)DELETE s Cypher Shredder is defeated
  • 20. Update PropertiesSTART t1 = node(0), t2 = node(2)SET t1.weapon = ‘Bo Staff’, t2.hungry = ‘Yes’ Cypher Donatello uses the Bo Staff Michelangelo is always hungry
  • 21. Delete PropertiesSTART t2 = node(2)DELETE t2.hungry Cypher Michelangelo nom nom nom
  • 22. Using RelateSTART turtles = node(1,2,3,4)RELATE turtles-[r:LOVE]->pizza Cypher The Ninja Turtles love pizza A pizza node and 4 relationships are created
  • 23. Using Relate againSTART turtles = node(1,2,3,4)RELATE turtles-[r:LOVE]-(pizza Cypher{name:’Supreme’}) The Ninja Turtles love pizza A pizza node with name “Supreme” and 4 relationships are created
  • 24. Questions?maxdemarzi.com