|
||||||||||
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 traversal()
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 SideSelectorPolicy |
alternatingSelectorOrdering()
|
|
static BidirectionalTraversalDescription |
bidirectionalTraversal()
|
|
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
|
emptyPathExpander()
Returns an empty PathExpander which, if not modified, will expand
all relationships when asked to expand a Node . |
|
static Expander |
expander(PathExpander expander)
|
|
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
|
initialState(STATE initialState)
InitialStateFactory which always returns the supplied initialState . |
|
static SideSelectorPolicy |
levelSelectorOrdering()
|
|
static PathDescription |
path()
|
|
static
|
pathExpanderForAllTypes()
Returns a RelationshipExpander which expands relationships
of all types and directions. |
|
static
|
pathExpanderForAllTypes(Direction direction)
Returns a PathExpander which expands relationships
of all types in the given direction . |
|
static
|
pathExpanderForTypes(RelationshipType type)
Creates a new PathExpander which is set to expand
relationships with type in any direction. |
|
static
|
pathExpanderForTypes(RelationshipType type,
Direction dir)
Creates a new PathExpander which is set to expand
relationships with type and direction . |
|
static
|
pathExpanderForTypes(RelationshipType type1,
Direction dir1,
RelationshipType type2,
Direction dir2)
Creates a new PathExpander which is set to expand
relationships with two different types and directions. |
|
static
|
pathExpanderForTypes(RelationshipType type1,
Direction dir1,
RelationshipType type2,
Direction dir2,
Object... more)
Creates a new PathExpander 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 BranchCollisionDetector |
shortestPathsCollisionDetector(int maxDepth)
|
|
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 . |
|
static TraversalDescription |
traversal()
More convenient name than description() when using static imports. |
|
static TraversalDescription |
traversal(UniquenessFactory uniqueness)
|
|
static TraversalDescription |
traversal(UniquenessFactory uniqueness,
Object optionalUniquenessParameter)
|
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 behaviors to it before traversing.
TraversalDescription
with default values.public static TraversalDescription traversal()
description()
when using static imports.
Does the same thing.
description()
public static TraversalDescription traversal(UniquenessFactory uniqueness)
public static TraversalDescription traversal(UniquenessFactory uniqueness, Object optionalUniquenessParameter)
public static BidirectionalTraversalDescription bidirectionalTraversal()
public static <STATE> InitialStateFactory<STATE> initialState(STATE initialState)
InitialStateFactory
which always returns the supplied initialState
.
initialState
- the initial state for a traversal branch.
InitialStateFactory
which always will return the supplied
initialState
.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 <STATE> PathExpander<STATE> pathExpanderForTypes(RelationshipType type, Direction dir)
PathExpander
which is set to expand
relationships with type
and direction
.
type
- the RelationshipType
to expand.dir
- the Direction
to expand.
PathExpander
.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 <STATE> PathExpander<STATE> pathExpanderForTypes(RelationshipType type)
PathExpander
which is set to expand
relationships with type
in any direction.
type
- the RelationshipType
to expand.
PathExpander
.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 <STATE> PathExpander<STATE> emptyPathExpander()
PathExpander
which, if not modified, will expand
all relationships when asked to expand a Node
. Criterias
can be added to narrow the Expansion
.
PathExpander
which, if not modified, will expand
all relationship for Path
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 <STATE> PathExpander<STATE> pathExpanderForTypes(RelationshipType type1, Direction dir1, RelationshipType type2, Direction dir2)
PathExpander
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.
PathExpander
.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 <STATE> PathExpander<STATE> pathExpanderForTypes(RelationshipType type1, Direction dir1, RelationshipType type2, Direction dir2, Object... more)
PathExpander
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.
PathExpander
.public static Expander expanderForAllTypes()
RelationshipExpander
which expands relationships
of all types and directions.
public static <STATE> PathExpander<STATE> pathExpanderForAllTypes()
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 <STATE> PathExpander<STATE> pathExpanderForAllTypes(Direction direction)
PathExpander
which expands relationships
of all types in the given direction
.
direction
.public static Expander expander(PathExpander expander)
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 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 SideSelectorPolicy alternatingSelectorOrdering()
public static SideSelectorPolicy levelSelectorOrdering()
public static BranchCollisionDetector shortestPathsCollisionDetector(int maxDepth)
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 PathDescription path()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |