Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350917

Summary: [future] OCL support for a Model Transformation Virtual Machine
Product: [Modeling] OCL Reporter: Ed Willink <ed>
Component: CoreAssignee: OCL Inbox <mdt-ocl-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: adrianp.quatinus
Version: 3.2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Ed Willink CLA 2011-07-01 06:34:22 EDT
The following facilities currently fall somewhere between OCL and QVT, but could significantly facilitate Model Transformations in general and could allow the OCL execution engine to be regarded as a Transformation Virtual Machine.

a) Type Constructors (Bug 293622) 

reuse Tuple syntax as in Date{day:1,month:5,year:2000}.

b) Multi-dimensional Collection::product

allows a model pattern search space to be specified as the Cartesian products of the instances. A::allInstances->product(B::allInstances(), A::allInstances(), D::allInstances()). (In practice must be supported by lazy branch and bound iterators.) 

c) Pattern iteration

someAs->pattern(a1:A, a2:A; b:B, c:C, d:D | constraint1, constraint2, constraint3)

returns the set of all {A, A, B, C, D} matches that satisfy the three constraints. It is naively just

someAs->product(A::allInstances(), B::allInstances(), C::allInstances(), D::allInstances)->select(constraint1)->select(constraint2)->select(constraint3)

with additional let support to unpack the set of matches for access by each constraint select. In practice the navigation operations within each constraint can be examined to dramatically improve the cost of naive multi-dimensional allInstances and total match.
------
Use of type constructors can express pattern constraints more compactly. Use of separate 'input' and 'output' patterns can establish the mapping candidates with eventual pairing of input-side and output-side pattern tuples establishing the traceability.
Comment 1 Ed Willink CLA 2014-10-28 09:48:36 EDT
At the MODELs OCL workshop, patterns were recognized as a generalized solution to a few specific problems.

Looking at it practically, we just migrate the QVTt patterns into OCL. The ewillink/ocl25 branch demonstrates the necessary grammar chnges.