2015-12-11 137 views

回答

0

我很惊讶网络无法返回关于如何使用neo4j和特别写入查询的一些信息。

为GraphDatabaseService的API文档都位于这里:

http://neo4j.com/docs/stable/javadocs/org/neo4j/graphdb/GraphDatabaseService.html

此外,手册中部分将介绍如何在Java中使用的Neo4j以嵌入模式:

http://neo4j.com/docs/stable/tutorials-java-embedded-hello-world.html

基本上,您需要在交易中包装您的操作:

try (Transaction tx = database.beginTx()) { 
    database.createNode(); 
    tx.success(); 
} 

寻找通过标签和属性点是之前的操作一样简单:

try (Transaction tx = database.beginTx()) { 
    Node user = database.findNode(DynamicLabel.label("User"), "login", "[email protected]"); 
    tx.success(); 
} 

如果在服务器模式下运行的Neo4j,你其实可以写的Cypher查询,拿起一个驱动程序的语言你选择:

http://neo4j.com/developer/language-guides/

和完整的暗号指南是为你准备好阅读:

http://neo4j.com/docs/stable/cypher-query-lang.html

您也可以按照免费在线课程:

http://neo4j.com/graphacademy/online-training/

您还可以在这里发现一个巨大的策划Neo4j的资源列表:

https://github.com/GraphGeeks/awesome-neo4j

+0

其实,我一直在寻找如何查询通过批量插入构建的neo4j db。我无法在那里使用GraphDatabaseService,因此发布了这个问题。 –

+0

所以插入是正确的? –

+0

是的,插入是好的 –