当前位置: 首页>>代码示例>>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;未经允许,请勿转载。