Getting started with cypher

Download cypher eBook

Remarks

Cypher is a declarative graph query language that allows for expressive and efficient querying and updating of a property graph.

Cypher was originally created by Neo Technology for its graph database Neo4j, but was opened up through the openCypher project in October 2015 and has since been adopted by several other graph database vendors, including SAP HANA and AgensGraph.

Versions

VersionRelease
3.22017-05-11
3.12016-12-13
3.02016-04-26
2.32015-10-21

Keyword Guide

Read Keywords

KeyWordFunctionExample
MATCHFind following expression in graphMATCH (n)

Write Keywords

KeyWordFunctionExample
CREATECreate the following patternCREATE (n:Person{name:"Bob"})
DELETEDelete the following nodes/relationshipsDELETE n
DETACH DELETEDelete the following nodes, and any attached relationshipsDETACH DELETE n

Read-Write Keywords

KeyWordFunctionExample
MergeMatch following pattern, or create itMerge (n:Person{id:1337})

Filter Keywords

KeyWordFunctionExample
LimitLimit result rows to the following number. Combine with Skip to page resultsLimit 25
SkipSkip first n result rows. Combine with Limit to page resultsSkip 25
WHEREFilter results by following expressionWHERE n.age > 21
AND/ORAnd/Or multiple expressionsWHERE n.age > 21 AND n.age < 30
NOTNegate following expressionWHERE NOT n.age > 21
ANY/ALL/NONE/SINGLEFilter based on collectionWHERE ALL (p in people

Remember to check the Refcard for your version of Cypher, as these may have changed.

Stats

13 Contributors: 2
Friday, June 9, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook