Package org.neo4j.graphdb.factory

Examples of org.neo4j.graphdb.factory.GraphDatabaseFactory


public class FileDatastoreFactory implements DatastoreFactory<EmbeddedNeo4jDatastore> {

    @Override
    public EmbeddedNeo4jDatastore createGraphDatabaseService(URI uri, Properties properties) throws MalformedURLException {
        GraphDatabaseBuilder databaseBuilder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(uri.toURL().getPath());
        Properties neo4jProperties = Neo4jPropertyHelper.getNeo4jProperties(properties);
        for (String name : neo4jProperties.stringPropertyNames()) {
            databaseBuilder.setConfig(name, neo4jProperties.getProperty(name));
        }
        GraphDatabaseService graphDatabaseService = databaseBuilder.newGraphDatabase();
View Full Code Here


public class FileDatastoreFactory implements DatastoreFactory<EmbeddedNeo4jDatastore> {

    @Override
    public EmbeddedNeo4jDatastore createGraphDatabaseService(URI uri) throws MalformedURLException {
        GraphDatabaseService graphDatabaseService = new GraphDatabaseFactory().newEmbeddedDatabase(uri.toURL().getPath());
        registerShutdownHook(graphDatabaseService);
        return new EmbeddedNeo4jDatastore(graphDatabaseService);
    }
View Full Code Here

        this.databaseDirectory = databaseDirectory;
    }

    @Override
    protected GraphDatabaseService startDatabase() {
        return new GraphDatabaseFactory().newEmbeddedDatabase(databaseDirectory);
    }
View Full Code Here

    super.setUp();
    this.databasePath = getNeoPath().getAbsolutePath();
  }

  private void checkIndexAndFeatureCount(String layerName) throws IOException {
    GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(databasePath);
    try (Transaction tx = database.beginTx()) {
      SpatialDatabaseService spatial = new SpatialDatabaseService(database);
      Layer layer = spatial.getLayer(layerName);
      if (layer.getIndex().count() < 1) {
        System.out.println("Warning: index count zero: " + layer.getName());
View Full Code Here

    importer.setCharset(Charset.forName("UTF-8"));
    BatchInserter batchInserter = BatchInserters.inserter(databasePath);
    importer.importFile(batchInserter, "map.osm", false);
    batchInserter.shutdown();

    GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(databasePath);
    importer.reIndex(db);
    db.shutdown();
    // END SNIPPET: importOsm
  }
View Full Code Here

    System.out.println("\n=== Simple test map.osm ===");
    importMapOSM();

    // START SNIPPET: searchBBox
    GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(databasePath);
    try {
      SpatialDatabaseService spatialService = new SpatialDatabaseService(database);
      Layer layer = spatialService.getLayer("map.osm");
      LayerIndexReader spatialIndex = layer.getIndex();
      System.out.println("Have " + spatialIndex.count() + " geometries in " + spatialIndex.getBoundingBox());
View Full Code Here

    deleteDatabase(true);

    System.out.println("\n=== Test Import Shapefile ===");

    // START SNIPPET: importShapefile
    GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(databasePath);
    try {
      ShapefileImporter importer = new ShapefileImporter(database);
      importer.importFile("shp/highway.shp", "highway", Charset.forName("UTF-8"));
    } finally {
      database.shutdown();
View Full Code Here

    deleteDatabase(true);

    System.out.println("\n=== Test import map.osm, create DynamicLayer and export shapefile ===");
    importMapOSM();

    GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(databasePath);
    try {
      // START SNIPPET: exportShapefileFromOSM
            SpatialDatabaseService spatialService = new SpatialDatabaseService(database);
            try (Transaction tx = database.beginTx()) {
          OSMLayer layer = (OSMLayer) spatialService.getLayer("map.osm");
View Full Code Here

    deleteDatabase(true);

    System.out.println("\n=== Test import map.osm, create DynamicLayer and export shapefile ===");
    importMapOSM();

    GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(databasePath);
    try {
      // START SNIPPET: exportShapefileFromQuery
      SpatialDatabaseService spatialService = new SpatialDatabaseService(database);
      Layer layer = spatialService.getLayer("map.osm");
      LayerIndexReader spatialIndex = layer.getIndex();
View Full Code Here

    } else {
      layerName = args[2];
      commitInterval = Integer.parseInt(args[3]);
    }
   
    GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(neoPath);
    try {
          ShapefileImporter importer = new ShapefileImporter(database, new NullListener(), commitInterval);
          importer.importFile(shpPath, layerName);
      } finally {
      database.shutdown();
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.