#git clone https://github.com/neo4j-contrib/java-rest-binding.git
#git tag -l
#git checkout neo4j-rest-graphdb-2.0.1
#mvn clean install
In mvn project's pom.xml
add
<dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-rest-graphdb</artifactId> <version>2.0.1</version> <scope>compile</scope> </dependency>
Sample code
package inokStormSolrContentRec;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.ResourceIterable;
import org.neo4j.graphdb.ResourceIterator;
import org.neo4j.rest.graphdb.RestGraphDatabase;
public class Neo4JSearch {
public static void main(String[] args) {
GraphDatabaseService gds = new RestGraphDatabase("http://localhost:7474/db/data");
ResourceIterable<Node> nodes = gds.findNodesByLabelAndProperty(FIFONeo4jLabel.User, "nickname", "zhaohj");
ResourceIterator<Node> it = nodes.iterator();
while(it.hasNext()){
Node node = it.next();
System.out.println("node info: " + node.getId() + "\t"+node.getProperty("nickname"));
}
}
}
Reference
https://github.com/neo4j-contrib/java-rest-binding/tree/neo4j-rest-graphdb-2.0.1
本文介绍如何使用Neo4j的REST API进行图数据库查询,并提供了完整的代码示例,包括项目的克隆、依赖配置及运行步骤。
3414

被折叠的 条评论
为什么被折叠?



