public abstract class MergeStep<S,E,C> extends FlatMapStep<S,E> implements Writing<Event>, Deleting<Event>, TraversalOptionParent<Merge,S,C>
mergeV/E() implementations.| Modifier and Type | Field and Description |
|---|---|
protected CallbackRegistry<Event> |
callbackRegistry |
protected boolean |
first |
protected boolean |
isStart |
protected Traversal.Admin<S,Map> |
mergeTraversal |
protected Traversal.Admin<S,Map> |
onCreateTraversal |
protected Traversal.Admin<S,Map<String,?>> |
onMatchTraversal |
id, labels, nextEnd, nextStep, previousStep, starts, traversal, traverserStepIdAndLabelsSetByChild| Constructor and Description |
|---|
MergeStep(Traversal.Admin traversal,
boolean isStart) |
MergeStep(Traversal.Admin traversal,
boolean isStart,
Map mergeMap) |
MergeStep(Traversal.Admin traversal,
boolean isStart,
Traversal.Admin mergeTraversal) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChildOption(Merge token,
Traversal.Admin<S,C> traversalOption)
|
MergeStep<S,E,C> |
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 abstract Iterator<E> |
flatMap(Traverser.Admin<S> traverser) |
protected abstract Set |
getAllowedTokens() |
CallbackRegistry<Event> |
getCallbackRegistry() |
protected Graph |
getGraph() |
<S,C> List<Traversal.Admin<S,C>> |
getLocalChildren() |
Traversal.Admin<S,Map> |
getMergeTraversal()
Gets the traversal that will be used to provide the
Map that will be used to search for elements. |
CallbackRegistry<Event> |
getMutatingCallbackRegistry()
Gets the callback registry for events that the step raises.
|
Traversal.Admin<S,Map> |
getOnCreateTraversal()
Gets the traversal that will be used to provide the
Map that will be used to create elements that
do not match the search criteria of getMergeTraversal(). |
Traversal.Admin<S,Map<String,?>> |
getOnMatchTraversal()
Gets the traversal that will be used to provide the
Map that will be used to modify elements that
match the search criteria of getMergeTraversal(). |
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. |
int |
hashCode() |
boolean |
isFirst()
Determine if this is the first pass through
processNextStart(). |
boolean |
isStart()
Determines if this is a start step.
|
protected Map |
materializeMap(Traverser.Admin<S> traverser,
Traversal.Admin<S,?> mapTraversal)
null Map == empty Map
|
protected Traverser.Admin<E> |
processNextStart() |
void |
reset()
Reset the state of the step such that it has no incoming starts.
|
protected CloseableIterator<Vertex> |
searchVertices(Map search)
Translate the Map into a g.V() traversal against the supplied graph.
|
protected GraphTraversal |
searchVerticesLabelConstraint(GraphTraversal t,
String label) |
protected GraphTraversal |
searchVerticesPropertyConstraints(GraphTraversal t,
Map search) |
protected GraphTraversal |
searchVerticesTraversal(Graph graph,
Object id) |
void |
setTraversal(Traversal.Admin<?,?> parentTraversal)
Set the
Traversal that this step is contained within. |
String |
toString() |
protected void |
validate(Map map,
boolean ignoreTokens) |
protected static void |
validate(Map map,
boolean ignoreTokens,
Set allowedTokens,
String op) |
protected void |
validateNoOverrides(Map<?,?> mergeMap,
Map<?,?> onCreateMap)
Prohibit overrides to the existence criteria (id/label/from/to) in onCreate.
|
closeIteratoraddLabel, addStart, addStarts, equals, getId, getLabels, getNextStep, getPreviousStep, getStarts, getTraversal, hasNext, hasStarts, isTraverserStepIdAndLabelsSetByChild, next, prepareTraversalForNextStep, removeLabel, setId, setNextStep, setPreviousStepfinalize, getClass, notify, notifyAll, wait, wait, waitaddGlobalChild, addLocalChild, asStep, close, getGlobalChildren, getSelfAndChildRequirements, integrateChild, removeGlobalChild, removeLocalChild, replaceLocalChildforEachRemaining, removeprotected final boolean isStart
protected boolean first
protected Traversal.Admin<S,Map> mergeTraversal
protected Traversal.Admin<S,Map> onCreateTraversal
protected Traversal.Admin<S,Map<String,?>> onMatchTraversal
protected CallbackRegistry<Event> callbackRegistry
public MergeStep(Traversal.Admin traversal, boolean isStart)
public MergeStep(Traversal.Admin traversal, boolean isStart, Map mergeMap)
public MergeStep(Traversal.Admin traversal, boolean isStart, Traversal.Admin mergeTraversal)
public Traversal.Admin<S,Map> getMergeTraversal()
Map that will be used to search for elements.
This Map also will be used as the default data set to be used to create the element if the search is not
successful.public Traversal.Admin<S,Map> getOnCreateTraversal()
Map that will be used to create elements that
do not match the search criteria of getMergeTraversal().public Traversal.Admin<S,Map<String,?>> getOnMatchTraversal()
Map that will be used to modify elements that
match the search criteria of getMergeTraversal().public boolean isStart()
public boolean isFirst()
processNextStart().public CallbackRegistry<Event> getCallbackRegistry()
public void addChildOption(Merge token, Traversal.Admin<S,C> traversalOption)
TraversalOptionParentPick 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,C>public <S,C> List<Traversal.Admin<S,C>> getLocalChildren()
getLocalChildren in interface TraversalParentpublic void configure(Object... keyValues)
ConfiguringStep. 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 Configuringpublic Parameters getParameters()
ParameterizinggetParameters in interface Parameterizingprotected Traverser.Admin<E> processNextStart()
processNextStart in class FlatMapStep<S,E>protected Graph getGraph()
public CallbackRegistry<Event> getMutatingCallbackRegistry()
MutatinggetMutatingCallbackRegistry in interface Mutating<Event>public int hashCode()
hashCode in class AbstractStep<S,E>public void reset()
Steppublic Set<TraverserRequirement> getRequirements()
StepTraverserRequirement 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,E>public String toString()
toString in class AbstractStep<S,E>public void setTraversal(Traversal.Admin<?,?> parentTraversal)
StepTraversal that this step is contained within.setTraversal in interface Step<S,E>setTraversal in class AbstractStep<S,E>parentTraversal - the new traversal for this steppublic MergeStep<S,E,C> clone()
StepStep.reset() is called. Moreover, the previous and next steps should be set to EmptyStep.protected void validate(Map map, boolean ignoreTokens)
protected static void validate(Map map, boolean ignoreTokens, Set allowedTokens, String op)
protected void validateNoOverrides(Map<?,?> mergeMap, Map<?,?> onCreateMap)
protected Map materializeMap(Traverser.Admin<S> traverser, Traversal.Admin<S,?> mapTraversal)
protected CloseableIterator<Vertex> searchVertices(Map search)
protected GraphTraversal searchVerticesTraversal(Graph graph, Object id)
protected GraphTraversal searchVerticesLabelConstraint(GraphTraversal t, String label)
protected GraphTraversal searchVerticesPropertyConstraints(GraphTraversal t, Map search)
protected abstract Iterator<E> flatMap(Traverser.Admin<S> traverser)
flatMap in class FlatMapStep<S,E>protected abstract Set getAllowedTokens()
Copyright © 2013–2023 Apache Software Foundation. All rights reserved.