Gremlin compatibility
Graph Database (GDB) supports the TinkerPop Gremlin query language. This topic describes how the GDB Gremlin implementation is compatible with TinkerPop Gremlin and where it differs.
Version compatibility
GDB Gremlin is compatible with TinkerPop Gremlin versions 3.3.x and 3.4.x.
Interaction with the GDB server uses the GraphSON format.
NoteGraphSON is the standard format for Gremlin. It uses the JSON format to represent vertices, edges, and properties.
Limits on DSL
The rules for using the domain-specific language (DSL) in GDB Gremlin differ from those in TinkerPop in the following ways:
All DSL queries must start with the built-in variable g. This variable is equivalent to
Graph.traversal()in TinkerPop.You cannot control query strategies. GDB automatically performs all query optimizations.
The IDs for vertices and edges are strings. You can specify the IDs. If you do not specify an ID, a universally unique identifier (UUID) is automatically generated for the vertex or edge.
The property graph model in GDB supports two cardinality modes: Single and Set. These modes correspond to the following in TinkerPop:
org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality.single; org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality.setGDB property values support only simple data types, such as numbers, strings, and Booleans. In Java, these data types correspond to byte, char, short, int, long, float, double, boolean, and String. Complex types, such as dates, are not supported.
Limits on Apache Groovy
GDB Gremlin does not support the following features of the Groovy language:
Groovy-style Lambda expressions and embedded function calls, such as
map.findAll{it.value>3}.Mathematical expressions, such as
1+1.System calls, such as
System.currentTimeMillis().
Support for transactions
GDB Gremlin supports transactions by default, as follows:
GDB Gremlin does not support ThreadedTransaction, which is a cross-thread transaction that you must manually start and commit. Instead, GDB Gremlin uses built-in sessionless transactions. All operations within a single DSL query are considered part of one transaction.
If a DSL query contains a mutation step, it is treated as a read-write transaction. Otherwise, it is treated as a read-only transaction.
A transaction is automatically started when a DSL query begins. The transaction is automatically committed or rolled back based on the execution result when the query ends.
The transaction isolation level is READ-COMMITTED.
The data is imported to GDB by row. Each row represents a single transaction. Transactions or rows are independent of each other.
Support for TinkerPop Gremlin Step interfaces
The main unsupported interfaces are in the following categories:
It utilizes the OLAP interface of the GraphComputer class.
Explain and Profiling interfaces.
Other auxiliary interfaces that are not used for creating, retrieving, updating, or deleting data.
In the table below,
indicates supported, and
indicates not supported.
Step interface | Supported | Remarks |
|---|---|---|
|
| Does not support |
|
| - |
|
| Does not support |
|
| Does not support |
|
| Does not support |
|
| - |
|
| - |
|
| Does not support |
|
| Does not support |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| Only |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
Features supported by GDB Gremlin
The feature information in the following table is the same as the content that is returned by the Graph.features() call in TinkerPop.
Category | Feature | Supported |
|---|---|---|
Graph | ThreadedTransactions |
|
Computer |
| |
Transactions |
| |
Persistence |
| |
ConcurrentAccess |
| |
Variable | SerializableValues |
|
UniformListValues |
| |
BooleanArrayValues |
| |
DoubleArrayValues |
| |
IntegerArrayValues |
| |
StringArrayValues |
| |
MapValues |
| |
MixedListValues |
| |
ByteArrayValues |
| |
FloatArrayValues |
| |
LongArrayValues |
| |
Variables |
| |
BooleanValues |
| |
ByteValues |
| |
DoubleValues |
| |
FloatValues |
| |
IntegerValues |
| |
LongValues |
| |
StringValues |
| |
Vertex | MetaProperties |
|
DuplicateMultiProperties |
| |
MultiProperties |
| |
NumericIds |
| |
UuidIds |
| |
CustomIds |
| |
AnyIds |
| |
AddVertices |
| |
RemoveVertices |
| |
UserSuppliedIds |
| |
AddProperty |
| |
RemoveProperty |
| |
StringIds |
| |
Vertex Property | UserSuppliedIds |
|
NumericIds |
| |
UuidIds |
| |
CustomIds |
| |
AnyIds |
| |
SerializableValues |
| |
UniformListValues |
| |
BooleanArrayValues |
| |
DoubleArrayValues |
| |
IntegerArrayValues |
| |
StringArrayValues |
| |
MapValues |
| |
MixedListValues |
| |
ByteArrayValues |
| |
FloatArrayValues |
| |
LongArrayValues |
| |
AddProperty |
| |
RemoveProperty |
| |
StringIds |
| |
Properties |
| |
BooleanValues |
| |
ByteValues |
| |
DoubleValues |
| |
FloatValues |
| |
IntegerValues |
| |
LongValues |
| |
StringValues |
| |
Edge | NumericIds |
|
UuidIds |
| |
CustomIds |
| |
AnyIds |
| |
AddEdges |
| |
RemoveEdges |
| |
UserSuppliedIds |
| |
AddProperty |
| |
RemoveProperty |
| |
StringIds |
| |
Edge Property | SerializableValues |
|
UniformListValues |
| |
BooleanArrayValues |
| |
DoubleArrayValues |
| |
IntegerArrayValues |
| |
StringArrayValues |
| |
MapValues |
| |
MixedListValues |
| |
ByteArrayValues |
| |
FloatArrayValues |
| |
LongArrayValues |
| |
Properties |
| |
BooleanValues |
| |
ByteValues |
| |
DoubleValues |
| |
FloatValues |
| |
IntegerValues |
| |
LongValues |
| |
StringValues |
|