| /******************************************************************************* |
| * 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 ecoreMM : 'http://www.eclipse.org/emf/2002/Ecore'; |
| import pivotMM : 'http://www.eclipse.org/ocl/2015/Pivot'; |
| --import extentMM : 'http://www.eclipse.org/qvt/2019/QVTruntimeLibrary'; |
| import extentMM : 'platform:/resource/org.eclipse.qvtd.runtime/model-gen/QVTruntimeLibrary.ecore'; |
| --import qvtlibMM : 'platform:/resource/org.eclipse.qvtd.pivot.qvtbase/model/QVTbaseLibrary.oclstdlib#/'; |
| --import pivotMM : 'platform:/resource/org.eclipse.ocl.pivot/model/Pivot.ecore'::pivot; |
| |
| package org::eclipse::ocl::pivot2::ecore2pivotRoot { |
| /** |
| * Transform an Ecore metamodel to a Pivot metamodel |
| */ |
| transformation Ecore2PivotRoot(ecore:{extentMM,ecoreMM}, as:{extentMM,pivotMM}) |
| { |
| top relation mapEPackage { |
| name : String; |
| nsPrefix : String; |
| nsURI : String; |
| /*enforce*/ domain ecore ePackage : ecoreMM::EPackage { |
| eSuperPackage = null, |
| name = name, |
| nsPrefix = nsPrefix, |
| nsURI = nsURI, |
| extent = eExtent : extentMM::qvtruntimelibrary::Extent{} |
| }; |
| enforce domain as asPackage : pivotMM::Package { |
| Model = asModel : pivotMM::Model{}, |
| name = name, |
| nsPrefix = nsPrefix, |
| URI = nsURI |
| }; |
| when { |
| mapEResource(eExtent, asModel); |
| } |
| } |
| |
| top relation mapEResource { |
| /*enforce*/ domain ecore eExtent : extentMM::qvtruntimelibrary::Extent {}; |
| enforce domain as asModel : pivotMM::Model { |
| extent = asExtent : extentMM::qvtruntimelibrary::Extent {} |
| }; |
| } |
| } |
| } |