Skip to main content



      Home
Home » Modeling » OCL » check refernce is defined
check refernce is defined [message #1766076] Thu, 15 June 2017 08:58 Go to next message
Eclipse UserFriend
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 856 times)
  • Attachment: Families.ecore
    (Size: 2.12KB, Downloaded 329 times)
Re: check refernce is defined [message #1766081 is a reply to message #1766076] Thu, 15 June 2017 09:28 Go to previous messageGo to next message
Eclipse UserFriend
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 10:28 Go to previous messageGo to next message
Eclipse UserFriend
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.

[Updated on: Thu, 15 June 2017 10:30] by Moderator

Re: check refernce is defined [message #1766095 is a reply to message #1766089] Thu, 15 June 2017 11:25 Go to previous messageGo to next message
Eclipse UserFriend
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] Fri, 16 June 2017 20:35 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: check refernce is defined [message #1766187 is a reply to message #1766181] Sat, 17 June 2017 03:41 Go to previous message
Eclipse UserFriend
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: Tue Jul 15 23:11:34 EDT 2025

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

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

Back to the top