Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » ocl for reflexive associationclass navigation bug
ocl for reflexive associationclass navigation bug [message #1271587] Sat, 15 March 2014 15:28 Go to next message
Pieter Martin is currently offline Pieter MartinFriend
Messages: 14
Registered: July 2013
Junior Member
Hi,

I have the following UML,

Person[0..*]knownBy------Friendship-------knows[0..*]Person

When parsing the ocl expression on context Person, self.friendship[knows]

I get the following exception

org.eclipse.ocl.SemanticException: Qualifier on association class navigation must be a role of the navigation source: (self.friendship)

This occurs because the role 'knows' is owned by the association and the validation in
org.eclipse.ocl.parser.AbstractOCLAnalyzer
checks for
uml.getAttributes(sourceType).contains(property)

and this check does not include roles owned by the association.

If I move the role to Person then the ocl parsing succeeds. So there is a work around but Papyrus defaults to putting a role on the association making it tedious to move the role to get the ocl to succeed.

Looks to me like a bug?

Further I see in the ocl spec the navigation is to the associationclass name without lowercasing the first character. This is minor just wondering why the lowercase?

Thanks
Pieter
Re: ocl for reflexive associationclass navigation bug [message #1271618 is a reply to message #1271587] Sat, 15 March 2014 17:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4188
Registered: July 2009
Senior Member
HI

Qualified associations are so poorly understood and exercised that I
would not be at all surprised to see quite a few bugs in tools and in
the OCL specification.

I can at least answer the lowercase issue. OCL 2.0/2.2 over-interpreted
a UML working practice for explicit names and so implied that name
conversion was appropriate for implicit names. This was clarified in OCL
2.3. No automated name conversion should occur.

How do you do qualified associations in Papyrus? last I heard they were
still a future.

Regards

Ed Willink

On 15/03/2014 15:28, Pieter Martin wrote:
> Hi,
>
> I have the following UML,
>
> Person[0..*]knownBy------Friendship-------knows[0..*]Person
> When parsing the ocl expression on context
> Person, self.friendship[knows]
>
> I get the following exception
>
> org.eclipse.ocl.SemanticException: Qualifier on association class
> navigation must be a role of the navigation source: (self.friendship)
>
> This occurs because the role 'knows' is owned by the association and
> the validation in
> org.eclipse.ocl.parser.AbstractOCLAnalyzer checks for
> uml.getAttributes(sourceType).contains(property)
> and this check does not include roles owned by the association.
>
> If I move the role to Person then the ocl parsing succeeds. So there
> is a work around but Papyrus defaults to putting a role on the
> association making it tedious to move the role to get the ocl to succeed.
>
> Looks to me like a bug?
>
> Further I see in the ocl spec the navigation is to the
> associationclass name without lowercasing the first character. This is
> minor just wondering why the lowercase?
>
> Thanks
> Pieter
>
Re: ocl for reflexive associationclass navigation bug [message #1271628 is a reply to message #1271618] Sat, 15 March 2014 18:17 Go to previous message
Pieter Martin is currently offline Pieter MartinFriend
Messages: 14
Registered: July 2013
Junior Member
Hi,

In Papyrus I use the model explorer and add a "property" to the member end property.

However I prefer to use the UML2 editor for this as it has a better gui. Right clicking on a member end property there gives one the option to add a "qualifier" not another "property" which leave me feeling more confident about what has happened.

I then tend to add a comment to the class diagram to indicate the association being qualified. Seeing as (in my understanding) the member end's multiplicity on a qualified association is generally [0..1] without some indication that the association is qualified the diagram conveys completely incorrect information.

Further I can not ignore the multiplicity and fudge it to be [0..*] as then I can not tell if the qualified association indicates that a unique index or regular index needs to be created down stream.

While I am at it I might as well say that I do not understand why it is such a low priority for Papyrus. Many associations in my rather corporate world requires qualifiers. id number on customer, account number on account and so it goes on.

The qualifier information makes a big difference in implementing data integrity validation (duplicate idnumbers) and efficient data structures (finding customers by their idnumber).

Anyhow, thanks for the help and a fantastic project.

Regards
Pieter
Previous Topic:qualified association returns object instead of collection
Next Topic:org.eclipse.ocl.examples.feature.group in target platform
Goto Forum:
  


Current Time: Sun Dec 21 05:33:36 GMT 2014

Powered by FUDForum. Page generated in 0.02848 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software