Package org.neo4j.graphdb

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


        }
        finally
        {
            transaction.finish();
        }
        assertFalse( graphDb.index().existsForNodes( "actors" ) );
        graphDb.shutdown();
    }

    @Test
    public void removeFromIndex()
View Full Code Here


    {
        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();
            Node node2 = service.createNode();
            String a_uuid = "xyz";
            Relationship relationship = node1.createRelationshipTo( node2, DynamicRelationshipType.withName( "related" ) );
View Full Code Here

   
    @Test
    public void testRecovery() throws Exception
    {
        final GraphDatabaseService graphDb = newGraphDbService();
        final Index<Node> nodeIndex = graphDb.index().forNodes( "node-index" );
        final Index<Relationship> relIndex = graphDb.index().forRelationships( "rel-index" );
        final RelationshipType relType = DynamicRelationshipType.withName( "recovery" );
       
        graphDb.beginTx();
        Random random = new Random();
View Full Code Here

    @Test
    public void testRecovery() throws Exception
    {
        final GraphDatabaseService graphDb = newGraphDbService();
        final Index<Node> nodeIndex = graphDb.index().forNodes( "node-index" );
        final Index<Relationship> relIndex = graphDb.index().forRelationships( "rel-index" );
        final RelationshipType relType = DynamicRelationshipType.withName( "recovery" );
       
        graphDb.beginTx();
        Random random = new Random();
        Thread stopper = new Thread()
View Full Code Here

      Thread.sleep( 6000 );
      process.destroy();
      process.waitFor();
     
      GraphDatabaseService db = new EmbeddedGraphDatabase( path );
      assertTrue( db.index().existsForNodes( "myIndex" ) );
      Index<Node> index = db.index().forNodes( "myIndex" );
      for ( Node node : db.getAllNodes() )
      {
          for ( String key : node.getPropertyKeys() )
          {
View Full Code Here

      process.destroy();
      process.waitFor();
     
      GraphDatabaseService db = new EmbeddedGraphDatabase( path );
      assertTrue( db.index().existsForNodes( "myIndex" ) );
      Index<Node> index = db.index().forNodes( "myIndex" );
      for ( Node node : db.getAllNodes() )
      {
          for ( String key : node.getPropertyKeys() )
          {
              String value = (String) node.getProperty( key );
View Full Code Here

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

   
    @Test
    public void testIndexDeleteIssue() throws Exception
    {
        GraphDatabaseService db = newGraphDbService();
        db.index().forNodes( "index" );
        db.shutdown();
       
        assertEquals( 0, Runtime.getRuntime().exec( new String[] { "java", "-cp", System.getProperty( "java.class.path" ),
                AddDeleteQuit.class.getName(), getDbPath() } ).waitFor() );
       
View Full Code Here

public class AddDeleteQuit
{
    public static void main( String[] args )
    {
        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" );
View Full Code Here

    public static void main( String[] args )
    {
        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();
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.