Last active
December 20, 2015 08:09
-
-
Save quagly/6098943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= graphGist generated from spock test Neo4jCypherOneNode.groovy | |
graphGist asciiDoc file for use at http://gist.neo4j.org/ [GitHub Gist] | |
Generated on Sun Jul 28 08:03:44 PDT 2013 | |
//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
Updated to new Cypher syntax, see https://gist.github.com/peterneubauer/6363731