Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL and uml::InstanceSpecification
OCL and uml::InstanceSpecification [message #50399] Thu, 07 February 2008 08:17 Go to next message
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 Go to previous message
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.
>
Previous Topic:[Announce] MDT OCL 1.2.0 I200802071021 is available
Next Topic:help me with a constraint please :)
Goto Forum:
  


Current Time: Tue Sep 16 21:36:07 GMT 2014

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

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