Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.GraphDatabaseService.createNode()


        {
            stopper.start();
            for ( int i = 0; i < 50; i++ )
            {
                Node node = graphDb.createNode();
                Node otherNode = graphDb.createNode();
                Relationship rel = node.createRelationshipTo( otherNode, relType );
                for ( int ii = 0; ii < 3; ii++ )
                {
                    nodeIndex.add( node, keys[random.nextInt( keys.length )], random.nextInt() );
                    relIndex.add( rel, keys[random.nextInt( keys.length )], random.nextInt() );
View Full Code Here


    public void testAsLittleAsPossibleRecoveryScenario() throws Exception
    {
        GraphDatabaseService db = newGraphDbService();
        Index<Node> index = db.index().forNodes( "my-index" );
        db.beginTx();
        Node node = db.createNode();
        index.add( node, "key", "value" );
        db.shutdown();
       
        // This doesn't seem to trigger recovery... it really should
        new EmbeddedGraphDatabase( getDbPath() ).shutdown();
View Full Code Here

        GraphDatabaseService db = new EmbeddedGraphDatabase( args[0] );
        Index<Node> index = db.index().forNodes( "index" );
        Transaction tx = db.beginTx();
        try
        {
            Node node = db.createNode();
            index.add( node, "key", "value" );
            index.delete();
            tx.success();
        }
        finally
View Full Code Here

        String path = args[0];
        String indexName = "myIndex";
        GraphDatabaseService db = new EmbeddedGraphDatabase( path );
        Index<Relationship> index = db.index().forRelationships( indexName );
        Transaction tx = db.beginTx();
        Node node = db.createNode();
        Relationship relationship = db.getReferenceNode().createRelationshipTo( node, DynamicRelationshipType.withName( "KNOWS" ) );
        index.add( relationship, "key", "value" );
        tx.success();
        tx.finish();
        // Skip shutdown
View Full Code Here

    @Test
    public void testWithGraphDbService()
    {
        BatchInserter batchInserter = newBatchInserter();
        GraphDatabaseService graphDb = batchInserter.getGraphDbService();
        Node startNode = graphDb.createNode();
        setProperties( startNode );
        Node endNodes[] = new Node[25];
        Set<Relationship> rels = new HashSet<Relationship>();
        for ( int i = 0; i < 25; i++ )
        {
View Full Code Here

        setProperties( startNode );
        Node endNodes[] = new Node[25];
        Set<Relationship> rels = new HashSet<Relationship>();
        for ( int i = 0; i < 25; i++ )
        {
            endNodes[i] = graphDb.createNode();
            setProperties( endNodes[i] );
            Relationship rel = startNode.createRelationshipTo( endNodes[i],
                relTypeArray[i % 5] );
            rels.add( rel );
            setProperties( rel );
View Full Code Here

    @Test
    public void testGraphDbServiceGetRelationships()
    {
        BatchInserter batchInserter = newBatchInserter();
        GraphDatabaseService graphDb = batchInserter.getGraphDbService();
        Node startNode = graphDb.createNode();
        for ( int i = 0; i < 5; i++ )
        {
            Node endNode = graphDb.createNode();
            startNode.createRelationshipTo( endNode, relTypeArray[i] );
        }
View Full Code Here

        BatchInserter batchInserter = newBatchInserter();
        GraphDatabaseService graphDb = batchInserter.getGraphDbService();
        Node startNode = graphDb.createNode();
        for ( int i = 0; i < 5; i++ )
        {
            Node endNode = graphDb.createNode();
            startNode.createRelationshipTo( endNode, relTypeArray[i] );
        }
        try
        {
            startNode.createRelationshipTo( startNode, relTypeArray[0] );
View Full Code Here

              for ( int i = 0; i < 100; i++ )
              {
                                String key = keys[i%keys.length];
                                String value = values[i%values.length]+i;
                               
                Node node = db.createNode();
                                node.setProperty( key, value );
                index.add( node, key, value );
              }
              tx.success();
            }
View Full Code Here

        String storePath = getStorePath( "test-neo2" );
        deleteFileOrDirectory( storePath );
        GraphDatabaseService graphDb2 = new EmbeddedGraphDatabase( storePath );
        Transaction tx2 = graphDb2.beginTx();
        getGraphDb().createNode();
        graphDb2.createNode();
        tx2.success();
        tx2.finish();
        graphDb2.shutdown();
    }
   
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.