I am using neo4js to store users as nodes with property as user_id. There is a friend relation from user1 to user 2.
I am trying to find the incomming friend connections on node user2(user_id =2) which are comming from node with user_id=1.
I am using the neography library for the same. https://github.com/maxdemarzi/neography/
u2 = Neography::Node.(id)
u2.outgoing(:friends).filter("..........")
I am not sure what exact filter should be given so th开发者_如何学JAVAat I can filter out the relationships comming from node(s) with user_id=1.
Regards,
Pankaj
You can use a traversal in neo4js to find those relationships.
This is untested code, but you want to do something like this:
var promise = somenode.traverse({
"prune_evaluator": {
"language": "javascript",
"body": "position.endNode().getId()!=2;" // Note that this is a string
}},
neo4j.traverse.RETURN_RELATIONSHIPS);
promise.then(function(relationships) {
console.log(relationships);
});
The first argument to the traverse method is a traversal object, for full docs on what you can put there, see http://docs.neo4j.org/chunked/snapshot/rest-api-traverse.html
精彩评论