Package org.neo4j.kernel

Examples of org.neo4j.kernel.EmbeddedGraphDatabase.createNode()


   
    EmbeddedGraphDatabase graphDB = ContextHelper.getGraphDatabase(servletContext);
   
    Transaction tx = graphDB.beginTx();
    try{
      userNode = graphDB.createNode();
      save();
     
      tx.success();
    } catch (Exception e){
      tx.failure();
View Full Code Here


    {
        String storeDir = "target/var/oldlog";
        deleteFileOrDirectory( storeDir );
        GraphDatabaseService db = new EmbeddedGraphDatabase( storeDir );
        Transaction tx = db.beginTx();
        db.createNode();
        tx.success();
        tx.finish();
       
        Pair<Pair<File, File>, Pair<File, File>> copy = copyLogicalLog( storeDir );
        decrementLogFormat( copy.other().other() );
View Full Code Here

        GraphDatabaseService db = new EmbeddedGraphDatabase( PATH );
        Node firstNode = db.getNodeById( first );
        Transaction tx = db.beginTx();
        for ( ; i < 5000000000L; i++ )
        {
            Node secondNode = db.createNode();
            firstNode.createRelationshipTo( secondNode, TYPE );
            firstNode = secondNode;
            if ( i % 100000 == 0 )
            {
                tx.success();
View Full Code Here

        GraphDatabaseService db = new EmbeddedGraphDatabase( PATH );
        Transaction tx = db.beginTx();
        Node prevNode = db.getReferenceNode();
        for ( int i = 0; i < 100; i++ )
        {
            Node node = db.createNode();
            Relationship rel = prevNode.createRelationshipTo( node, type );
            node.setProperty( "someKey" + i%10, i%15 );
            rel.setProperty( "since", System.currentTimeMillis() );
        }
        tx.success();
View Full Code Here

    public void testReadOnlyOperationsAndNoTransaction()
    {
        GraphDatabaseService db = new EmbeddedGraphDatabase( PATH );

        Transaction tx = db.beginTx();
        Node node1 = db.createNode();
        Node node2 = db.createNode();
        Relationship rel = node1.createRelationshipTo( node2, withName( "TEST" ) );
        node1.setProperty( "key1", "value1" );
        rel.setProperty( "key1", "value1" );
        tx.success();
View Full Code Here

    {
        GraphDatabaseService db = new EmbeddedGraphDatabase( PATH );

        Transaction tx = db.beginTx();
        Node node1 = db.createNode();
        Node node2 = db.createNode();
        Relationship rel = node1.createRelationshipTo( node2, withName( "TEST" ) );
        node1.setProperty( "key1", "value1" );
        rel.setProperty( "key1", "value1" );
        tx.success();
        tx.finish();
View Full Code Here

        tx.finish();
       
        // make sure write operations still throw exception
        try
        {
            db.createNode();
            fail( "Write operation and no transaction should throw exception" );
        }
        catch ( NotInTransactionException e )
        { // good
        }
View Full Code Here

        // START SNIPPET: operationsInATransaction
        // Encapsulate operations in a transaction
        Transaction tx = graphDb.beginTx();
        try
        {
            Node firstNode = graphDb.createNode();
            firstNode.setProperty( NAME_KEY, "Hello" );
            Node secondNode = graphDb.createNode();
            secondNode.setProperty( NAME_KEY, "World" );

            firstNode.createRelationshipTo( secondNode,
View Full Code Here

        Transaction tx = graphDb.beginTx();
        try
        {
            Node firstNode = graphDb.createNode();
            firstNode.setProperty( NAME_KEY, "Hello" );
            Node secondNode = graphDb.createNode();
            secondNode.setProperty( NAME_KEY, "World" );

            firstNode.createRelationshipTo( secondNode,
                ExampleRelationshipTypes.EXAMPLE );
View Full Code Here

        Transaction transaction = service.beginTx();
        try
        {
            RelationshipIndex index = service.index().forRelationships( "exact" );
            // ...creation of the nodes and relationship
            Node node1 = service.createNode();
            Node node2 = service.createNode();
            String a_uuid = "xyz";
            Relationship relationship = node1.createRelationshipTo( node2, DynamicRelationshipType.withName( "related" ) );
            index.add( relationship, "uuid", a_uuid );
            // query
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.