Hardly spam, Richard. I often find useful insight when people post questions which they subsequently answer themselves. Particularly with a new way of thinking like using a graph instead of relational tables.
Cheers, Andreas On Jul 10, 2009, at 1:55 AM, Richard Wallace wrote: > You know what, I just found the traverse method variant that takes a > variable number of relationship types and directions > <http://api.neo4j.org/current/org/neo4j/api/core/Node.html#traverse(org.neo4j.api.core.Traverser.Order,%20org.neo4j.api.core.StopEvaluator,%20org.neo4j.api.core.ReturnableEvaluator,%20java.lang.Object...) > > >. > Looks like that does exactly what I need. > > Sorry for the spam, > Rich > > On Thu, Jul 9, 2009 at 10:26 PM, Richard > Wallace<[email protected]> wrote: >> Hello, >> >> I've been experimenting with neo4j as a replacement for a typical >> relational database in an application I'm working on. The object >> graph I have has a relationship path like >> >> Customer ---- customer ordered ----> Order ----> order includes ----> >> Item ----> of type ----> Type >> >> There are other relationships, but this is the one I'm interested in >> finding out about at the moment. What I want to be able to do is >> find >> all the customers that have ordered items of a specific type. I >> looked at the traverser API and you can find last relationship >> traversed, but is there a way to find the path that was traversed? >> One solution might be to start with the type node(s) and find any >> customer nodes? But, if there is an additional relationship like >> >> Customer ----> interested in -----> Type >> >> I'm not sure that would work. I suppose I could also do a the >> traversal a bit more manually like >> >> for (Relationship orderedRel : >> customerNode.getRelationships(ORDERED)) { >> for (Relationship includesRel : >> orderedRel.getEndNode().getRelationships(INCLUDED)) { >> for (Relationship typeRel : >> includesRel.getEndNode().getRelationships(OF_TYPE)) { >> if (typeRel.getProperty("name").equals(searchType)) { >> customersWhoBought.add(orderedRel.getEndNode()); >> } >> } >> } >> } >> >> But that seems inefficient. Is there a better way? >> >> Thanks, >> Rich >> > _______________________________________________ > Neo mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

