本文整理匯總了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();*/
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}