Examples of EmbeddedGraphDatabase


Examples of org.neo4j.collections.graphdb.impl.EmbeddedGraphDatabase

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

Examples of org.neo4j.kernel.EmbeddedGraphDatabase

            switch (type) {
                case IN_MEMORY:
                    instance = new ContextTrackingServiceImpl(new ImpermanentGraphDatabase(defaultDB));
                    break;
                case EMBEDDED:
                    instance = new ContextTrackingServiceImpl(new EmbeddedGraphDatabase(defaultDB));
                    break;
                case REST:
                    instance = new ContextTrackingServiceRest(SERVER_BASE_URL);
                    break;
                default:
View Full Code Here

Examples of org.neo4j.kernel.EmbeddedGraphDatabase

    private static enum RelTypes implements RelationshipType {
        KNOWS, OWNED
    }

    private void initDatabase() {
        graphDb = new EmbeddedGraphDatabase(new File("mydb").getAbsolutePath());
        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() {
                System.out.println("shutting down the database");
                graphDb.shutdown();
            }
View Full Code Here

Examples of org.neo4j.kernel.EmbeddedGraphDatabase

    this.databaseDirectory = configuredDirectory!= null ? configuredDirectory: "/tmp/database";
  }
 
  @PostConstruct
  public void initialize() {
    db = new EmbeddedGraphDatabase(databaseDirectory);
  }
View Full Code Here

Examples of org.neo4j.kernel.EmbeddedGraphDatabase

    private static AbstractGraphDatabase graphDatabase;
    private static NeoServer neoServer;

    @BeforeClass
    public static void startServerWithACleanDb() {
        graphDatabase = new EmbeddedGraphDatabase("target/db1");

        ServerConfigurator config = new ServerConfigurator(graphDatabase);
        config.configuration().setProperty("org.neo4j.server.thirdparty.delete.key", "secret-key");
        config.getThirdpartyJaxRsClasses().add(new ThirdPartyJaxRsPackage("org.neo4j.server.extension.test.delete", "/cleandb"));
View Full Code Here

Examples of org.neo4j.kernel.EmbeddedGraphDatabase

    public Neo4jGraph(final String directory, final Map<String, String> configuration) {
        boolean fresh = !new File(directory).exists();
        try {
            if (null != configuration)
                this.rawGraph = new EmbeddedGraphDatabase(directory, configuration);
            else
                this.rawGraph = new EmbeddedGraphDatabase(directory);

            if (fresh)
                this.freshLoad();

            this.loadKeyIndices();
View Full Code Here

Examples of org.neo4j.kernel.EmbeddedGraphDatabase

         if (fileConfiguration != null)
            path = new File(fileConfiguration.dataDirectory(), config.get().identity().get()).getAbsolutePath();
         else
            path = "build/neodb";
      }
      neo = new EmbeddedGraphDatabase(path);
      indexService = new LuceneIndexService(neo);
      uuid = UUID.randomUUID().toString() + "-";
   }
View Full Code Here

Examples of org.neo4j.kernel.EmbeddedGraphDatabase

        @Override
        public void startDatabase()
            throws Exception
        {
            String path = new File( config.dataDirectory(), identity().get() ).getAbsolutePath();
            db = new EmbeddedGraphDatabase( path );
        }
View Full Code Here

Examples of org.neo4j.kernel.EmbeddedGraphDatabase

            deleteDir(NEO4J_FOLDER);
        }


        //Init Neo4j database
        GraphDatabaseService db = new EmbeddedGraphDatabase(NEO4J_FOLDER);


        //Import OSM data into the Neo4j database
        new OsmImporter(db).importXML(OSM_MAP);


        //Optimize previously loaded database
        GlobalGraphOperations graphOperations = GlobalGraphOperations.at(db);
        System.out.printf("BEFORE OPTIMIZE nodes =  %d  ways = %d  \n", nodesCount(graphOperations), relCount(graphOperations));

        new OsmRoutingOptimizer(db).optimize();
        System.out.printf("AFTER OPTIMIZE nodes =  %d  ways = %d  \n", nodesCount(graphOperations), relCount(graphOperations));


        //Find route
        List<LineString> route = new RouteCalculator().findRoute(getStartNode(db), getEndNode(db));


        //Dump route to KML
        KmlBuilder kmlBuilder = new KmlBuilder();
        kmlBuilder.start();
        kmlBuilder.addPoint(getCoordinate(getStartNode(db)), "START");
        for (LineString lineString : route) {
            kmlBuilder.addLineString(lineString, "");
        }
        kmlBuilder.addPoint(getCoordinate(getEndNode(db)), "FINISH");
        kmlBuilder.finish();
        kmlBuilder.writeToFile(new File("siem-reap.kml"));


        //Close Neo4j
        db.shutdown();

    }
View Full Code Here

Examples of org.neo4j.kernel.EmbeddedGraphDatabase

        if(newDb){
            clearDb();
        }
        // START SNIPPET: startDb
        //graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( DB_PATH );
        graphDb = new EmbeddedGraphDatabase( DB_PATH );  
        ID_KEY = idKey;
        idIndex = graphDb.index().forNodes(ID_KEY);
        registerShutdownHook( graphDb );
        // END SNIPPET: startDb     
    }
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.