Package org.neo4j.graphdb

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


    public void inabilityToStartFromOldFormatFromNonCleanShutdown() throws Exception
    {
        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 );
View Full Code Here


        System.out.println( "Switch to embedded" );
       
        // Then create the rest with embedded graph db.
        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;
View Full Code Here

            if ( i % 100000 == 0 )
            {
                tx.success();
                tx.finish();
                System.out.println( (i/1000000) + "M" );
                tx = db.beginTx();
            }
        }
       
        // Here we have a huge db. Loop through it and count chain length.
/*        long count = 0;
View Full Code Here

    {
        DbRepresentation someData = createSomeData();
        GraphDatabaseService readGraphDb = new EmbeddedReadOnlyGraphDatabase( PATH );
        assertEquals( someData, DbRepresentation.of( readGraphDb ) );

        Transaction tx = readGraphDb.beginTx();
        try
        {
            readGraphDb.createNode();
        }
        catch ( ReadOnlyDbException e )
View Full Code Here

   
    private DbRepresentation createSomeData()
    {
        DynamicRelationshipType type = withName( "KNOWS" );
        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 );
View Full Code Here

    @Test
    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" );
View Full Code Here

    @Test
    public void deleteIndex()
    {
        GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "target/graphdb-delete" );
        Transaction transaction = graphDb.beginTx();
        try
        {
            // START SNIPPET: delete
            IndexManager index = graphDb.index();
            Index<Node> actors = index.forNodes( "actors" );
View Full Code Here

    }

    private DbRepresentation addMoreData( String path )
    {
        GraphDatabaseService db = startGraphDatabase( path );
        Transaction tx = db.beginTx();
        Node node = db.createNode();
        node.setProperty( "backup", "Is great" );
        db.getReferenceNode().createRelationshipTo( node,
                DynamicRelationshipType.withName( "LOVES" ) );
        tx.success();
View Full Code Here

    }

    private DbRepresentation createInitialDataSet( String path )
    {
        GraphDatabaseService db = startGraphDatabase( path );
        Transaction tx = db.beginTx();
        Node node = db.createNode();
        node.setProperty( "myKey", "myValue" );
        db.getReferenceNode().createRelationshipTo( node,
                DynamicRelationshipType.withName( "KNOWS" ) );
        tx.success();
View Full Code Here

{
    @Test
    public void question5346011()
    {
        GraphDatabaseService service = new EmbeddedGraphDatabase( "target/soquestion-test" );
        Transaction transaction = service.beginTx();
        try
        {
            RelationshipIndex index = service.index().forRelationships( "exact" );
            // ...creation of the nodes and relationship
            Node node1 = service.createNode();
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.