From 312831c1973de2fa5c20371ad9ee12b5bf714421 Mon Sep 17 00:00:00 2001 From: Ed Willink Date: Wed, 11 Jan 2017 15:21:07 +0000 Subject: [509858] Add QVTc/QVTi isPartial WFRs --- .../model/QVTbase.ecore | 6 +-- .../model/QVTcore.ecore | 46 ++++++++++++++--- .../model/QVTcore.genmodel | 20 +++++--- .../model/QVTcore.ocl | 44 ++++++++++++---- .../model/QVTimperative.ecore | 59 ++++++++++++++-------- .../model/QVTimperative.genmodel | 10 ++-- .../model/QVTimperative.ocl | 34 +++++++++++-- .../model/QVTrelation.ecore | 2 +- .../model/QVTtemplate.ecore | 2 +- .../qvtd/build/mwe2/GenerateQVTdASModels.mwe2 | 30 +++++++++++ 10 files changed, 194 insertions(+), 59 deletions(-) diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/model/QVTbase.ecore b/plugins/org.eclipse.qvtd.pivot.qvtbase/model/QVTbase.ecore index 80469a3c0..0f84294d8 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtbase/model/QVTbase.ecore +++ b/plugins/org.eclipse.qvtd.pivot.qvtbase/model/QVTbase.ecore @@ -42,10 +42,10 @@ @@ -177,7 +177,7 @@ name="domain" upperBound="-1" eType="#T-qvtbase-Domain" containment="true" eOpposite="#F-qvtbase-Domain-rule"/> diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.ecore b/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.ecore index 582536f4b..0235c998f 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.ecore +++ b/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.ecore @@ -29,10 +29,10 @@ - + -
+
+ + +
+ + + + + + + + + + + +
-
+
@@ -244,12 +259,27 @@
- + -
+
+ + +
+ + + + + + + + + + + +
-
+
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.genmodel b/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.genmodel index b9cdfae56..ab46bd39f 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.genmodel +++ b/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.genmodel @@ -84,9 +84,13 @@ - - - + + + + + + + @@ -100,9 +104,13 @@ - - - + + + + + + + diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.ocl b/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.ocl index 82b38d3a1..cfa45b1e7 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.ocl +++ b/plugins/org.eclipse.qvtd.pivot.qvtcore/model/QVTcore.ocl @@ -27,11 +27,23 @@ inv RootNameIsNotNull: context OppositePropertyAssignment def: getReferredTargetProperty() : pivot::Property[1] = targetProperty.opposite -inv CompatibleTypeForValue('OppositePropertyAssignment::CompatibleTypeForValue: ' + value.type?.name + ' must conform to ' + getReferredTargetProperty().type?.name + ' or vice-versa'): - let propertyType = getReferredTargetProperty().type in - let valueType = value.type in - valueType.conformsTo(propertyType) - or propertyType.conformsTo(valueType) +inv CompatibleTypeForPartialValue: + isPartial implies + let propertyType = getReferredTargetProperty().type.oclAsType(ocl::CollectionType).elementType in + let valueType = value.type in + Tuple{ + status : Boolean = valueType.conformsTo(propertyType) or propertyType.conformsTo(valueType), + message : String = 'OppositePropertyAssignment::CompatibleTypeForPartialValue: ' + valueType?.name + ' must conform to ' + propertyType.name + ' or vice-versa' + }.status + +inv CompatibleTypeForTotalValue: + not isPartial implies + let propertyType = getReferredTargetProperty().type in + let valueType = value.type in + Tuple{ + status : Boolean = valueType.conformsTo(propertyType) or propertyType.conformsTo(valueType), + message : String = 'OppositePropertyAssignment::CompatibleTypeForTotalValue: ' + valueType?.name + ' must conform to ' + propertyType?.name + ' or vice-versa' + }.status inv OppositePropertyIsImplicit: targetProperty.isImplicit @@ -42,11 +54,23 @@ inv TargetPropetyIsSlotProperty: context PropertyAssignment def: getReferredTargetProperty() : pivot::Property[1] = targetProperty -inv CompatibleTypeForValue('PropertyAssignment::CompatibleTypeForValue: ' + value.type?.name + ' must conform to ' + getReferredTargetProperty().type?.name + ' or vice-versa'): - let propertyType = getReferredTargetProperty().type in - let valueType = value.type in - valueType.conformsTo(propertyType) - or propertyType.conformsTo(valueType) +inv CompatibleTypeForPartialValue: + isPartial implies + let propertyType = getReferredTargetProperty().type.oclAsType(ocl::CollectionType).elementType in + let valueType = value.type in + Tuple{ + status : Boolean = valueType.conformsTo(propertyType) or propertyType.conformsTo(valueType), + message : String = 'PropertyAssignment::CompatibleTypeForPartialValue: ' + valueType?.name + ' must conform to ' + propertyType.name + ' or vice-versa' + }.status + +inv CompatibleTypeForTotalValue: + not isPartial implies + let propertyType = getReferredTargetProperty().type in + let valueType = value.type in + Tuple{ + status : Boolean = valueType.conformsTo(propertyType) or propertyType.conformsTo(valueType), + message : String = 'PropertyAssignment::CompatibleTypeForTotalValue: ' + valueType?.name + ' must conform to ' + propertyType?.name + ' or vice-versa' + }.status inv PropertyIsNotImplicit: not targetProperty.isImplicit diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ecore b/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ecore index 2bc2bd25f..6944fc093 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ecore +++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ecore @@ -40,7 +40,7 @@ + name="isEnforcedUnique" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
@@ -129,7 +129,7 @@
@@ -172,7 +172,7 @@
@@ -210,7 +210,7 @@
@@ -280,14 +280,14 @@
@@ -313,7 +313,7 @@
@@ -380,7 +380,7 @@
@@ -403,7 +403,7 @@
-
+
@@ -451,14 +451,14 @@
@@ -600,7 +600,7 @@ + name="isContained" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
@@ -641,7 +641,7 @@
-
+
@@ -651,12 +651,27 @@ - + -
+
+ + +
+ + + + + + + + + + + +
-
+
@@ -671,7 +686,7 @@
-
+
@@ -701,17 +716,17 @@
-
+
@@ -779,7 +794,7 @@
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.genmodel b/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.genmodel index 91f47ec31..917d0511f 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.genmodel +++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.genmodel @@ -175,9 +175,13 @@ - - - + + + + + + + diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ocl b/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ocl index dec9e1e6c..fd223f9ec 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ocl +++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ocl @@ -40,7 +40,7 @@ inv LocalVariabelNamesAreUnique: ownedMappingParameters->union(ownedStatements-> context MappingCall def: referredNames : OrderedSet(String) = referredMapping.ownedMappingParameters.name->asSet()->sortedBy(n | n) def: referringNames : OrderedSet(String) = ownedMappingParameterBindings.boundVariable.name->asSet()->sortedBy(n | n) -inv MatchingCallBindings('Mismatched bindings ' + referredMapping.name + joinNames(referredNames) + ' <= ' + joinNames(referringNames)): referredNames = referringNames +inv MatchingCallBindings('MappingCall::MatchingCallBindings: ' + referredMapping.name + joinNames(referredNames) + ' <= ' + joinNames(referringNames)): referredNames = referringNames inv NotBothInstallAndInvoke: not (isInstall and isInvoke) inv UniqueCallBindings: ownedMappingParameterBindings->isUnique(boundVariable) @@ -54,12 +54,36 @@ inv NonDataTypeForType: not type.oclIsKindOf(ocl::DataType) context SetStatement def:resolvedProperty : ocl::Property[1] = if isOpposite then targetProperty.opposite else targetProperty endif -inv CompatibleClassForProperty(targetVariable.type?.name + ' must conform to ' + resolvedProperty.owningClass?.name): -targetVariable.type.conformsTo(resolvedProperty.owningClass) -inv CompatibleTypeForValue(ownedExpression.type?.name + ' must conform to ' + resolvedProperty.type?.name): -ownedExpression.type.conformsTo(resolvedProperty.type) + +inv CompatibleClassForProperty: + let requiredType = resolvedProperty.owningClass in + let actualType = targetVariable.type in + Tuple{ + status : Boolean = actualType.conformsTo(requiredType), + message : String = 'SetStatement::CompatibleClassForProperty: ' + actualType?.name + ' must conform to ' + requiredType?.name + }.status + +inv CompatibleTypeForPartialValue: + isPartial implies + let requiredType = resolvedProperty.type.oclAsType(ocl::CollectionType).elementType in + let actualType = ownedExpression.type in + Tuple{ + status : Boolean = actualType.conformsTo(requiredType), + message : String = 'SetStatement::CompatibleTypeForPartialValue: ' + actualType?.name + ' must conform to ' + requiredType.name + }.status + +inv CompatibleTypeForTotalValue: + not isPartial implies + let requiredType = resolvedProperty.type in + let actualType = ownedExpression.type in + Tuple{ + status : Boolean = actualType.conformsTo(requiredType), + message : String = 'SetStatement::CompatibleTypeForTotalValue: ' + actualType?.name + ' must conform to ' + requiredType?.name + }.status + inv ValueDoesNotNavigateFromRealizedVariables: ownedExpression->closure(e : ocl::OclElement | e.oclContents())->selectByKind(ocl::VariableExp)->select(referredVariable.oclIsKindOf(NewStatement))->select(s | s.oclContainer().oclIsKindOf(ocl::CallExp) and s.oclContainer().oclAsType(ocl::CallExp).ownedSource = s)->isEmpty() + inv TargetPropertyIsNotReadOnly: not resolvedProperty.isReadOnly diff --git a/plugins/org.eclipse.qvtd.pivot.qvtrelation/model/QVTrelation.ecore b/plugins/org.eclipse.qvtd.pivot.qvtrelation/model/QVTrelation.ecore index 00e2542f3..f99f04496 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtrelation/model/QVTrelation.ecore +++ b/plugins/org.eclipse.qvtd.pivot.qvtrelation/model/QVTrelation.ecore @@ -144,7 +144,7 @@ + name="isTopLevel" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> diff --git a/plugins/org.eclipse.qvtd.pivot.qvttemplate/model/QVTtemplate.ecore b/plugins/org.eclipse.qvtd.pivot.qvttemplate/model/QVTtemplate.ecore index bd3b1bfdc..1d29a3324 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvttemplate/model/QVTtemplate.ecore +++ b/plugins/org.eclipse.qvtd.pivot.qvttemplate/model/QVTtemplate.ecore @@ -187,7 +187,7 @@