Operation Body Expression [message #972270] |
Mon, 05 November 2012 08:48  |
Eclipse User |
|
|
|
I am trying to use Operation Body Expression as they are defined in the OCL specification at section 7.4.6
I created an example ocl file like this
import '[url]http://www.eclipse.org/uml2/4.0.0/UML[/url]'
package UML
context Operation
def: class:Class=self.oclAsType(ocl::OclElement)->closure(oclContainer())->select(oclIsTypeOf(Class))->any(true).oclAsType(Class)
inv testName('this is a test warning'):
class.name='Test'
endpackage
And validated a simple UML model against it. It works properly.
If I modify the ocl in this way
import 'http://www.eclipse.org/uml2/4.0.0/UML'
package UML
context Operation
def: class:Class=self.oclAsType(ocl::OclElement)->closure(oclContainer())->select(oclIsTypeOf(Class))->any(true).oclAsType(Class)
inv testName('this is a test warning'):
class.name='Test'
context Operation::getContainerClass() : Class
body: self.oclAsType(ocl::OclElement)->closure(oclContainer())->select(oclIsTypeOf(Class))->any(true).oclAsType(Class)
endpackage
I get an error depicted on the getContainerClass() Operation Declaration saying
Unresolved 'unknown-type' 'getContainerClass'
What am I doing wrong?
[Updated on: Mon, 05 November 2012 08:48] by Moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05421 seconds