[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt.ocl] Re: def expression?

Hi, Joel,

The current "official" OCL Console example does not support def: expressions by any means.  It only supports query expressions (in "M2" mode) or constraints (in "M1" mode; invariants on classifier selection, post-conditions on operation selection, derive on attribute selection).  In particular, there is no support for any of the concrete syntax of context declaration (which includes the "def:" keyword) and the console internal always constructs this context declaration according to the selected object.

In your case, the console is prepending to your '_expression_' (which includes the "def:" keyword) a context declaration ending with "inv:" because it thinks you want to define an invariant constraint or a query.

Cheers,

Christian


On Sun, 2009-08-02 at 10:21 +0200, Joel Greenyer wrote:
Hi Ed,
I took a def _expression_ from the royal-and-loyal example

def  :
	initial : String = self.name.substring(1, 1)

and execute it (in the context of an object that has a "name" attribute). I did that in the OCL console as well as in my 
transformation rules. Either way, I get

org.eclipse.ocl.SyntaxException: "inv:" misplaced construct(s)

Any idea? The OCL interpreter/environment does really not have to be set up in any certain way to support def-expressions?

Joel