Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.RelationshipType


    }

    public Relationship getSingleRelationship( NodeManager nodeManager, RelationshipType type,
        Direction dir )
    {
        RelationshipType types[] = new RelationshipType[] { type };
        Iterator<Relationship> rels = new IntArrayIterator( getAllRelationshipsOfType( nodeManager,
                types ),
            this, dir, nodeManager, types );
        if ( !rels.hasNext() )
        {
View Full Code Here


    }

    public Iterable<Relationship> getRelationships( NodeManager nodeManager, RelationshipType type,
        Direction dir )
    {
        RelationshipType types[] = new RelationshipType[] { type };
        return new IntArrayIterator( getAllRelationshipsOfType( nodeManager, types ),
            this, dir, nodeManager, types );
    }
View Full Code Here

    {
        Node node1 = getGraphDb().createNode();
        Node node2 = getGraphDb().createNode();
        Relationship rel = node1.createRelationshipTo( node2, MyRelTypes.TEST );
        assertTrue( rel.isType( MyRelTypes.TEST ) );
        assertTrue( rel.isType( new RelationshipType()
        {
            public String name()
            {
                return MyRelTypes.TEST.name();
            }
View Full Code Here

        for ( int i = 1; i < nodeSpace.length; i++ )
        {
            nodeSpace[i].setProperty( key, "" + i );
        }

        RelationshipType ise = MyRelTypes.TEST;
        RelationshipType clone = MyRelTypes.TEST_TRAVERSAL;

        // Bind it together
        //
        //               ----(1)-------
        //              /      \       \
View Full Code Here

        node1.createRelationshipTo( node2, MyRelTypes.TEST_TRAVERSAL );
        tx.success();
        tx.finish();
        tx = graphDb.beginTx();
        Set<Relationship> rels = new HashSet<Relationship>();
        RelationshipType types[] = new RelationshipType[] {
            MyRelTypes.TEST, MyRelTypes.TEST2, MyRelTypes.TEST_TRAVERSAL };
        graphDb.getConfig().getGraphDbModule().getNodeManager().clearCache();
       
        for ( Relationship rel : node1.getRelationships( types ) )
        {
View Full Code Here

    }
   
    @Test
    public void makeSureNodesAreTraversedInCorrectOrder()
    {
        RelationshipType next = DynamicRelationshipType.withName( "NEXT" );
        RelationshipType firstComment = DynamicRelationshipType.withName( "FIRST_COMMENT" );
        RelationshipType comment = DynamicRelationshipType.withName( "COMMENT" );
        RelationshipExpander expander =
            new OrderedByTypeExpander().add( firstComment ).add( comment ).add( next );
        Iterator<Node> itr = Traversal.description().depthFirst().expand(
                expander ).traverse( referenceNode() ).nodes().iterator();
        assertOrder( itr, "A1", "C1", "C2", "C3", "A2", "C4", "C5", "C6", "A3", "C7", "C8", "C9" );
View Full Code Here

        assertNotNull( "Failure creating first node", firstNode );
        secondNode = getGraphDb().createNode();
        assertNotNull( "Failure creating second node", secondNode );
        rel = firstNode.createRelationshipTo( secondNode, MyRelTypes.TEST );
        assertNotNull( "Relationship is null", rel );
        RelationshipType relType = rel.getType();
        assertNotNull( "Relationship's type is is null", relType );

        // Verify that the node reports that it has a relationship of
        // the type we created above
        assertTrue( firstNode.getRelationships( relType ).iterator().hasNext() );
View Full Code Here

    {
        InputDialog input = new InputDialog( null, NEW_RELTYPE_DIALOG_TITLE,
            NEW_RELTYPE_DIALOG_TEXT, null, null );
        if ( input.open() == OK && input.getReturnCode() == OK )
        {
            RelationshipType relType = provider.addFakeType( input.getValue() );
            switch ( extraAction )
            {
                case NONE:
                    return;
                case RELATIONSHIP:
View Full Code Here

            }
            return graphDecorator.getRelationshipColor( rel );
        }
        else if ( o instanceof RelationshipType )
        {
            RelationshipType relType = (RelationshipType) o;
            return graphDecorator.getRelationshipColor( relType );
        }
        return null;
    }
View Full Code Here

     *
     * @param name the name of the relationship type
     */
    public RelationshipType addFakeType( final String name )
    {
        RelationshipType relType = DynamicRelationshipType.withName( name );
        fakeTypes.add( relType );
        notifyTypesListeners( new NeoclipseEvent( relType ) );
        return relType;
    }
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.RelationshipType

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.