Skip to main content



      Home
Home » Modeling » Papyrus » Simple OCL question(Class and InstanceSpecification)
Simple OCL question [message #1117123] Thu, 26 September 2013 01:49 Go to next message
Eclipse UserFriend
Please allow me to ask this very basic question.

I created a class diagram with Papyrus, and defined a class "Library" with one property "name" of type String. I created an OCL constraint [self.name.size()>6] and created a constraint link to the Library class. Then, I created an instanceSpecification, named it to "abc" and chose Library as a classifier. I expected the result of model validation would be an error violating the OCL constraint, but no error was reported.

BTW, an OCL worked with UML Profile (created a profile, created a stereotype with a property "name" linked with the same OCL as above, applied it to a class, and model validation worked).

Could anybody let me know what I should have done to get the OCL working in above scenario?

Thank you very much in advance.
Akira
Re: Simple OCL question [message #1117225 is a reply to message #1117123] Thu, 26 September 2013 04:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi,


This is not supported in Papyrus. See the following bug:

Bug 417062: [OCL For Papyrus] Validating constraints defined on the M1 level for Instance Specifications on the M0 level is not possible
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417062


Regards,
Camille
Re: Simple OCL question [message #1119300 is a reply to message #1117225] Sat, 28 September 2013 05:22 Go to previous message
Eclipse UserFriend
Hi all,

I would like to add my two cents to this bug. If this is going to be
realized, please introduce a mechanism to suppress the validation for
certain InstanceSpecifications.

In the past, I also thought this needs to be definitely supported, but the
nature of InstanceSpecifications must not be confused with the nature of an
Instance! In UML, an InstanceSpecification specifies a set of Instances,
thus, it neither has to be completely specified (features are simply not
mentioned in the InstanceSpecification) nor does it have to cope with all
restrictions and constraints that are defined for the classifier of the
InstanceSpecification. An InstanceSpecification may be used to specify the
state of a system at any point in time, this means it may represent the
system during a transaction where the constraints does not have to be
restricted at all.

If you just simply implement that each and every InstanceSpecification
always has to comply with the constraint specified for its classifiers, the
idea of InstanceSpecification is contradicted and it is not longer possible
to model e.g, incorrect data for a given class, which is an important
concept in testing e.g.

Nevertheless, I agree that it would be helpful in situations to claim that a
certain InstanceSpecification complies with the constraints defined at type
level. But as I said, this needs to be explicitly stated for the given
InstanceSpecification.

Marc-Florian

"Camille Letavernier" wrote in message
news:l20pvt$ko1$1@xxxxxxxxe.org...

Hi,


This is not supported in Papyrus. See the following bug:

Bug 417062: [OCL For Papyrus] Validating constraints defined on the M1 level
for Instance Specifications on the M0 level is not possible
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417062


Regards,
Camille
Previous Topic:Association classes and association blocks
Next Topic:OCL Constraints on Profile
Goto Forum:
  


Current Time: Wed Jul 16 07:05:01 EDT 2025

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

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

Back to the top