Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Basic syntax question in mapping(Basic syntax question in mapping)
Basic syntax question in mapping [message #1783576] Wed, 14 March 2018 09:52 Go to next message
Bruce Trask is currently offline Bruce TraskFriend
Messages: 58
Registered: July 2009
Member
Hello,

Apologies for a basic syntax question but I can't seem to locate the answer despite some looking.

For a given mapping:
mapping Root :: Root2Root() : Root {
element += self.element->select(a | a.oclIsKindOf(A))[A]->map A2B();
}
what is the purpose of the [A] or is it redundant (being shorthand forselect(a | a.oclIsKindOf(A)) ) . I am trying to find the reference in the OCL standard for this. I understand it is some sort of OCL shorthand but was wondering its purpose in this case.

Should I be able to execute
self.element->select(a | a.oclIsKindOf(A))[A]
in the OCL console. I get an error

Evaluating:
self.element->select(a | a.oclIsKindOf(A))[A]
Results:
2:1:2:42 "simpleNameCS" expected instead of "self.element->select(a | a.oclIsKindOf(A))"

I can do

Evaluating:
self.element->select(a | a.oclIsKindOf(A))
Results:
A 1
A -1

but not self.element[A]
for that I get

Evaluating:
self.element[A]
Results:
Qualifiers do not conform to expected types: (self.element)

Regards,
Bruce

[Updated on: Wed, 14 March 2018 10:15]

Report message to a moderator

Re: Basic syntax question in mapping [message #1783578 is a reply to message #1783576] Wed, 14 March 2018 10:37 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

One of my minor triumphs over OMG bureaucracy has been the retention of the index in OCL and QVT specifications. (Unfortunately the useful UML 2.5 index/concordance was stripped.) You will find that the "[...]" entry takes you to page 126.

I'm not a big fan of the QVTo shorthands since I feel that they fall the wrong side of the helpful-for-experts/intelligible-to-occasional-users threshold. I always have to look them up which is why I made sure that they were indexed. I'm also very worried about whether their definitions are actually compatible with OCL today or OCL once it takes on board pattern matching.

Regards

Ed Willink

Re: Basic syntax question in mapping [message #1783590 is a reply to message #1783578] Wed, 14 March 2018 12:40 Go to previous messageGo to next message
Bruce Trask is currently offline Bruce TraskFriend
Messages: 58
Registered: July 2009
Member
Hi Ed,

> You will find that the "[...]" entry takes you to page 126.

Was that page 126 in the OCL 2.4 Spec?

Regards,
Bruce

[Updated on: Wed, 14 March 2018 12:42]

Report message to a moderator

Re: Basic syntax question in mapping [message #1783592 is a reply to message #1783590] Wed, 14 March 2018 12:50 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

No. "mapping Root :: Root2Root() : Root { element += self.element->select(a | a.oclIsKindOf(A))[A]->map A2B(); }" ia a QVTo statement so you should consult the QVT specification.

(The OCL console is for evaluation of OCL expressions. Once QVTo migrates to exploit the PIvot-based OCL, it might be relatively easy to have a QVTo console for QVTo evaluation. However QVTo is imperative so perhaps it should be part of the QVTo debugger. Perhaps it already is. I have not used it very much.)

Regards

Ed Willink
Previous Topic:Documentation for QVTO
Next Topic:QVTO - Calling a mapping versus clone
Goto Forum:
  


Current Time: Thu Apr 18 09:35:37 GMT 2024

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

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

Back to the top