當前位置: 首頁>>代碼示例>>Java>>正文


Java GraphDatabaseFactory.newEmbeddedDatabase方法代碼示例

本文整理匯總了Java中org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase方法的典型用法代碼示例。如果您正苦於以下問題:Java GraphDatabaseFactory.newEmbeddedDatabase方法的具體用法?Java GraphDatabaseFactory.newEmbeddedDatabase怎麽用?Java GraphDatabaseFactory.newEmbeddedDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.neo4j.graphdb.factory.GraphDatabaseFactory的用法示例。


在下文中一共展示了GraphDatabaseFactory.newEmbeddedDatabase方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import org.neo4j.graphdb.factory.GraphDatabaseFactory; //導入方法依賴的package包/類
public static void main(String []args) {
        dbFact = new GraphDatabaseFactory();
        db= dbFact.newEmbeddedDatabase("gestionAvionsBD2");
        /*AjouterDepart ad = new AjouterDepart();
        ad.setLocationRelativeTo(null);
        ad.loadTableBD();
        ad.setVisible(true);*/
        
        MainWindow mainFen = new MainWindow();
        mainFen.setLocationRelativeTo(null);
        mainFen.setVisible(true);
            /*Node jNode = db.createNode(Tutorials.JAVAtest);
            Node jNode2 = db.createNode(Tutorials.Test2);
            jNode.setProperty("Id", "5");
            jNode2.setProperty("Id2", "10");11
            Relationship relat = jNode.createRelationshipTo(jNode2, Relations.Relation);
            relat.setProperty("Id", "15");
            tx.success();*/
}
 
開發者ID:ATF19,項目名稱:flight-management-system-java,代碼行數:20,代碼來源:Main.java

示例2: shouldLoadAndUseLuceneProvider

import org.neo4j.graphdb.factory.GraphDatabaseFactory; //導入方法依賴的package包/類
@Test
public void shouldLoadAndUseLuceneProvider() throws Exception
{
    // GIVEN
    File storeDir = testDirectory.graphDbDir();
    BatchInserter inserter = BatchInserters.inserter( storeDir );
    inserter.createDeferredSchemaIndex( LABEL ).on( "name" ).create();

    // WHEN
    inserter.createNode( map( "name", "Mattias" ), LABEL );
    inserter.shutdown();

    // THEN
    GraphDatabaseFactory graphDatabaseFactory = new TestGraphDatabaseFactory();
    GraphDatabaseAPI db = (GraphDatabaseAPI) graphDatabaseFactory.newEmbeddedDatabase( storeDir );
    DependencyResolver dependencyResolver = db.getDependencyResolver();
    SchemaIndexProvider schemaIndexProvider = dependencyResolver.resolveDependency(
            SchemaIndexProvider.class,
            SchemaIndexProvider.HIGHEST_PRIORITIZED_OR_NONE );

    // assert the indexProvider is a Lucene one
    try ( Transaction ignore = db.beginTx() )
    {
        IndexDefinition indexDefinition = single( db.schema().getIndexes( LABEL ) );
        assertThat( db.schema().getIndexState( indexDefinition ), is( Schema.IndexState.ONLINE ) );
        assertThat( schemaIndexProvider, instanceOf( LuceneSchemaIndexProvider.class ) );
    }

    // CLEANUP
    db.shutdown();
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-lucene5-index,代碼行數:32,代碼來源:TestLuceneSchemaBatchInsertIT.java

示例3: loadTopology

import org.neo4j.graphdb.factory.GraphDatabaseFactory; //導入方法依賴的package包/類
public static <V, E> Neo4jTopology loadTopology(Neo4jWorkspaceSettings settings) throws Exception {
    String db = DatabaseConfiguration.readDatabase(settings);
    Logger.getLogger(Neo4jWorkspace.class).info("using db " + db);

    // Get neo4j stuffs
    GraphDatabaseFactory factory = new GraphDatabaseFactory();
    GraphDatabaseService database = factory.newEmbeddedDatabase(db);
    GlobalGraphOperations operation = GlobalGraphOperations.at(database);

    ViewsManager views = new ViewsManager();
    views.load(settings);

    // Setup graph model
    Neo4jGraphModelIO gio = new Neo4jGraphModelIO();
    gio.read(SimpleFile.read(settings.getModelPath()));
    Neo4jGraphModel typeModel = gio.getGraphModel();

    // Build graph
    INeo4jGraphReader r = views.getFirst().getFilter();
    Graph<IPropertyNode, IPropertyEdge> graph = r.read(operation, typeModel);
    Logger.getLogger(Neo4jWorkspace.class).info("filtered graph has " + graph.getVertexCount() + " nodes using db " + db);

    // Build topology using graph typing model
    String topologyName = views.getFirst().getTopologyName();
    Neo4jTopologyFactory tfact = new Neo4jTopologyFactory();
    Neo4jTopology topology = tfact.newTopology(topologyName, graph, typeModel);

    return topology;
}
 
開發者ID:datagr4m,項目名稱:org.datagr4m,代碼行數:30,代碼來源:Neo4jWorkspace.java

示例4: main

import org.neo4j.graphdb.factory.GraphDatabaseFactory; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    String db = null;
    if(args.length>0){
        db = args[0];
    }
    else{
        System.err.println("requires the relative db path as parameter: data/databases/???");
        return;
    }
        
    // Get graph data to build model
    GraphDatabaseFactory f = new GraphDatabaseFactory();
    GraphDatabaseService s = f.newEmbeddedDatabase(db);
    GlobalGraphOperations o = GlobalGraphOperations.at(s);

    // Build all netscope models
    
    
    //Multimap<NodeType, Node> getNodeTypes(Collection<Node> nodes)
    
    String st = nodeTypes(getGraph(o));
    System.out.println(st);
    
    File dbf = new File(db);
    String pt = dbf.getParent() + "/" + dbf.getName() + "-types.ns";
    SimpleFile.write(st, pt);
    System.out.println("--------------");
    System.out.println("this was saved to " + pt);
}
 
開發者ID:datagr4m,項目名稱:org.datagr4m,代碼行數:30,代碼來源:Neo4jNodeTypeAnalysis.java

示例5: before

import org.neo4j.graphdb.factory.GraphDatabaseFactory; //導入方法依賴的package包/類
@Before
public void before(){
    Logger.getLogger(this.getClass()).info("using db " + TEST_DB);
    factory = new GraphDatabaseFactory();
    database = factory.newEmbeddedDatabase(TEST_DB);
    operation = GlobalGraphOperations.at(database);
}
 
開發者ID:datagr4m,項目名稱:org.datagr4m,代碼行數:8,代碼來源:TrialTestNeo4jTopologyEditorEmbeddedDb.java

示例6: Neo4jWorkspace

import org.neo4j.graphdb.factory.GraphDatabaseFactory; //導入方法依賴的package包/類
/**
 * Build full Neo4jWorkspace involving reading files given by settings:
 * <ul>
 * <li>neo4j database
 * <li>view
 * <li>graph model
 * <li>projection
 * </ul>
 * and build topology & geometrical model according to Neo4j factories
 * 
 * @param settings
 * @throws Exception
 */
public Neo4jWorkspace(Neo4jWorkspaceSettings settings) throws Exception {
	String db = DatabaseConfiguration.readDatabase(settings);
    Logger.getLogger(Neo4jWorkspace.class).info("using db " + db);

    // Get neo4j stuffs
    GraphDatabaseFactory factory = new GraphDatabaseFactory();
    database = factory.newEmbeddedDatabase(db);
    operation = GlobalGraphOperations.at(database);

    views = new ViewsManager();
    views.load(settings);
    layoutML = views.getFirst().getLayout();

    // Setup graph model
    Neo4jGraphModelIO gio = new Neo4jGraphModelIO();
    gio.read(SimpleFile.read(settings.getModelPath()));
    Neo4jGraphModel typeModel = gio.getGraphModel();

    // Build graph
    INeo4jGraphReader r = views.getFirst().getFilter();
    Graph<IPropertyNode, IPropertyEdge> graph = r.read(operation, typeModel);
    Logger.getLogger(Neo4jWorkspace.class).info("filtered graph has " + graph.getVertexCount() + " nodes using db " + db);

    // Build topology using graph typing model
    String topologyName = views.getFirst().getTopologyName();
    Neo4jTopologyFactory tfact = new Neo4jTopologyFactory();
    topology = tfact.newTopology(topologyName, graph, typeModel);

    // Edit topology according to dataprism
    Dataprism dp = loadDataprism(settings);
    if (dp != null)
        ((Neo4jTopology)topology).edit().apply(dp);

    // Build layout model
    modelFactory = new Neo4jModelFactory(gio.getGraphModel());
    model = (IHierarchicalNodeModel)modelFactory.getLayoutModel(topology);
    edgeModel = model.getEdgeModel();
    applyLayoutMLConfiguration(model, layoutML);
   
    // Build layout
    layoutFactory = new Neo4jLayoutFactory(typeModel);
    if (layoutML != null) {
        Map<String, String> mapping = extractModelLayoutMapping(layoutML);
        layoutFactory.setModelLayoutMapping(mapping);
    }

    layout = layoutFactory.getLayout(model);
    layout.getEdgeLayout().setEdgePostProcess(null);

    // finalize workspace
    annotationModel = new AnnotationModel();
    metadata = null;
    setName(settings.getName());
    loadMapIfExist();
    
    this.configuration = new ConfigurationFacade(this);
}
 
開發者ID:datagr4m,項目名稱:org.datagr4m,代碼行數:71,代碼來源:Neo4jWorkspace.java


注:本文中的org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。