本文整理汇总了Java中org.neo4j.graphdb.GraphDatabaseService.findNode方法的典型用法代码示例。如果您正苦于以下问题:Java GraphDatabaseService.findNode方法的具体用法?Java GraphDatabaseService.findNode怎么用?Java GraphDatabaseService.findNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.neo4j.graphdb.GraphDatabaseService
的用法示例。
在下文中一共展示了GraphDatabaseService.findNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newContext
import org.neo4j.graphdb.GraphDatabaseService; //导入方法依赖的package包/类
/**
* Get current configuration manager
* @return
*/
public static DocumentGrapherExecutionContext newContext(GraphDatabaseService db, Log log)
{
if(instance == null)
{
Node configurationNode = db.findNode(Label.label("JSON_CONFIG"), "configuration", "byNode");
if(configurationNode == null)
{
log.info("Load default configuration: "+JsonHelperConfigurationDefault.class);
instance = new JsonHelperConfigurationDefault();
}else
{
log.info("Load configuration from node: "+JsonHelperConfigurationByNode.class);
instance = new JsonHelperConfigurationByNode(configurationNode);
}
}
return instance.buildContext(db, log);
}
示例2: testRelReader
import org.neo4j.graphdb.GraphDatabaseService; //导入方法依赖的package包/类
@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();
}