Niclas Hedhman wrote:
> I probably don't get the concept of AssociationRole (yet?)... Looking
> at your JIRA post;
> 
> interface Employer
> {
>  ManyAssociation<AssociationRole<Employee,Position>> employees();
> }
> 
> 1. Why is the Position a good example? Why doesn't it belong inside
> the Employee, and the Employee references the Person? For instance, a
> Position often comes with Rights and Responsibilities, and wouldn't
> that be exploded into a complex problem of references to Entities in
> AssocitationRoles, query on fields in AssociationRole "type"??

I think you are assuming that this a model "owned" by the 
Company/Employer. If it is instead an "open database" (a la LinkedIn), 
then an Employee can work easily for many Employers at the same time. A 
Company would be an Employer and a Person would be an Employee, and the 
Position is what qualifies the relation between the two.

The idea is basically the same as association roles in UML, so read 
descriptions of that to get more info on the concept.

> 2. If the interface is instead;
> 
> interface Employer
> {
>  SetAssociation<AssociationRole<Employee,Position>> employees();
> }
> 
> Does that mean that there could be an arbitrarily number of of
> AssociationRoles to the same Employee? Otherwise, it doesn't make
> sense at all.

I would think so, yes. It is only the specific combination of 
Employee/Position that needs to be unique in a set.

> We had the discussion in KL a few months ago, about the pro/con of
> subtyped Associations. IIRC, we basically said that "in principle a
> good idea" but that "EntityStores will have problems". Could you
> elaborate on the differences between the AR vs subtypes, from these
> two overall pro vs con of subtypes?

One difference is that I now figured out how to support it in 
EntityStores trivially, without any major changes at all. The difference 
is that an association points to something which can only be two 
references (asociated entity+role entity), which is easy to store. What 
we discussed earlier was to have subtypes of Association and put the 
properties on that (IIRC), which is way trickier. I've implemented 
support for it in all EntityStores so it definitely works (since it's so 
simple).

Right now I'm doing the final part, which is to support queries over 
association roles. Almost done.

/Rickard


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to