Re: [Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Tobias Ivarsson
That would be EXCLUDE_AND_PRUNE.

On Thu, Apr 7, 2011 at 7:58 AM, Dario Rexin dario.re...@xing.com wrote:

 Hi Peter, yes that would be not to include the path in the result set.



 On 07.04.2011, at 07:01, Peter Neubauer 
 peter.neuba...@neotechnology.com wrote:

  Dario,
  I am not quite sure I understand what you mean by drop is that not
  to include the path into the result or prune or something else? Do you
  have a concrete example of this, maybe a simple toy graph test with
  toy information?
 
  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 Wed, Apr 6, 2011 at 6:35 PM, Dario Rexin dario.re...@xing.com
 wrote:
  Hello,
 
  we are trying to construct an Evaluator that will select only one node
 from the middle of a path and include it in the result. We do have a
 specific path we are looking for and the endNode is stored in 'end'. Now
 what we would like to do is have an Evaluator like this:
 
   import org.neo4j.graphdb.traversal.
  Evaluator;
 
   new Evaluator(){
 @Override
 public Evaluation evaluate(org.neo4j.graphdb.Path path) {
 if(path.length()  3) {
 return Evaluation.EXCLUDE_AND_PRUNE;
 } else if (path.length() == 2) {
 return Evaluation.INCLUDE_AND_CONTINUE;
 } else if (path.length()  2){
 return Evaluation.EXCLUDE_AND_CONTINUE;
 } else {
 return path.endNode().getId() == end.getId() ?
 Evaluation.EXCLUDE_AND_PRUNE : Evaluation.DROP_PATH_AND_PRUNE;
 }
 }
   }
 
  The decision on whether to accept or drop a path is based on wether we
 have reached the endNode. That's why we would like to use something like
 DROP_PATH_AND_PRUNE, which doesn't exist. What are we missing?
 
  Any help appreciated!
 
  Thanks,
  Stephan and Dario
  ___
  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 mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




-- 
Tobias Ivarsson tobias.ivars...@neotechnology.com
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Mattias Persson
INCLUDE_AND_CONTINUE
the path will be included in the result set and the traversal will
go further down that path
INCLUDE_AND_PRUNE
the path will be included in the result set, but the traversal
will continue from that path
EXCLUDE_AND_CONTINUE
the path won't be included in the result set, but the traversal
will continue from that path
EXCLUDE_AND_PRUNE
the path won't be included in the result set and the traversal
won't go further down that path, but will continue down other paths
that haven't been pruned

2011/4/7 Tobias Ivarsson tobias.ivars...@neotechnology.com:
 That would be EXCLUDE_AND_PRUNE.

 On Thu, Apr 7, 2011 at 7:58 AM, Dario Rexin dario.re...@xing.com wrote:

 Hi Peter, yes that would be not to include the path in the result set.



 On 07.04.2011, at 07:01, Peter Neubauer 
 peter.neuba...@neotechnology.com wrote:

  Dario,
  I am not quite sure I understand what you mean by drop is that not
  to include the path into the result or prune or something else? Do you
  have a concrete example of this, maybe a simple toy graph test with
  toy information?
 
  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 Wed, Apr 6, 2011 at 6:35 PM, Dario Rexin dario.re...@xing.com
 wrote:
  Hello,
 
  we are trying to construct an Evaluator that will select only one node
 from the middle of a path and include it in the result. We do have a
 specific path we are looking for and the endNode is stored in 'end'. Now
 what we would like to do is have an Evaluator like this:
 
           import org.neo4j.graphdb.traversal.
  Evaluator;
 
           new Evaluator(){
             @Override
             public Evaluation evaluate(org.neo4j.graphdb.Path path) {
                 if(path.length()  3) {
                     return Evaluation.EXCLUDE_AND_PRUNE;
                 } else if (path.length() == 2) {
                     return Evaluation.INCLUDE_AND_CONTINUE;
                 } else if (path.length()  2){
                     return Evaluation.EXCLUDE_AND_CONTINUE;
                 } else {
                     return path.endNode().getId() == end.getId() ?
 Evaluation.EXCLUDE_AND_PRUNE : Evaluation.DROP_PATH_AND_PRUNE;
                 }
             }
           }
 
  The decision on whether to accept or drop a path is based on wether we
 have reached the endNode. That's why we would like to use something like
 DROP_PATH_AND_PRUNE, which doesn't exist. What are we missing?
 
  Any help appreciated!
 
  Thanks,
  Stephan and Dario
  ___
  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 mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




 --
 Tobias Ivarsson tobias.ivars...@neotechnology.com
 Hacker, Neo Technology
 www.neotechnology.com
 Cellphone: +46 706 534857
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Mattias Persson
Sory, I meant

INCLUDE_AND_PRUNE
   the path will be included in the result set, but the traversal
   won't go further down that path, but will continue down other paths
   that haven't been pruned



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Stephan Hagemann
Hi guys,

Dario and I are working together on this, so let me clarify, what we want to
achieve. An example query in a friend network would be:

Retrieve a set of people P that are the direct friends of person A. P should
include only those friends that are also on a path between A and another
user B.

We know how to find paths, but we fail at returning nodes - let alone sets
of nodes.

The old ReturnableEvaluator seemed to achieve just that: A client hook for
evaluating whether a specific node should be returned from a traverser.,
but that is deprecated in the current milestone release. We're unable to
find the equivalent functionality with the new Traversal framework.

Thanks
Stephan



On Thu, Apr 7, 2011 at 09:35, Mattias Persson matt...@neotechnology.comwrote:

 Sory, I meant

 INCLUDE_AND_PRUNE
the path will be included in the result set, but the traversal
won't go further down that path, but will continue down other paths
   that haven't been pruned



 --
 Mattias Persson, [matt...@neotechnology.com]
 Hacker, Neo Technology
 www.neotechnology.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] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Mattias Persson
2011/4/7 Stephan Hagemann stephan.hagem...@googlemail.com:
 Hi guys,

 Dario and I are working together on this, so let me clarify, what we want to
 achieve. An example query in a friend network would be:

 Retrieve a set of people P that are the direct friends of person A. P should
 include only those friends that are also on a path between A and another
 user B.

 We know how to find paths, but we fail at returning nodes - let alone sets
 of nodes.

 The old ReturnableEvaluator seemed to achieve just that: A client hook for
 evaluating whether a specific node should be returned from a traverser.,
 but that is deprecated in the current milestone release. We're unable to
 find the equivalent functionality with the new Traversal framework.

ReturnableEvaluator is like controlling the INCLUDE/EXCLUDE part of an
evaluation
StopEvaluator is like controlling the CONTINUE/PRUNE part of an evaluation

The @Deprecated TraversalDescription#prune and #filter are also a
direct mapping of StopEvaluator and ReturnableEvaluator respectively.
Evaluator replaces those and combines them into one concept where you
can express the same semantics.


 Thanks
 Stephan



 On Thu, Apr 7, 2011 at 09:35, Mattias Persson 
 matt...@neotechnology.comwrote:

 Sory, I meant

 INCLUDE_AND_PRUNE
    the path will be included in the result set, but the traversal
    won't go further down that path, but will continue down other paths
   that haven't been pruned



 --
 Mattias Persson, [matt...@neotechnology.com]
 Hacker, Neo Technology
 www.neotechnology.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




-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Michael Hunger
I think the confusing thing here is that ReturnableEvaluator talked about 
including/excluding nodes
whereas when describing the Evaluations you spoke about including/excluding 
paths.

Which of those is correct ?

Cheers

Michael

Am 07.04.2011 um 10:40 schrieb Mattias Persson:

 2011/4/7 Stephan Hagemann stephan.hagem...@googlemail.com:
 Hi guys,
 
 Dario and I are working together on this, so let me clarify, what we want to
 achieve. An example query in a friend network would be:
 
 Retrieve a set of people P that are the direct friends of person A. P should
 include only those friends that are also on a path between A and another
 user B.
 
 We know how to find paths, but we fail at returning nodes - let alone sets
 of nodes.
 
 The old ReturnableEvaluator seemed to achieve just that: A client hook for
 evaluating whether a specific node should be returned from a traverser.,
 but that is deprecated in the current milestone release. We're unable to
 find the equivalent functionality with the new Traversal framework.
 
 ReturnableEvaluator is like controlling the INCLUDE/EXCLUDE part of an
 evaluation
 StopEvaluator is like controlling the CONTINUE/PRUNE part of an evaluation
 
 The @Deprecated TraversalDescription#prune and #filter are also a
 direct mapping of StopEvaluator and ReturnableEvaluator respectively.
 Evaluator replaces those and combines them into one concept where you
 can express the same semantics.
 
 
 Thanks
 Stephan
 
 
 
 On Thu, Apr 7, 2011 at 09:35, Mattias Persson 
 matt...@neotechnology.comwrote:
 
 Sory, I meant
 
 INCLUDE_AND_PRUNE
the path will be included in the result set, but the traversal
won't go further down that path, but will continue down other paths
   that haven't been pruned
 
 
 
 --
 Mattias Persson, [matt...@neotechnology.com]
 Hacker, Neo Technology
 www.neotechnology.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
 
 
 
 
 -- 
 Mattias Persson, [matt...@neotechnology.com]
 Hacker, Neo Technology
 www.neotechnology.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] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Stephan Hagemann
If they are indeed equivalent, Michael is right - then I was confused by the
doc talking about nodes vs the other talking about paths.


On Thu, Apr 7, 2011 at 10:43, Michael Hunger 
michael.hun...@neotechnology.com wrote:

 I think the confusing thing here is that ReturnableEvaluator talked about
 including/excluding nodes
 whereas when describing the Evaluations you spoke about including/excluding
 paths.

 Which of those is correct ?

 Cheers

 Michael

 Am 07.04.2011 um 10:40 schrieb Mattias Persson:

  2011/4/7 Stephan Hagemann stephan.hagem...@googlemail.com:
  Hi guys,
 
  Dario and I are working together on this, so let me clarify, what we
 want to
  achieve. An example query in a friend network would be:
 
  Retrieve a set of people P that are the direct friends of person A. P
 should
  include only those friends that are also on a path between A and another
  user B.
 
  We know how to find paths, but we fail at returning nodes - let alone
 sets
  of nodes.
 
  The old ReturnableEvaluator seemed to achieve just that: A client hook
 for
  evaluating whether a specific node should be returned from a
 traverser.,
  but that is deprecated in the current milestone release. We're unable to
  find the equivalent functionality with the new Traversal framework.
 
  ReturnableEvaluator is like controlling the INCLUDE/EXCLUDE part of an
  evaluation
  StopEvaluator is like controlling the CONTINUE/PRUNE part of an
 evaluation
 
  The @Deprecated TraversalDescription#prune and #filter are also a
  direct mapping of StopEvaluator and ReturnableEvaluator respectively.
  Evaluator replaces those and combines them into one concept where you
  can express the same semantics.
 
 
  Thanks
  Stephan
 
 
 
  On Thu, Apr 7, 2011 at 09:35, Mattias Persson 
 matt...@neotechnology.comwrote:
 
  Sory, I meant
 
  INCLUDE_AND_PRUNE
 the path will be included in the result set, but the traversal
 won't go further down that path, but will continue down other paths
that haven't been pruned
 
 
 
  --
  Mattias Persson, [matt...@neotechnology.com]
  Hacker, Neo Technology
  www.neotechnology.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
 
 
 
 
  --
  Mattias Persson, [matt...@neotechnology.com]
  Hacker, Neo Technology
  www.neotechnology.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

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


Re: [Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Mattias Persson
2011/4/7 Michael Hunger michael.hun...@neotechnology.com:
 I think the confusing thing here is that ReturnableEvaluator talked about 
 including/excluding nodes
 whereas when describing the Evaluations you spoke about including/excluding 
 paths.

Oh, sorry... one major difference from the old traversal framework is
that it returns nodes. The new framework returns paths leading from
the start node up to that node. You still make include/exclude
decisions based on the current position of the traversal, just that in
the new framework you've got the full path in addition to the current
node (the end node of the path).

 Which of those is correct ?

 Cheers

 Michael

 Am 07.04.2011 um 10:40 schrieb Mattias Persson:

 2011/4/7 Stephan Hagemann stephan.hagem...@googlemail.com:
 Hi guys,

 Dario and I are working together on this, so let me clarify, what we want to
 achieve. An example query in a friend network would be:

 Retrieve a set of people P that are the direct friends of person A. P should
 include only those friends that are also on a path between A and another
 user B.

 We know how to find paths, but we fail at returning nodes - let alone sets
 of nodes.

 The old ReturnableEvaluator seemed to achieve just that: A client hook for
 evaluating whether a specific node should be returned from a traverser.,
 but that is deprecated in the current milestone release. We're unable to
 find the equivalent functionality with the new Traversal framework.

 ReturnableEvaluator is like controlling the INCLUDE/EXCLUDE part of an
 evaluation
 StopEvaluator is like controlling the CONTINUE/PRUNE part of an evaluation

 The @Deprecated TraversalDescription#prune and #filter are also a
 direct mapping of StopEvaluator and ReturnableEvaluator respectively.
 Evaluator replaces those and combines them into one concept where you
 can express the same semantics.


 Thanks
 Stephan



 On Thu, Apr 7, 2011 at 09:35, Mattias Persson 
 matt...@neotechnology.comwrote:

 Sory, I meant

 INCLUDE_AND_PRUNE
    the path will be included in the result set, but the traversal
    won't go further down that path, but will continue down other paths
   that haven't been pruned



 --
 Mattias Persson, [matt...@neotechnology.com]
 Hacker, Neo Technology
 www.neotechnology.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




 --
 Mattias Persson, [matt...@neotechnology.com]
 Hacker, Neo Technology
 www.neotechnology.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




-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Mattias Persson
2011/4/7 Stephan Hagemann stephan.hagem...@googlemail.com:
 Thanks for clearing that up!

 Then I can come back to my initial comment. If the Evaluator returns paths
 and we are looking for nodes (sets of nodes to be specific), we have no easy
 mechanism that will ensure we do not return duplicate nodes (because the
 paths they are extracted from are not duplicates). Again, with the example:

 Retrieve a set of people P that are the direct friends of person A. P should
 include only those friends that are also on a path between A and another
 user B.

 I have attach an image that highlights this problem.

 As you can see from the attached image, querying for the paths that satisfy
 this proposition will lead to a duplication of node P in the result. If we
 deduplicate after the traversal, we can't stop the traversal when we have
 found the maximum number of nodes we wanted to return.

Oh, so if any node in the path has been returned in any other path
before if (except the start node) then exclude it? That's the first
time I've heard that requirement. Love the fact that you sent a
picture, guys :)

So what about:

   int hitCount = 0;
   for ( Path path : ...traverse(...) ) {
   if ( unique( path ) ) {
   if ( hitCount++ = 50 )
   break;
   // handle the path
   }
   }

...or wrap the IterablePath from traverse in:

   new FilteringIterablePath(...traverse(...), new PredicatePath() {
   public boolean accept( Path path ) {
   return unique( path );
   }
   } );

and only iterate max 50 of those. Write the unique() method however
you'd like... maybe just with a SetNode with all the nodes except
the start/end nodes and add all those nodes from each path and if that
set had any of those nodes then don't consider it unique.


 That is... unless we specify more complex include/exclude/continue/prune
 rules in an Evaluator that takes into account the nodes that it has
 internally stored as returnables. Is that the way to go?


 On Thu, Apr 7, 2011 at 10:48, Mattias Persson 
 matt...@neotechnology.comwrote:

 2011/4/7 Michael Hunger michael.hun...@neotechnology.com:
  I think the confusing thing here is that ReturnableEvaluator talked about
 including/excluding nodes
  whereas when describing the Evaluations you spoke about
 including/excluding paths.

 Oh, sorry... one major difference from the old traversal framework is
 that it returns nodes. The new framework returns paths leading from
 the start node up to that node. You still make include/exclude
 decisions based on the current position of the traversal, just that in
 the new framework you've got the full path in addition to the current
 node (the end node of the path).
 
  Which of those is correct ?
 
  Cheers
 
  Michael
 
  Am 07.04.2011 um 10:40 schrieb Mattias Persson:
 
  2011/4/7 Stephan Hagemann stephan.hagem...@googlemail.com:
  Hi guys,
 
  Dario and I are working together on this, so let me clarify, what we
 want to
  achieve. An example query in a friend network would be:
 
  Retrieve a set of people P that are the direct friends of person A. P
 should
  include only those friends that are also on a path between A and
 another
  user B.
 
  We know how to find paths, but we fail at returning nodes - let alone
 sets
  of nodes.
 
  The old ReturnableEvaluator seemed to achieve just that: A client hook
 for
  evaluating whether a specific node should be returned from a
 traverser.,
  but that is deprecated in the current milestone release. We're unable
 to
  find the equivalent functionality with the new Traversal framework.
 
  ReturnableEvaluator is like controlling the INCLUDE/EXCLUDE part of an
  evaluation
  StopEvaluator is like controlling the CONTINUE/PRUNE part of an
 evaluation
 
  The @Deprecated TraversalDescription#prune and #filter are also a
  direct mapping of StopEvaluator and ReturnableEvaluator respectively.
  Evaluator replaces those and combines them into one concept where you
  can express the same semantics.
 
 
  Thanks
  Stephan
 
 
 
  On Thu, Apr 7, 2011 at 09:35, Mattias Persson 
 matt...@neotechnology.comwrote:
 
  Sory, I meant
 
  INCLUDE_AND_PRUNE
     the path will be included in the result set, but the traversal
     won't go further down that path, but will continue down other paths
    that haven't been pruned
 
 
 
  --
  Mattias Persson, [matt...@neotechnology.com]
  Hacker, Neo Technology
  www.neotechnology.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
 
 
 
 
  --
  Mattias Persson, [matt...@neotechnology.com]
  Hacker, Neo Technology
  www.neotechnology.com
  ___
  Neo4j mailing list
  User@lists.neo4j.org
  https://lists.neo4j.org/mailman/listinfo/user
 
  

Re: [Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-07 Thread Stephan Hagemann
Thanks, that will help! Iwill try defining my own uniqueness criteria.


  Oh, so if any node in the path has been returned in any other path
 before if (except the start node) then exclude it? That's the first
 time I've heard that requirement. Love the fact that you sent a
 picture, guys :)


Handcrafted - that's how we do it ;)

Our requirement is a little bit different than you state it:

if any node in the path _that will be returned_ has been returned in any
other path
before then exclude it.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-06 Thread Dario Rexin
Hello,

we are trying to construct an Evaluator that will select only one node from the 
middle of a path and include it in the result. We do have a specific path we 
are looking for and the endNode is stored in 'end'. Now what we would like to 
do is have an Evaluator like this:

  import org.neo4j.graphdb.traversal.
Evaluator;

  new Evaluator(){
@Override
public Evaluation evaluate(org.neo4j.graphdb.Path path) {
if(path.length()  3) {
return Evaluation.EXCLUDE_AND_PRUNE;
} else if (path.length() == 2) {
return Evaluation.INCLUDE_AND_CONTINUE;
} else if (path.length()  2){
return Evaluation.EXCLUDE_AND_CONTINUE;
} else {
return path.endNode().getId() == end.getId() ? 
Evaluation.EXCLUDE_AND_PRUNE : Evaluation.DROP_PATH_AND_PRUNE;
}
}
  }

The decision on whether to accept or drop a path is based on wether we have 
reached the endNode. That's why we would like to use something like 
DROP_PATH_AND_PRUNE, which doesn't exist. What are we missing?

Any help appreciated!

Thanks,
Stephan and Dario
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Constructing an evaluator that only takes specific nodes from a path

2011-04-06 Thread Peter Neubauer
Dario,
I am not quite sure I understand what you mean by drop is that not
to include the path into the result or prune or something else? Do you
have a concrete example of this, maybe a simple toy graph test with
toy information?

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 Wed, Apr 6, 2011 at 6:35 PM, Dario Rexin dario.re...@xing.com wrote:
 Hello,

 we are trying to construct an Evaluator that will select only one node from 
 the middle of a path and include it in the result. We do have a specific path 
 we are looking for and the endNode is stored in 'end'. Now what we would like 
 to do is have an Evaluator like this:

          import org.neo4j.graphdb.traversal.
 Evaluator;

          new Evaluator(){
            @Override
            public Evaluation evaluate(org.neo4j.graphdb.Path path) {
                if(path.length()  3) {
                    return Evaluation.EXCLUDE_AND_PRUNE;
                } else if (path.length() == 2) {
                    return Evaluation.INCLUDE_AND_CONTINUE;
                } else if (path.length()  2){
                    return Evaluation.EXCLUDE_AND_CONTINUE;
                } else {
                    return path.endNode().getId() == end.getId() ? 
 Evaluation.EXCLUDE_AND_PRUNE : Evaluation.DROP_PATH_AND_PRUNE;
                }
            }
          }

 The decision on whether to accept or drop a path is based on wether we have 
 reached the endNode. That's why we would like to use something like 
 DROP_PATH_AND_PRUNE, which doesn't exist. What are we missing?

 Any help appreciated!

 Thanks,
 Stephan and Dario
 ___
 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] Constructing an evaluator that only takes specific nodes from a path

2011-04-06 Thread Dario Rexin
Hi Peter, yes that would be not to include the path in the result set. 



On 07.04.2011, at 07:01, Peter Neubauer peter.neuba...@neotechnology.com 
wrote:

 Dario,
 I am not quite sure I understand what you mean by drop is that not
 to include the path into the result or prune or something else? Do you
 have a concrete example of this, maybe a simple toy graph test with
 toy information?
 
 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 Wed, Apr 6, 2011 at 6:35 PM, Dario Rexin dario.re...@xing.com wrote:
 Hello,
 
 we are trying to construct an Evaluator that will select only one node from 
 the middle of a path and include it in the result. We do have a specific 
 path we are looking for and the endNode is stored in 'end'. Now what we 
 would like to do is have an Evaluator like this:
 
  import org.neo4j.graphdb.traversal.
 Evaluator;
 
  new Evaluator(){
@Override
public Evaluation evaluate(org.neo4j.graphdb.Path path) {
if(path.length()  3) {
return Evaluation.EXCLUDE_AND_PRUNE;
} else if (path.length() == 2) {
return Evaluation.INCLUDE_AND_CONTINUE;
} else if (path.length()  2){
return Evaluation.EXCLUDE_AND_CONTINUE;
} else {
return path.endNode().getId() == end.getId() ? 
 Evaluation.EXCLUDE_AND_PRUNE : Evaluation.DROP_PATH_AND_PRUNE;
}
}
  }
 
 The decision on whether to accept or drop a path is based on wether we have 
 reached the endNode. That's why we would like to use something like 
 DROP_PATH_AND_PRUNE, which doesn't exist. What are we missing?
 
 Any help appreciated!
 
 Thanks,
 Stephan and Dario
 ___
 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 mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user