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();*/
}
java类org.neo4j.graphdb.factory.GraphDatabaseFactory的实例源码
Main.java 文件源码
项目:flight-management-system-java
阅读 20
收藏 0
点赞 0
评论 0
Neo4jBatchInserterNodeTest.java 文件源码
项目:neo4j-talend-component
阅读 21
收藏 0
点赞 0
评论 0
@Test
public void insert_node_should_succeed_with_populated_index() throws Exception {
Neo4jBatchInserterNode nodeInserter = getNeo4jBatchInserterNode(false);
// populate the db
List<String> columns = DummyTalendPojo.getColumnList();
for (int i = 0; i < 100; i++) {
DummyTalendPojo pojo = DummyTalendPojo.getDummyTalendPojo();
nodeInserter.create(pojo, columns);
}
nodeInserter.finish();
// check if index size
Assert.assertEquals(100, batchDb.batchInserterIndexes.get(INDEX_NAME).query("*:*").size());
// check the database data
batchDb.shutdown();
// Testing it with real graphdb
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(dbPath);
try (Transaction tx = graphDb.beginTx()) {
String result = graphDb.execute("MATCH (n:" + LABEL_NAME + ") RETURN count(n) AS count").resultAsString();
Assert.assertEquals("+-------+\n| count |\n+-------+\n| 100 |\n+-------+\n1 row\n", result);
}
graphDb.shutdown();
}
Neo4jBatchInserterNodeTest.java 文件源码
项目:neo4j-talend-component
阅读 21
收藏 0
点赞 0
评论 0
@Test
public void update_node_should_succeed() throws Exception {
// populate the db
Neo4jBatchInserterNode nodeInserter = getNeo4jBatchInserterNode(false);
List<String> columns = DummyTalendPojo.getColumnList();
DummyTalendPojo pojo = DummyTalendPojo.getDummyTalendPojo();
nodeInserter.create(pojo, columns);
nodeInserter.finish();
// By indexing the import id, I update the last node
pojo.propString = "A new String";
nodeInserter = getNeo4jBatchInserterNode(true);
nodeInserter.create(pojo, columns);
nodeInserter.finish();
// check the result into the database
batchDb.shutdown();
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(dbPath);
try (Transaction tx = graphDb.beginTx()) {
String result = graphDb.execute("MATCH (n:" + LABEL_NAME + ") WHERE exists(n.id) RETURN n.propString AS string").resultAsString();
Assert.assertEquals("+----------------+\n| string |\n+----------------+\n| \"A new String\" |\n+----------------+\n1 row\n", result);
}
graphDb.shutdown();
}
Neo4jBatchDatabaseTest.java 文件源码
项目:neo4j-talend-component
阅读 21
收藏 0
点赞 0
评论 0
@Test
public void create_node_uniqueness_constraint_should_work() {
// Test const.
String label = "Test";
String property = "myProp";
// crete the schema
batchDb.createSchema("NODE_PROPERTY_UNIQUE", label, property);
batchDb.shutdown();
// Testing it with real graphdb
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(dbPath);
try (Transaction tx = graphDb.beginTx()) {
Assert.assertTrue(graphDb.schema().getConstraints(DynamicLabel.label(label)).iterator().hasNext());
}
graphDb.shutdown();
}
Neo4jBatchDatabaseTest.java 文件源码
项目:neo4j-talend-component
阅读 20
收藏 0
点赞 0
评论 0
@Test
public void create_node_index_should_work() {
// Test const.
String label = "Test";
String property = "myProp";
// crete the schema
batchDb.createSchema("NODE_PROPERTY_INDEX", label, property);
batchDb.shutdown();
// Testing it with real graphdb
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(dbPath);
try (Transaction tx = graphDb.beginTx()) {
Assert.assertTrue(graphDb.schema().getIndexes(DynamicLabel.label(label)).iterator().hasNext());
}
graphDb.shutdown();
}
Neo4jEventHandlerTest.java 文件源码
项目:neo4j-couchbase-connector
阅读 20
收藏 0
点赞 0
评论 0
@Test
public void shouldTransformCypherAlbumsToJSONDoc() throws SQLException {
// GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();
GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(new File("/Applications/Development/Neo4j-2.3.2/neo4j-community-2.3.2/data/graph.db"));
database.registerTransactionEventHandler(new Neo4jEventListener(database));
String cypher = "MATCH (n) "
+ "WHERE n.name = \"Volcano\" "
+ "WITH n "
+ "SET n.explicit = true "
+ "RETURN n";
try (Transaction tx = database.beginTx()) {
database.execute(cypher);
tx.success();
}
}
KnowledgeGraph.java 文件源码
项目:artificial-guy
阅读 21
收藏 0
点赞 0
评论 0
@SuppressWarnings("deprecation")
public KnowledgeGraph(String db_path) {
this.db_path = new String(db_path);
// delete data from previous runs
try {
FileUtils.deleteRecursively(new File(this.db_path));
} catch (IOException e) {
e.printStackTrace();
}
// create a neo4j database
this.graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(this.db_path);
registerShutdownHook(graphDb);
}
TestRelReader.java 文件源码
项目:umls-graph-api
阅读 19
收藏 0
点赞 0
评论 0
@Test
public void testRelReader() throws IOException{
RelReader reader = new RelReader(neo4jLocation);
reader.batchBuildGraph(new File("my_test_umls/"), "CtakesAllTuis.txt", "SNOMEDCT_US");
GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(new File(neo4jLocation));
try ( Transaction tx = db.beginTx() ){
TraversalDescription td = db.traversalDescription()
.breadthFirst()
.relationships(RelReader.RelTypes.ISA, Direction.INCOMING)
.evaluator(Evaluators.excludeStartPosition());
Node cuiNode = db.findNode(RelReader.DictLabels.Concept, RelReader.CUI_PROPERTY, "C0007102");
Assert.assertNotNull(cuiNode);
Traverser traverser = td.traverse(cuiNode);
for(Path path : traverser){
System.out.println("At depth " + path.length() + " => " + path.endNode().getProperty("cui"));
}
}
db.shutdown();
}
BiDiDi.java 文件源码
项目:NeoDD
阅读 22
收藏 0
点赞 0
评论 0
public GraphDatabaseService connect() {
if (null == graph) {
graph = new GraphDatabaseFactory().newEmbeddedDatabase(path);
try (Transaction tx = graph.beginTx()) {
graph.schema().indexFor(LABEL).on(ID).create();
tx.success();
}
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
graph.shutdown();
}
});
}
return graph;
}
Application.java 文件源码
项目:NeoDD
阅读 25
收藏 0
点赞 0
评论 0
private void createDb() {
graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH);
registerShutdownHook(graphDb);
try (Transaction tx = graphDb.beginTx()) {
// Database operations go here
firstNode = graphDb.createNode();
firstNode.setProperty("message", "Hello, ");
secondNode = graphDb.createNode();
secondNode.setProperty("message", "World!");
relationship = firstNode.createRelationshipTo(secondNode, RelTypes.KNOWS);
relationship.setProperty("message", "brave Neo4j ");
System.out.print(firstNode.getProperty("message"));
System.out.print(relationship.getProperty("message"));
System.out.print(secondNode.getProperty("message"));
greeting = ((String) firstNode.getProperty("message")) + ((String) relationship.getProperty("message"))
+ ((String) secondNode.getProperty("message"));
tx.success();
}
}
GraphOwlVisitorTransactionalGraphTest.java 文件源码
项目:SciGraph
阅读 19
收藏 0
点赞 0
评论 0
@Override
protected GraphTransactionalImpl createInstance() throws Exception {
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(new File(path));
Neo4jConfiguration config = new Neo4jConfiguration();
config.getExactNodeProperties().addAll(newHashSet(
NodeProperties.LABEL,
Concept.SYNONYM,
Concept.ABREVIATION,
Concept.ACRONYM));
config.getIndexedNodeProperties().addAll(newHashSet(
NodeProperties.LABEL,
Concept.CATEGORY, Concept.SYNONYM,
Concept.ABREVIATION,
Concept.ACRONYM));
Neo4jModule.setupAutoIndexing(graphDb, config);
IdMap idMap = new IdMap();
RelationshipMap relationahipMap = new RelationshipMap();
return new GraphTransactionalImpl(graphDb, idMap, relationahipMap);
}
BatchOwlLoaderIT.java 文件源码
项目:SciGraph
阅读 16
收藏 0
点赞 0
评论 0
@Test
public void test() throws Exception {
OwlLoadConfiguration config = new OwlLoadConfiguration();
Neo4jConfiguration neo4jConfig = new Neo4jConfiguration();
neo4jConfig.setLocation(folder.getRoot().getAbsolutePath());
config.setGraphConfiguration(neo4jConfig);
OntologySetup ontSetup = new OntologySetup();
ontSetup.setUrl("http://127.0.0.1:10000/main.owl");
config.getOntologies().add(ontSetup);
BatchOwlLoader.load(config);
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(folder.getRoot());
graphDb.beginTx();
GraphvizWriter writer = new GraphvizWriter();
Walker walker = Walker.fullGraph(graphDb);
writer.emit(new File("/tmp/test.dot"), walker);
}
WikiNerGraphConnector.java 文件源码
项目:WikiN-G-ER
阅读 22
收藏 0
点赞 0
评论 0
private WikiNerGraphConnector(String dbDir) {
graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(dbDir);
IndexDefinition indexDefinition;
Schema schema;
Transaction tx = graphDb.beginTx();
schema = graphDb.schema();
IndexManager index = graphDb.index();
entities = index.forNodes(entityLabel.name());
cities = index.forNodes(cityLabel.name());
try{
indexDefinition = schema.indexFor( entityLabel ).on( "nameType" ).create();
}catch(Exception e){
}
tx.success();
tx.close();
}
Neo4jGraph.java 文件源码
项目:octotron_core
阅读 21
收藏 0
点赞 0
评论 0
private void DBInit()
{
graph_db = new GraphDatabaseFactory()
.newEmbeddedDatabaseBuilder(db_name)
.setConfig(GraphDatabaseSettings.keep_logical_logs, "false")
.setConfig(GraphDatabaseSettings.use_memory_mapped_buffers, "true")
.setConfig(ShellSettings.remote_shell_enabled, "true")
.setConfig(ShellSettings.remote_shell_port, "1337")
.setConfig(ShellSettings.remote_shell_read_only, "true")
.newGraphDatabase();
if(bootstrap)
DoBootstrap();
transaction = new NinjaTransaction(graph_db, Neo4jGraph.COUNT_THRESHOLD);
}
Neo4jTest.java 文件源码
项目:jooby
阅读 22
收藏 0
点赞 0
评论 0
@SuppressWarnings("unchecked")
private Block dbFactory(final Path dbdir, final String dbkey) {
return unit -> {
GraphDatabaseService dbservice = unit.registerMock(GraphDatabaseService.class);
// unit.mockStatic(RuntimeRegistry.class);
// expect(RuntimeRegistry.getStartedRuntime(dbservice)).andReturn(null);
LinkedBindingBuilder<GraphDatabaseService> lbb = unit.mock(LinkedBindingBuilder.class);
lbb.toInstance(dbservice);
Binder binder = unit.get(Binder.class);
expect(binder.bind(Key.get(GraphDatabaseService.class))).andReturn(lbb);
ServiceKey keys = unit.get(ServiceKey.class);
keys.generate(eq(GraphDatabaseService.class), eq(dbkey), unit.capture(Consumer.class));
GraphDatabaseBuilder dbbuilder = unit.registerMock(GraphDatabaseBuilder.class);
expect(dbbuilder.newGraphDatabase()).andReturn(dbservice);
GraphDatabaseFactory factory = unit.constructor(GraphDatabaseFactory.class)
.build();
expect(factory.setUserLogProvider(isA(Slf4jLogProvider.class))).andReturn(factory);
expect(factory.newEmbeddedDatabaseBuilder(dbdir.toFile())).andReturn(dbbuilder);
};
}
NeoConfiguration.java 文件源码
项目:checklistbank
阅读 21
收藏 0
点赞 0
评论 0
/**
* Creates a new embedded db in the neoRepository folder.
*
* @param eraseExisting if true deletes previously existing db
*/
public GraphDatabaseBuilder newEmbeddedDb(File storeDir, boolean eraseExisting) {
if (eraseExisting && storeDir.exists()) {
// erase previous db
LOG.debug("Removing previous neo4j database from {}", storeDir.getAbsolutePath());
FileUtils.deleteQuietly(storeDir);
}
GraphDatabaseBuilder builder = new GraphDatabaseFactory()
.setUserLogProvider(new Slf4jLogProvider())
.newEmbeddedDatabaseBuilder(storeDir)
.setConfig(GraphDatabaseSettings.keep_logical_logs, "false")
.setConfig(GraphDatabaseSettings.pagecache_memory, mappedMemory + "m");
if (shell) {
LOG.info("Enable neo4j shell on port " + port);
builder.setConfig(ShellSettings.remote_shell_enabled, "true")
.setConfig(ShellSettings.remote_shell_port, String.valueOf(port))
// listen to all IPs, not localhost only
.setConfig(ShellSettings.remote_shell_host, "0.0.0.0");
}
return builder;
}
FileDatastoreFactory.java 文件源码
项目:extended-objects
阅读 16
收藏 0
点赞 0
评论 0
@Override
public EmbeddedNeo4jDatastore createGraphDatabaseService(URI uri, Properties properties) throws MalformedURLException {
String path;
try {
path = URLDecoder.decode(uri.toURL().getPath(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new MalformedURLException(e.getMessage());
}
GraphDatabaseBuilder databaseBuilder = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(new File(path));
Properties neo4jProperties = Neo4jPropertyHelper.getNeo4jProperties(properties);
for (String name : neo4jProperties.stringPropertyNames()) {
databaseBuilder.setConfig(name, neo4jProperties.getProperty(name));
}
GraphDatabaseService graphDatabaseService = databaseBuilder.newGraphDatabase();
return new EmbeddedNeo4jDatastore(graphDatabaseService);
}
Neo4jManager.java 文件源码
项目:bio4j-neo4j
阅读 20
收藏 0
点赞 0
评论 0
public Neo4jManager(String dbFolder, boolean createServices, boolean readOnly, Map<String, String> config) {
if (createServices) {
if(!readOnly){
if(config != null){
graphService = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(dbFolder).setConfig(config).newGraphDatabase();
}else{
graphService = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(dbFolder).newGraphDatabase();
}
}else{
if(config != null){
config.put( "read_only", "true" );
graphService = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(dbFolder).setConfig(config).newGraphDatabase();
}else{
config = new HashMap<>();
config.put( "read_only", "true" );
graphService = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(dbFolder).setConfig(config).newGraphDatabase();
}
}
}
}
Neo4jGraphDatabase.java 文件源码
项目:graphdb-benchmarks
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void open()
{
neo4jGraph = new GraphDatabaseFactory().newEmbeddedDatabase(dbStorageDirectory.getAbsolutePath());
try (final Transaction tx = beginUnforcedTransaction())
{
try
{
neo4jGraph.schema().awaitIndexesOnline(10l, TimeUnit.MINUTES);
tx.success();
}
catch (Exception e)
{
tx.failure();
throw new BenchmarkingException("unknown error", e);
}
}
}
Neo4jGraphDatabase.java 文件源码
项目:graphdb-benchmarks
阅读 22
收藏 0
点赞 0
评论 0
@Override
public void createGraphForSingleLoad()
{
neo4jGraph = new GraphDatabaseFactory().newEmbeddedDatabase(dbStorageDirectory.getAbsolutePath());
try (final Transaction tx = beginUnforcedTransaction())
{
try
{
schema = neo4jGraph.schema();
schema.indexFor(NODE_LABEL).on(NODE_ID).create();
schema.indexFor(NODE_LABEL).on(COMMUNITY).create();
schema.indexFor(NODE_LABEL).on(NODE_COMMUNITY).create();
tx.success();
}
catch (Exception e)
{
tx.failure();
throw new BenchmarkingException("unknown error", e);
}
}
}
Neo4JConnection.java 文件源码
项目:visitmeta
阅读 19
收藏 0
点赞 0
评论 0
/**
* Clears all data in the DB and reconnects to it afterwards.
*/
public void ClearDatabase(){
// Shutdown database before erasing it
log.debug("Shutting down the database");
mGraphDb.shutdown();
try
{
log.debug("Erasing the database files");
FileUtils.deleteRecursively( new File( mDbPath ) );
}
catch ( IOException e )
{
throw new RuntimeException( e );
}
// Restart database
log.debug("Reconnecting to database");
mGraphDb = new GraphDatabaseFactory().
newEmbeddedDatabaseBuilder(mDbPath).
setConfig( GraphDatabaseSettings.node_keys_indexable, KEY_HASH ).
setConfig( GraphDatabaseSettings.node_auto_indexing, "true" ).
newGraphDatabase();
registerShutdownHook(mGraphDb);
}
GraphDatabaseConfiguration.java 文件源码
项目:MicroServiceProject
阅读 22
收藏 0
点赞 0
评论 0
@Bean(destroyMethod = "shutdown")
public GraphDatabaseService graphDatabaseService() {
if(Arrays.asList(environment.getActiveProfiles()).contains("cloud")) {
// Connect to external Neo4j server
setGraphDatabaseService(new SpringCypherRestGraphDatabase(url, username, password));
} else {
// Connect to local ephemeral database
return new GraphDatabaseFactory().newEmbeddedDatabase("user3.db");
}
return getGraphDatabaseService();
}
GraphDatabaseConfiguration.java 文件源码
项目:MicroServiceProject
阅读 25
收藏 0
点赞 0
评论 0
@Bean(destroyMethod = "shutdown")
public GraphDatabaseService graphDatabaseService() {
if(Arrays.asList(environment.getActiveProfiles()).contains("cloud")) {
// Connect to external Neo4j server
setGraphDatabaseService(new SpringCypherRestGraphDatabase(url, username, password));
} else {
// Connect to local ephemeral database
return new GraphDatabaseFactory().newEmbeddedDatabase("user2.db");
}
return getGraphDatabaseService();
}
Neo4jQuery.java 文件源码
项目:FAIRsharing-Owl2Neo
阅读 21
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
CommandLineParser parser = new DefaultParser();
CommandLine cmd = Utils.parseCommandLine(getOptions(), args);
String graphDbPath = cmd.getOptionValue("d", Owl2Neo4jLoader.GRAPH_DB_PATH);
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(new File(graphDbPath));
String query = "MATCH (n) RETURN n ORDER BY ID(n) DESC LIMIT 30;";
Transaction tx = graphDb.beginTx();
try {
Result result = graphDb.execute(query);
while (result.hasNext()) {
Map<String, Object> row = result.next();
for (String key : result.columns()) {
Node node = (Node) row.get(key);
Object name = node.getProperty("name");
System.out.printf("%s = %s; name = %s%n", key, row.get(key), name);
}
}
tx.success();
}
catch (Exception e) {
System.err.println("Exception caught: " + e.getMessage());
e.printStackTrace();
System.exit(ERR_STATUS);
}
finally {
tx.close();
}
System.out.println("Exiting with success...");
System.exit(OK_STATUS);
}
Owl2Neo4jLoaderTest.java 文件源码
项目:FAIRsharing-Owl2Neo
阅读 58
收藏 0
点赞 0
评论 0
@Before
public void setUp() throws Exception {
graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(new File(TEST_GRAPH_DB_PATH));
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(file.getFile());
OWLDataFactory factory = manager.getOWLDataFactory();
loader = new Owl2Neo4jLoader(graphDb, ontology, factory);
}
Neo4jImportToolTest.java 文件源码
项目:neo4j-talend-component
阅读 20
收藏 0
点赞 0
评论 0
@Test
public void execute_import_should_succeed() throws IOException {
this.importTool.execute();
// Testing it with real graphdb
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(dbPath);
try (Transaction tx = graphDb.beginTx()) {
String result = graphDb.execute("MATCH ()-[r]->() RETURN count(r) AS count").resultAsString();
Assert.assertEquals("+-------+\n| count |\n+-------+\n| 9 |\n+-------+\n1 row\n", result);
}
graphDb.shutdown();
}
Neo4jBatchInserterRelationshipTest.java 文件源码
项目:neo4j-talend-component
阅读 15
收藏 0
点赞 0
评论 0
@Test
public void insert_edge_should_succeed() throws Exception {
Neo4jBatchInserterNode nodeInserter = getNeo4jBatchInserterNode(false);
// populate the db with nodes
List<String> columns = DummyTalendPojo.getColumnList();
for (int i = 0; i < 100; i++) {
DummyTalendPojo pojo = DummyTalendPojo.getDummyTalendPojo(i);
nodeInserter.create(pojo, columns);
}
nodeInserter.finish();
// create relationship
Neo4jBatchInserterRelationship batchInserterRelationship = getNeo4jBatchInserterRelationship(true);
for (int i = 0; i < 100; i++) {
batchInserterRelationship.create(DummyTalendPojo.getDummyTalendPojo(i), DummyTalendPojo.getColumnList());
}
batchInserterRelationship.finish();
// check the database data
batchDb.shutdown();
// Testing it with real graphdb
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(dbPath);
try (Transaction tx = graphDb.beginTx()) {
String result = graphDb.execute("MATCH ()-[r:" + REL_TYPE + "]->() RETURN count(r) AS count").resultAsString();
Assert.assertEquals("+-------+\n| count |\n+-------+\n| 100 |\n+-------+\n1 row\n", result);
}
graphDb.shutdown();
}
SnowGraphBuilder.java 文件源码
项目:SnowGraph
阅读 18
收藏 0
点赞 0
评论 0
private void run(){
GraphDatabaseService graph=new GraphDatabaseFactory().newEmbeddedDatabase( new File(config.getGraphPath()) );
for (int i=0;i<extractors.size();i++) {
System.out.println(extractors.get(i).getClass().getName()+" started.");
extractors.get(i).run(graph);
extractors.set(i, new DefaultExtractor());
System.gc();
}
}
NetworkNeo4j.java 文件源码
项目:GraphClustering
阅读 17
收藏 0
点赞 0
评论 0
private boolean initDB() {
File db = new File(this.networkFileName);
graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(db);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
shutdown();
}
});
//graphDb.beginTx();
return true;
}
Propoli.java 文件源码
项目:NeoDD
阅读 21
收藏 0
点赞 0
评论 0
public GraphDatabaseService connect() {
if (null == graph) {
graph = new GraphDatabaseFactory().newEmbeddedDatabase(path);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
graph.shutdown();
}
});
}
return graph;
}