Search Tutorials


Neo4j Tutorials - Understanding Neo4j Cypher Language | JavaInUse

Neo4j Cypher Language



Neo4j query language is known as Cypher. Cypher language has syntax similar to SQL. Using Cypher language, users can perform CRUD operations on Neo4j database.

Neo4j - Table Of Contents

Need for Neo4j Install Neo4j Neo4j Cypher
Let us try understand the Cypher language syntax.
neo-4_1
This creates a new node with label emp1, property name and value employee.
Labels are used to name / categorize / classify / type nodes and relationships in a graph which does not represent entities of a single kind.
Here emp is the identifier. Identifier acts as a temporary variable and is not stored in neo4j database. It is optional, and usually used only when a reference of the node is required to perform some operation. in the above example we are performing the operation of retrieving a node and displaying it, so we used an identifier. If we want to only create a node, then we may not need to use the identifier like we do in the next example.
neo-4_2
This creates a new node with label org1, property name and value organization . Here employer is the identifier.
neo-4_3
This cypher query retrieves the previously created nodes emp1 and org1 using the MATCH keyword. Note that we have used different identifiers than before.
Next we create a relationship between the retrieved nodes.