Package org.neo4j.kernel.impl.traversal

Examples of org.neo4j.kernel.impl.traversal.TraversalDescriptionImpl$WrappedPruneEvaluator


        }
        return Collections.emptyList();
    }

    private Iterator<Node> traversePath(Node startNode, RelationshipType relType, PathReturnEval returnEval) {
        TraversalDescription traversalDescription = new TraversalDescriptionImpl()
                .order(Traversal.postorderBreadthFirst())
                .prune(Traversal.pruneAfterDepth(MAXIMUM_DEPTH))
                .filter(returnEval)
                .expand(Traversal.expanderForTypes(relType, Direction.BOTH));
        final Traverser traverser = traversalDescription
View Full Code Here


    }

    private static class PeopleTraversalBuilder implements FieldTraversalDescriptionBuilder {
        @Override
        public TraversalDescription build(NodeBacked start, Neo4JPersistentProperty property, String...params) {
            return new TraversalDescriptionImpl()
                    .relationships(DynamicRelationshipType.withName(params[0]))
                    .filter(Traversal.returnAllButStartNode());

        }
View Full Code Here

        final GraphRepository<Person> finder = graphRepositoryFactory.createGraphRepository(Person.class);
        Person p = persistedPerson("Michael", 35);
        Group group = new Group().persist();
        group.setName("dev");
        group.addPerson(p);
        final TraversalDescription traversalDescription = new TraversalDescriptionImpl().relationships(DynamicRelationshipType.withName("persons")).filter(Traversal.returnAllButStartNode());
        Iterable<Person> people = finder.findAllByTraversal(group, traversalDescription);
        final HashSet<Person> found = new HashSet<Person>();
        for (Person person : people) {
            found.add(person);
        }
View Full Code Here

   * instance and returns all nodes of a path until a passed node is reached.
   *
   * @return the traversal description_stop on state_passed
   */
  private TraversalDescription getTraversalDescriptionStopOnStatePassed() {
    return new TraversalDescriptionImpl()
        .breadthFirst()
        .relationships(
            DynamicRelationshipType.withName("HAS_FOLLOWING_INSTANCE"),
            Direction.INCOMING)
        .evaluator(new Evaluator() {
View Full Code Here

* the stars are multiplied by pow(1/2,distance to startNode==path.depth)
*/
class TopRatedRestaurantTraverser implements FieldTraversalDescriptionBuilder {
    @Override
    public TraversalDescription build(Object start, Neo4jPersistentProperty field, String... params) {
        return new TraversalDescriptionImpl()
                .breadthFirst()
                .relationships(DynamicRelationshipType.withName("friends"))
                .order(new BranchOrderingPolicy() {
                    @Override
                    public BranchSelector create(final TraversalBranch startBranch, final PathExpander expander) {
View Full Code Here

    private static final int MAXIMUM_DEPTH = 5;
    public Collection<RatedRestaurant> getTopNRatedRestaurants(final UserAccount user, final int n) {
        final CalculateRatingPredicate calculateRatingPredicate = new CalculateRatingPredicate();
        final Node userNode=user.getPersistentState();
        final TraversalDescription traversalDescription = new TraversalDescriptionImpl()
                .order(Traversal.postorderBreadthFirst())
                .evaluator(Evaluators.toDepth(MAXIMUM_DEPTH))
                .evaluator(calculateRatingPredicate)
                .relationships(DynamicRelationshipType.withName("friends"));
        final Traverser traverser = traversalDescription.traverse(userNode);
View Full Code Here

     *
     * @return a new {@link TraversalDescription} with default values.
     */
    public static TraversalDescription description()
    {
        return new TraversalDescriptionImpl();
    }
View Full Code Here

* the stars are multiplied by pow(1/2,distance to startNode==path.depth)
*/
class TopRatedRestaurantTraverser implements FieldTraversalDescriptionBuilder {
    @Override
    public TraversalDescription build(NodeBacked start, Field field, String... params) {
        return new TraversalDescriptionImpl()
                .breadthFirst()
                .relationships(DynamicRelationshipType.withName("friends"))
                .order(new BranchOrderingPolicy() {
                    @Override
                    public BranchSelector create(final TraversalBranch startBranch) {
View Full Code Here

    private static final int MAXIMUM_DEPTH = 5;
    public Collection<RatedRestaurant> getTopNRatedRestaurants(final UserAccount user, final int n) {
        final CalculateRatingPredicate calculateRatingPredicate = new CalculateRatingPredicate();
        final Node userNode=user.getPersistentState();
        final TraversalDescription traversalDescription = new TraversalDescriptionImpl()
                .order(Traversal.postorderBreadthFirst())
                .prune(Traversal.pruneAfterDepth(MAXIMUM_DEPTH))
                .filter(calculateRatingPredicate)
                .relationships(DynamicRelationshipType.withName("friends"));
        final Traverser traverser = traversalDescription.traverse(userNode);
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.impl.traversal.TraversalDescriptionImpl$WrappedPruneEvaluator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.