public class MergeVertexStep<S> extends FlatMapStep<S,Vertex> implements Mutating<Event>, TraversalOptionParent<Merge,S,Vertex>
mergeV()
step covering both the start step version and the one used mid-traversal.Modifier and Type | Field and Description |
---|---|
protected CallbackRegistry<Event> |
callbackRegistry |
id, labels, nextEnd, nextStep, previousStep, starts, traversal, traverserStepIdAndLabelsSetByChild
Constructor and Description |
---|
MergeVertexStep(Traversal.Admin traversal,
boolean isStart) |
MergeVertexStep(Traversal.Admin traversal,
boolean isStart,
Map<Object,Object> searchCreate) |
MergeVertexStep(Traversal.Admin traversal,
boolean isStart,
Traversal.Admin<S,Map<Object,Object>> searchCreateTraversal) |
Modifier and Type | Method and Description |
---|---|
void |
addChildOption(Merge token,
Traversal.Admin<S,Vertex> traversalOption)
|
MergeVertexStep<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<Vertex> |
createSearchStream(Map<Object,Object> search)
Use the
Map of search criteria to most efficiently return a Stream<Vertex> of matching elements. |
protected Iterator<Vertex> |
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 vertex 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 vertices 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 vertices. |
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<Vertex> |
processNextStart() |
void |
reset()
Reset the state of the step such that it has no incoming starts.
|
void |
setTraversal(Traversal.Admin<?,?> parentTraversal)
Set the
Traversal that this step is contained within. |
String |
toString() |
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
protected CallbackRegistry<Event> callbackRegistry
public MergeVertexStep(Traversal.Admin traversal, boolean isStart)
public MergeVertexStep(Traversal.Admin traversal, boolean isStart, Map<Object,Object> searchCreate)
public MergeVertexStep(Traversal.Admin traversal, boolean isStart, Traversal.Admin<S,Map<Object,Object>> searchCreateTraversal)
public Traversal.Admin<S,Map<Object,Object>> getSearchCreateTraversal()
Map
that will be used to search for vertices.
This Map
also will be used as the default data set to be used to create a vertex 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 vertex creation events.public Traversal.Admin<S,Map<String,Object>> getOnMatchTraversal()
Map
that will be used to modify vertices 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,Vertex> 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,Vertex>
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<Vertex> processNextStart()
processNextStart
in class FlatMapStep<S,Vertex>
protected Stream<Vertex> createSearchStream(Map<Object,Object> search)
Map
of search criteria to most efficiently return a Stream<Vertex>
of matching elements.
Providers might override this method when extending this step to provide their own optimized mechanisms for
matching the list of vertices. 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<Vertex> flatMap(Traverser.Admin<S> traverser)
flatMap
in class FlatMapStep<S,Vertex>
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,Vertex>
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,Vertex>
public String toString()
toString
in class AbstractStep<S,Vertex>
public void setTraversal(Traversal.Admin<?,?> parentTraversal)
Step
Traversal
that this step is contained within.setTraversal
in interface Step<S,Vertex>
setTraversal
in class AbstractStep<S,Vertex>
parentTraversal
- the new traversal for this steppublic MergeVertexStep<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.