use of org.neo4j.graphdb.traversal.Uniqueness in project neo4j by neo4j.
the class TestBidirectionalTraversal method mirroredTraversalReversesInitialState.
@Test
void mirroredTraversalReversesInitialState() {
/*
* (a)-->(b)-->(c)-->(d)
*/
createGraph("a TO b", "b TO c", "c TO d");
try (Transaction transaction = getGraphDb().beginTx()) {
BranchCollisionPolicy collisionPolicy = (evaluator, pathPredicate) -> new StandardBranchCollisionDetector(null, null) {
@Override
protected boolean includePath(Path path, TraversalBranch startPath, TraversalBranch endPath) {
assertEquals(0, startPath.state());
assertEquals(10, endPath.state());
return true;
}
};
Iterables.count(transaction.bidirectionalTraversalDescription().mirroredSides(transaction.traversalDescription().uniqueness(NODE_PATH).expand(PathExpanders.forType(to), new InitialBranchState.State<>(0, 10))).collisionPolicy(collisionPolicy).traverse(getNodeWithName(transaction, "a"), getNodeWithName(transaction, "d")));
}
}
use of org.neo4j.graphdb.traversal.Uniqueness in project neo4j by neo4j.
the class TraversalDescriptionBuilder method describeUniqueness.
private TraversalDescription describeUniqueness(TraversalDescription result, Map<String, Object> description) {
Object uniquenessDescription = description.get("uniqueness");
if (uniquenessDescription != null) {
String name = null;
Object value = null;
if (uniquenessDescription instanceof Map) {
Map map = (Map) uniquenessDescription;
name = (String) map.get("name");
value = map.get("value");
} else {
name = (String) uniquenessDescription;
}
Uniqueness uniqueness = stringToEnum(enumifyName(name), Uniqueness.class, true);
result = value == null ? result.uniqueness(uniqueness) : result.uniqueness(uniqueness, value);
}
return result;
}
Aggregations