Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [qvto-dev] QVT13-48 allInstances() needs clarification

Hi

A change in OCL is not an option, since there will be no new OCL specifiction for at least a year.

Another try below.

    Regards

        Ed

Add a new sub-clause

6.5 Interpretation of the OCL specification

OCL is a side effect free language that supports evaluation of constraints on the state of the objects in a model. (Operation pre- and post-conditions and @pre extend this to two states.) The controlled mechanisms for object mutation of the QVT languages conflicts with OCL's expectations of stability. These conflicts are clarified in this subclause. .

The declarative QVTc and QVTr languages may cascade mappings in which OCL evaluations access intermediate objects. These evaluations occur predictably for either an old or a new state of an object. An old state is inherently stable. The new state is stabilized by the declarative computation of values before usage. An exception however arises for allInstances() for which the declarative mapping execution order is difficult for a programmer to predict with certainty. This is not surprising since the uncertain order is a consequence of the search for matches traversing all relevant instances anyway. allInstances() is therefore not available for use by declarative transformations.

The imperative QVTo language performs object mutations as it advances from one program state to another in a predictable order. OCL evaluation may be used within each state. The functionality of allInstances() is clarified in the Section 8.3.18.

Before "8.3.18 predefined tags" add

Operations on Classifiers

Classifier::allInstances() : Set(T)

The OCL definition is: The operation allInstances() returns all instances of the classifier and the classifiers specializing it. May only be used for classifiers that have a finite number of instances. This is the case, for example, for user defined classes because instances need to be created explicitly, and for enumerations, the standard Boolean type, and other special types such as OclVoid. This is not the case, for example, for data types such as collection types or the standard String, UnlimitedNatural, Integer, and Real types.

This needs clarification for use in an imperative QVTo context for which OCL's expectation of an unchanging context is only valid within sub-expressions of an ImperativeExpression. The sets of instances returned by successive calls to T::allInstances() may grow or shrink during the execution of the transformation. The properties of individual instances may change as a result of assignments.

Instances are returned from the all model extents for input, inout and output models. Instances of intermediate objects are not returned unless they have been added to an extent. Instances from a metamodel are not returned unless the metamodel is also an input model. The Model::objectsOfKind() operation may be used to return selected instances from a particular model extent.



On 06/10/2015 13:30, Adolfo Sanchez-Barbudo Herrera wrote:
On 06/10/2015 11:47, Ed Willink wrote:
allInstances() is underspecified, in particular the extent from the instances are discovered is unclear
Hi Ed,

I think that this a problem that should be clarified in OCL, rather than in QVT. I see allInstances working on a kind of "Environment" or "Scope" (e.g. ResourceSet in EMF? initial Resource plus all reachable Resources from it? ). Whatever how "wide" the scope is something to be considered/clarified for both OCL and QVT. Ideally, a good clarification in OCL, might transparently be applied to QVT.

Regards,
Adolfo.
_______________________________________________
qvto-dev mailing list
qvto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/qvto-dev


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6140 / Virus Database: 4435/10768 - Release Date: 10/06/15




Back to the top