Package org.neo4j.graphdb.factory

Examples of org.neo4j.graphdb.factory.GraphDatabaseFactory


  protected SpatialDatabaseService setDataset(String dataset) {
    this.dataset = dataset;
    if (db != null) {
      shutdownDatabase();
    }
    db = new GraphDatabaseFactory().newEmbeddedDatabase("var/" + dataset);
    return new SpatialDatabaseService(db);
  }
View Full Code Here


    private static long n2Id = 0L;

    @Before
    public void setUp() throws Exception {
        storePrefix++;
      graphDb = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(getNeoPath().getAbsolutePath()).newGraphDatabase();
      buildDataModel();
    }
View Full Code Here

      throw new IOException("The parameters map isn't correct!!");
    }
   
      File neodir = (File) DIRECTORY.lookUp(params);

    GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(neodir.getAbsolutePath());
    Neo4jSpatialDataStore dataStore = new Neo4jSpatialDataStore(db);

    return dataStore;
  }
View Full Code Here

        }
        if (useBatchInserter) {
            batchInserter = BatchInserters.inserter(getNeoPath().getAbsolutePath(), config);
            graphDb = new SpatialBatchGraphDatabaseService(batchInserter);
        } else {
            graphDb = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(getNeoPath().getAbsolutePath()).setConfig( config ).newGraphDatabase();
        }
        if (autoTx) {
            // with the batch inserter the tx is a dummy that simply succeeds all the time
            tx = graphDb.beginTx();
        }
View Full Code Here

      System.out.println("No database["+dbPath+"] or osm["+osmPath+"] - cannot run test");
    }
  }
 
  private void importShapefileDatabase(String shpPath, String dbPath, String layerName) throws ShapefileException, FileNotFoundException, IOException {
    GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(dbPath).setConfig(Neo4jTestCase.LARGE_CONFIG ).newGraphDatabase();
        ShapefileImporter importer = new ShapefileImporter(graphDb, new ConsoleListener(), 10000, true);
        importer.setFilterEnvelope(makeFilterEnvelope());
        importer.importFile(shpPath, layerName, Charset.forName("UTF-8"));
        graphDb.shutdown();
  }
View Full Code Here

      for (int i = 0; i < 3; i++) {
        System.gc();
        Thread.sleep(1000);
      }
    }
    GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(dbPath).setConfig(Neo4jTestCase.LARGE_CONFIG ).newGraphDatabase();
    importer.reIndex(graphDb, 10000, false, false);
    TestOSMImport.checkOSMLayer(graphDb, layerName);
    graphDb.shutdown();
  }
View Full Code Here

      return name + "\t" + duration;
    }
  }

  private void runTestPointSetGeoptimaIntersection(String tracePath, String dbPath, String layerName, boolean testMultiPoint) throws ParseException, IOException, XMLStreamException {
    GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(dbPath).setConfig( Neo4jTestCase.NORMAL_CONFIG ).newGraphDatabase();
    SpatialDatabaseService spatial = new SpatialDatabaseService(graphDb);
        System.out.println("Opened database with node count=" + ((GraphDatabaseAPI) graphDb).getDependencyResolver().resolveDependency(NodeManager.class).getNumberOfIdsInUse(Node.class));
    System.out.println("Searching for '"+layerName+"' in "+spatial.getLayerNames().length+" layers:");
    for(String name:spatial.getLayerNames()){
      System.out.println("\t"+name);
View Full Code Here

    }
    String database = args[0];
    String exportdir = args[1];
    String stylefile = args[2];
    double zoom = new Double(args[3]);
    GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(database);
    try {
      StyledImageExporter imageExporter = new StyledImageExporter(db);
      imageExporter.setExportDir(exportdir);
      imageExporter.setZoom(zoom);
      imageExporter.setSize(800, 600);
View Full Code Here

     *
     * @param performanceTest to create a database for.
     * @param params          with which the test will be run.
     */
    private void createDatabase(PerformanceTest performanceTest, Map<String, Object> params) {
        GraphDatabaseBuilder graphDatabaseBuilder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(temporaryFolder.getRoot().getPath());

        Map<String, String> dbConfig = performanceTest.databaseParameters(params);
        if (dbConfig != null) {
            graphDatabaseBuilder = graphDatabaseBuilder.setConfig(dbConfig);
        }
View Full Code Here

        assertEquals("Two", batchInserter.getNodeProperties(iterator.next()).get("name"));
    }

    @Test
    public void shouldReturnAllNodesFromTheDatabaseWithGaps() {
        GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(temporaryFolder.getRoot().getAbsolutePath());

        new SimpleTransactionExecutor(database).executeInTransaction(new VoidReturningCallback() {
            @Override
            protected void doInTx(GraphDatabaseService database) {
                Node node1 = database.createNode();
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.factory.GraphDatabaseFactory

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.