Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Semantics of xmap on a null value
Semantics of xmap on a null value [message #1754585] Mon, 20 February 2017 14:59 Go to next message
Rolf Theunissen is currently offline Rolf TheunissenFriend
Messages: 259
Registered: April 2012
Senior Member

I wonder what the semantics should be of calling a xmap on a null value? For instance as in the example below. Should this raise an exception or should this return an invalid value? The current QVTo implementation returns 'invalid'. The specification only talks about checking the 'when' precondition. Though, I would not expect 'invalid' values to be returned by xmap.

Kind Regards,
Rolf Theunissen

modeltype ecore "strict" uses ecore('');

transformation NewTransformation();

main() {
    var a : EAttribute;
    var b := a.xmap toEClass();
    log ("b", b);

mapping EAttribute::toEClass() : EClass
Re: Semantics of xmap on a null value [message #1754590 is a reply to message #1754585] Mon, 20 February 2017 15:24 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7492
Registered: July 2009
Senior Member

Doing things with null is generally BAD. Bad things in OCL lead to an invalid value. Bad things in QVTo lead to an exception.

The new QVT 1.3 8.1.20 wording doesn't help that much: Every use of a source value by an ImperativeExpression has an implicit assertion that the source value is not invalid,
therefore using invalid is an assertion failure

But I'm inclined to take the view that the "a.xmap" is a QVTo extension that emulates an OCL navigation and so returns invalid. Therefore in your example any use of the invalid "b", should throw an exception. But of course "log" is perhaps an "access" rather than "use" and so we don't want addition of a log to a program to add an exception. raised.


Ed Willink
Previous Topic:Serialization of QVT-O Traces
Next Topic:apply stereotype on element Problem!
Goto Forum:

Current Time: Wed Jul 06 23:15:31 GMT 2022

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

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

Back to the top