`

Neo4j: Remote Restful API (java)

 
阅读更多

#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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics