Class MergeElementStep<S,E,C>
java.lang.Object
org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep<S,E>
org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep<S,E>
org.apache.tinkerpop.gremlin.process.traversal.step.map.MergeElementStep<S,E,C>
- All Implemented Interfaces:
Serializable,AutoCloseable,Cloneable,Iterator<Traverser.Admin<E>>,Step<S,,E> Deleting<Event>,MergeStepContract<S,,E, C> Mutating<Event>,PopContaining,PropertiesHolder,TraversalOptionParent<Merge,,S, C> TraversalParent,Writing<Event>
- Direct Known Subclasses:
MergeEdgeStep,MergeVertexStep
public abstract class MergeElementStep<S,E,C>
extends FlatMapStep<S,E>
implements MergeStepContract<S,E,C>
Abstract base class for the
mergeV/E() implementations.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.step.PopContaining
PopContaining.PopInstruction -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CallbackRegistry<Event>protected booleanprotected final booleanprotected Traversal.Admin<S,Map> protected Traversal.Admin<S,Map> protected Traversal.Admin<S,Map<String, ?>> protected booleanFields inherited from class org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep
id, labels, nextEnd, nextStep, previousStep, starts, traversal, traverserStepIdAndLabelsSetByChildFields inherited from interface org.apache.tinkerpop.gremlin.process.traversal.step.map.MergeStepContract
CONCRETE_STEPS -
Constructor Summary
ConstructorsConstructorDescriptionMergeElementStep(Traversal.Admin traversal, boolean isStart) MergeElementStep(Traversal.Admin traversal, boolean isStart, Map mergeMap) MergeElementStep(Traversal.Admin traversal, boolean isStart, Traversal.Admin mergeTraversal) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChildOption(Merge token, Traversal.Admin<S, C> traversalOption) voidaddProperty(Object key, Object value) This implementation should only be used as a mechanism for supportingPartitionStrategy.clone()Cloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication.flatMap(Traverser.Admin<S> traverser) protected abstract Setprotected GraphgetGraph()<S,C> List<Traversal.Admin<S, C>> Gets a list of all "local" child traversals for this step.Gets the traversal that will be used to provide theMapthat will be used to search for elements.Gets the callback registry for events that the step raises.Gets the traversal that will be used to provide theMapthat will be used to create elements that do not match the search criteria ofgetMergeTraversal().Traversal.Admin<S,Map<String, ?>> Gets the traversal that will be used to provide theMapthat will be used to modify elements that match the search criteria ofgetMergeTraversal().Provide the necessaryTraverserRequirementthat must be met by the traverser in order for the step to function properly.inthashCode()booleanisFirst()Determine if this is the first pass throughprocessNextStart().booleanisStart()Determines if this is a start step.booleanprotected MapmaterializeMap(Traverser.Admin<S> traverser, Traversal.Admin<S, ?> mapTraversal) null Map == empty Mapprotected Traverser.Admin<E>booleanvoidreset()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 GraphTraversalsearchVerticesLabelConstraint(GraphTraversal t, Object labelValue) protected GraphTraversalsearchVerticesPropertyConstraints(GraphTraversal t, Map search) protected GraphTraversalsearchVerticesTraversal(Graph graph, Object id) voidsetMerge(Traversal.Admin<?, Map<Object, Object>> mergeTraversal) voidsetOnCreate(Traversal.Admin<?, Map<Object, Object>> onCreateTraversal) voidsetOnMatch(Traversal.Admin<?, Map<Object, Object>> onMatchTraversal) voidsetTraversal(Traversal.Admin<?, ?> parentTraversal) Set theTraversalthat this step is contained within.toString()protected voidprotected static voidstatic voidvalidateNoOverrides(Map<?, ?> mergeMap, Map<?, ?> onCreateMap) Prohibit overrides to the existence criteria (id/label/from/to) in onCreate.static voidvalidateStaticNoOverrides(Traversal.Admin search, Traversal.Admin create) Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep
closeIteratorMethods inherited from class org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep
addLabel, addStart, addStarts, clearLabels, equals, getId, getLabels, getNextStep, getPreviousStep, getStarts, getTraversal, hasNext, hasStarts, isTraverserStepIdAndLabelsSetByChild, next, prepareTraversalForNextStep, removeLabel, setId, setNextStep, setPreviousStepMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, removeMethods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.step.map.MergeStepContract
getMergeMapWithGValue, getOnCreateMapWithGValue, getOnMatchMapWithGValueMethods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.step.PropertiesHolder
getPropertiesWithGValuesMethods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent
addGlobalChild, addLocalChild, asStep, close, getGlobalChildren, getPopInstructions, getSelfAndChildRequirements, integrateChild, removeGlobalChild, removeLocalChild, replaceLocalChild
-
Field Details
-
isStart
protected final boolean isStart -
first
protected boolean first -
mergeTraversal
-
onCreateTraversal
-
onMatchTraversal
-
callbackRegistry
-
usesPartitionStrategy
protected boolean usesPartitionStrategy
-
-
Constructor Details
-
MergeElementStep
-
MergeElementStep
-
MergeElementStep
-
-
Method Details
-
getMergeTraversal
Gets the traversal that will be used to provide theMapthat will be used to search for elements. ThisMapalso will be used as the default data set to be used to create the element if the search is not successful.- Specified by:
getMergeTraversalin interfaceMergeStepContract<S,E, C>
-
getOnCreateTraversal
Gets the traversal that will be used to provide theMapthat will be used to create elements that do not match the search criteria ofgetMergeTraversal().- Specified by:
getOnCreateTraversalin interfaceMergeStepContract<S,E, C>
-
getOnMatchTraversal
Gets the traversal that will be used to provide theMapthat will be used to modify elements that match the search criteria ofgetMergeTraversal().- Specified by:
getOnMatchTraversalin interfaceMergeStepContract<S,E, C>
-
isStart
public boolean isStart()Determines if this is a start step.- Specified by:
isStartin interfaceMergeStepContract<S,E, C>
-
isFirst
public boolean isFirst()Determine if this is the first pass throughprocessNextStart().- Specified by:
isFirstin interfaceMergeStepContract<S,E, C>
-
getCallbackRegistry
-
addChildOption
Description copied from interface:TraversalOptionParentThe child as defined by the token it takes, likePickorMerge. This traversal may be of local or global scope depending on the step implementation that works withoption().- Specified by:
addChildOptionin interfaceTraversalOptionParent<S,E, C>
-
getLocalChildren
Description copied from interface:TraversalParentGets a list of all "local" child traversals for this step. A "local" traversal is one which is evaluated independently for each incoming traverser to the parent step. This is typically used in cases where the child is used to process or augment each traverser individually. SeeLocalSteporByModulatingas examples.- Specified by:
getLocalChildrenin interfaceTraversalParent
-
isUsingPartitionStrategy
public boolean isUsingPartitionStrategy()- Specified by:
isUsingPartitionStrategyin interfaceMergeStepContract<S,E, C>
-
processNextStart
- Overrides:
processNextStartin classFlatMapStep<S,E>
-
getGraph
-
getMutatingCallbackRegistry
Description copied from interface:MutatingGets the callback registry for events that the step raises.- Specified by:
getMutatingCallbackRegistryin interfaceMutating<S>
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractStep<S,E>
-
reset
public void reset()Description copied from interface:StepReset the state of the step such that it has no incoming starts. Internal states are to be reset, but any sideEffect data structures are not to be recreated. -
getRequirements
Description copied from interface:StepProvide the necessaryTraverserRequirementthat must be met by the traverser in order for the step to function properly. The provided default implements returns an empty set.- Specified by:
getRequirementsin interfaceMergeStepContract<S,E, C> - Specified by:
getRequirementsin interfaceStep<S,E> - Returns:
- the set of requirements
-
toString
- Overrides:
toStringin classAbstractStep<S,E>
-
setTraversal
Description copied from interface:StepSet theTraversalthat this step is contained within.- Specified by:
setTraversalin interfaceStep<S,E> - Overrides:
setTraversalin classAbstractStep<S,E> - Parameters:
parentTraversal- the new traversal for this step
-
clone
Description copied from interface:StepCloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication. When cloning a step, it is important that the steps, the cloned step is equivalent to the state of the step whenStep.reset()is called. Moreover, the previous and next steps should be set toEmptyStep. -
validate
-
validate
-
validateNoOverrides
Prohibit overrides to the existence criteria (id/label/from/to) in onCreate. -
materializeMap
null Map == empty Map -
searchVertices
Translate the Map into a g.V() traversal against the supplied graph. Graph providers will presumably optimize this traversal to use whatever indices are present and appropriate for efficiency. Callers are responsible for closing this iterator when finished. -
searchVerticesTraversal
-
searchVerticesLabelConstraint
-
searchVerticesPropertyConstraints
-
flatMap
- Specified by:
flatMapin classFlatMapStep<S,E>
-
getAllowedTokens
-
setMerge
- Specified by:
setMergein interfaceMergeStepContract<S,E, C>
-
setOnCreate
- Specified by:
setOnCreatein interfaceMergeStepContract<S,E, C>
-
setOnMatch
- Specified by:
setOnMatchin interfaceMergeStepContract<S,E, C>
-
addProperty
This implementation should only be used as a mechanism for supportingPartitionStrategy.- Specified by:
addPropertyin interfacePropertiesHolder
-
getProperties
- Specified by:
getPropertiesin interfacePropertiesHolder
-
removeProperty
- Specified by:
removePropertyin interfacePropertiesHolder
-
validateStaticNoOverrides
-