Class GremlinAntlrToJava
- java.lang.Object
-
- org.antlr.v4.runtime.tree.AbstractParseTreeVisitor<T>
-
- org.apache.tinkerpop.gremlin.language.grammar.DefaultGremlinBaseVisitor<Object>
-
- org.apache.tinkerpop.gremlin.language.grammar.GremlinAntlrToJava
-
- All Implemented Interfaces:
org.antlr.v4.runtime.tree.ParseTreeVisitor<Object>
,GremlinVisitor<Object>
- Direct Known Subclasses:
NoOpTerminalVisitor
public class GremlinAntlrToJava extends DefaultGremlinBaseVisitor<Object>
This is the entry point for converting the Gremlin Antlr grammar into Java. It is bound to aGraph
instance as that instance may spawn specificTraversal
orTraversalSource
types. A new instance should be created for each parse execution.
-
-
Constructor Summary
Constructors Modifier Constructor Description GremlinAntlrToJava()
Constructs a new instance and is bound to anEmptyGraph
.protected
GremlinAntlrToJava(String traversalSourceName, Graph graph, Supplier<GraphTraversal<?,?>> createAnonymous)
protected
GremlinAntlrToJava(String traversalSourceName, Graph graph, Supplier<GraphTraversal<?,?>> createAnonymous, GraphTraversalSource g)
GremlinAntlrToJava(GraphTraversalSource g)
Constructs a new instance that is bound to the specifiedGraphTraversalSource
and thus spawns theTraversal
from this "g" rather than from a fresh one constructed from theGraph
instance.protected
GremlinAntlrToJava(GraphTraversalSource g, Supplier<GraphTraversal<?,?>> createAnonymous)
Constructs a new instance that is bound to the specifiedGraphTraversalSource
and thus spawns theTraversal
from this "g" rather than from a fresh one constructed from theGraph
instance.GremlinAntlrToJava(Graph graph)
Constructs a new instance that is bound to the specifiedGraph
instance.protected
GremlinAntlrToJava(Graph graph, Supplier<GraphTraversal<?,?>> createAnonymous)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
aggregateResult(Object result, Object nextResult)
Override the aggregate result behavior.Object
visitQuery(GremlinParser.QueryContext ctx)
Visit a parse tree produced byGremlinParser.query()
.Object
visitQueryList(GremlinParser.QueryListContext ctx)
Visit a parse tree produced byGremlinParser.queryList()
.-
Methods inherited from class org.apache.tinkerpop.gremlin.language.grammar.DefaultGremlinBaseVisitor
notImplemented, visitBooleanLiteral, visitChainedParentOfGraphTraversal, visitChainedTraversal, visitConnectedComponentConstants, visitConnectedComponentStringConstant, visitDateLiteral, visitEmptyQuery, visitFloatLiteral, visitGenericLiteral, visitGenericLiteralCollection, visitGenericLiteralExpr, visitGenericLiteralList, visitGenericLiteralMap, visitGenericLiteralRange, visitGremlinStringConstants, visitGremlinStringConstants_connectedComponentStringConstants_component, visitGremlinStringConstants_connectedComponentStringConstants_edges, visitGremlinStringConstants_connectedComponentStringConstants_propertyName, visitGremlinStringConstants_ioOptionsStringConstants_graphml, visitGremlinStringConstants_ioOptionsStringConstants_graphson, visitGremlinStringConstants_ioOptionsStringConstants_gryo, visitGremlinStringConstants_ioOptionsStringConstants_reader, visitGremlinStringConstants_ioOptionsStringConstants_writer, visitGremlinStringConstants_pageRankStringConstants_edges, visitGremlinStringConstants_pageRankStringConstants_propertyName, visitGremlinStringConstants_pageRankStringConstants_times, visitGremlinStringConstants_peerPressureStringConstants_edges, visitGremlinStringConstants_peerPressureStringConstants_propertyName, visitGremlinStringConstants_peerPressureStringConstants_times, visitGremlinStringConstants_shortestPathStringConstants_distance, visitGremlinStringConstants_shortestPathStringConstants_edges, visitGremlinStringConstants_shortestPathStringConstants_includeEdges, visitGremlinStringConstants_shortestPathStringConstants_maxDistance, visitGremlinStringConstants_shortestPathStringConstants_target, visitGremlinStringConstants_withOptionsStringConstants_all, visitGremlinStringConstants_withOptionsStringConstants_ids, visitGremlinStringConstants_withOptionsStringConstants_indexer, visitGremlinStringConstants_withOptionsStringConstants_keys, visitGremlinStringConstants_withOptionsStringConstants_labels, visitGremlinStringConstants_withOptionsStringConstants_list, visitGremlinStringConstants_withOptionsStringConstants_map, visitGremlinStringConstants_withOptionsStringConstants_none, visitGremlinStringConstants_withOptionsStringConstants_tokens, visitGremlinStringConstants_withOptionsStringConstants_values, visitInfLiteral, visitIntegerLiteral, visitIoOptionsStringConstant, visitIoOptionsStringConstants, visitMapEntry, visitNanLiteral, visitNestedTraversal, visitNestedTraversalExpr, visitNestedTraversalList, visitNullLiteral, visitNumericLiteral, visitPageRankStringConstant, visitPageRankStringConstants, visitPeerPressureStringConstant, visitPeerPressureStringConstants, visitRootTraversal, visitShortestPathStringConstant, visitShortestPathStringConstants, visitStringBasedLiteral, visitStringLiteral, visitStringLiteralExpr, visitStringLiteralList, visitStructureVertex, visitTerminatedTraversal, visitTransactionPart, visitTraversalBiFunction, visitTraversalCardinality, visitTraversalColumn, visitTraversalComparator, visitTraversalDirection, visitTraversalFunction, visitTraversalMerge, visitTraversalMethod, visitTraversalMethod_addE_String, visitTraversalMethod_addE_Traversal, visitTraversalMethod_addV_Empty, visitTraversalMethod_addV_String, visitTraversalMethod_addV_Traversal, visitTraversalMethod_aggregate_Scope_String, visitTraversalMethod_aggregate_String, visitTraversalMethod_and, visitTraversalMethod_as, visitTraversalMethod_barrier_Consumer, visitTraversalMethod_barrier_Empty, visitTraversalMethod_barrier_int, visitTraversalMethod_both, visitTraversalMethod_bothE, visitTraversalMethod_bothV, visitTraversalMethod_branch, visitTraversalMethod_by_Comparator, visitTraversalMethod_by_Empty, visitTraversalMethod_by_Function, visitTraversalMethod_by_Function_Comparator, visitTraversalMethod_by_Order, visitTraversalMethod_by_String, visitTraversalMethod_by_String_Comparator, visitTraversalMethod_by_T, visitTraversalMethod_by_Traversal, visitTraversalMethod_by_Traversal_Comparator, visitTraversalMethod_call_string, visitTraversalMethod_call_string_map, visitTraversalMethod_call_string_map_traversal, visitTraversalMethod_call_string_traversal, visitTraversalMethod_cap, visitTraversalMethod_choose_Function, visitTraversalMethod_choose_Predicate_Traversal, visitTraversalMethod_choose_Predicate_Traversal_Traversal, visitTraversalMethod_choose_Traversal, visitTraversalMethod_choose_Traversal_Traversal, visitTraversalMethod_choose_Traversal_Traversal_Traversal, visitTraversalMethod_coalesce, visitTraversalMethod_coin, visitTraversalMethod_connectedComponent, visitTraversalMethod_constant, visitTraversalMethod_count_Empty, visitTraversalMethod_count_Scope, visitTraversalMethod_cyclicPath, visitTraversalMethod_dedup_Scope_String, visitTraversalMethod_dedup_String, visitTraversalMethod_drop, visitTraversalMethod_element, visitTraversalMethod_elementMap, visitTraversalMethod_emit_Empty, visitTraversalMethod_emit_Predicate, visitTraversalMethod_emit_Traversal, visitTraversalMethod_fail_Empty, visitTraversalMethod_fail_String, visitTraversalMethod_filter_Predicate, visitTraversalMethod_filter_Traversal, visitTraversalMethod_flatMap, visitTraversalMethod_fold_Empty, visitTraversalMethod_fold_Object_BiFunction, visitTraversalMethod_from_String, visitTraversalMethod_from_Traversal, visitTraversalMethod_from_Vertex, visitTraversalMethod_group_Empty, visitTraversalMethod_group_String, visitTraversalMethod_groupCount_Empty, visitTraversalMethod_groupCount_String, visitTraversalMethod_has_String, visitTraversalMethod_has_String_Object, visitTraversalMethod_has_String_P, visitTraversalMethod_has_String_String_Object, visitTraversalMethod_has_String_String_P, visitTraversalMethod_has_String_Traversal, visitTraversalMethod_has_T_Object, visitTraversalMethod_has_T_P, visitTraversalMethod_has_T_Traversal, visitTraversalMethod_hasId_Object_Object, visitTraversalMethod_hasId_P, visitTraversalMethod_hasKey_P, visitTraversalMethod_hasKey_String_String, visitTraversalMethod_hasLabel_P, visitTraversalMethod_hasLabel_String_String, visitTraversalMethod_hasNot, visitTraversalMethod_hasValue_Object_Object, visitTraversalMethod_hasValue_P, visitTraversalMethod_id, visitTraversalMethod_identity, visitTraversalMethod_in, visitTraversalMethod_index, visitTraversalMethod_inE, visitTraversalMethod_inject, visitTraversalMethod_inV, visitTraversalMethod_is_Object, visitTraversalMethod_is_P, visitTraversalMethod_key, visitTraversalMethod_label, visitTraversalMethod_limit_long, visitTraversalMethod_limit_Scope_long, visitTraversalMethod_local, visitTraversalMethod_loops_Empty, visitTraversalMethod_loops_String, visitTraversalMethod_map, visitTraversalMethod_match, visitTraversalMethod_math, visitTraversalMethod_max_Empty, visitTraversalMethod_max_Scope, visitTraversalMethod_mean_Empty, visitTraversalMethod_mean_Scope, visitTraversalMethod_mergeE_empty, visitTraversalMethod_mergeE_Map, visitTraversalMethod_mergeE_Traversal, visitTraversalMethod_mergeV_empty, visitTraversalMethod_mergeV_Map, visitTraversalMethod_mergeV_Traversal, visitTraversalMethod_min_Empty, visitTraversalMethod_min_Scope, visitTraversalMethod_not, visitTraversalMethod_option_Merge_Map, visitTraversalMethod_option_Merge_Traversal, visitTraversalMethod_option_Object_Traversal, visitTraversalMethod_option_Predicate_Traversal, visitTraversalMethod_option_Traversal, visitTraversalMethod_optional, visitTraversalMethod_or, visitTraversalMethod_order_Empty, visitTraversalMethod_order_Scope, visitTraversalMethod_otherV, visitTraversalMethod_out, visitTraversalMethod_outE, visitTraversalMethod_outV, visitTraversalMethod_pageRank_double, visitTraversalMethod_pageRank_Empty, visitTraversalMethod_path, visitTraversalMethod_peerPressure, visitTraversalMethod_profile_Empty, visitTraversalMethod_profile_String, visitTraversalMethod_project, visitTraversalMethod_properties, visitTraversalMethod_property_Cardinality_Object, visitTraversalMethod_property_Cardinality_Object_Object_Object, visitTraversalMethod_property_Object, visitTraversalMethod_property_Object_Object_Object, visitTraversalMethod_propertyMap, visitTraversalMethod_range_long_long, visitTraversalMethod_range_Scope_long_long, visitTraversalMethod_read, visitTraversalMethod_repeat_String_Traversal, visitTraversalMethod_repeat_Traversal, visitTraversalMethod_sack_BiFunction, visitTraversalMethod_sack_Empty, visitTraversalMethod_sample_int, visitTraversalMethod_sample_Scope_int, visitTraversalMethod_select_Column, visitTraversalMethod_select_Pop_String, visitTraversalMethod_select_Pop_String_String_String, visitTraversalMethod_select_Pop_Traversal, visitTraversalMethod_select_String, visitTraversalMethod_select_String_String_String, visitTraversalMethod_select_Traversal, visitTraversalMethod_shortestPath, visitTraversalMethod_sideEffect, visitTraversalMethod_simplePath, visitTraversalMethod_skip_long, visitTraversalMethod_skip_Scope_long, visitTraversalMethod_store, visitTraversalMethod_subgraph, visitTraversalMethod_sum_Empty, visitTraversalMethod_sum_Scope, visitTraversalMethod_tail_Empty, visitTraversalMethod_tail_long, visitTraversalMethod_tail_Scope, visitTraversalMethod_tail_Scope_long, visitTraversalMethod_timeLimit, visitTraversalMethod_times, visitTraversalMethod_to_Direction_String, visitTraversalMethod_to_String, visitTraversalMethod_to_Traversal, visitTraversalMethod_to_Vertex, visitTraversalMethod_toE, visitTraversalMethod_toV, visitTraversalMethod_tree_Empty, visitTraversalMethod_tree_String, visitTraversalMethod_unfold, visitTraversalMethod_union, visitTraversalMethod_until_Predicate, visitTraversalMethod_until_Traversal, visitTraversalMethod_V, visitTraversalMethod_value, visitTraversalMethod_valueMap_boolean_String, visitTraversalMethod_valueMap_String, visitTraversalMethod_values, visitTraversalMethod_where_P, visitTraversalMethod_where_String_P, visitTraversalMethod_where_Traversal, visitTraversalMethod_with_String, visitTraversalMethod_with_String_Object, visitTraversalMethod_write, visitTraversalOperator, visitTraversalOrder, visitTraversalPick, visitTraversalPop, visitTraversalPredicate, visitTraversalPredicate_between, visitTraversalPredicate_containing, visitTraversalPredicate_endingWith, visitTraversalPredicate_eq, visitTraversalPredicate_gt, visitTraversalPredicate_gte, visitTraversalPredicate_inside, visitTraversalPredicate_lt, visitTraversalPredicate_lte, visitTraversalPredicate_neq, visitTraversalPredicate_not, visitTraversalPredicate_notContaining, visitTraversalPredicate_notEndingWith, visitTraversalPredicate_notRegex, visitTraversalPredicate_notStartingWith, visitTraversalPredicate_outside, visitTraversalPredicate_regex, visitTraversalPredicate_startingWith, visitTraversalPredicate_within, visitTraversalPredicate_without, visitTraversalSackMethod, visitTraversalScope, visitTraversalSelfMethod, visitTraversalSelfMethod_none, visitTraversalSource, visitTraversalSourceSelfMethod, visitTraversalSourceSelfMethod_with, visitTraversalSourceSelfMethod_withBulk, visitTraversalSourceSelfMethod_withPath, visitTraversalSourceSelfMethod_withSack, visitTraversalSourceSelfMethod_withSideEffect, visitTraversalSourceSelfMethod_withStrategies, visitTraversalSourceSpawnMethod, visitTraversalSourceSpawnMethod_addE, visitTraversalSourceSpawnMethod_addV, visitTraversalSourceSpawnMethod_call_empty, visitTraversalSourceSpawnMethod_call_string, visitTraversalSourceSpawnMethod_call_string_map, visitTraversalSourceSpawnMethod_call_string_map_traversal, visitTraversalSourceSpawnMethod_call_string_traversal, visitTraversalSourceSpawnMethod_E, visitTraversalSourceSpawnMethod_inject, visitTraversalSourceSpawnMethod_io, visitTraversalSourceSpawnMethod_mergeE_Map, visitTraversalSourceSpawnMethod_mergeE_Traversal, visitTraversalSourceSpawnMethod_mergeV_Map, visitTraversalSourceSpawnMethod_mergeV_Traversal, visitTraversalSourceSpawnMethod_V, visitTraversalStrategy, visitTraversalStrategyArgs_EdgeLabelVerificationStrategy, visitTraversalStrategyArgs_PartitionStrategy, visitTraversalStrategyArgs_ProductiveByStrategy, visitTraversalStrategyArgs_ReservedKeysVerificationStrategy, visitTraversalStrategyArgs_SubgraphStrategy, visitTraversalStrategyExpr, visitTraversalStrategyList, visitTraversalTerminalMethod, visitTraversalTerminalMethod_explain, visitTraversalTerminalMethod_hasNext, visitTraversalTerminalMethod_iterate, visitTraversalTerminalMethod_next, visitTraversalTerminalMethod_toBulkSet, visitTraversalTerminalMethod_toList, visitTraversalTerminalMethod_toSet, visitTraversalTerminalMethod_tryNext, visitTraversalToken, visitWithOptionsStringConstant, visitWithOptionsStringConstants
-
Methods inherited from class org.antlr.v4.runtime.tree.AbstractParseTreeVisitor
defaultResult, shouldVisitNextChild, visit, visitChildren, visitErrorNode, visitTerminal
-
-
-
-
Constructor Detail
-
GremlinAntlrToJava
public GremlinAntlrToJava()
Constructs a new instance and is bound to anEmptyGraph
. This form of construction is helpful for generatingBytecode
or for various forms of testing.Traversal
instances constructed from this form will not be capable of iterating. Assumes that "g" is the name of theGraphTraversalSource
.
-
GremlinAntlrToJava
public GremlinAntlrToJava(Graph graph)
Constructs a new instance that is bound to the specifiedGraph
instance. Assumes that "g" is the name of theGraphTraversalSource
.
-
GremlinAntlrToJava
public GremlinAntlrToJava(GraphTraversalSource g)
Constructs a new instance that is bound to the specifiedGraphTraversalSource
and thus spawns theTraversal
from this "g" rather than from a fresh one constructed from theGraph
instance.
-
GremlinAntlrToJava
protected GremlinAntlrToJava(Graph graph, Supplier<GraphTraversal<?,?>> createAnonymous)
Constructs a new instance that is bound to the specifiedGraph
instance with an override to using__
for constructing anonymousTraversal
instances. Assumes that "g" is the name of theGraphTraversalSource
.
-
GremlinAntlrToJava
protected GremlinAntlrToJava(GraphTraversalSource g, Supplier<GraphTraversal<?,?>> createAnonymous)
Constructs a new instance that is bound to the specifiedGraphTraversalSource
and thus spawns theTraversal
from this "g" rather than from a fresh one constructed from theGraph
instance.
-
GremlinAntlrToJava
protected GremlinAntlrToJava(String traversalSourceName, Graph graph, Supplier<GraphTraversal<?,?>> createAnonymous)
Constructs a new instance that is bound to the specifiedGraph
instance with an override to using__
for constructing anonymousTraversal
instances.- Parameters:
traversalSourceName
- The name of the traversal source which will be "g" if not specified.
-
GremlinAntlrToJava
protected GremlinAntlrToJava(String traversalSourceName, Graph graph, Supplier<GraphTraversal<?,?>> createAnonymous, GraphTraversalSource g)
Constructs a new instance that is bound to the specifiedGraph
instance with an override to using__
for constructing anonymousTraversal
instances. If theGraphTraversalSource
is provided then theTraversal
will spawn from it as opposed to a fresh one from theGraph
instance.- Parameters:
traversalSourceName
- The name of the traversal source which will be "g" if not specified.
-
-
Method Detail
-
visitQuery
public Object visitQuery(GremlinParser.QueryContext ctx)
Visit a parse tree produced byGremlinParser.query()
.- Specified by:
visitQuery
in interfaceGremlinVisitor<Object>
- Overrides:
visitQuery
in classDefaultGremlinBaseVisitor<Object>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitQueryList
public Object visitQueryList(GremlinParser.QueryListContext ctx)
Visit a parse tree produced byGremlinParser.queryList()
.- Specified by:
visitQueryList
in interfaceGremlinVisitor<Object>
- Overrides:
visitQueryList
in classDefaultGremlinBaseVisitor<Object>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
aggregateResult
protected Object aggregateResult(Object result, Object nextResult)
Override the aggregate result behavior. If the next result isnull
, return the current result. This is used to handle child EOF, which is the last child of theQueryList
context. If the next Result is notnull
, return the next result. This is used to handle multiple queries, and return only the last query result logic.- Overrides:
aggregateResult
in classorg.antlr.v4.runtime.tree.AbstractParseTreeVisitor<Object>
-
-