Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » OclInvalid as method argument
OclInvalid as method argument [message #33804] Wed, 10 May 2006 15:30 Go to next message
Eclipse UserFriend
Originally posted by: wojciech.zurek.gmail.com

Hello!

I have recently started using ocl for describing some constraints and
navigating through our EMF models.
My question is about navigation - I have OCL that looks like:

self.process.getObject(self.objectRef.objId)

self has reference to the process, that has method 'getObject' that takes
string which in this case is an attribute objectRef.
Unfortunately when there is no objectRef (the value of objectRef on the self
is null), evaluation visitor is trying to pass OclInvalid as the argument to
'getObject' method - as a result I have a lot of error messages in the log.

I have looked into EvaluationVisitor and it looks like there should be check
if any of the arguments is OclInvalid and return null or OclInvalid from the
method - without reporting this in Eclipse log file.
Am I right with that? (if so I can report defect/supply patch) or I should
rewrite my ocl expression in different way?

Wojciech Zurek
Re: OclInvalid as method argument [message #33874 is a reply to message #33804] Thu, 11 May 2006 14:03 Go to previous message
Christian Vogt is currently offline Christian VogtFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Wojciech,

The OCL 2.0 spec states that "any property call applied on null results in
OclInvalid, except for the operation oclIsUndefined()."

In your expression, if self.objectRef is null then the expression must
result in OclInvalid because it is unable to to evaluate the full
expression of self.objectRef.objId.

Depending on whether you prefer to call the getObject method with a null
argumement or not, and if getObject returns null for a null argument, here
are a couple suggestions for your expression:

self.process.getObject(if self.objectRef = null then null else
self.objectRef.objId endif)

or

if self.objectRef = null then null else
self.process.getObject(self.objectRef.objId) endif


Christian Vogt


Wojciech Zurek wrote:

> Hello!

> I have recently started using ocl for describing some constraints and
> navigating through our EMF models.
> My question is about navigation - I have OCL that looks like:

> self.process.getObject(self.objectRef.objId)

> self has reference to the process, that has method 'getObject' that takes
> string which in this case is an attribute objectRef.
> Unfortunately when there is no objectRef (the value of objectRef on the self
> is null), evaluation visitor is trying to pass OclInvalid as the argument to
> 'getObject' method - as a result I have a lot of error messages in the log.

> I have looked into EvaluationVisitor and it looks like there should be check
> if any of the arguments is OclInvalid and return null or OclInvalid from the
> method - without reporting this in Eclipse log file.
> Am I right with that? (if so I can report defect/supply patch) or I should
> rewrite my ocl expression in different way?

> Wojciech Zurek
Re: OclInvalid as method argument [message #577330 is a reply to message #33804] Thu, 11 May 2006 14:03 Go to previous message
Christian Vogt is currently offline Christian VogtFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Wojciech,

The OCL 2.0 spec states that "any property call applied on null results in
OclInvalid, except for the operation oclIsUndefined()."

In your expression, if self.objectRef is null then the expression must
result in OclInvalid because it is unable to to evaluate the full
expression of self.objectRef.objId.

Depending on whether you prefer to call the getObject method with a null
argumement or not, and if getObject returns null for a null argument, here
are a couple suggestions for your expression:

self.process.getObject(if self.objectRef = null then null else
self.objectRef.objId endif)

or

if self.objectRef = null then null else
self.process.getObject(self.objectRef.objId) endif


Christian Vogt


Wojciech Zurek wrote:

> Hello!

> I have recently started using ocl for describing some constraints and
> navigating through our EMF models.
> My question is about navigation - I have OCL that looks like:

> self.process.getObject(self.objectRef.objId)

> self has reference to the process, that has method 'getObject' that takes
> string which in this case is an attribute objectRef.
> Unfortunately when there is no objectRef (the value of objectRef on the self
> is null), evaluation visitor is trying to pass OclInvalid as the argument to
> 'getObject' method - as a result I have a lot of error messages in the log.

> I have looked into EvaluationVisitor and it looks like there should be check
> if any of the arguments is OclInvalid and return null or OclInvalid from the
> method - without reporting this in Eclipse log file.
> Am I right with that? (if so I can report defect/supply patch) or I should
> rewrite my ocl expression in different way?

> Wojciech Zurek
Previous Topic:OclInvalid as method argument
Next Topic:[Announce] EMFT OCL 1.0.0 I200605111218 is available
Goto Forum:
  


Current Time: Wed May 22 14:44:24 GMT 2024

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

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

Back to the top