Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL Expression error in a constraint(OCL Expression error in a constraint)
OCL Expression error in a constraint [message #522086] Fri, 19 March 2010 17:25
Fernando Herrera is currently offline Fernando Herrera
Messages: 49
Registered: January 2010
Member
Hi guys. I'm reading the book Eclipse Modeling Project of Gronback. In the gmfmap file, I add a constraint for one generalization link in the form of link constraint in the target end:

(oppositeEnd <> self and not superclasses >includes(oppositeEnd) and
((oppositeEnd.oclIsTypeOf(dnc::Role) and self.oclIsTypeOf(dnc::Role))
or
(oppositeEnd.oclIsTypeOf(dnc::Party) and self.oclIsTypeOf(dnc::Party))
or
(oppositeEnd.oclIsTypeOf(dnc::Place) and self.oclIsTypeOf(dnc::Place))
or
(oppositeEnd.oclIsTypeOf(dnc::Thing) and self.oclIsTypeOf(dnc::Thing))
or
(oppositeEnd.oclIsTypeOf(dnc::Description) and
self.oclIsTypeOf(dnc::Description)))

I dont' know much about OCL (I'm looking for a book now). When I try to create the genmodel one error appear and it show:"invalid expression" for this expression.

Role,Party,Place, Thing, Description are classes that inherits of Archetype. The book says: The Link Constraints provide some important functionality to our link and to the Practitioner's usability of our diagram. The first constraint allows only a generalization link to be drawn from an archetype that does not yet have a superclass. In this manner, we restrict the underlying metamodel to just one superclass. Also, we prohibit cyclic inheritance by applying a target end constraint that checks to see if the oppositeEnd of the link contains the source in its superclasses list. With that, we disallow generalization to one's self. Finally, we prevent generalization relationships between archetypes of different types. In this approach to domain modeling, generalization is rarely used, and it doesn't make
sense to inherit from one type of archetype to another.

Where is the mistake? Can somebody help me?. The ocl interpreter says

Results:
Unrecognized variable: (oppositeEnd)

the oppositeEnd has another name?

[Updated on: Fri, 19 March 2010 19:39]

Report message to a moderator

Previous Topic:need guidance for execution of OCL query
Next Topic:EMF validation: provide clientData for validationListeners from inside a constraint
Goto Forum:
  


Current Time: Sat Aug 30 14:27:11 EDT 2014

Powered by FUDForum. Page generated in 0.06534 seconds