Hi,

> > The mapping to nodes and relationships is easy, if you have a node
type:
> > - User --> Node {type = User}
> > - UserGroup --> Node {type = UserGroup}
> > - members --> Relationship {type = members}
> > - admins --> Relationship {type = admins}
> >
> 
> I'm not sure I follow you here. Does relationships from UserGroup ->
> UserGroup not have a type?

This relationship would be of type "members", e.g. relationships of this
type either point to nodes of type "User" or nodes of type "UserGroup".


> Using three relationship types {group, member, admin} the node type
> would be given from the relationship in all cases. The strenght of
> putting this information in the relationship type (and I'm talking
about
> the RelationshipType interface here, not a property value) is that you
> can get the nodes you want without having to inspect any properties at
> all.

Yes, you can get rid of relations to abstract superclasses by
introducing redundancy, e.g. by using distinct relationship types for
every kind of concrete subclass. However, this can lead to new problems:

Imagine, someone wants to introduce another object type that can also be
a member of a group. If you rely on node types, you can simply create a
new subclass of "Principal" in the domain model. That's it. It can be
added to the group, because groups can have principals as members, and
when resolving the "members" relationship, the new domain object can be
instantiated, because the node specifies its type.

On the other hand, with attaching the type information to the
relationship, you would have to rework all classes that are referencing
the new object. In our example, you would have to modify the "UserGroup"
class too and add some new relationship type to it that can point to the
new object. I don't think this is a good idea...

Regards,
Peter

_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to