Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[qvtd-dev] QVT Standard Libraries

HI

M7 introduces a QVTbase and a QVTimperative Standard Library.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=445105

The QVTbase Standard Library defines the M1 (run-time) types Transformation and Model [not to be confused with the same-named M2 (specification) types].

The QVTimperative Standard Library adds some non-declarative methods allowing the prevailing objects in a Model to be accessed.

e.g for HSV2HLS

map __root__ in hsv2hls {
    for hsvRoot : HSVTree::HSVNode in HSVTree::HSVNode.allInstances() {
        ...
    }
}

can be replaced by

map __root__ in hsv2hls {
    for hsvRoot : HSVTree::HSVNode in hsv.objectsOfKind(HSVTree::HSVNode) {
        ...
    }
}

These methods should enable the naive flat schedule to be incredibly naive. Any bugs in the use of objectsOfKind() can be fixed, whereas bugs in the use of allInstances() run up against a philosophical conflict.

To make this work, there are now "Transformation::ownedContext : Variable[?]", and a "TypedModel::ownedContext : Variable[?]" context variables at M2 analoguous to the ExpressionInOCL::ownedContext.

These new ownedContext variables can be constructed lazily by QVTbaseUtil.getOwnedContext() or by equivalent creation, which must access the QVTbase Standard Library to use the M1 Transformation/Model as the Variable::type. Once the context variable exists, the "hsv.objectsOfKind" is an ordinary OperationCallExp whose source is a VariableExp referencing the relevant TypedModel::ownedContext variable.

It should no longer be necessary for QVTr RelationCallExp or QVTr/QVTc/QVTi query calls to have an inconsistently missing source. The Transformation::ownedContext, whose name is "this", can be used ensuring that the regular lookups and dynamic dispatching should apply. NB the missing source is just a nuisance at the moment. It will become illegal once OCL provides comprehensive validation rules and specifies that derived invariants conjunct rather than replace inherited invariants; one of the basic principles of Design By Contract OO.

Use of the QVTbase/imperative Standard Library just requires EnvironmentFactory.getStandardLibrary().setDefaultStandardLibraryURI() to be invoked with e.g. QVTimperativeLibrary.STDLIB_URI. This should happen automatically if the QVTbase/QVTimperative facades are used in place of OCLInternal. These new facades probably render the QVTiFacade obsolete that has crept in elsewhere for similar purposes.

    Regards

        Ed Willink







Back to the top