Documentation ¶
Overview ¶
Package traversal contains the struct for a graph traversal and its steps.
The traversal contains various steps which all have their own file associated with them individually. Each step can be used modular-ly to construct a query.
Index ¶
- type Custom
- type Parameter
- type String
- func (g String) AddE(param interface{}) String
- func (g *String) AddStep(step string, params ...interface{})
- func (g String) AddV(params ...interface{}) String
- func (g String) Aggregate(str string) String
- func (g String) And(params ...String) String
- func (g String) As(labels ...string) String
- func (g String) Barrier(param ...interface{}) String
- func (g String) Both(labels ...string) String
- func (g String) BothE(labels ...string) String
- func (g String) BothV() String
- func (g String) By(params ...interface{}) String
- func (g String) Cap(str string, optStrings ...string) String
- func (g String) Choose(first interface{}, optTraversals ...String) String
- func (g String) Coalesce(traversals ...String) String
- func (g String) Coin(bias float32) String
- func (g String) Constant(obj string) String
- func (g String) Count(scope ...scope.Scope) String
- func (g String) CyclicPath() String
- func (g String) Dedup(params ...interface{}) String
- func (g String) Drop() String
- func (g String) E(params ...interface{}) String
- func (g String) Emit(predOrTrav ...interface{}) String
- func (g String) Explain() String
- func (g String) Fold(params ...interface{}) String
- func (g String) From(param interface{}) String
- func (g String) Group(str ...string) String
- func (g String) GroupCount(str ...string) String
- func (g String) Has(first interface{}, params ...interface{}) String
- func (g String) HasID(objOrP interface{}, objs ...string) String
- func (g String) HasKey(pOrStr interface{}, handledStrings ...string) String
- func (g String) HasLabel(pOrStr interface{}, handledStrings ...string) String
- func (g String) HasNot(str string) String
- func (g String) HasValue(objOrP interface{}, objs ...string) String
- func (g String) ID() String
- func (g String) Identity() String
- func (g String) In(labels ...string) String
- func (g String) InE(labels ...string) String
- func (g String) InV() String
- func (g String) Inject(obj string) String
- func (g String) Is(objOrP interface{}) String
- func (g String) Key() String
- func (g String) Label() String
- func (g String) Limit(params ...interface{}) String
- func (g String) Local(traversal String) String
- func (g String) Loops() String
- func (g String) Match(traversals ...String) String
- func (g String) Math(str string) String
- func (g String) Max(scopes ...scope.Scope) String
- func (g String) Mean(scopes ...scope.Scope) String
- func (g String) Min(scopes ...scope.Scope) String
- func (g String) Not(traversal String) String
- func (g String) Option(params ...string) String
- func (g String) Optional(traversal String) String
- func (g String) Or(traversals ...String) String
- func (g String) Order(scope ...scope.Scope) String
- func (g String) OtherV() String
- func (g String) Out(labels ...string) String
- func (g String) OutE(labels ...string) String
- func (g String) OutV() String
- func (g String) PageRank(args ...float32) String
- func (g String) Path() String
- func (g String) PeerPressure() String
- func (g String) Profile(str ...string) String
- func (g String) Program(vertexProgram interface{}) String
- func (g String) Project(str string, extraStrings ...string) String
- func (g String) Properties(str ...string) String
- func (g String) Property(objOrCard interface{}, obj interface{}, params ...interface{}) String
- func (g String) PropertyMap(str ...string) String
- func (g String) Range(params ...interface{}) String
- func (g String) Raw() String
- func (g String) Repeat(traversal String) String
- func (g String) Sack(operator ...operator.Operator) String
- func (g String) Sample(params ...interface{}) String
- func (g String) Select(first interface{}, extras ...interface{}) String
- func (g String) SimplePath() String
- func (g String) Skip(first interface{}, extraFloat ...float32) String
- func (g String) Store(str string) String
- func (g String) String() string
- func (g String) SubGraph(str string) String
- func (g String) Sum(scopes ...scope.Scope) String
- func (g String) Tail(first interface{}, extraFloat ...float32) String
- func (g String) TimeLimit(limit float32) String
- func (g String) To(first interface{}, extraStrings ...string) String
- func (g String) ToE(dir direction.Direction, str string) String
- func (g String) ToV(dir direction.Direction) String
- func (g String) ToVId(vertexID interface{}) String
- func (g String) Tree(str ...string) String
- func (g String) Unfold() String
- func (g String) Union(traversals ...String) String
- func (g String) Until(predOrTrav interface{}) String
- func (g String) V(params ...interface{}) String
- func (g String) Value() String
- func (g String) ValueMap(boolOrStrings ...interface{}) String
- func (g String) Values(strs ...string) String
- func (g String) Where(first interface{}, extra ...string) String
- func (g String) WithSack(sackVal float32) String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parameter ¶
type Parameter interface {
String() string
}
Parameter is used for handling all Gremlin types.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is used to construct commands for the Grammes API when querying type String string
func NewCustomTraversal ¶
NewCustomTraversal could be used when you need to specifically need to change some property of the traversal. This can be something such as:
// ==> graph.traversal().withoutStrategies(LazyBarrierStrategy)
func NewTraversal ¶
func NewTraversal() (g String)
NewTraversal will return a new Query with a default value of 'g' to start a command.
func (String) AddE ¶
AddE (map/sideEffect) adds a new edge between two vertices on the graph. Signatures: AddE(string) AddE(*String)
func (*String) AddStep ¶
AddStep will add a new step to the traversal string using a list of parameters.
func (String) AddV ¶
AddV (map/sideEffect) is used to add vertices to the graph. Signatures: AddV() AddV(string) AddV(*String (Traversal))
func (String) Aggregate ¶
Aggregate (sideEffect) is used to aggregate all the objects in a particular point of traversal into a Collection. The step uses eager evaluation in that no objects continue on until all previous objects have been fully aggregated (as opposed to Store() which lazily files a collection). Signatures: Aggregate(string)
func (String) And ¶
And (filter) ensures that all provided traversals yield a result. Signatures: And() And(...*String (Traversal))
func (String) As ¶
As (step modulator) similar to By() & Option(). With As(), it is possible to provide a label to the step that can later be accessed by steps and data structures that make use of such labels. Signatures: As(string) As(string, string...)
func (String) Barrier ¶
Barrier (barrier) turns the lazy traversal pipeline into a bulk-synchronous pipeline. Signatures: Barrier() Barrier(string (Consumer)) Barrier(int)
func (String) Both ¶
Both moves to both the incoming and outgoing adjacent vertices given the edge labels.
func (String) BothE ¶
BothE moves to both the incoming and outgoing incident edges given the edge labels.
func (String) By ¶
By (step modulator) similar to As() & Option(). If a step is able to accept traversals, functions, comparator, etc. then By() is the means by which they are added. The general pattern is step().By()...By(). Some steps can only accept one By() while others can take an arbitrary amount Signatures: By() By(string) By(...interface{})
func (String) Cap ¶
Cap (barrier) iterates the traversal up to itself and emits the sideEffect referenced by the provided key. If multiple keys are provided, then a Map<String, Object> of sideEffects is emitted. Signatures: Cap(string, ...string)
func (String) Choose ¶
Choose (branch) routes the current traverser to a particular traversal branch option. Note: Signatures: Choose(string (Function)) Choose(string (Predicate), *String (Traversal)) Choose(string (Predicate), *String (Traversal), *String (Traversal)) Choose(*String (Traversal), *String (Traversal)) Choose(*String (Traversal), *String (Traversal), *String (Traversal)) Choose(*String (Traversal))
func (String) Coalesce ¶
Coalesce evaluates the provided traversals in order and returns the first traversal that emits at least one element. Signatures: Coalesce(...*String (Traversal))
func (String) Constant ¶
Constant (map) is used to specify a constant value for a traverser. Signatures: Constant(string (Object))
func (String) Count ¶
Count (map) counts the total number of represented traversers in the stream. Signatures: Count() Count(Scope)
func (String) CyclicPath ¶
CyclicPath (filter) analyzes the path of the traverser thus far and if there are any repeats, the traverser is filtered out over the traersal computation. Signatures: CyclicPath()
func (String) Dedup ¶
Dedup (filter) repeatedly seen objects are removed from the traversal stream. Signatures: Dedup(Scope, ...string) Dedup(...string)
func (String) Drop ¶
Drop (filter/sideEffect) will remove an element and properties from the graph. Signatures: Drop()
func (String) Emit ¶
Emit (step modulator) for Repeat() Signatures: Emit() Emit(string (Predicate)) Emit(*String (Traversal))
func (String) Explain ¶
Explain (terminal) will return a TraversalExplanation. Signatures: Explain()
func (String) Fold ¶
Fold (map) is used when the traversal stream needs a "barrier" to aggregate all the objects and emite a computation that is a function of the aggregate. Signatures: Fold() Fold(interface{} (Object)) Fold(interface{} (Object), interface{} (BiFunction))
func (String) From ¶
From (step-modulator) similar to As() and By(). If a step is able to accept traversal or strings then From() is the means by which they are added. Note:
- From does not handle string formatting. If you wish to input a string then you must format it with single quotes beforehand.
Signatures: From(string) From(*String (Traversal)) From(string (Vertex))
func (String) Group ¶
Group (map/sideEffect) is one such sideEffect that organizes the objects according to some function of the object. Then, if required, that organization (a list) is reduced. Signatures: Group() Group(string)
func (String) GroupCount ¶
GroupCount (map/sideEffect) is the amount of times a particular object has been at a particular part of a traversal. Signatures: Group() Group(string)
func (String) Has ¶
Has (filter) filters vertices, edges, and vertex properties based on their properties. Signatures: Has(string) Has(string, string (Object)) Has(string, string (P)) Has(string, string, string (Object)) Has(string, string, string (P)) Has(string, *String (Traversal)) Has(Token, string (Object)) Has(Token, string (P)) Has(Token, *String (Traversal))
func (String) HasID ¶
HasID (filter) filters vertices, edges, and vertex properties based on their properties. In this case the ID. Signatures: HasID(string (Object), ...string (Object)) HasID(string (P))
func (String) HasKey ¶
HasKey (filter) filters vertices, edges, and vertex properties based on their properties. In this case the Key. Signatures: HasKey(string (Predicate)) HasKey(string, ...string)
func (String) HasLabel ¶
HasLabel (filter) filters vertices, edges, and vertex properties based on their properties. In this case the Label. Signatures: HasLabel(string (Predicate)) HasLabel(string, ...string)
func (String) HasNot ¶
HasNot (filter) filters vertices, edges, and vertex properties based on their properties. In this case if it doesn't have this property. Signatures: HasNot(string)
func (String) HasValue ¶
HasValue (filter) filters vertices, edges, and vertex properties based on their properties. In this case the Value. Signatures: HasValue(string (Object), ...string (Object)) HasValue(string (P))
func (String) Identity ¶
Identity (map) is an identity function which maps the current object to itself. Signatures: Identity()
func (String) Inject ¶
Inject (sideEffect) makes it possible to insert objects arbitrarily into a traversal stream. Signatures: Inject(string (Object))
func (String) Is ¶
Is (filter) makes it possible to filter scalar values. Signatures: Is(string (Object)) Is(string (P))
func (String) Label ¶
Label (map) takes an element and extracts its label from it. Signatures: Label()
func (String) Limit ¶
Limit (analogous to range) except the minimum will always be 0 there are two typical parameters for Limit. (Scope, MaxLimit) Signatures: Limit(int) Limit(Scope, int)
func (String) Local ¶
Local (branch) allows for object-local traversal computations. Signatures: Local(*String (Traversal))
func (String) Loops ¶
Loops (map) extracts the number of times the traverser has gone through a current loop. Signatures: Loops()
func (String) Match ¶
Match (map) provides a more declarative form of graph querying based on the notion of pattern matching. With Match(), the user provides a collection of "traversal fragments," called patterns, that have variables defined that must hold true throughout the duration of the Match(). Signatures: Match(...*String (Traversal))
func (String) Math ¶
Math (math) neables scientific calculator functionality within Gremlin. This step deviates from the common function composition and nesting formalisms to provide an easy to read string-based math processor. Variables within the equation map to scopes in Gremlin (e.g. path labels), side-effects, or incoming map keys. Signatures: Math(string)
func (String) Max ¶
Max (map) operates on a stream of numbers and determines which is the largest number in the stream. Signatures: Max() Max(Scope)
func (String) Mean ¶
Mean (map) operates on a stream of numbers and determines the average of those two numbers. Signatures: Mean() Mean(Scope)
func (String) Min ¶
Min (map) operates on astream of numbers and determines which is the smallest number in the stream. Signatures: Min() Min(Scope)
func (String) Not ¶
Not (filter) removes objects from the traversal stream when the traversal provided as an argument does not return any objects. Signatures: Not(*String (Traversal))
func (String) Option ¶
Option (step modulator) is an 'option' to a Branch() or Choose() Signatures: Option(string) Option(string, string)
func (String) Optional ¶
Optional (branch/filterMap) returns the result of the specified traversal if it yields a result else it returns the calling element i.e. the Indentity(). Signatures: Optional(String (Traversal))
func (String) Or ¶
Or (filter) ensures that at least of the provided traversals yield a result. Signatures: Or() Or(...*String (Traversal))
func (String) Order ¶
Order (map) sorts the objects of the traversal stream. Signatures: Order() Order(Scope)
func (String) PageRank ¶
PageRank (map/sideEffect) calculates PageRank using PageRankVertexProgram. Signatures: PageRank() PageRank(float32)
func (String) Path ¶
Path (map) realizes the history of the traverser and its path. Signatures: Path()
func (String) PeerPressure ¶
PeerPressure (map/sideEffect) clusters vertices using PeerPressureVertexProgram. Signatures: PeerPressure()
func (String) Profile ¶
Profile (sideEffect) exists to allow developers to profile their traversals to determine statistical information like step runtime, counts, etc. Signatures: Profile() Profile(string)
func (String) Program ¶
Program (map/sideEffect) is the "lambda" step for GraphComputer jobs. The step takes a VertexProgram as an argument and will process the incoming graph accordingly. Thus, the user can create their own VertexProgram and have it execute within a traversal. Signatures: Program(VertexProgram)
func (String) Project ¶
Project (map) projects the current object into a Map<string, object> keyed by provided labels. It is similar to Select(), save that instead of retrieving and modulating historic traverser state, it modulates the current state of the traverser. Signatures: Project(string, ...string)
func (String) Properties ¶
Properties (map) extracts properties from an Element in the traversal stream. Signatures: Properties() Properties(...string)
func (String) Property ¶
Property (sideEffect) unlike AddV() and AddE(), Property() is a full sideEffect step in that it does not return the property that it created, but the element that streamed into it. Note:
- This function does not handle your string formatting because of the Cardinality parameter.
Signatures: Property(interface{} (Object), interface{} (Object), ...interface{} (Object)) Property(Cardinality, string (Object), interface{} (Object), ...interface{} (Object))
func (String) PropertyMap ¶
PropertyMap (map) extracts properties from an Element in the traversal stream. Signatures: PropertyMap(...string)
func (String) Range ¶
Range (filter) allows for filtering on a low-end and high-end when objects are being iterated. -1 on the high range will emit remaining traversers after the low range begins. Signatures: Range(int, int) Range(Scope, int, int)
func (String) Raw ¶
Raw will return the raw traversal commands to be used as a parameter for other steps.
func (String) Repeat ¶
Repeat (branch) is used for loopping over a traversal given some break predicate. Signatures: Repeat(*String (Traversal))
func (String) Sack ¶
Sack (sideEffect or map) is used to read and write sacks. Signatures: Sack() Sack(string (Bifunction))
func (String) Sample ¶
Sample (step-modulator) is useful for sampling some number of traversers previous in the traversal. Signatures: Sample(int) Sample(Scope, int)
func (String) Select ¶
Select (map) Can go back in a traversal in the previously seen area of computation. Note:
- Select does not handle any string formatting. If you wish to input a normal string as a parameter then you must add single-quotes around the string beforehand.
Signatures: Select(string (Column)) Select(Pop, string) Select(string) Select(string, string, ...string) Select(*String (Traversal)) Select(Pop, *String (Traversal))
func (String) SimplePath ¶
SimplePath (filter) should be used when it's important that the traverser should not repeat its path through the graph. Signatures: SimplePath()
func (String) Skip ¶
Skip (filter) is analogous to Range() save that the higher end range is set to -1. Signatures: Skip(float32) Skip(Scope, float32)
func (String) Store ¶
Store (sideEffect) should be bused over Aggregate() when lazy aggregation is needed. Signatures: Store(string)
func (String) SubGraph ¶
SubGraph (sideEffect) provides a way to produce an edge-induced subgraph from virtually any traversal. Signatures: SubGraph(string)
func (String) Sum ¶
Sum (map) operates on a stream of numbers and sums the numbers together to yield a double. Signatures: Sum() Sum(Scope)
func (String) Tail ¶
Tail (filter) is analogous to Limit(), except that it emits the last n-objects instead of the first n-objects. Signatures: Tail() Tail(float32) Tail(Scope) Tail(Scope, float32)
func (String) TimeLimit ¶
TimeLimit (filter) should be used if you wish the traversal to execute within a certain time. Signatures: TimeLimit(float32)
func (String) To ¶
To (step-modulator) similar to As() and By(). If a step is able to accept traversals or strings then To() is the means by which they are added. Note:
- To does not handle any string formatting for you. If you wish to pass a regular string as a parameter you must add single-quotes around it beforehand.
Signatures: To(Direction, ...string) To(string) To(*String (Traversal)) To(string Vertex)
func (String) ToVId ¶
ToVId can be used to make a string query that will take a vertex id as a parameter, and can be used to point an edge towards this vertex ID.
func (String) Tree ¶
Tree (sideEffect) is used when the emanating paths from an element can be aggregated to form a tree. Signatures: Tree() Tree(string)
func (String) Unfold ¶
Unfold (flatMap) is an iterator, iterable, or map, then it is unrolled into a linear form. If not, then the object is simply emitted. Signatures: Unfold()
func (String) Union ¶
Union (branch) supports the merging of the results of an arbitrary number of traversers. When a traverser reaches a Union(), it is copied of its internal steps. The traverser emitted from Union are the outputs of the respective internal traversals. Signatures: Union() Union(...*String (Traversal))
func (String) Until ¶
Until (step-modulator) for Repeat() Signatures: Until(string (Predicate)) Until(*String (Traversal))
func (String) V ¶
V will return the vertices that belong to this graph traversal. Optional parameter is the index of a specific vertex on the graph. Signatures: V() V(int...)
func (String) Value ¶
Value (map) takes a property and extracts the value from it. Signatures: Value()
func (String) ValueMap ¶
ValueMap (map) yields a map representation of the properties of an element. Signatures: ValueMap() ValueMap(bool, string...) ValueMap(string...)
func (String) Values ¶
Values (map) extracts the values of properties from an element in the traversal stream. Signatures: Values() Values(string...)
func (String) Where ¶
Where (filter) filters the current objects based on either the object itself or the path history of the object. Notes:
- Where does not handle string formatting. If you wish to input a string has a parameter you must surround it with single-quotes beforehand.
Signatures: Where(string (P)) Where(string, string (P)) Where(*String (Traversal))
Source Files ¶
- addedge.go
- addproperty.go
- addvertex.go
- aggregate.go
- and.go
- as.go
- barrier.go
- both.go
- by.go
- cap.go
- choose.go
- coalesce.go
- coin.go
- constant.go
- count.go
- cyclicpath.go
- dedup.go
- drop.go
- e.go
- emit.go
- explain.go
- fold.go
- from.go
- graph.go
- group.go
- groupcount.go
- has.go
- id.go
- identity.go
- in.go
- inject.go
- is.go
- key.go
- label.go
- limit.go
- local.go
- loops.go
- match.go
- math.go
- max.go
- mean.go
- min.go
- model.go
- not.go
- option.go
- optional.go
- or.go
- order.go
- other.go
- out.go
- pagerank.go
- path.go
- peerpressure.go
- profile.go
- program.go
- project.go
- properties.go
- propertymap.go
- range.go
- repeat.go
- sack.go
- sample.go
- select.go
- simplepath.go
- skip.go
- store.go
- subgraph.go
- sum.go
- tail.go
- timelimit.go
- to.go
- traversal.go
- tree.go
- unfold.go
- union.go
- until.go
- util.go
- value.go
- valuemap.go
- values.go
- where.go
- withsack.go