# QVTTemplate Model Compliance

This document describes clarifications and fixes to

- OMG MOF 2.0 specification (06-01-01)
- OMG OCL 2.0 specification (06-05-01)
- OMG QVT 1.0 specification (08-04-03)

realised by the Ecore-based and EMOF-based QVTTemplate models.

The EMOF-based `QVTTemplate` model is intended to exactly comply with the spirit of the latest QVT specification; the model therefore corrects numerous problems in the official QVT 1.0 models. The EMOF-based model should be used for modelling, where accuracy is important.

The Ecore-based `QVTTemplate` model is intended to provide identical behaviour subject to the replacement of

- the `EMOF` package by Ecore (from Eclipse EMF)
- the `EssentialOCL` package by the Ecore OCL package (from Eclipse MDT).

The Ecore-based model should be used within tools, where the power of Ecore and its associated tooling is important.

## EMOF-based Model Compliance with respect to the OMG QVT Rose Model

The OMG QVT Rose Model is the source of all diagrams in the QVT specification and the notional source of all other generated models.

The Eclipse `QVTTemplate` Model resolves the following errors and anomalies in the OMG QVT Rose Model.

`nsURI` for `QVTTemplate` is `http://schema.omg.org/spec/QVT/1.0/qvttemplate.xml` rather than `http:///qvttemplate.ecore`
`nsPrefix` for `QVTTemplate` is `qvtt` rather than `qvttemplate`
`name` for `QVTTemplate` is `QVTTemplate` rather than `qvttemplate`
`lowerBound` for `CollectionTemplateExp.member` is `0` rather than `1`
`lowerBound` for `CollectionTemplateExp.rest` is `0` rather than `1`
`lowerBound` for `CollectionTemplateExp.referredCollectionType` is `1` rather than `0`
`PropertyTemplateItem.isOpposite` is defined

## EMOF-based Model Compliance with respect to the OMG Ecore Model

The OMG Ecore Models are notionally generated from the OMG QVT Rose Model.

The Eclipse `QVTTemplate` Model resolves the following errors and anomalies in the corresponding OMG Ecore Model.

`nsURI` for `QVTTemplate` is `http://schema.omg.org/spec/QVT/1.0/qvttemplate.xml` rather than `http://www.schema.omg.org/spec/QVT/1.0/qvtrelation`
`nsPrefix` for `QVTTemplate` is `qvtt` rather than `qvttemplate`
`name` for `QVTTemplate` is `QVTTemplate` rather than `qvttemplate`
`eType` for `CollectionTemplateExp.rest` is `Variable` rather than `OclExpression`
`CollectionTemplateExp.kind` is undefined
`lowerBound` for `CollectionTemplateExp.member` is `0` rather than `1`
`lowerBound` for `CollectionTemplateExp.rest` is `0` rather than `1`
`lowerBound` for `CollectionTemplateExp.referredCollectionType` is `1` rather than `0`
`ordered` for `CollectionTemplateExp.member` is `false` rather than `true`
`ordered` for `ObjectTemplateExp.part` is `false` rather than `true`
Unnavigable `opposite` of `CollectionTemplateExp.member` is modelled
Unnavigable `opposite` of `CollectionTemplateExp.rest` is modelled
Unnavigable `opposite` of `PropertyTemplateItem.referredProperty` is modelled
Unnavigable `opposite` of `PropertyTemplateItem.value` is modelled
Unnavigable `opposite` of `TemplateExp.where` is modelled
`PropertyTemplateItem.isOpposite` is defined

## EMOF-based Model Compliance with respect to the OMG EMOF Model

The OMG EMOF Model is notionally generated from the OMG QVT Rose Model.

The Eclipse `QVTTemplate` Model resolves the following errors and anomalies in the corresponding OMG EMOF Model.

The model namespace is `http://schema.omg.org/spec/MOF/2.0/emof.xml` rather than `http://www.schema.omg.org/spec/MOF/2.0/emof.xml`
`xmi:type` of `Boolean` is `emof:PrimitiveType` rather than `emof:Class`
`xmi:type` of `Integer` is `emof:PrimitiveType` rather than `emof:Class`
`xmi:type` of `String` is `emof:PrimitiveType` rather than `emof:Class`
`xmi:type` of `UnlimitedNatural` is `emof:PrimitiveType` rather than `emof:Class`
`package` of `Boolean` is `emof` rather than `primitivetypes`
`package` of `Integer` is `emof` rather than `primitivetypes`
`package` of `String` is `emof` rather than `primitivetypes`
`package` of `UnlimitedNatural` is `emof` rather than `primitivetypes`

`uri` for `QVTTemplate` is defined
`name` for `QVTTemplate` is `QVTTemplate` rather than `qvttemplate`
`eType` for `CollectionTemplateExp.rest` is `Variable` rather than `OclExpression`
`transient` for `PropertyTemplateItem.objContainer` is `true` rather than `false`
`lowerBound` for `CollectionTemplateExp.member` is `0` rather than `1`
`lowerBound` for `CollectionTemplateExp.rest` is `0` rather than `1`
`lowerBound` for `ObjectTemplateExp.part` is `0` rather than `1`
`lowerBound` for `TemplateExp.bindsTo` is `0` rather than `1`
`lowerBound` for `TemplateExp.where` is `0` rather than `1`
Unnavigable `opposite` of `CollectionTemplateExp.member` is modelled
Unnavigable `opposite` of `CollectionTemplateExp.rest` is modelled
Unnavigable `opposite` of `PropertyTemplateItem.referredProperty` is modelled
Unnavigable `opposite` of `PropertyTemplateItem.value` is modelled
Unnavigable `opposite` of `TemplateExp.where` is modelled
`PropertyTemplateItem.isOpposite` is defined

## EMOF-based Model Compliance with respect to the Eclipse QVT Rose Model

The Eclipse QVT Rose Model provides the definition for all models; it resolves numerous errors in the OMG QVT Rose Model.

The EMOF-based `QVTTemplate` Model exhibits the following differences with respect to the Eclipse QVT Rose Model.

`nsPrefix` for `QVTTemplate` is `qvtt` rather than `qvttemplate`

## Ecore-based Model Compliance with respect to the EMOF-based Model

The Ecore-based `QVTTemplate` model exhibits the following differences with respect to its EMOF-based counterpart.

`nsURI` for `QVTTemplate` is `http://www.eclipse.org/qvt/1.0/QVTTemplate` rather than `http://schema.omg.org/spec/QVT/1.0/qvttemplate.xml`
`nsPrefix` for `QVTTemplate` is `eqvtt` rather than `qvtt`