public class TraversalOptions extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TraversalOptions.Direction |
static class |
TraversalOptions.ItemOrder |
static class |
TraversalOptions.Order |
static class |
TraversalOptions.Strategy |
static class |
TraversalOptions.Uniqueness |
static class |
TraversalOptions.UniquenessType |
Constructor and Description |
---|
TraversalOptions() |
public String getSort()
public TraversalOptions sort(String sort)
sort
- JavaScript code of a custom comparison function for the edges. The signature of this function is (l,
r) -> integer (where l and r are edges) and must return -1 if l is smaller than, +1 if l is greater
than, and 0 if l and r are equal. The reason for this is the following: The order of edges returned
for a certain vertex is undefined. This is because there is no natural order of edges for a vertex
with multiple connected edges. To explicitly define the order in which edges on the vertex are
followed, you can specify an edge comparator function with this attribute. Note that the value here
has to be a string to conform to the JSON standard, which in turn is parsed as function body on the
server side. Furthermore note that this attribute is only used for the standard expanders. If you use
your custom expander you have to do the sorting yourself within the expander code.public TraversalOptions.Direction getDirection()
public TraversalOptions direction(TraversalOptions.Direction direction)
direction
- direction for traversal
if set, must be either "outbound", "inbound", or "any"
if not set, the expander attribute must be specifiedpublic Integer getMinDepth()
public TraversalOptions minDepth(Integer minDepth)
minDepth
- ANDed with any existing filters): visits only nodes in at least the given depthpublic String getStartVertex()
public TraversalOptions startVertex(String startVertex)
startVertex
- The id of the startVertex, e.g. "users/foo".public String getVisitor()
public TraversalOptions visitor(String visitor)
visitor
- JavaScript code of custom visitor function function signature: (config, result, vertex, path,
connected) -> void The visitor function can do anything, but its return value is ignored. To populate
a result, use the result variable by reference. Note that the connected argument is only populated
when the order attribute is set to "preorder-expander".public TraversalOptions.ItemOrder getItemOrder()
public TraversalOptions itemOrder(TraversalOptions.ItemOrder itemOrder)
itemOrder
- The item iteration order can be "forward" or "backward"public TraversalOptions.Strategy getStrategy()
public TraversalOptions strategy(TraversalOptions.Strategy strategy)
strategy
- The traversal strategy can be "depthfirst" or "breadthfirst"public String getFilter()
public TraversalOptions filter(String filter)
filter
- default is to include all nodes: body (JavaScript code) of custom filter function function signature:
(config, vertex, path) -> mixed can return four different string values:
"exclude" -> this vertex will not be visited.
"prune" -> the edges of this vertex will not be followed.
"" or undefined -> visit the vertex and follow it's edges.
Array -> containing any combination of the above.
If there is at least one "exclude" or "prune" respectivly is contained, it's effect will occur.public String getInit()
public TraversalOptions init(String init)
init
- JavaScript code of custom result initialization function function signature: (config, result) -> void
initialize any values in result with what is requiredpublic Integer getMaxIterations()
public TraversalOptions maxIterations(Integer maxIterations)
maxIterations
- Maximum number of iterations in each traversal. This number can be set to prevent endless loops in
traversal of cyclic graphs. When a traversal performs as many iterations as the maxIterations value,
the traversal will abort with an error. If maxIterations is not set, a server-defined value may be
used.public Integer getMaxDepth()
public TraversalOptions maxDepth(Integer maxDepth)
maxDepth
- ANDed with any existing filters visits only nodes in at most the given depth.public TraversalOptions.UniquenessType getVerticesUniqueness()
public TraversalOptions verticesUniqueness(TraversalOptions.UniquenessType vertices)
vertices
- Specifies uniqueness for vertices can be "none", "global" or "path"public TraversalOptions.UniquenessType getEdgesUniqueness()
public TraversalOptions edgesUniqueness(TraversalOptions.UniquenessType edges)
edges
- Specifies uniqueness for edges can be "none", "global" or "path"public TraversalOptions.Order getOrder()
public TraversalOptions order(TraversalOptions.Order order)
order
- The traversal order can be "preorder", "postorder" or "preorder-expander"public String getGraphName()
public TraversalOptions graphName(String graphName)
graphName
- The name of the graph that contains the edges. Either edgeCollection or graphName has to be given. In
case both values are set the graphName is prefered.public String getExpander()
public TraversalOptions expander(String expander)
expander
- JavaScript code of custom expander function must be set if direction attribute is not set function
signature: (config, vertex, path) -> array expander must return an array of the connections for vertex
each connection is an object with the attributes edge and vertexpublic String getEdgeCollection()
public TraversalOptions edgeCollection(String edgeCollection)
edgeCollection
- The name of the collection that contains the edges.Copyright © 2016–2017 ArangoDB GmbH. All rights reserved.