Class GremlinLang
java.lang.Object
org.apache.tinkerpop.gremlin.process.traversal.GremlinLang
- All Implemented Interfaces:
Serializable,Cloneable
This class helps to build a gremlin-lang compatible string representation based on a
TraversalSource
and then a Traversal.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGremlinLang(String sourceName, Object... arguments) GremlinLang(PDTRegistry pdtRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd aTraversalSourceinstruction to the GremlinLang.voidAdd aTraversalinstruction to the GremlinLang.clone()booleanReturnstrueifargAsString()encountered at least one type that could not be represented as a gremlin-lang literal.static StringconvertParametersToString(Map<String, Object> params) Converts an arbitrary parameter map to a gremlin-lang map literal string.booleanGet gremlin-lang compatible representation of TraversalgetGremlin(String g) Get gremlin-lang compatible representation of Traversal.Provides a way to get configuration of a Traversal.Get parameters used in Traversal.Serializes this instance's parameter map to a gremlin-lang map literal string.Gets thePDTRegistryused for registry-based dehydration.Returns the simple class name of the last type encountered byargAsString()that could not be represented as a gremlin-lang literal.inthashCode()booleanisEmpty()voidsetPdtRegistry(PDTRegistry pdtRegistry) Sets thePDTRegistryused for registry-based dehydration of unknown types.toString()
-
Constructor Details
-
GremlinLang
public GremlinLang() -
GremlinLang
-
GremlinLang
-
-
Method Details
-
getGremlin
Get gremlin-lang compatible representation of Traversal- Returns:
- gremlin-lang compatible String
-
getGremlin
Get gremlin-lang compatible representation of Traversal. "g" is expected for gremlin-lang. "__" can be used for an anonymousGraphTraversal.- Parameters:
g- GraphTraversalSource name- Returns:
- gremlin-lang compatible String
-
getParameters
Get parameters used in Traversal.- Returns:
- parameters Map
-
getUnsupportedType
Returns the simple class name of the last type encountered byargAsString()that could not be represented as a gremlin-lang literal. An empty string means all types were supported.- Returns:
- the simple class name of the unsupported type, or empty string if none
-
containsUnsupportedTypes
public boolean containsUnsupportedTypes()ReturnstrueifargAsString()encountered at least one type that could not be represented as a gremlin-lang literal. In remote mode, the driver should check this before sending the request.Note: this only covers types encountered while building the gremlin string. Named
GValueparameters store their inner value directly in the parameter map without type-checking viaargAsString(), so an unsupported type wrapped in a namedGValuewill not be detected by this method. Such cases are caught separately byconvertParametersToString(Map)when the parameter map is serialized. UnnamedGValueinstances (null name) recurse intoargAsString()and will set this flag.- Returns:
- true if unsupported types were encountered in the gremlin string
-
getParametersAsString
Serializes this instance's parameter map to a gremlin-lang map literal string. Keys are parameter names (identifiers), values are formatted usingargAsString().- Returns:
- a gremlin-lang map literal string, e.g.
["x":1,"y":"stephen"]or[:]for empty
-
convertParametersToString
Converts an arbitrary parameter map to a gremlin-lang map literal string. Keys must be valid identifier strings. Values are formatted as gremlin-lang literals.- Parameters:
params- the parameter map to convert- Returns:
- a gremlin-lang map literal string, e.g.
["x":1,"y":"stephen"]or[:]for empty
-
addSource
Add aTraversalSourceinstruction to the GremlinLang.- Parameters:
sourceName- the traversal source method name (e.g. withSack())arguments- the traversal source method arguments
-
addStep
Add aTraversalinstruction to the GremlinLang.- Parameters:
stepName- the traversal method name (e.g. out())arguments- the traversal method arguments
-
getOptionsStrategies
Provides a way to get configuration of a Traversal.- Returns:
- list of OptionsStrategy
-
setPdtRegistry
Sets thePDTRegistryused for registry-based dehydration of unknown types. -
getPdtRegistry
Gets thePDTRegistryused for registry-based dehydration. -
isEmpty
public boolean isEmpty() -
toString
-
equals
-
hashCode
public int hashCode() -
clone
-