self construct ignored
----------------------

         Key: OCL-15
         URL: http://jira.andromda.org/browse/OCL-15
     Project: OCL Translation
        Type: Bug
  Components: AndroMDA Validation  
 Environment: WinXP, Java 1.4
    Reporter: Dominik Hofmann
 Assigned to: Chad Brandon 
    Priority: Minor


I tried to use “self” in one of my constraints, but it seems to be ignored by 
AndroMDA. According to my understanding of OCL self should reference the 
context object of a constraint:

“Each OCL expression is written in the context of an instance of a specific 
type. In an OCL expression, the reserved word self is used to refer to the 
contextual instance. For instance, if the context is Company, then self refers 
to an instance of Company.” OCL SPEC

But this is not the case. (May be my constraint is wrong.)

Example: 

Metafacade BstereoFacade
- one property: btag: String


Metafacade AstereoFacade
properties: 
-       atag: String
-       associatedBs: Collection (of  BstereoFacade)

Constraint on AstereoFacade: (supposed to check if the btag’s of all associated 
BstereoFacades have the same value as the atag of the context object)  

context AstereoFacade inv: associatedBs->forAll(btag = self.atag)

This causes the following error:
No property named 'atag', found on element 
'de.ifis.guidsl_facade.BstereoFacadeLogicImpl[TestClass2]'

According to my understanding of self, it should be of type AstereoFacade, 
which has a atag property.

What also confuses me is that there is no difference in the code generated for: 
context AstereoFacade inv: associatedBs->forAll(btag = self.atag)
context AstereoFacade inv: associatedBs->forAll(btag = atag)
=> using self makes no difference






-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php

Reply via email to