public class MergeEdgeStep<S> extends FlatMapStep<S,Edge> implements Mutating<Event>, TraversalOptionParent<Merge,S,Edge>
mergeE()
step covering both the start step version and the one used mid-traversal.Modifier and Type | Field and Description |
---|---|
protected CallbackRegistry<Event> |
callbackRegistry |
static Vertex |
PLACEHOLDER_VERTEX |
id, labels, nextEnd, nextStep, previousStep, starts, traversal, traverserStepIdAndLabelsSetByChild
Constructor and Description |
---|
MergeEdgeStep(Traversal.Admin traversal,
boolean isStart) |
MergeEdgeStep(Traversal.Admin traversal,
boolean isStart,
Map<Object,Object> searchCreate) |
MergeEdgeStep(Traversal.Admin traversal,
boolean isStart,
Traversal.Admin<?,Map<Object,Object>> searchCreateTraversal) |
Modifier and Type | Method and Description |
---|---|
void |
addChildOption(Merge token,
Traversal.Admin<S,Edge> traversalOption)
|
MergeEdgeStep<S> |
clone()
Cloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication.
|
void |
configure(Object... keyValues)
Accept a configuration to the
Step . |
protected Stream<Edge> |
createSearchStream(Map<Object,Object> search)
Use the
Map of search criteria to most efficiently return a Stream<Edge> of matching elements. |
protected Iterator<Edge> |
flatMap(Traverser.Admin<S> traverser) |
CallbackRegistry<Event> |
getCallbackRegistry() |
<S,E> List<Traversal.Admin<S,E>> |
getLocalChildren() |
CallbackRegistry<Event> |
getMutatingCallbackRegistry()
Gets the callback registry for events that the step raises.
|
Traversal.Admin<S,Map<Object,Object>> |
getOnCreateTraversal()
Gets the traversal that will be used to provide the
Map that will be the override to the one provided
by the getSearchCreateTraversal() for edge creation events. |
Traversal.Admin<S,Map<String,Object>> |
getOnMatchTraversal()
Gets the traversal that will be used to provide the
Map that will be used to modify edges that
match the search criteria of getSearchCreateTraversal() . |
Parameters |
getParameters()
Gets the parameters on the step.
|
Set<TraverserRequirement> |
getRequirements()
Provide the necessary
TraverserRequirement that must be met by the traverser in order for the step to
function properly. |
Traversal.Admin<S,Map<Object,Object>> |
getSearchCreateTraversal()
Gets the traversal that will be used to provide the
Map that will be used to search for edges. |
int |
hashCode() |
boolean |
isFirst()
Determine if this is the first pass through
processNextStart() . |
boolean |
isStart()
Determines if this is a start step.
|
protected Traverser.Admin<Edge> |
processNextStart() |
void |
reset()
Reset the state of the step such that it has no incoming starts.
|
protected Vertex |
resolveVertex(Traverser.Admin<S> traverser,
Map<Object,Object> searchCreate,
Direction direction)
|
void |
setTraversal(Traversal.Admin<?,?> parentTraversal)
Set the
Traversal that this step is contained within. |
String |
toString() |
protected Vertex |
tryAttachVertex(Vertex maybeAttachable)
|
static void |
validateMapInput(Map<?,Object> m,
boolean ignoreTokens)
Validates input to any
Map arguments to this step. |
closeIterator
addLabel, addStart, addStarts, equals, getId, getLabels, getNextStep, getPreviousStep, getStarts, getTraversal, hasNext, hasStarts, isTraverserStepIdAndLabelsSetByChild, next, prepareTraversalForNextStep, removeLabel, setId, setNextStep, setPreviousStep
finalize, getClass, notify, notifyAll, wait, wait, wait
addGlobalChild, addLocalChild, asStep, close, getGlobalChildren, getSelfAndChildRequirements, integrateChild, removeGlobalChild, removeLocalChild, replaceLocalChild
forEachRemaining, remove
public static final Vertex PLACEHOLDER_VERTEX
protected CallbackRegistry<Event> callbackRegistry
public MergeEdgeStep(Traversal.Admin traversal, boolean isStart)
public MergeEdgeStep(Traversal.Admin traversal, boolean isStart, Map<Object,Object> searchCreate)
public MergeEdgeStep(Traversal.Admin traversal, boolean isStart, Traversal.Admin<?,Map<Object,Object>> searchCreateTraversal)
public Traversal.Admin<S,Map<Object,Object>> getSearchCreateTraversal()
Map
that will be used to search for edges.
This Map
also will be used as the default data set to be used to create a edge if the search is not
successful.public Traversal.Admin<S,Map<Object,Object>> getOnCreateTraversal()
Map
that will be the override to the one provided
by the getSearchCreateTraversal()
for edge creation events.public Traversal.Admin<S,Map<String,Object>> getOnMatchTraversal()
Map
that will be used to modify edges that
match the search criteria of getSearchCreateTraversal()
.public boolean isStart()
public boolean isFirst()
processNextStart()
.public CallbackRegistry<Event> getCallbackRegistry()
public void addChildOption(Merge token, Traversal.Admin<S,Edge> traversalOption)
TraversalOptionParent
Pick
or Merge
. This traversal may be of local
or global scope depending on the step implementation that works with option()
.addChildOption
in interface TraversalOptionParent<Merge,S,Edge>
public <S,E> List<Traversal.Admin<S,E>> getLocalChildren()
getLocalChildren
in interface TraversalParent
public void configure(Object... keyValues)
Configuring
Step
. Note that this interface extends Parameterizing
and so
there is an expectation that the Step
implementation will have a Parameters
instance that will
house any values passed to this method. Storing these configurations in Parameters
is not a requirement
however, IF the configuration is an expected option for the step and can be stored on a member field that can
be accessed on the step by more direct means (i.e. like a getter method).configure
in interface Configuring
public Parameters getParameters()
Parameterizing
getParameters
in interface Parameterizing
protected Traverser.Admin<Edge> processNextStart()
processNextStart
in class FlatMapStep<S,Edge>
protected Stream<Edge> createSearchStream(Map<Object,Object> search)
Map
of search criteria to most efficiently return a Stream<Edge>
of matching elements.
Providers might override this method when extending this step to provide their own optimized mechanisms for
matching the list of edges. This implementation is only optimized for the T.id
so any other usage
will simply be in-memory filtering which could be slow.protected Iterator<Edge> flatMap(Traverser.Admin<S> traverser)
flatMap
in class FlatMapStep<S,Edge>
protected Vertex resolveVertex(Traverser.Admin<S> traverser, Map<Object,Object> searchCreate, Direction direction)
Direction
map keys to a Vertex
which is the currency
of this step. Since this step can accept a Vertex
as the traverser it uses that as a default value
in the case where Direction
is not specified in the Map
. As a result the Map
value
overrides the traverser. Note that if this is a start step then the traverser will contain a
PLACEHOLDER_VERTEX
which is basically just a dummy to use as a marker where it will be assumed a
Map
argument to the step will have the necessary Vertex
to allow the step to do its work. If
the Direction
contains something other than a Vertex
it will become the T.id
to a
fresh ReferenceVertex
.public static void validateMapInput(Map<?,Object> m, boolean ignoreTokens)
Map
arguments to this step. For Merge.onMatch
updates cannot be applied
to immutable parts of an Edge
(id, label, incident vertices) so those can be ignored in the validation.public CallbackRegistry<Event> getMutatingCallbackRegistry()
Mutating
getMutatingCallbackRegistry
in interface Mutating<Event>
public int hashCode()
hashCode
in class AbstractStep<S,Edge>
public void reset()
Step
public Set<TraverserRequirement> getRequirements()
Step
TraverserRequirement
that must be met by the traverser in order for the step to
function properly. The provided default implements returns an empty set.getRequirements
in interface Step<S,Edge>
public String toString()
toString
in class AbstractStep<S,Edge>
public void setTraversal(Traversal.Admin<?,?> parentTraversal)
Step
Traversal
that this step is contained within.setTraversal
in interface Step<S,Edge>
setTraversal
in class AbstractStep<S,Edge>
parentTraversal
- the new traversal for this steppublic MergeEdgeStep<S> clone()
Step
Step.reset()
is called. Moreover, the previous and next steps should be set to EmptyStep
.Copyright © 2013–2022 Apache Software Foundation. All rights reserved.