Cypher Data Model

The Cypher language interacts with data organized in a graph structure, unlike tabular or document-based models. This graph-based model in Cypher consists of Nodes, Relationships, Properties, Labels, and Paths. Understanding these elements is fundamental to working with Cypher in Polypheny.


Nodes are the primary entities in the graph. They are the “things” or objects that data is stored about. For example, in a social network, each person could be represented by a node. Nodes are usually represented in Cypher syntax as follows:



Relationships connect nodes and represent how they are associated with each other. For instance, in a social network, a ‘FRIEND_OF’ relationship might exist between two person nodes. Relationships are always directional and always have a start node and an end node. However, you can ignore the direction if it’s not relevant to your query. In Cypher, a relationship is represented as:



Both nodes and relationships can have properties. Properties are named values that add details or attributes to nodes and relationships. For example, a ‘Person’ node might have ‘name’ and ‘age’ properties. A ‘FRIEND_OF’ relationship might have a ‘since’ property indicating when the friendship started. In Cypher, properties are contained within curly brackets {}:

(person:Person {name: 'John', age: 30})


Labels are used to categorize nodes into different groups. A node can have zero or more labels. For instance, a ‘Person’ label might be applied to all nodes representing people. Labels can also be used to create indexes and constraints. Labels are prefixed by a colon ::



Paths are sequences of nodes and relationships. Paths can be of any length and are particularly useful when making complex queries. For example, you might want to find a path of ‘FRIEND_OF’ relationships leading from one person to another. In Cypher, a path can be represented as follows:


In the above, the * indicates that any number of the ‘relationship’ can exist between the startNode and endNode.

Understanding these five key aspects of the Cypher data model is crucial to working with Cypher queries effectively. They form the building blocks for modeling and querying your data in a graph database in Polypheny using the Cypher language.

© Polypheny GmbH. All Rights Reserved.