| |
| modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore"; |
| |
| transformation ImportedMappingTest(in modelIn : ecore, out model : ecore); |
| |
| property INDIRECT_IMPORT_PROP : String = 'ImportedMappingTest::INDIRECT_IMPORT_PROP'; |
| |
| main() { |
| } |
| |
| mapping upCastToModelElement(in element: EModelElement) : ecore::EModelElement { |
| init { |
| result := element; |
| } |
| } |
| |
| /** |
| Test virtual operations deifned in a single module |
| */ |
| mapping testGlobalVirtualMapping( |
| element: EAnnotation, named: EEnumLiteral, |
| typed: EOperation, attrib: EStructuralFeature, |
| ref: EReference, param : EParameter) : Tuple(status : Boolean, p : EPackage) { |
| |
| --just test a local mapping |
| |
| init { |
| var outputs : Sequence(EModelElement) := Sequence { |
| this.map upCastToModelElement(element), named, typed, attrib, ref, param |
| }; |
| |
| var resultCollectorPack := object EPackage { |
| name := 'testGlobalVirtualMapping'; |
| eClassifiers := outputs.map globalVirtualMapping( |
| 12, Set{ 1 }, Tuple { val = Bag{ false }})->asOrderedSet(); |
| }; |
| |
| var expectedResultTag := resultCollectorPack.eClassifiers.name = Sequence { |
| 'EModelElement::globalVirtualMapping', -- EAnnotation |
| 'ENamedElement::globalVirtualMapping', -- EEnumLiteral |
| 'ETypedElement::globalVirtualMapping', -- EOperation |
| 'EStructuralFeature::globalVirtualMapping', -- EAttribute |
| 'EReference::globalVirtualMapping', -- concrete match |
| 'EParameter::globalVirtualMapping' -- concrete match |
| }; |
| |
| result := Tuple { status = expectedResultTag, p = resultCollectorPack }; |
| } |
| } |
| |
| /** |
| Define for the leaf sub-types first as the subsequent operations on super-types are not be available |
| to MDT OCL yet. Otherwise they would be resolved as available on supertype. |
| => this test the lookup including methods defined on subtypes |
| */ |
| mapping EReference::globalVirtualMapping(in arg1 : OclAny, in arg2 : Collection(Real), in arg3: Tuple (val : Collection(OclAny))) : EClass { |
| name:='EReference::globalVirtualMapping'; |
| } |
| |
| mapping ENamedElement::globalVirtualMapping(in arg1 : OclAny, in arg2 : Collection(Real), in arg3: Tuple (val : Collection(OclAny))) : EClass { |
| name:='ENamedElement::globalVirtualMapping'; |
| } |
| |
| mapping EModelElement::globalVirtualMapping(in arg1 : OclAny, in arg2 : Collection(Real), in arg3: Tuple (val : Collection(OclAny))) : EClass { |
| name:='EModelElement::globalVirtualMapping'; |
| } |
| |