| OCL for InstanceSpecifications on M1 [message #721231] |
Thu, 01 September 2011 04:30  |
Timothy Marc Messages: 547 Registered: July 2009 |
Senior Member |
|
|
Hi all,
this might be a silly question, but I'm really not sure about the answer
(maybe I got something wrong when talking about instances at M1 level):
I need to create InstanceSpecifications of a particular classifier (mostly
signal and class) at M1 level. So I use the well-known InstanceSpecification
element provided by UML2 Superstructure for the in-model instantiation of
classifier.
Let's construct a simple example:
Class A{
+ attA : Integer [0..1]
}
Now, assume there some OCL constraints applied on the classifier for which I
have to create the InstanceSpecification like
context ClassA
inv attA: self.attA > 0 and self.attA <= 10
To check whether the constraint works, I create two InstanceSpecifications:
ins1:ClassA{
slot -> attA = LiteralInteger(value=-5)
}
insValid:ClassA{
slot -> attA = LiteralInteger(value=5)
}
Will the OCL engine complain about the first InstanceSpecification that do
not comply with the restriction given by the constraint? I have really no
idea whether the Eclipse OCL is aware of InstanceSpecification as in-model
instances at the same M-level (M1) where the defining context is located as
well.
Thanks for a nice answer.
Timothy
|
|
|