|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.neo4j.kernel.Traversal
public class Traversal
A factory for objects regarding traversal of the graph. F.ex. it has a
method description()
for creating a new
TraversalDescription
, methods for creating new
TraversalBranch
instances and more.
Nested Class Summary | |
---|---|
static class |
Traversal.DefaultPathDescriptor<T extends Path>
The default Traversal.PathDescriptor used in common toString()
representations in classes implementing Path . |
static interface |
Traversal.PathDescriptor<T extends Path>
Provides hooks to help build a string representation of a Path . |
Constructor Summary | |
---|---|
Traversal()
|
Method Summary | ||
---|---|---|
static TraversalBranch |
combineSourcePaths(TraversalBranch source,
TraversalBranch target)
Combines two TraversalBranch s with a common
head node in order to obtain an
TraversalBranch representing a path from the start node of the
source TraversalBranch to the start node of the
target TraversalBranch . |
|
static String |
defaultPathToString(Path path)
Returns the default string representation of a Path . |
|
static TraversalDescription |
description()
Creates a new TraversalDescription with default value for
everything so that it's OK to call
TraversalDescription.traverse(org.neo4j.graphdb.Node) without
modification. |
|
static Expander |
emptyExpander()
Returns an empty Expander which, if not modified, will expand
all relationships when asked to expand a Node . |
|
static Expander |
expander(RelationshipExpander expander)
Returns a RelationshipExpander wrapped as an Expander . |
|
static Expander |
expanderForAllTypes()
Returns a RelationshipExpander which expands relationships
of all types and directions. |
|
static Expander |
expanderForAllTypes(Direction direction)
Returns a RelationshipExpander which expands relationships
of all types in the given direction . |
|
static Expander |
expanderForTypes(RelationshipType type)
Creates a new RelationshipExpander which is set to expand
relationships with type in any direction. |
|
static Expander |
expanderForTypes(RelationshipType type,
Direction dir)
Creates a new RelationshipExpander which is set to expand
relationships with type and direction . |
|
static Expander |
expanderForTypes(RelationshipType type1,
Direction dir1,
RelationshipType type2,
Direction dir2)
Creates a new RelationshipExpander which is set to expand
relationships with two different types and directions. |
|
static Expander |
expanderForTypes(RelationshipType type1,
Direction dir1,
RelationshipType type2,
Direction dir2,
Object... more)
Creates a new RelationshipExpander which is set to expand
relationships with multiple types and directions. |
|
static
|
pathToString(T path,
Traversal.PathDescriptor<T> builder)
Method for building a string representation of a Path , using
the given builder . |
|
static BranchOrderingPolicy |
postorderBreadthFirst()
Returns a "postorder breadth first" ordering policy. |
|
static BranchOrderingPolicy |
postorderDepthFirst()
Returns a "postorder depth first" ordering policy. |
|
static BranchOrderingPolicy |
preorderBreadthFirst()
Returns a "preorder breadth first" ordering policy. |
|
static BranchOrderingPolicy |
preorderDepthFirst()
Returns a "preorder depth first" ordering policy. |
|
static PruneEvaluator |
pruneAfterDepth(int depth)
Deprecated. because of the introduction of Evaluator . The equivalent
is Evaluators.toDepth(int) . |
|
static Predicate<Path> |
returnAcceptedByAny(Predicate<Path>... filters)
Returns a filter which accepts items accepted by at least one of the supplied filters. |
|
static Predicate<Path> |
returnAll()
Deprecated. because of the introduction of Evaluator . The equivalent
is Evaluators.all() . |
|
static Predicate<Path> |
returnAllButStartNode()
Deprecated. because of the introduction of Evaluator . The equivalent
is Evaluators.excludeStartPosition() . |
|
static Predicate<Path> |
returnWhereLastRelationshipTypeIs(RelationshipType firstRelationshipType,
RelationshipType... relationshipTypes)
|
|
static String |
simplePathToString(Path path)
Returns a quite simple string representation of a Path . |
|
static String |
simplePathToString(Path path,
String nodePropertyKey)
Returns a quite simple string representation of a Path . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Traversal()
Method Detail |
---|
public static TraversalDescription description()
TraversalDescription
with default value for
everything so that it's OK to call
TraversalDescription.traverse(org.neo4j.graphdb.Node)
without
modification. But it isn't a very useful traversal, instead you should
add rules and behaviours to it before traversing.
TraversalDescription
with default values.public static Expander expanderForTypes(RelationshipType type, Direction dir)
RelationshipExpander
which is set to expand
relationships with type
and direction
.
type
- the RelationshipType
to expand.dir
- the Direction
to expand.
RelationshipExpander
.public static Expander expanderForTypes(RelationshipType type)
RelationshipExpander
which is set to expand
relationships with type
in any direction.
type
- the RelationshipType
to expand.
RelationshipExpander
.public static Expander emptyExpander()
Expander
which, if not modified, will expand
all relationships when asked to expand a Node
. Criterias
can be added to narrow the Expansion
.
Expander
which, if not modified, will expand
all relationship for Node
s.public static Expander expanderForTypes(RelationshipType type1, Direction dir1, RelationshipType type2, Direction dir2)
RelationshipExpander
which is set to expand
relationships with two different types and directions.
type1
- a RelationshipType
to expand.dir1
- a Direction
to expand.type2
- another RelationshipType
to expand.dir2
- another Direction
to expand.
RelationshipExpander
.public static Expander expanderForTypes(RelationshipType type1, Direction dir1, RelationshipType type2, Direction dir2, Object... more)
RelationshipExpander
which is set to expand
relationships with multiple types and directions.
type1
- a RelationshipType
to expand.dir1
- a Direction
to expand.type2
- another RelationshipType
to expand.dir2
- another Direction
to expand.more
- additional pairs or type/direction to expand.
RelationshipExpander
.public static Expander expanderForAllTypes()
RelationshipExpander
which expands relationships
of all types and directions.
public static Expander expanderForAllTypes(Direction direction)
RelationshipExpander
which expands relationships
of all types in the given direction
.
direction
.public static Expander expander(RelationshipExpander expander)
RelationshipExpander
wrapped as an Expander
.
expander
- RelationshipExpander
to wrap.
RelationshipExpander
wrapped as an Expander
.public static TraversalBranch combineSourcePaths(TraversalBranch source, TraversalBranch target)
TraversalBranch
s with a common
head node
in order to obtain an
TraversalBranch
representing a path from the start node of the
source
TraversalBranch
to the start node of the
target
TraversalBranch
. The resulting
TraversalBranch
will not expand
further
, and does not provide a parent
TraversalBranch
.
source
- the TraversalBranch
where the resulting path startstarget
- the TraversalBranch
where the resulting path ends
TraversalBranch
that represents the path from the
start node of the source
TraversalBranch
to
the start node of the target
TraversalBranch
IllegalArgumentException
- if the head nodes
of the supplied TraversalBranch
s does not
matchpublic static PruneEvaluator pruneAfterDepth(int depth)
Evaluator
. The equivalent
is Evaluators.toDepth(int)
.
PruneEvaluator
which prunes everything beyond depth
.
depth
- the depth to prune beyond (after).
PruneEvaluator
which prunes everything after
depth
.public static Predicate<Path> returnAll()
Evaluator
. The equivalent
is Evaluators.all()
.
Path
s it encounters.
public static Predicate<Path> returnAcceptedByAny(Predicate<Path>... filters)
filters
- to group together.
Predicate
which accepts if any of the filters accepts.public static Predicate<Path> returnAllButStartNode()
Evaluator
. The equivalent
is Evaluators.excludeStartPosition()
.
Path
s except the
position of the start node.
public static BranchOrderingPolicy preorderDepthFirst()
BranchOrderingPolicy
for a preorder depth first
selector.public static BranchOrderingPolicy postorderDepthFirst()
BranchOrderingPolicy
for a postorder depth first
selector.public static BranchOrderingPolicy preorderBreadthFirst()
BranchOrderingPolicy
for a preorder breadth first
selector.public static BranchOrderingPolicy postorderBreadthFirst()
BranchOrderingPolicy
for a postorder breadth first
selector.public static <T extends Path> String pathToString(T path, Traversal.PathDescriptor<T> builder)
Path
, using
the given builder
.
T
- the type of Path
.path
- the Path
to build a string representation of.builder
- the Traversal.PathDescriptor
to get
Node
and Relationship
representations from.
Path
.public static String defaultPathToString(Path path)
Path
. It uses
the Traversal.DefaultPathDescriptor
to get representations.
path
- the Path
to build a string representation of.
Path
.public static String simplePathToString(Path path)
Path
. It
doesn't print relationship types or ids, just directions.
path
- the Path
to build a string representation of.
Path
.public static String simplePathToString(Path path, String nodePropertyKey)
Path
. It
doesn't print relationship types or ids, just directions. it uses the
nodePropertyKey
to try to display that property value as in the
node representation instead of the node id. If that property doesn't
exist, the id is used.
path
- the Path
to build a string representation of.
Path
.public static Predicate<Path> returnWhereLastRelationshipTypeIs(RelationshipType firstRelationshipType, RelationshipType... relationshipTypes)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |