This page has how to do exactly that.
https://github.com/maxdemarzi/neography/blob/master/examples/facebook.rb
Try:
{
"order": "breadth first",
"uniqueness": "node global",
"relationships": [
{ "type": "friends", "direction": "in" },
],
"return filter": {
"language": "javascript",
"body": "position.length() == 2;"
},
"max depth": 2
}
On Sun, Dec 12, 2010 at 2:11 PM, Peter Neubauer
<[email protected]> wrote:
> Hi Snipe,
> Max has been putting out a lot of good examples for the REST API in
> his Ruby bindings, look at https://github.com/maxdemarzi/neography.
>
> In there, you will find for instance
>
> n1.outgoing(:friends).depth(2).include_start_node
>
> Which I think does exactly what you are trying to do? Not sure right
> now what the REST call looks like but I would say something like
>
> POST /node/123/traverse/node
>
> with a body of
>
> {
> "order": "depth first",
> "uniqueness": "node path",
> "relationships": [
> { "type": "KNOWS", "direction": "out" }
> ],
> "return filter": {
> "language": "javascript",
> "name": "position.length == 2"
> },
> "max depth": 2
> }
>
> Does that work? I hope that very soon we are going to move to real
> scripting support when it comes to traversals, so you can do them in
> JavaScript, JRuby or Gremlin. Until then, the above should be
> something you can work with ...
>
> Cheers,
>
> /peter neubauer
>
> COO and Sales, Neo Technology
>
> GTalk: neubauer.peter
> Skype peter.neubauer
> Phone +46 704 106975
> LinkedIn http://www.linkedin.com/in/neubauer
> Twitter http://twitter.com/peterneubauer
>
> http://www.neo4j.org - Your high performance graph database.
> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>
>
>
> On Sun, Dec 12, 2010 at 8:40 PM, snipe <[email protected]> wrote:
>> Hi,
>>
>> I am a new user of neo4j and I think it's great:) Unfortunately, I
>> have a small problem with using REST. I have already defined nodes and
>> relations between them, but I can't get friends of friends (the 2nd
>> level of relationship, example: me => jonh => jack; I want to get jack
>> and others on this level). How can I do it with prune evaluator and
>> return filter? Could you help me? : D Any javascript examples? :)
>>
>> Regards,
>> snipe
>> _______________________________________________
>> Neo4j mailing list
>> [email protected]
>> https://lists.neo4j.org/mailman/listinfo/user
>>
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user