Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » check refernce is defined
check refernce is defined [message #1766076] Thu, 15 June 2017 12:58 Go to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Hi,

When I input the below ocl program to "EMFtoCSP" tool. I have the bellow error:
import Families : 'Families.ecore'

package families

context Member

inv ocl1 : not familyFather.oclIsUndefined()

endpackage

index.php/fa/29672/0/

However, when I input another ocl program it works fine. It seems something was wrong in my ocl program although it has no syntax error.
I attached the metamodel.
  • Attachment: f.JPG
    (Size: 35.25KB, Downloaded 720 times)
  • Attachment: Families.ecore
    (Size: 2.12KB, Downloaded 276 times)


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: check refernce is defined [message #1766081 is a reply to message #1766076] Thu, 15 June 2017 13:28 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The message offers two possible non-OCL reasons for the unexpected error. Further advice is to look at the *.ecl.

You might try familyFather <> null to avoid dependence on the troublesome invalid concept.

Otherwise debug the exception in the EMFtoCSP tooling.

Regards

Ed Willink
Re: check refernce is defined [message #1766089 is a reply to message #1766081] Thu, 15 June 2017 14:28 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
Thank you.

When I tried "familyFather <> null", the error disappears. my problem was solved.
However, when I write "familyFather = null", the error appears. How should I write it?
I also attached the .ecl file.


Member of MDSE Research Group
http://mdse.ui.ac.ir

[Updated on: Thu, 15 June 2017 14:30]

Report message to a moderator

Re: check refernce is defined [message #1766095 is a reply to message #1766089] Thu, 15 June 2017 15:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

not familyFather.oclIsUndefined() is true for non-null and non-invalid, false for null or invalid

familyFather <> null is true for non-null, false for null, invalid for invalid (almost the same; the same for practical purposes).

If familyFather = null gives an error then something wierd is going on. Possibly familyFather is provably non-null because of a 1 lowerBound but I see no such lowerBound. It seems like EMFtoCSP has some questions to answer.

Regards

Ed Willink
Re: check refernce is defined [message #1766181 is a reply to message #1766095] Sat, 17 June 2017 00:35 Go to previous messageGo to next message
Banafsheh Azizi is currently offline Banafsheh AziziFriend
Messages: 328
Registered: July 2016
Senior Member
I contacted with its developer and he said "one of the limitations of the EMFtoCSP tool is the lack of support for OCL's three valued logic. The null and undefined values are not supported by the tool, so you can get unexpected error messages if you use them in your OCL code".

Do you know an alternative approach?


Member of MDSE Research Group
http://mdse.ui.ac.ir
Re: check refernce is defined [message #1766187 is a reply to message #1766181] Sat, 17 June 2017 07:41 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Hm. No null/invalid! Hardly an OCL tool then.

You could upgrade EMFtoCSP to support at least null and possibly invalid.

You could modify your modeling to make NULL / INVALID as explicitly modeled concepts.

You could modify your modeling to prevent any usage of null / invalid.
- the safe navigation analyses enable most forms of unsafe null to be detected, non-zero lowerbounds prohibit null
- you might use a variant OCLstdlib to exclude null support
- you might exploit the org.eclipse.ocl.pivot.internal.manager.InvalidAnalysis on the Lazy Collections branch (ewillink/509670) to prove that your expressions are invalid-free

Beware; the independent InvalidAnalysis might be integrated extending [?] (may-be-null) or [1] (may-not-be-null) element multiplicities in the grammar with [/] (may-be-invalid-or-null) and introducing Nullable<T>, Invalidatable<T> wrapper types to model them in the AST.

Regards

Ed Willink
Previous Topic:ETL constraints to OCL
Next Topic:Simplifying OCL Expressions
Goto Forum:
  


Current Time: Thu Apr 25 19:52:41 GMT 2024

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

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

Back to the top