Skip to content

Instantly share code, notes, and snippets.

@peterneubauer
Forked from quagly/OneNode
Last active December 21, 2015 20:49
Show Gist options
  • Save peterneubauer/6363731 to your computer and use it in GitHub Desktop.
Save peterneubauer/6363731 to your computer and use it in GitHub Desktop.
= One Node Kant
//console
query to create one node with one property
[source,cypher]
----
CREATE (n {name : 'Immanuel'})
----
//table
query to add property to node
[source,cypher]
----
START n=node(*)
WHERE n.name = 'Immanuel'
SET n.lastName = 'Kant'
RETURN n as kant
----
//table
query to add and remove property from node
[source,cypher]
----
START n=node(*)
WHERE n.name = 'Immanuel'
SET n.firstName = 'Immanuel'
REMOVE n.name
RETURN n as kant
----
//table
query to filter with AND HAS and RegEx
[source,cypher]
----
START n=node(*)
WHERE
HAS(n.firstName) // test existence
AND n.firstName = 'Immanuel' // test not Null and equal
AND n.lastName =~ '^K.*' // RegEx
AND n.firstName =~ '(?i)immANuEl' // case insensitive RegEx
AND n.lastName IN [ 'Kant', 'Kan', 'NoIKant', 'YesIKan' ] // in list
RETURN n as kant
----
//table
query to delete node
[source,cypher]
----
START n=node(*)
WHERE n.firstName = 'Immanuel'
DELETE n
----
//table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment