Hi & welcome Philip! Philip Southam: > In the "hello world" type of examples relationship objects returned from > [snip] > firstNodeInstance.createRelationshipTo(secondNodeInstance, > MyRelationshipTypes.EXAMPLE) > [/snip] > seem to be ignored, in the since that no data other than the > relationship type is associated with it. >
Even if no further data is associated with relationships, they still give the data it's structure and enable you to traverse/navigate this structure. Moving on to the IMDB example, relationships makes it very easy to answer questions like "which movies does [actor] have a role in?" or "which actors have a role in [movie]?" You simply iterate over the ACTS_IN type relationships connected to the actor/movie node. And as we can answer the above type of questions (and at a very high speed), we are also able to find the shortest path between two actors, a.k.a. their Bacon path. > But introduce the binding of Role to RelTypes.ACTS_IN and I'm a little > confused. We can index the objects bound to nodes making the > properties associated with them easily query-able, but why do we bind > objects to relationships if we cannot easily query them? Because we can still find them using traversal/navigation. And I can't really imagine the IMDB domain without Role objects! Using them, our application can speak the language of the domain, not having to care about the underlying data structure. > I ask this > because I cannot figure out, using the IMDB example, how do I return > the Role object representing "Neo" if I don't know the actor or movie > that the character/role was in. In the IMDB application, this is not really possible. So: good question! :-) > In IMDB example, if the quering of > Roles were a requirement, is there a different way that the graph/ > domain could be designed to allow for this? > Yes. We could have made the Roles nodes, too. Instead of just a simple relationship we could use a relationship -- node -- relationship construct. Please feel free to ask more questions! /anders -- Anders Nawroth [and...@neotechnology.com] GTalk, Skype: anders.nawroth Phone: +46 737 894 163 http://twitter.com/nawroth http://blog.nawroth.com/ _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user