Thanks Mattias. I agree about storing the IDs, it doesn't feel right but I'm 
still working out the best network model.
Thanks for the example, I guess I need to relook at when to use a filter vs 
control the traversal other ways.

On Nov 24, 2010, at 4:00 PM, Mattias Persson wrote:

> Hi Kalin,
> 
> To begin with I'm not fond of storing ids as properties... that's what
> relationships are for. So I'd perhaps insert a "middle node" between Asset
> and Consumer which then also can have relationships to Producers.
> 
> Anyways, to get that behaviour you can use a filter which will exclude
> unwanted paths.
> 
> Traversal.description().uniqueness(RELATIONSHIP_PATH)
>   .relationships(Contributes_to, OUTGOING)
>   .relationships(Subscribes_to, INCOMING)
>   .filter(new Predicate<Path>() {
>       public boolean accept(Path position) {
>           if ( position.length() != 2 ) return false;
>           Relationship subscribesToRel = position.lastRelationship();
>           if ( /* check properties on subscribesToRel is OK */ ) return
> true;
>           return false;
>       }
>   });
> 
> do you need the pruneAfterDepth(2) here? I don't think so because I don't
> think your traverser will be able to go deeper anyways, but that's just a
> detail.
> 
> 
> 
> 
> -- 
> 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

Reply via email to