Package org.neo4j.kernel

Examples of org.neo4j.kernel.EmbeddedGraphDatabase


    private static AbstractGraphDatabase graphdb;

    @BeforeClass
    public static void startDb()
    {
        graphdb = new EmbeddedGraphDatabase( "target" + File.separator + "var" + File.separator
                                             + DescriptionTest.class.getSimpleName() );
    }
View Full Code Here


        at( args[0] );
    }

    public static void at( String storeDir )
    {
        new EmbeddedGraphDatabase( storeDir ).shutdown();
    }
View Full Code Here

   
    private void startDb( String backupConfigValue )
    {
        if ( backupConfigValue == null )
        {
            db = new EmbeddedGraphDatabase( PATH );
        }
        else
        {
            db = new EmbeddedGraphDatabase( PATH, stringMap( ENABLE_ONLINE_BACKUP, backupConfigValue ) );
        }
        createSomeData( db );
    }
View Full Code Here

    @BeforeClass
    public static void setUpGraphDb() throws Exception
    {
        String storeDir = "target/var/algotest";
        deleteFileOrDirectory( new File( storeDir ) );
        graphDb = new EmbeddedGraphDatabase( storeDir );
        graph = new SimpleGraphBuilder( graphDb, MyRelTypes.R1 );
    }
View Full Code Here

    // END SNIPPET: createReltype

    public static void main( final String[] args )
    {
        // START SNIPPET: startDb
        GraphDatabaseService graphDb = new EmbeddedGraphDatabase( DB_PATH );
        registerShutdownHook( graphDb );
        // END SNIPPET: startDb

        // 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,
                ExampleRelationshipTypes.EXAMPLE );

            String greeting = firstNode.getProperty( NAME_KEY ) + " "
                + secondNode.getProperty( NAME_KEY );
            System.out.println( greeting );
            // END SNIPPET: operationsInATransaction

            // START SNIPPET: removingData
            // let's remove the data before committing
            firstNode.getSingleRelationship( ExampleRelationshipTypes.EXAMPLE,
                    Direction.OUTGOING ).delete();
            firstNode.delete();
            secondNode.delete();

            tx.success();
        }
        finally
        {
            tx.finish();
        }
        // END SNIPPET: removingData

        System.out.println( "Shutting down database ..." );
        // START SNIPPET: shutdownServer
        graphDb.shutdown();
        // END SNIPPET: shutdownServer
    }
View Full Code Here

        return result;
    }

    private GraphDatabaseService startGraphDatabase( String path )
    {
        return new EmbeddedGraphDatabase( path, stringMap(
                Config.KEEP_LOGICAL_LOGS, "true" ) );
    }
View Full Code Here

    @BeforeClass
    public static final void beforeSuite()
    {
        deleteFileOrDirectory( new File( TARGET_NEODB ) );
        graphdb = new EmbeddedGraphDatabase( TARGET_NEODB );
    }
View Full Code Here

    @BeforeClass
    public static void setUpDb()
    {
        Neo4jTestCase.deleteFileOrDirectory( new File( "target/graphdb" ) );
        graphDb = new EmbeddedGraphDatabase( "target/graphdb" );
        Transaction transaction = graphDb.beginTx();
        try
        {
            // START SNIPPET: createIndices
            IndexManager index = graphDb.index();
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" );
            actors.delete();
            // END SNIPPET: delete
            transaction.success();
        }
        finally
        {
            transaction.finish();
        }
        assertFalse( graphDb.index().existsForNodes( "actors" ) );
        graphDb.shutdown();
    }
View Full Code Here

    @BeforeClass
    public static void setUpDb() throws Exception
    {
        deleteFileOrDirectory( dbPath );
        graphDb = new EmbeddedGraphDatabase( dbPath.getAbsolutePath() );
    }
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.EmbeddedGraphDatabase

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.