Re: [Neo4j] chain TraversalDescription?

2011-09-09 Thread Peter Neubauer
Linan,
yes, deep down Pipes are composing the pipeline out of iterators to
the base API operations node.getRelationships() and
relationship.getNodes() . The Neo4j traversal API is using callbacks
instead. What you want to use depends on your taste :)

Cheers,

/peter neubauer

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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Fri, Sep 9, 2011 at 11:12 PM, Linan Wang  wrote:
> Actually i'm fine with nesting multiple traversers to solve the
> problem if deep inside gremlin, evaluator and fluentPipeline are just
> nice constructs over the same solution. is it correct?
> thanks
>
> On Fri, Sep 9, 2011 at 7:03 PM, Linan Wang  wrote:
>> Thanks! I really appreciate. i'll have a deeper look at the
>> FluentPipeline and Gremlin options later.
>>
>> Regarding using Evaluator in
>> https://github.com/neo4j/community/blob/master/embedded-examples/src/test/java/org/neo4j/examples/orderedpath/OrderedPathTest.java
>> my question:
>> When the Evaluator.evaluate is called, the last node in the path is
>> already retrieved, right? using the example, at depth 1, all my dogs
>> and books i wrote have been retrieved, what the evaluator does is to
>> decide not to continue from the, and exclude it in the return. am i
>> right? any way to prevent from retrieving them at all? imagine i've
>> written 10,000 books and have 1m dogs, visiting these nodes would be
>> waste of time.
>>
>> On Fri, Sep 9, 2011 at 4:12 PM, Peter Neubauer
>>  wrote:
>>> That's right!
>>>
>>> Looking all forward to that!
>>>
>>> Cheers,
>>>
>>> /peter neubauer
>>>
>>> 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
>>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>>
>>>
>>>
>>> On Fri, Sep 9, 2011 at 5:10 PM, Marko Rodriguez  
>>> wrote:
 Hey,

> Hi Linan,
> http://docs.neo4j.org/chunked/snapshot/tutorials-java-embedded-traversal.html#_new_traversal_framework
> has an example of an ordered path, does that help? The code for it is
> at 
> https://github.com/neo4j/community/blob/master/embedded-examples/src/test/java/org/neo4j/examples/orderedpath/OrderedPathTest.java
>
> Also, Gremlin, as Marko states, is applicable here.


 One more point to this. The next release of the Pipes comes with 
 FluentPipeline which will allow you to, in native Java, do this:

        Pipe pipe = new 
 FluentPipeline(graph.getVertex(1)).out("read").in("wrote").uniqueObject().out("pet").property("name");
        while(pipe.hasNext()) {
                String petName = pipe.next();
        }

 In this way, you can effect the same "Gremlin-esque" behavior, but in pure 
 Java.

 This is planned for a September 21st released and, if all goes well, will 
 be in the next release of Neo4j.

 Take care,
 Marko.

 http://markorodriguez.com
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

>>> ___
>>> Neo4j mailing list
>>> User@lists.neo4j.org
>>> https://lists.neo4j.org/mailman/listinfo/user
>>>
>>
>>
>>
>> --
>> Best regards
>>
>> Linan Wang
>>
>
>
>
> --
> Best regards
>
> Linan Wang
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] chain TraversalDescription?

2011-09-09 Thread Linan Wang
Actually i'm fine with nesting multiple traversers to solve the
problem if deep inside gremlin, evaluator and fluentPipeline are just
nice constructs over the same solution. is it correct?
thanks

On Fri, Sep 9, 2011 at 7:03 PM, Linan Wang  wrote:
> Thanks! I really appreciate. i'll have a deeper look at the
> FluentPipeline and Gremlin options later.
>
> Regarding using Evaluator in
> https://github.com/neo4j/community/blob/master/embedded-examples/src/test/java/org/neo4j/examples/orderedpath/OrderedPathTest.java
> my question:
> When the Evaluator.evaluate is called, the last node in the path is
> already retrieved, right? using the example, at depth 1, all my dogs
> and books i wrote have been retrieved, what the evaluator does is to
> decide not to continue from the, and exclude it in the return. am i
> right? any way to prevent from retrieving them at all? imagine i've
> written 10,000 books and have 1m dogs, visiting these nodes would be
> waste of time.
>
> On Fri, Sep 9, 2011 at 4:12 PM, Peter Neubauer
>  wrote:
>> That's right!
>>
>> Looking all forward to that!
>>
>> Cheers,
>>
>> /peter neubauer
>>
>> 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>
>>
>>
>> On Fri, Sep 9, 2011 at 5:10 PM, Marko Rodriguez  wrote:
>>> Hey,
>>>
 Hi Linan,
 http://docs.neo4j.org/chunked/snapshot/tutorials-java-embedded-traversal.html#_new_traversal_framework
 has an example of an ordered path, does that help? The code for it is
 at 
 https://github.com/neo4j/community/blob/master/embedded-examples/src/test/java/org/neo4j/examples/orderedpath/OrderedPathTest.java

 Also, Gremlin, as Marko states, is applicable here.
>>>
>>>
>>> One more point to this. The next release of the Pipes comes with 
>>> FluentPipeline which will allow you to, in native Java, do this:
>>>
>>>        Pipe pipe = new 
>>> FluentPipeline(graph.getVertex(1)).out("read").in("wrote").uniqueObject().out("pet").property("name");
>>>        while(pipe.hasNext()) {
>>>                String petName = pipe.next();
>>>        }
>>>
>>> In this way, you can effect the same "Gremlin-esque" behavior, but in pure 
>>> Java.
>>>
>>> This is planned for a September 21st released and, if all goes well, will 
>>> be in the next release of Neo4j.
>>>
>>> Take care,
>>> Marko.
>>>
>>> http://markorodriguez.com
>>> ___
>>> Neo4j mailing list
>>> User@lists.neo4j.org
>>> https://lists.neo4j.org/mailman/listinfo/user
>>>
>> ___
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>
>
>
> --
> Best regards
>
> Linan Wang
>



-- 
Best regards

Linan Wang
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] chain TraversalDescription?

2011-09-09 Thread Linan Wang
Thanks! I really appreciate. i'll have a deeper look at the
FluentPipeline and Gremlin options later.

Regarding using Evaluator in
https://github.com/neo4j/community/blob/master/embedded-examples/src/test/java/org/neo4j/examples/orderedpath/OrderedPathTest.java
my question:
When the Evaluator.evaluate is called, the last node in the path is
already retrieved, right? using the example, at depth 1, all my dogs
and books i wrote have been retrieved, what the evaluator does is to
decide not to continue from the, and exclude it in the return. am i
right? any way to prevent from retrieving them at all? imagine i've
written 10,000 books and have 1m dogs, visiting these nodes would be
waste of time.

On Fri, Sep 9, 2011 at 4:12 PM, Peter Neubauer
 wrote:
> That's right!
>
> Looking all forward to that!
>
> Cheers,
>
> /peter neubauer
>
> 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>
>
>
> On Fri, Sep 9, 2011 at 5:10 PM, Marko Rodriguez  wrote:
>> Hey,
>>
>>> Hi Linan,
>>> http://docs.neo4j.org/chunked/snapshot/tutorials-java-embedded-traversal.html#_new_traversal_framework
>>> has an example of an ordered path, does that help? The code for it is
>>> at 
>>> https://github.com/neo4j/community/blob/master/embedded-examples/src/test/java/org/neo4j/examples/orderedpath/OrderedPathTest.java
>>>
>>> Also, Gremlin, as Marko states, is applicable here.
>>
>>
>> One more point to this. The next release of the Pipes comes with 
>> FluentPipeline which will allow you to, in native Java, do this:
>>
>>        Pipe pipe = new 
>> FluentPipeline(graph.getVertex(1)).out("read").in("wrote").uniqueObject().out("pet").property("name");
>>        while(pipe.hasNext()) {
>>                String petName = pipe.next();
>>        }
>>
>> In this way, you can effect the same "Gremlin-esque" behavior, but in pure 
>> Java.
>>
>> This is planned for a September 21st released and, if all goes well, will be 
>> in the next release of Neo4j.
>>
>> Take care,
>> Marko.
>>
>> http://markorodriguez.com
>> ___
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Best regards

Linan Wang
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] chain TraversalDescription?

2011-09-09 Thread Peter Neubauer
That's right!

Looking all forward to that!

Cheers,

/peter neubauer

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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Fri, Sep 9, 2011 at 5:10 PM, Marko Rodriguez  wrote:
> Hey,
>
>> Hi Linan,
>> http://docs.neo4j.org/chunked/snapshot/tutorials-java-embedded-traversal.html#_new_traversal_framework
>> has an example of an ordered path, does that help? The code for it is
>> at 
>> https://github.com/neo4j/community/blob/master/embedded-examples/src/test/java/org/neo4j/examples/orderedpath/OrderedPathTest.java
>>
>> Also, Gremlin, as Marko states, is applicable here.
>
>
> One more point to this. The next release of the Pipes comes with 
> FluentPipeline which will allow you to, in native Java, do this:
>
>        Pipe pipe = new 
> FluentPipeline(graph.getVertex(1)).out("read").in("wrote").uniqueObject().out("pet").property("name");
>        while(pipe.hasNext()) {
>                String petName = pipe.next();
>        }
>
> In this way, you can effect the same "Gremlin-esque" behavior, but in pure 
> Java.
>
> This is planned for a September 21st released and, if all goes well, will be 
> in the next release of Neo4j.
>
> Take care,
> Marko.
>
> http://markorodriguez.com
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] chain TraversalDescription?

2011-09-09 Thread Marko Rodriguez
Hey,

> Hi Linan,
> http://docs.neo4j.org/chunked/snapshot/tutorials-java-embedded-traversal.html#_new_traversal_framework
> has an example of an ordered path, does that help? The code for it is
> at 
> https://github.com/neo4j/community/blob/master/embedded-examples/src/test/java/org/neo4j/examples/orderedpath/OrderedPathTest.java
> 
> Also, Gremlin, as Marko states, is applicable here.


One more point to this. The next release of the Pipes comes with FluentPipeline 
which will allow you to, in native Java, do this:

Pipe pipe = new 
FluentPipeline(graph.getVertex(1)).out("read").in("wrote").uniqueObject().out("pet").property("name");
while(pipe.hasNext()) {
String petName = pipe.next();
}

In this way, you can effect the same "Gremlin-esque" behavior, but in pure Java.

This is planned for a September 21st released and, if all goes well, will be in 
the next release of Neo4j.

Take care,
Marko.

http://markorodriguez.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] chain TraversalDescription?

2011-09-09 Thread Peter Neubauer
Hi Linan,
http://docs.neo4j.org/chunked/snapshot/tutorials-java-embedded-traversal.html#_new_traversal_framework
has an example of an ordered path, does that help? The code for it is
at 
https://github.com/neo4j/community/blob/master/embedded-examples/src/test/java/org/neo4j/examples/orderedpath/OrderedPathTest.java

Also, Gremlin, as Marko states, is applicable here.

Cheers,

/peter neubauer

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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Fri, Sep 9, 2011 at 4:48 PM, Linan Wang  wrote:
> Hi,
>
> say people read books, books are written by authors, authors has dogs,
> then how to reach the dogs of authors of books i've read? when i'm
> also a writer, also have dogs, the TraversalDescription seems
> inefficient since it'll also traverse my own books and dogs first,
> before my customised StopEvaluator stops the expansion process.
>
> my feeling is RelationshipExpander is the way to go but stucked at the
> problem to get the depth info. my goal is to have the designated
> RelationshipExpander to tell traverser that at depth 1 only looking
> for OUTGOING read relationship, depth 2 for INCOMING wrote
> relationship and depth 3 for OUTGOING has relationship. any comment is
> appreciated! thanks.
>
> --
> Best regards
>
> Linan Wang
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] chain TraversalDescription?

2011-09-09 Thread Marko Rodriguez
Hi,

I would do this using Gremlin as such:

g.v(1).out('read').in('wrote').uniqueObject.out('pet').name

If you are vertex 1 (g.v(1)), 
then you will go to the books you read, 
then to the authors of those books,
then because you might have read two Stephen King books, you will 
remove duplicates,
then to their pets,
and then to the names of those pets.

This assumes a graph of the form:

person ---read--> book <---wrote--- person ---pet---> 
animal[string:name]

Take care,
Marko.

http://markorodriguez.com

On Sep 9, 2011, at 8:48 AM, Linan Wang wrote:

> Hi,
> 
> say people read books, books are written by authors, authors has dogs,
> then how to reach the dogs of authors of books i've read? when i'm
> also a writer, also have dogs, the TraversalDescription seems
> inefficient since it'll also traverse my own books and dogs first,
> before my customised StopEvaluator stops the expansion process.
> 
> my feeling is RelationshipExpander is the way to go but stucked at the
> problem to get the depth info. my goal is to have the designated
> RelationshipExpander to tell traverser that at depth 1 only looking
> for OUTGOING read relationship, depth 2 for INCOMING wrote
> relationship and depth 3 for OUTGOING has relationship. any comment is
> appreciated! thanks.
> 
> -- 
> Best regards
> 
> Linan Wang
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] chain TraversalDescription?

2011-09-09 Thread Linan Wang
Hi,

say people read books, books are written by authors, authors has dogs,
then how to reach the dogs of authors of books i've read? when i'm
also a writer, also have dogs, the TraversalDescription seems
inefficient since it'll also traverse my own books and dogs first,
before my customised StopEvaluator stops the expansion process.

my feeling is RelationshipExpander is the way to go but stucked at the
problem to get the depth info. my goal is to have the designated
RelationshipExpander to tell traverser that at depth 1 only looking
for OUTGOING read relationship, depth 2 for INCOMING wrote
relationship and depth 3 for OUTGOING has relationship. any comment is
appreciated! thanks.

-- 
Best regards

Linan Wang
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user