JanusGraph uses Gremlin graph query language to retrieve data from and modify data in the graph. Gremlin is a functional language whereby traversal operators are chained together to form path-like expressions, expressing query or data modification on graphs.
A Gremlin query is a chain of operations/functions that are evaluated from left to right. A simple example of gremlin language to query the name of Alex's grandson on his genealogy graph is provided below
g.V().has('name', 'Alex').out('father').out('father').values('name')
The query can be read as
g : for the current graph
V : for the vertices in the graph
has('name', 'Alex') : filters the vertices down to those with the "name" property "Alex"
out('father') : traverse outgoing through edges whose type is "father" from "Alex" (Notice here the result can be more than one vertices)
out('father') : traverse outgoing through edges whose type is "father" from "Alex"' son (the result from the last traversal)
values('name') : get the property of "name"
Other more complex examples of Gremlin can be found in
Complete Gremlin Manual
There're two ways to query JanusGraph with Gremlin
First one is to use Gremlin Console, Gremlin Console is an interactive shell that is distributed with JanusGraph, by connecting Gremlin Console to JanusGraph Server, users can directly interact with graphs stored in JanusGraph Server using Gremlin.
The second one is to embed Gremlin code into your Java Application
Applications can interact with JanusGraph in two different ways using Gremlin query language.
Embed JanusGraph inside the application executing Gremlin queries directly against the graph within the same JVM. Query execution, JanusGraph’s caches, and transaction handling all happen in the same JVM as the application while data retrieval from the storage backend may be local or remote.
Interact with a local or remote JanusGraph instance by submitting Gremlin queries to the server. JanusGraph natively supports the Gremlin Server component of the Apache TinkerPop stack.
The more detailed explanation for the two interaction models between application and JanusGraph can be found on the System Architecture section.
https://github.com/JanusGraph/janusgraph/
https://docs.janusgraph.org/latest/
The Linux Foundation
2012
Titan
DataStax