blob: 7d7ee4a104364d61411fb5dfb5daac21fe6bcc4a [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2017 Willink Transformations and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* E.D.Willink - initial implementation
*******************************************************************************/
import atlMM : 'platform:/resource/org.eclipse.m2m.atl.common/model/ATL.ecore#/0';
import atloclMM : 'platform:/resource/org.eclipse.m2m.atl.common/model/ATL.ecore#/1';
import atlprimsMM : 'platform:/resource/org.eclipse.m2m.atl.common/model/ATL.ecore#/2';
--import atlMM : 'http://www.eclipse.org/gmt/2005/ATL';
--import atloclMM : 'http://www.eclipse.org/gmt/2005/OCL';
--import atlprimsMM : 'http://www.eclipse.org/gmt/2005/ATL-PrimitiveTypes';
import pivotMM : 'platform:/resource/org.eclipse.ocl.pivot/model/Pivot.ecore'::pivot;
import qvtbMM : 'platform:/resource/org.eclipse.qvtd.pivot.qvtbase/model/QVTbase.ecore'::qvtbase;
import qvttMM : 'platform:/resource/org.eclipse.qvtd.pivot.qvttemplate/model/QVTtemplate.ecore'::qvttemplate;
import qvtrMM : 'platform:/resource/org.eclipse.qvtd.pivot.qvtrelation/model/QVTrelation.ecore'::qvtrelation;
import qvttraceMM : 'platform:/resource/org.eclipse.qvtd.runtime/model/QVTtrace.ecore'::qvttrace;
package org::eclipse::qvtd::atl::atl2qvtr {
/**
* Transform an ATL transformation to a QVTr transformation
*/
transformation ATL2QVTr(atl:{atlMM,atloclMM,atlprimsMM}, qvtr:{qvtrMM,qvttMM,qvtbMM,pivotMM})
{
query getCommonType(type1 : pivotMM::Type[1], type2 : pivotMM::Type[1]) : pivotMM::Type[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.utilities.Helper4getCommonType';
-- query getContextVariable(_transformation : qvtrMM::RelationalTransformation) : pivotMM::VariableDeclaration[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.Helper4getContextVariable';
query getHelper(element : atlMM::LocatedElement[1]) : atlMM::Helper[?] {
let helpers = element->closure(e : ocl::OclElement | e.oclContainer())->selectByKind(atlMM::Helper)
in if helpers->notEmpty() then helpers->any(true) else null endif
}
-- query getHelper(element : atlMM::LocatedElement[1]) : atlMM::Helper[1] {
-- element->closure(e : ocl::OclElement | e.oclContainer())->selectByKind(atlMM::Helper)->any(true)
-- }
query getModule(element : atlMM::LocatedElement) : atlMM::Module[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.utilities.Helper4getModule';
query getOperation(type : pivotMM::Type[1], name : String[1]) : pivotMM::Operation[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.utilities.Helper4getOperation';
query getPackage(atlModule : atlMM::Module[1], name : String[1]) : pivotMM::Package implementedby 'org.eclipse.qvtd.atl.atl2qvtr.utilities.Helper4getPackage';
query getProperty(type : pivotMM::Type[1], name : String[1]) : pivotMM::Property[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.utilities.Helper4getProperty';
query getType(type : atloclMM::OclType[?]) : pivotMM::Class[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.utilities.Helper4getType';
-- query getType(type : atloclMM::OclType[1]) : pivotMM::Type[1] {
-- if type.oclIsKindOf(atloclMM::BooleanType[1]) then pivotMM::Boolean
-- elseif type.oclIsKindOf(atloclMM::IntegerType[1]) then pivotMM::Integer
-- elseif type.oclIsKindOf(atloclMM::RealType[1]) then pivotMM::Real
-- elseif type.oclIsKindOf(atloclMM::StringType[1]) then pivotMM::String
-- else pivotMM::OclInvalid
-- endif
-- }
query getTypedModel(oclModel : atloclMM::OclModel[1], _transformation : qvtrMM::RelationalTransformation) : qvtbMM::TypedModel[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.utilities.Helper4getTypedModel';
-- query getTypedModel_IN(atlPattern : atlMM::InPattern[1], _relation : qvtrMM::Relation) : qvtbMM::TypedModel[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.Helper4getTypedModel';
-- query getTypedModel_OUT(atlPattern : atlMM::OutPattern[1], _relation : qvtrMM::Relation) : qvtbMM::TypedModel[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.Helper4getTypedModel';
query getVariable(type : atloclMM::VariableDeclaration[1]) : pivotMM::Variable[1] implementedby 'org.eclipse.qvtd.atl.atl2qvtr.utilities.Helper4getVariable';
/**
* atl::Binding <=> qvtr::PropertyTemplateItem
*/
top relation mapBinding {
propertyName : String;
atlExpression : atloclMM::OclExpression;
atlOutPatternElement : atlMM::SimpleOutPatternElement;
qvtrExpression : pivotMM::OCLExpression;
qvtrTemplate : qvttMM::ObjectTemplateExp;
enforce domain atl atlBinding : Binding {
outPatternElement = atlOutPatternElement,
propertyName = propertyName,
value = atlExpression
};
enforce domain qvtr qvtrPart : PropertyTemplateItem {
objContainer = qvtrTemplate,
value = qvtrExpression,
referredProperty = getProperty(qvtrTemplate.type, propertyName)
};
when {
mapSimpleOutPatternElement(atlOutPatternElement, qvtrTemplate);
mapOclExpression(atlExpression, qvtrExpression);
}
}
/**
* atl::Helper <=> qvtr::Function
*/
top abstract relation mapHelper {
enforce domain atl atlHelper : Helper {};
enforce domain qvtr qvtrFunction : Function {};
}
/**
* atl::Helper/OclFeatureDefinition/Attribute <=> qvtr::Function
*/
top relation mapHelper_Attribute overrides mapHelper {
attributeName : String;
atlModule : atlMM::Module;
atlExpression : atloclMM::OclExpression;
atlType : atloclMM::OclType;
qvtrTransformation : qvtrMM::RelationalTransformation;
qvtrExpression : pivotMM::OCLExpression;
enforce domain atl atlHelper : Helper {
module = atlModule,
definition = atlDefinition : OclFeatureDefinition {
feature = atlFeature : Attribute {
name = attributeName,
type = atlType,
initExpression = atlExpression
}
}
};
enforce domain qvtr qvtrFunction : Function {
name = attributeName,
owningClass = qvtrTransformation,
type = getType(atlType),
queryExpression = qvtrExpression
};
when {
mapModule(atlModule, qvtrTransformation);
mapOclExpression(atlExpression, qvtrExpression);
}
where {
mapHelper_Context(atlHelper, qvtrFunction);
-- mapType(aType, returnType);
}
}
relation mapHelper_Context {
enforce domain atl atlHelper : Helper {
definition = atlDefinition: OclFeatureDefinition {
context_ = atlContext : OclContextDefinition {
context_ = atlReturnType : OclType{}
}
}
};
enforce domain qvtr qvtrFunction : Function {
ownedParameters = qvtrParameter : FunctionParameter {
name = 'self',
type = getType(atlContext.context_)
}
};
where {
-- mapType(aType, returnType);
mapVariable(atlHelper, qvtrParameter);
}
}
/**
* atl::Helper/OclFeatureDefinition/Operation <=> qvtr::Function
*/
top relation mapHelper_Operation overrides mapHelper {
operationName : String;
atlModule : atlMM::Module;
atlExpression : atloclMM::OclExpression;
atlType : atloclMM::OclType;
qvtrTransformation : qvtrMM::RelationalTransformation;
qvtrExpression : pivotMM::OCLExpression;
enforce domain atl atlHelper : Helper {
module = atlModule,
definition = atlDefinition : OclFeatureDefinition {
feature = atlFeature : Operation {
name = operationName,
returnType = atlType,
body = atlExpression
}
}
};
enforce domain qvtr qvtrFunction : Function {
name = operationName,
owningClass = qvtrTransformation,
type = getType(atlType),
queryExpression = qvtrExpression
};
when {
mapModule(atlModule, qvtrTransformation);
mapOclExpression(atlExpression, qvtrExpression);
}
where {
mapHelper_Context(atlHelper, qvtrFunction);
-- mapType(aType, returnType);
}
}
/**
* atl::InPattern <=> qvtr::RelationDomain (checkonly)
*/
top relation mapInPattern {
atlModule : atlMM::Module;
qvtrTypedModel : qvtbMM::TypedModel;
atlModel : atloclMM::OclModel = atlPattern.elements.type->selectByKind(atloclMM::OclModelElement)->any(true).model;
enforce domain atl atlPattern : InPattern {
rule = atlRule : MatchedRule{
-- module = atlModule
}
} { atlModel.metamodel = null };
enforce domain qvtr qvtrDomain : RelationDomain {
rule = qvtrRelation : Relation {
-- transformation = qvtrTransformation : RelationalTransformation{}
},
isCheckable = true,
isEnforceable = false,
typedModel = qvtrTypedModel
-- typedModel = getTypedModel(atlPattern.elements.type->selectByKind(atloclMM::OclModelElement)->any(z | true).model, qvtrTransformation)
};
when {
mapOclMetamodel(atlModel, qvtrTypedModel);
mapMatchedRule(atlRule, qvtrRelation);
-- mapOclMetamodel_IN(atlPattern.elements->any(true).type.model, qvtrTypedModel);
-- mapOclMetamodel_IN(atlPattern.elements->any(true).type.model, qvtrTypedModel);
}
}
/**
* atl::InPattern filter <=> qvtr::RelationDomain when
*/
top relation mapInPattern_filter {
atlExpression : atloclMM::OclExpression;
qvtrExpression : pivotMM::OCLExpression;
enforce domain atl atlPattern : InPattern {
rule = atlRule : MatchedRule{},
filter = atlExpression
};
enforce domain qvtr qvtrDomain : RelationDomain {
rule = qvtrRelation : Relation {
when = w : Pattern{
predicate = p : Predicate{
conditionExpression = qvtrExpression
}
}
}
};
when {
mapMatchedRule(atlRule, qvtrRelation);
mapInPattern(atlPattern, qvtrDomain);
mapOclExpression(atlExpression, qvtrExpression);
}
}
/**
* atl::MatchedRule <=> qvtr::Relation
*/
top relation mapMatchedRule {
ruleName : String;
atlModule : atlMM::Module;
qvtrTransformation : qvtrMM::RelationalTransformation;
enforce domain atl matchedRule : MatchedRule {
module = atlModule,
name = ruleName,
outPattern = atlOutPattern : OutPattern {}
};
enforce domain qvtr qvtrRelation : Relation {
name = ruleName,
isAbstract = matchedRule.isAbstract,
isTopLevel = true,
transformation = qvtrTransformation,
variable = :SharedVariable {
name = 'trace',
isImplicit = true,
type = qvttraceMM::TraceElement
}
};
when {
mapModule(atlModule, qvtrTransformation);
}
}
/**
* atl::MatchedRule super <=> qvtr::Relation overridden
*/
top relation mapMatchedRule_super {
enforce domain atl atlChildRule : MatchedRule {
superRule = atlSuperRule : MatchedRule{}
};
enforce domain qvtr qvtrOverridesRelation : Relation {
overrides = qvtrOverriddenRelation:Relation{}
};
when {
mapMatchedRule(atlSuperRule, qvtrOverriddenRelation);
mapMatchedRule(atlChildRule, qvtrOverridesRelation);
}
}
/**
* atl::Module <=> qvtr::RelationModel/Package/RelationalTransformation
*/
top relation mapModule {
txName : String;
enforce domain atl atlModule : Module {
name = txName
};
enforce domain qvtr qvtrTransformation : RelationalTransformation {
name = txName,
owningPackage = : Package {
name = '',
Model = : RelationModel {
-- name = null
}
},
ownedContext = : pivotMM::Parameter {
name = 'this',
type = qvtrTransformation,
isRequired = true
},
modelParameter = : qvtbMM::TypedModel {
isTrace = true,
name = 'middle'
}
};
}
/**
* atl::Module/atl::OclModel <=> qvtr::TypedModel (create)
*/
top relation mapOclMetamodel {
tmName : String;
enforce domain atl oclMetamodel : OclModel {
metamodel = null,
name = tmName
};
enforce domain qvtr qvtrTypedModel : TypedModel {
name = tmName
};
}
/**
* atl::Module/atl::OclModel <=> qvtr::TypedModel (create)
*/
top relation mapOclModel_IN {
qvtrTransformation : qvtrMM::RelationalTransformation;
qvtrPackages : Set(pivotMM::Package);
enforce domain atl oclModel : OclModel {
metamodel = oclMetamodel : OclModel {
metamodel = null
},
opposite(Module::inModels) = atlModule : Module {}
};
enforce domain qvtr qvtrTypedModel : TypedModel {
transformation = qvtrTransformation,
usedPackage = qvtrPackages
}
default_values {
qvtrPackages = getPackage(atlModule, oclMetamodel.name).oclAsSet();
};
when {
mapModule(atlModule, qvtrTransformation);
mapOclMetamodel(oclMetamodel, qvtrTypedModel);
}
}
/**
* atl::Module/atl::OclModel <=> qvtr::TypedModel (create)
*/
top relation mapOclModel_OUT {
qvtrTransformation : qvtrMM::RelationalTransformation;
qvtrPackages : Set(pivotMM::Package);
enforce domain atl oclModel : OclModel {
metamodel = oclMetamodel : OclModel {
metamodel = null
},
opposite(Module::outModels) = atlModule : Module {}
};
enforce domain qvtr qvtrTypedModel : TypedModel {
transformation = qvtrTransformation,
usedPackage = qvtrPackages
}
default_values {
qvtrPackages = getPackage(atlModule, oclMetamodel.name).oclAsSet();
};
when {
mapModule(atlModule, qvtrTransformation);
mapOclMetamodel(oclMetamodel, qvtrTypedModel);
}
}
/**
* atl::StringExp <=> ocl::StringLiteralExp
*/
top relation mapOclType overrides mapOclExpression {
enforce domain atl atlExpression : OclType {};
enforce domain qvtr; -- FIXME don't really want anything
}
/**
* atl::SimpleInPatternElement <=> qvtr::DomainPattern,ObjectTemplateExp,TemplateVariable
*/
top relation mapSimpleInPatternElement {
elementName : String;
atlRule : atlMM::MatchedRule;
-- qvtrDomain : qvtrMM::RelationDomain;
qvtrRelation : qvtrMM::Relation;
enforce domain atl atlElement : atlMM::SimpleInPatternElement {
varName = elementName,
inPattern = atlPattern : InPattern{
rule = atlRule
}
};
enforce domain qvtr qvtrTemplate : ObjectTemplateExp{
bindsTo = qvtrVariable : TemplateVariable{
name = elementName,
type = getType(atlElement.type),
Relation = qvtrRelation,
RelationDomain = qvtrDomain : RelationDomain{
--FIXME rule = qvtrRelation,
pattern = qvtrPattern : DomainPattern{
templateExpression = qvtrTemplate
}
}
},
referredClass = getType(atlElement.type),
type = getType(atlElement.type)
};
when {
mapMatchedRule(atlRule, qvtrRelation);
mapInPattern(atlPattern, qvtrDomain);
-- mapOclExpression(atlExpression, qvtrExpression);
}
where {
mapVariable(atlElement, qvtrVariable);
}
}
/**
* atl::SimpleOutPatternElement <=> qvtr::RelationDomain,DomainPattern,ObjectTemplateExp,TemplateVariable
*/
top relation mapSimpleOutPatternElement {
elementName : String;
qvtrType : pivotMM::Type;
enforce domain atl atlElement : atlMM::SimpleOutPatternElement {
varName = elementName,
type = atlType : OclModelElement{
model = atlMetamodel : OclModel{
metamodel = null
}
},
outPattern = atlPattern : OutPattern{
rule = atlRule : MatchedRule{}
}
};
enforce domain qvtr qvtrTemplate : ObjectTemplateExp{
DomainPattern = qvtrPattern : DomainPattern{
relationDomain = qvtrDomain : RelationDomain{
isCheckable = false,
isEnforceable = true,
typedModel = qvtrTypedModel : TypedModel{},
rule = qvtrRelation : Relation{}
}
},
bindsTo = qvtrVariable : TemplateVariable{
name = elementName,
type = qvtrType,
RelationDomain = qvtrDomain,
Relation = qvtrRelation
},
referredClass = qvtrType,
type = qvtrType
}
default_values { qvtrType = getType(atlType);};
when {
mapOclMetamodel(atlMetamodel, qvtrTypedModel);
mapMatchedRule(atlRule, qvtrRelation);
}
where {
mapVariable(atlElement, qvtrVariable);
}
}
/**
* atl::Module <=> qvtr::RelationModel/Package/RelationalTransformation
*
top relation mapType {
-- txName : String;
/*enforce* / domain atl atlType : StringType {
-- name = txName
};
enforce domain qvtr qvtrType : Type {
};
} */
/************************************Expressions*********************************/
/**
* atl::BooleanExp <=> ocl::BooleanLiteralExp
*/
top relation mapBooleanExp overrides mapOclExpression {
symbol : Boolean;
enforce domain atl atlExpression : BooleanExp {
booleanSymbol = symbol
};
enforce domain qvtr qvtrExpression : BooleanLiteralExp {
booleanSymbol = symbol,
type = pivotMM::Boolean
};
}
/**
* atl::IfExp <=> ocl::IfExp
*/
top relation mapIfExp overrides mapOclExpression {
enforce domain atl atlExpression : IfExp {
condition = atlCondition : OclExpression{},
thenExpression = atlThen : OclExpression{},
elseExpression = atlElse : OclExpression{}
};
enforce domain qvtr qvtrExpression : IfExp {
ownedCondition = qvtrCondition : OCLExpression{},
ownedThen = qvtrThen : OCLExpression{},
ownedElse = qvtrElse : OCLExpression{},
type = getCommonType(qvtrThen.type, qvtrElse.type)
};
when {
mapOclExpression(atlCondition, qvtrCondition);
mapOclExpression(atlThen, qvtrThen);
mapOclExpression(atlElse, qvtrElse);
}
}
/**
* atl::IntegerExp <=> ocl::IntegerLiteralExp
*/
top relation mapIntegerExp overrides mapOclExpression {
symbol : Integer;
enforce domain atl atlExpression : IntegerExp {
integerSymbol = symbol
};
enforce domain qvtr qvtrExpression : IntegerLiteralExp {
integerSymbol = symbol,
type = pivotMM::Integer
};
}
/**
* atl::NavigationOrAttributeCallExp <=> ocl::PropertyCallExp
*/
top abstract relation mapNavigationOrAttributeCallExp overrides mapOclExpression {
enforce domain atl atlExpression : NavigationOrAttributeCallExp {};
enforce domain qvtr qvtrExpression : PropertyCallExp {};
}
top relation mapNavigationOrAttributeCallExp_Helper overrides mapNavigationOrAttributeCallExp {
propertyName : String;
atlModule = getModule(atlExpression);
atlAttributes = atlModule.elements->selectByKind(atlMM::Helper)._definition.feature->selectByKind(atloclMM::Attribute)->select(name=propertyName);
qvtrTransformation : qvtrMM::RelationalTransformation;
qvtrOperation : pivotMM::Operation;
qvtrThisVariable = qvtrTransformation.ownedContext.oclAsType(pivotMM::VariableDeclaration[1]);
enforce domain atl atlExpression : NavigationOrAttributeCallExp {
source = atlSource : OclExpression{},
name = propertyName
};
enforce domain qvtr qvtrExpression : OperationCallExp {
ownedSource = qvtrSource : VariableExp{
referredVariable = qvtrThisVariable,
type = qvtrThisVariable.type,
name = qvtrThisVariable.name -- debug/readability aid
},
ownedArguments = qvtrSourceArgument : OCLExpression{},
referredOperation = qvtrOperation,
type = qvtrOperation.type,
name = propertyName -- debug/readability aid
};
when {
mapModule(atlModule, qvtrTransformation);
atlAttributes->notEmpty();
mapHelper_Attribute(atlAttributes->any(true)._definition?.Helper, qvtrOperation);
mapOclExpression(atlSource, qvtrSourceArgument);
}
}
top relation mapNavigationOrAttributeCallExp_Property overrides mapNavigationOrAttributeCallExp {
propertyName : String;
atlModule : atlMM::Module = getModule(atlExpression);
atlAttributes : Sequence(atloclMM::Attribute);
qvtrProperty : pivotMM::Property[1] = getProperty(qvtrSource.type, propertyName);
enforce domain atl atlExpression : NavigationOrAttributeCallExp {
source = atlSource : OclExpression{},
name = propertyName
}
default_values {
atlAttributes = Sequence{};
};
enforce domain qvtr qvtrExpression : PropertyCallExp {
ownedSource = qvtrSource : OCLExpression{},
referredProperty = qvtrProperty,
type = qvtrProperty.type,
name = propertyName -- debug/readability aid
}
default_values {
atlAttributes = atlModule.elements->selectByKind(atlMM::Helper)._definition.feature->selectByKind(atloclMM::Attribute)->select(name=propertyName);
};
when {
atlAttributes->isEmpty();
mapOclExpression(atlSource, qvtrSource);
}
}
/**
* atl::OclExpression <=> ocl::OCLExpression
*/
top abstract relation mapOclExpression {
enforce domain atl atlExpression : OclExpression {};
enforce domain qvtr qvtrExpression : OCLExpression {};
}
/**
* atl::OperationCallExp <=> ocl::OperationCallExp
*/
top abstract relation mapOperationCallExp overrides mapOclExpression {
enforce domain atl atlExpression : OperationCallExp {};
enforce domain qvtr qvtrExpression : OperationCallExp {};
}
top relation mapOperationCallExp_Helper overrides mapOperationCallExp {
operationName : String;
atlModule = getModule(atlExpression);
atlOperations = atlModule.elements->selectByKind(atlMM::Helper)._definition.feature->selectByKind(atloclMM::Operation)->select(name=operationName);
qvtrTransformation : qvtrMM::RelationalTransformation;
qvtrOperation : pivotMM::Operation;
qvtrThisVariable = qvtrTransformation.ownedContext.oclAsType(pivotMM::VariableDeclaration[1]);
enforce domain atl atlExpression : OperationCallExp {
source = atlSource : OclExpression{},
operationName = operationName
}; -- {not atlExpression.oclIsKindOf(OperatorCallExp)};
enforce domain qvtr qvtrExpression : OperationCallExp {
ownedSource = qvtrSource : VariableExp{
referredVariable = qvtrThisVariable,
type = qvtrThisVariable.type,
name = qvtrThisVariable.name -- debug/readability aid
},
ownedArguments = qvtrSourceArgument : OCLExpression{},
referredOperation = qvtrOperation,
type = qvtrOperation.type,
name = operationName -- debug/readability aid
};
when {
mapModule(atlModule, qvtrTransformation);
atlOperations->notEmpty();
mapHelper_Operation(atlOperations->any(true)._definition?.Helper, qvtrOperation);
mapOclExpression(atlSource, qvtrSourceArgument);
}
}
top relation mapOperationCallExp_Operation overrides mapOperationCallExp {
operationName : String;
atlModule : atlMM::Module;
atlOperations : Sequence(atloclMM::Operation);
qvtrOperation : pivotMM::Operation;
enforce domain atl atlExpression : OperationCallExp {
source = atlSource : OclExpression{},
operationName = operationName
} --{not atlExpression.oclIsKindOf(OperatorCallExp)}
default_values {
atlOperations = Sequence{};
};
enforce domain qvtr qvtrExpression : OperationCallExp {
ownedSource = qvtrSource : OCLExpression{},
referredOperation = qvtrOperation,
type = qvtrOperation.type,
name = operationName -- debug/readability aid
}
default_values {
atlModule = getModule(atlExpression);
atlOperations = atlModule.elements->selectByKind(atlMM::Helper)._definition.feature->selectByKind(atloclMM::Operation)->select(name=operationName);
qvtrOperation = getOperation(qvtrSource.type, operationName);
};
when {
atlOperations->isEmpty();
mapOclExpression(atlSource, qvtrSource);
}
}
/**
* atl::OperationCallExp argument <=> ocl::OperationCallExp argument
*/
top relation mapOperationCallExp_argument {
enforce domain atl atlArgument : OclExpression {
parentOperation = atlParent : OperationCallExp{}
};
enforce domain qvtr qvtrArgument : OCLExpression {
OperationCallExp = qvtrParent : OperationCallExp{}
};
when {
mapOperationCallExp(atlParent, qvtrParent);
mapOclExpression(atlArgument, qvtrArgument);
}
}
/**
* atl::OperatorCallExp <=> ocl::OperationCallExp
*/
top relation mapOperatorCallExp overrides mapOperationCallExp_Operation {
operationName : String;
-- atlModule : atlMM::Module = getModule(atlExpression);
-- qvtrTransformation : qvtrMM::RelationalTransformation;
qvtrOperation : pivotMM::Operation = getOperation(qvtrSource.type, operationName);
enforce domain atl atlExpression : OperatorCallExp {
source = atlSource : OclExpression{},
operationName = operationName
};
enforce domain qvtr qvtrExpression : OperationCallExp {
ownedSource = qvtrSource : OCLExpression{},
referredOperation = qvtrOperation,
type = qvtrOperation.type,
name = operationName -- debug/readability aid
};
when {
-- mapModule(atlModule, qvtrTransformation);
mapOclExpression(atlSource, qvtrSource);
}
}
/** FIXME CG fails double => BigDecimal
* atl::RealExp <=> ocl::RealLiteralExp
*
top relation mapRealExp overrides mapOclExpression {
symbol : Real;
/*enforce* / domain atl atlExpression : RealExp {
realSymbol = symbol
};
enforce domain qvtr qvtrExpression : RealLiteralExp {
realSymbol = symbol,
type = pivotMM::Real
};
} */
/**
* atl::StringExp <=> ocl::StringLiteralExp
*/
top relation mapStringExp overrides mapOclExpression {
symbol : String;
enforce domain atl atlExpression : StringExp {
stringSymbol = symbol
};
enforce domain qvtr qvtrExpression : StringLiteralExp {
stringSymbol = symbol,
type = pivotMM::String
};
}
/**
* atl::VariableDeclaration <=> ocl::VariableDeclaration
*/
relation mapVariable {
enforce domain atl atlVariable : LocatedElement {};
enforce domain qvtr qvtrVariable : VariableDeclaration {};
}
/**
* atl::VariableExp <=> ocl::VariableExp
*/
top relation mapVariableExp overrides mapOclExpression {
varName : String;
enforce domain atl atlExpression : VariableExp {
referredVariable = atlVariable : VariableDeclaration{
varName = varName
}
};
enforce domain qvtr qvtrExpression : VariableExp {
name = varName
-- type = getType(atlExpression.referredVariable)
};
where {
mapVariableExp_referredVariable(atlExpression, qvtrExpression);
}
}
/**
* atl::VariableExp referredVariable <=> ocl::VariableExp referredVariable
*/
abstract relation mapVariableExp_referredVariable {
enforce domain atl atlExpression : VariableExp {};
enforce domain qvtr qvtrExpression : VariableExp {};
}
relation mapVariableExp_referredVariable_Helper overrides mapVariableExp_referredVariable {
atlHelper : atlMM::Helper;
enforce domain atl atlExpression : VariableExp {
referredVariable = atlVariable : VariableDeclaration{
varName = 'self'
}
} {atlHelper = getHelper(atlExpression)};
enforce domain qvtr qvtrExpression : VariableExp {
referredVariable = qvtrVariable : VariableDeclaration{},
type = qvtrVariable.type, -- getType(atlHelper.definition.context_.context_),
name = 'self'
};
when {
mapVariable(atlHelper, qvtrVariable);
}
}
relation mapVariableExp_referredVariable_VariableDeclaration overrides mapVariableExp_referredVariable {
enforce domain atl atlExpression : VariableExp {
referredVariable = atlVariable : PatternElement{}
};
enforce domain qvtr qvtrExpression : VariableExp {
referredVariable = qvtrVariable : VariableDeclaration{},
type = qvtrVariable.type,
name = qvtrVariable.name -- debug/readability aid
};
when {
mapVariable(atlVariable, qvtrVariable);
}
}
}
-- ActionBlock, BindingStat, ExpressionStat, IfStat, ForStat
-- CalledRule
-- DropPattern
-- ForEachOutPatternElement
-- LazyMatchedRule
-- Library, LibraryRef
-- Query
-- RuleVariableDeclaration
-- BagExp, OrderedSetExp, SequenceExp, SetExp
-- BagType, OrderedSetType, SequenceType, SetType
-- BooleanType, IntegerType, ReakType, StringType
-- CollectionType
-- EnumLiteralExp
-- IterateExp, IteratorElement
-- Iterator
-- LetExp
-- MapExp, MapElement
-- MapType
-- OclAnyType
-- OclContextDefinition
-- OclFeatureDefinition
-- OclModelElement
-- OclType
-- OclUndefinedExp
-- Parameter
-- RealExp
-- SuperExp
-- TupleExp, TuplePart
-- TupleType, TupleTypeAttribute
}