Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OclType as query parameter problem
OclType as query parameter problem [message #645633] Sun, 19 December 2010 06:27 Go to next message
Glenview Jeff is currently offline Glenview JeffFriend
Messages: 79
Registered: September 2010
Member
I'm guessing I'm making a simple mistake but can't figure out how to pass an OclType as parameter to a query.

This works:
[query public test() : 
	Boolean = aThing.widgets->exists(oclIsTypeOf(ConcreteType)) /]


But passing it as a parameter doesn't:
[query public test(aType : OclType ) : 
	Boolean = aThing.widgets->exists(oclIsTypeOf(aType)) /]


I'd appreciate help very much. Thanks!
Re: OclType as query parameter problem [message #645642 is a reply to message #645633] Sun, 19 December 2010 10:35 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Your expertise has now reached the point where the OCL specification,
and consequently Eclipse OCL is broken.

The status of OclType, OclElement and OclAny::oclType have varied from
version to version as each inadequacy is revealed.

The ability to use types as Literal expressions is missing from the
OCL specification, even though there are many oclAsType(xx) expressions
in which xx is clearly a type literal. OCL 2.3 defines a TypeLiteralExp
to resolve this.

I anticipate that OMG OCL 2.4 and Eclipse OCL 3.1 Examples will finally
endorse what you are trying to do by defining a uniform ability to
handle meta-types.

I'm afraid that doesn't help you today.

Regards

Ed Willink

On 19/12/2010 06:27, glenviewjeff wrote:
> I'm guessing I'm making a simple mistake but can't figure out how to
> pass an OclType as parameter to a query.
>
> This works:
> [query public test() : Boolean =
> aThing.widgets->exists(oclIsTypeOf(ConcreteType)) /]
>
>
> But passing it as a parameter doesn't:
> [query public test(aType : OclType ) : Boolean =
> aThing.widgets->exists(oclIsTypeOf(aType)) /]
>
>
> I'd appreciate help very much. Thanks!
>
Re: OclType as query parameter problem [message #645656 is a reply to message #645642] Sun, 19 December 2010 14:35 Go to previous message
Glenview Jeff is currently offline Glenview JeffFriend
Messages: 79
Registered: September 2010
Member
Thanks so much Ed for the quick response and detailed explanation. I found it more than a bit funny that you mentioned that "at this level of expertise," as I only started reading the OCL specification for the first time for about 10 minutes last night to try to get the syntax right.

I have had a pretty good experience so far with the Eclipse/Acceleo/MTL path, but I had heard several somewhat negative remarks on the OMG's output on Software Engineering Radio. I wonder if this one of those sources of criticism.

I'll keep working on this path until I find that it becomes objectionable enough to switch or the language is fixed.

Jeff
Previous Topic:Re: [Xpand & Xtend] OCL to Java
Next Topic:Re: [MDT-OCL] Defining OCL constraints
Goto Forum:
  


Current Time: Thu Mar 28 21:59:57 GMT 2024

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

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

Back to the top