|Re: Accessing extensions and tagged values in OCL constraints [message #66723 is a reply to message #66640]
||Fri, 06 February 2009 05:04
Originally posted by: cdamus.zeligsoft.com|
Is the Servicecall stereotype actually applied to the instance of
CallBehaviorAction on which you call this defined operation? If not,
then the "any" iterator will return null, and attempting to access the
"service" property of null results in a run-time exception, signaled by
This is the general way to access the attributes of applied stereotypes,
Do you get a different result if you try this formulation?
def servicecallService: Profile::Service =
if self.extension_Servicecall->isEmpty() then
The fact that the referenced Service is, itself, a stereotype instance
One handy way to debug problems like this is to turn on evaluation
tracing. Enable the org.eclipse.ocl/debug/evaluation debug option and
see in the console output what is the first sub-expression that
evaluates to OclInvalid, and trace it back (usually to null values) to
see what is the cause.
Michael Felderer wrote:
> I have created the following OCL query based on a user defined profile,
> where CallBehaviorAction has a stereotype Servicecall and a tagged value
> service which refers to an element whose type is itself a stereotype.
> context CallBehaviorAction
> def servicecallService:
> servicecallService(): Profile::Service =
> Eclipse OCL parses this definition but it is not evaluated right because
> it always returns
> org.eclipse.uml2.uml.internal.impl.InstanceSpecificationImpl @f73ca4
> (name: OclInvalid, visibility: <unset>) for an
> CallBehaviorAction-element which indeed has a value set for service. I
> think that already the extension_Servicecall returns an invalid value.
> Is this the right way to access tagged values? Can this type of query
> principally be handled and how?
> I am using org.eclipse.feature.group in version 1.3.0.v20081119 !
> thanks in advance,
> Michael Felderer
Powered by FUDForum
. Page generated in 0.03580 seconds