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: 27
Registered: April 2012
Junior Member
Hi,

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('http://www.eclipse.org/emf/2002/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: 5893
Registered: July 2009
Senior Member
Hi

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. http://issues.omg.org/browse/QVT14-49 raised.

Regards

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


Current Time: Mon May 28 07:42:04 GMT 2018

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

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

Back to the top