OCL and uml::InstanceSpecification [message #50399] |
Thu, 07 February 2008 08:17 |
Eclipse User |
|
|
|
Originally posted by: firstname.name.gmail.com
hello,
I am facing with some problems with OCL queries on uml::InstanceSpecification
elements. I am using the OCL interpreter (v.1.1.1v20070713).
I have a uml model named MyModel, owning one uml class named MyClass and one uml
InstanceSpecification named myInstance (the instance specification has no
classifier). I do queries UML/M2 levels.
1) problem with InstanceSpecification
I select myInstance:
[query] self.name
[result]
no name is returned. Of course, if do the same on my class, I get the name
MyClass
2) problem with oclIsKindOf
Now, I select my model element MyModel and do the following query:
[query] self.ownedElement->select(e | e.oclIsKindOf(uml::InstanceSpecification))
[result]
[query] self.ownedElement
[result] Instance Specification myInstance
[result] Class MyClass
Maybe this odd thing is linked to this (resolved?) bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=196264
thanks.
--
F. Lagarde
|
|
|
Re: OCL and uml::InstanceSpecification [message #50484 is a reply to message #50399] |
Fri, 08 February 2008 13:38 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, François,
Actually, you're seeing the effect of
https://bugs.eclipse.org/bugs/show_bug.cgi?id=194390
The UMLEvaluationEnvironment was getting muddled when evaluating expressions
on InstanceSpecifications because of its support for evaluating model
constraints on instance models. On an InstanceSpecification, it assumed
that the constraint was a model constraint, even if the client intended it
as a metamodel constraint.
The 1.2 release resolves this ambiguity by adding evaluation options to the
UMLEvaluationEnvironment, which allow a client to specify whether
evaluation should treat context elements as an instance model (i.e.,
InstanceSpecifications as an object model in a UML model), or as run-time
objects (i.e., instances of the UML model viewed as a metamodel, generated
from UML2). There is a third option, "adaptive", which is the default and
provides compatible behaviour with the 1.1 release. It does a better job
of guessing which way to treat objects, but still sometimes gets it wrong.
Have a look at the the org.eclipse.ocl.uml.options.EvaluationMode in any
recent 1.2 build.
Cheers,
Christian
François Lagarde wrote:
> hello,
>
> I am facing with some problems with OCL queries on
> uml::InstanceSpecification
> elements. I am using the OCL interpreter (v.1.1.1v20070713).
>
> I have a uml model named MyModel, owning one uml class named MyClass and
> one uml InstanceSpecification named myInstance (the instance specification
> has no classifier). I do queries UML/M2 levels.
>
> 1) problem with InstanceSpecification
> I select myInstance:
> [query] self.name
> [result]
>
> no name is returned. Of course, if do the same on my class, I get the name
> MyClass
>
> 2) problem with oclIsKindOf
> Now, I select my model element MyModel and do the following query:
> [query] self.ownedElement->select(e |
> [e.oclIsKindOf(uml::InstanceSpecification)) result]
> [query] self.ownedElement
> [result] Instance Specification myInstance
> [result] Class MyClass
>
> Maybe this odd thing is linked to this (resolved?) bug
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=196264
>
> thanks.
>
|
|
|
Powered by
FUDForum. Page generated in 0.03513 seconds