Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Path.endNode()


                Path path = indexedRelationshipDestinationIterator.next();
                String direction = (String) path.lastRelationship().getProperty(
                    IndexedRelationship.RELATIONSHIP_DIRECTION );
                try
                {
                    IndexedRelationship indexedRelationship = new IndexedRelationship( path.endNode(), relType,
                        Direction.valueOf( direction ) );
                    return indexedRelationship.getRelationship( path.relationships().iterator().next() );
                }
                catch ( Exception e )
                {
View Full Code Here


        System.out.println("pathData = " + pathData);
        Path path = RestPathParser.parse(pathData, restApi);
        assertEquals(0,path.length());
        assertEquals(null,path.lastRelationship());
        assertEquals(0,path.startNode().getId());
        assertEquals(0,path.endNode().getId());
    }
    @Test
    public void testParsePath() throws Exception {
        RestAPI restApi = new RestAPIImpl(URI);
        Map<String,Object> node = node(0);
View Full Code Here

        System.out.println("pathData = " + pathData);
        Path path = RestPathParser.parse(pathData, restApi);
        assertEquals(1,path.length());
        assertEquals(1,path.lastRelationship().getId());
        assertEquals(0,path.startNode().getId());
        assertEquals(1,path.endNode().getId());
    }

    private Map<String, Object> node(int id) {
        return MapUtil.map("data", Collections.EMPTY_MAP, "self", nodeUrl(id));
    }
View Full Code Here

        path.put("end", node2);
        Path result = (Path)converter.convertToResultType(path, new TypeInformation(Path.class));

        assertEquals(SimplePath.class, result.getClass());
        assertEquals(1, result.startNode().getId());
        assertEquals(2, result.endNode().getId());
        assertEquals(1, result.lastRelationship().getId());
    }


    @Test
View Full Code Here

        if ( !visitor.hasNext() )
        {
            return null;
        }
        Path position = visitor.next();
        Visit visit = visits.get( position.endNode() );
        if ( visit != null )
        {
            if ( visitor != visit.visitor )
            {
                return new Path[] { visit.position, position };
View Full Code Here

                return new Path[] { visit.position, position };
            }
        }
        else
        {
            visits.put( position.endNode(), new Visit( position, visitor ) );
        }
        return null;
    }

    private static class Visit
View Full Code Here

        Iterable<Path> paths = finder.findAllPaths( startNode, endNode );
        // END SNIPPET: shortestPathUsage
        Path path = paths.iterator().next();
        assertEquals( 2, path.length() );
        assertEquals( startNode, path.startNode() );
        assertEquals( endNode, path.endNode() );
        Iterator<Node> iterator = path.nodes().iterator();
        iterator.next();
        assertEquals( middleNode1, iterator.next() );
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.