• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Intro to Mutating Cypher
 

Intro to Mutating Cypher

on

  • 2,015 views

 

Statistics

Views

Total Views
2,015
Views on SlideShare
2,009
Embed Views
6

Actions

Likes
0
Downloads
32
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 Intro to Mutating Cypher Presentation Transcript

  • Cypher Query Language Chicago Graph Database Meet-Up Max De Marzi
  • What is Cypher?• Graph Query Language for Neo4j• Aims to make querying simple
  • Design Decisions Pattern matching A B C
  • Design Decisions Pattern matching
  • Design Decisions Pattern matching
  • Design Decisions Pattern matching
  • Design Decisions Pattern matching
  • Design Decisions ASCII-art patterns () --> ()
  • Design Decisions Directed relationship A B (A) --> (B)
  • Design Decisions Undirected relationship A B (A) -- (B)
  • Design Decisions specific relationships LOVES A B A -[:LOVES]-> B
  • Design Decisions Joined paths A B C A --> B --> C
  • Design Decisions multiple paths A B C A --> B --> C, A --> C A --> B --> C <-- A
  • Design Decisions Variable length paths A B A B A B ... A -[*]-> B
  • Design Decisions Optional relationships A B A -[?]-> B
  • Mutating Cypher New in Neo4j 1.8
  • Create NodesCREATE turtle1 = {name : Donatello}, turtle2 = {name : ‘Michelangelo}, Cypher turtle3 = {name : ‘Raphael}, turtle4 = {name : ‘Leonardo} The Ninja Turtles
  • 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
  • Delete NodesSTART  s = node:nodes(name = ‘Shredder’)DELETE s Cypher Shredder is defeated
  • 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
  • Delete PropertiesSTART t2 = node(2)DELETE t2.hungry Cypher Michelangelo nom nom nom
  • 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
  • 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
  • Questions?maxdemarzi.com