Database Reference
In-Depth Information
The previous snippet iterates through Cypher query results row by row. Another option is
to iterate through the results by a single column, which is useful if you're not interested in
all columns returned, as the following code illustrates:
Cypher and Scala
Although the core Neo4j graph engine is implemented in Java, the Neo4j Cypher engine is
implemented in Scala, the popular, hybrid, functional programming language that runs on
the Java virtual machine (JVM). For more information on Scala, see www.scala-lang.org/ .
Alternatives to Cypher
Cypher isn't the only query language available for graphs. Another popular graph query
languageisGremlin,whichNeo4jalsosupports.Gremlinisactually asetofinterfaces that
define how the graph can be traversed and manipulated, and these interfaces must be im-
plemented by every graph engine that wishes to be compatible. That means you can the-
oretically use the same Gremlin queries to work with data in any compatible graph data-
base, making your code portable. Gremlin is an open source library and part of the popular
Tinkerpop stack of graph libraries ( https://github.com/tinkerpop/gremlin ) .
The main difference between Cypher and Gremlin is in their nature—Gremlin is an im-
perative language where users describe how to traverse the graph, Cypher is a declarative
language that uses pattern matching to describe what parts of the graph data are required.
This makes Cypher easier to read and understand. Gremlin is portable between different
graph databases, but Cypher is developed by the Neo4j team and works only on Neo4j
graph databases.
The Gremlin syntax and use are beyond the scope of this topic, but you can find out more
at https://github.com/tinkerpop/gremlin .
Search WWH ::




Custom Search