Package org.neo4j.graphdb.factory

Examples of org.neo4j.graphdb.factory.GraphDatabaseBuilder


    configuration = properties;
  }

  @Override
  public GraphDatabaseService create() {
    GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder( dbLocation );
    setConfigurationFromLocation( builder, configurationLocation );
    setConfigurationFromProperties( builder, configuration );
    return builder.newGraphDatabase();
  }
View Full Code Here


        console.start(port);
        console.join();
    }

    private static GraphDatabaseService embeddedGraphDatabase(String path, boolean expose) {
        GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(path);
        if (!expose) {
            builder.setConfig(GraphDatabaseSettings.read_only,"true");
        }
        return builder.newGraphDatabase();
    }
View Full Code Here

    configuration = properties;
  }

  @Override
  public GraphDatabaseService create() {
    GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder( dbLocation );
    setConfigurationFromLocation( builder, configurationLocation );
    setConfigurationFromProperties( builder, configuration );
    return builder.newGraphDatabase();
  }
View Full Code Here

    configuration = properties;
  }

  @Override
  public GraphDatabaseService create() {
    GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder( dbLocation );
    setConfigurationFromLocation( builder, configurationLocation );
    setConfigurationFromProperties( builder, configuration );
    return builder.newGraphDatabase();
  }
View Full Code Here

    }

    private void removeReferenceNodeAndFinalizeKeyIndices() {
        GraphDatabaseService rawGraphDB = null;
        try {
            GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(this.rawGraph.getStoreDir());
            if (this.vertexIndexKeys.size() > 0)
                builder.setConfig(GraphDatabaseSettings.node_keys_indexable, vertexIndexKeys.toString().replace("[", "").replace("]", "")).setConfig(GraphDatabaseSettings.node_auto_indexing, "true");
            if (this.edgeIndexKeys.size() > 0)
                builder.setConfig(GraphDatabaseSettings.relationship_keys_indexable, edgeIndexKeys.toString().replace("[", "").replace("]", "")).setConfig(GraphDatabaseSettings.relationship_auto_indexing, "true");

            rawGraphDB = builder.newGraphDatabase();

            Transaction tx = rawGraphDB.beginTx();
            try {
                GlobalGraphOperations graphOperations = GlobalGraphOperations.at(rawGraphDB);
                if (this.vertexIndexKeys.size() > 0)
View Full Code Here

        init();
    }

    public Neo4j2Graph(final String directory, final Map<String, String> configuration) {
        try {
            GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(directory);
            if (null != configuration)
                this.rawGraph = builder.setConfig(configuration).newGraphDatabase();
            else
                this.rawGraph = builder.newGraphDatabase();

            transactionManager = ((GraphDatabaseAPI) rawGraph).getDependencyResolver().resolveDependency(TransactionManager.class);
            cypher = new ExecutionEngine(rawGraph);

            init();
View Full Code Here

    }

    private void removeReferenceNodeAndFinalizeKeyIndices() {
        GraphDatabaseService rawGraphDB = null;
        try {
            GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(this.rawGraph.getStoreDir());
            if (this.vertexIndexKeys.size() > 0)
                builder.setConfig(GraphDatabaseSettings.node_keys_indexable, vertexIndexKeys.toString().replace("[", "").replace("]", "")).setConfig(GraphDatabaseSettings.node_auto_indexing, GraphDatabaseSetting.TRUE);
            if (this.edgeIndexKeys.size() > 0)
                builder.setConfig(GraphDatabaseSettings.relationship_keys_indexable, edgeIndexKeys.toString().replace("[", "").replace("]", "")).setConfig(GraphDatabaseSettings.relationship_auto_indexing, GraphDatabaseSetting.TRUE);

            rawGraphDB = builder.newGraphDatabase();
            Transaction tx = rawGraphDB.beginTx();

            try {
                rawGraphDB.getReferenceNode().delete();
                tx.success();
View Full Code Here

    }
  }

  @Override
  public GraphDatabaseService create() {
    GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder( dbLocation );
    setConfigurationFromLocation( builder, configurationLocation );
    setConfigurationFromProperties( builder, configuration );
    return builder.newGraphDatabase();
  }
View Full Code Here

  @Override
  public void initialize(final StructrConf config) {

    final String dbPath                = config.getProperty(Services.DATABASE_PATH);
    final GraphDatabaseBuilder builder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(dbPath);

    logger.log(Level.INFO, "Initializing database ({0}) ...", dbPath);

    if (graphDb != null) {

      logger.log(Level.INFO, "Database already running ({0}) ...", dbPath);

      return;

    }

    final File confFile = new File(dbPath + "/neo4j.conf");
    if (confFile.exists()) {

      builder.loadPropertiesFromFile(confFile.getAbsolutePath());
    }

    // neo4j remote shell configuration
    builder.setConfig(ShellSettings.remote_shell_enabled, config.getProperty(Services.NEO4J_SHELL_ENABLED, "false"));
    builder.setConfig(ShellSettings.remote_shell_port,    config.getProperty(Services.NEO4J_SHELL_PORT, "1337"));

    // create graph database instance
    graphDb = builder.newGraphDatabase();

    // success?
    if (graphDb == null) {

      logger.log(Level.SEVERE, "Database could not be started ({0}) ...", dbPath);
View Full Code Here

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();
        return new EmbeddedNeo4jDatastore(graphDatabaseService);
    }
View Full Code Here

TOP

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

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.