Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVT] How to process element/package imports to href models/libraries?
[QVT] How to process element/package imports to href models/libraries? [message #503620] Tue, 15 December 2009 00:26 Go to next message
Eclipse UserFriend
Originally posted by: Nicolas.F.Rouquette.jpl.nasa.gov

In a QVT transformation for UML models, how do I copy from the source model
to the target model an element/package import where the imported
element/package is specified via an href to an external resource?


Below is an example of a model with a package import to an external resource
(the uml primitive types library) and another one where the imported package
is in the model.

<?xml version="1.0" encoding="UTF-8"?>
<uml:Package xmi:version="2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML"
xmi:id="_HBip8Og2Ed6AGZMjiodrGw" name="M3">
<packageImport xmi:id="_Dxjv0OhKEd6AGZMjiodrGw">
<importedPackage xmi:type="uml:Model"
href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packagedElement xmi:type="uml:Package" xmi:id="_4n_dIOjHEd6Wx9-kamIeQw"
name="P1">
<packagedElement xmi:type="uml:Class" xmi:id="_OJ7B4Og2Ed6AGZMjiodrGw"
name="C1">
<ownedAttribute xmi:id="_OyMBIOhJEd6AGZMjiodrGw" name="size">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedAttribute>
</packagedElement>
</packagedElement>
<packagedElement xmi:type="uml:Package" xmi:id="_6916MOjHEd6Wx9-kamIeQw"
name="P2">
<packageImport xmi:id="_-a-vcOjHEd6Wx9-kamIeQw"
importedPackage="_4n_dIOjHEd6Wx9-kamIeQw"/>
</packagedElement>
</uml:Package>

- Nicolas.
Re: [QVT] How to process element/package imports to href models/libraries? [message #503649 is a reply to message #503620] Tue, 15 December 2009 08:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Nicolas,

You can do something like:


modeltype Uml uses "http://www.eclipse.org/uml2/2.1.0/UML";

transformation DynamicProfile(in m1 : Uml, out m2 : Uml);

main() {
m1.objects()[PackageImport]->map copyHere();
}

mapping PackageImport::copyHere() : Package {
init {
// create a Package copy in the output extent
result := self.importedPackage.deepclone().oclAsType(Package);
}
}


Regards,
/Radek


On Tue, 15 Dec 2009 01:26:14 +0100, Nicolas F Rouquette
<Nicolas.F.Rouquette@jpl.nasa.gov> wrote:

> In a QVT transformation for UML models, how do I copy from the source
> model
> to the target model an element/package import where the imported
> element/package is specified via an href to an external resource?
>
>
> Below is an example of a model with a package import to an external
> resource
> (the uml primitive types library) and another one where the imported
> package
> is in the model.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Package xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML"
> xmi:id="_HBip8Og2Ed6AGZMjiodrGw" name="M3">
> <packageImport xmi:id="_Dxjv0OhKEd6AGZMjiodrGw">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packagedElement xmi:type="uml:Package"
> xmi:id="_4n_dIOjHEd6Wx9-kamIeQw"
> name="P1">
> <packagedElement xmi:type="uml:Class"
> xmi:id="_OJ7B4Og2Ed6AGZMjiodrGw"
> name="C1">
> <ownedAttribute xmi:id="_OyMBIOhJEd6AGZMjiodrGw" name="size">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> </packagedElement>
> </packagedElement>
> <packagedElement xmi:type="uml:Package"
> xmi:id="_6916MOjHEd6Wx9-kamIeQw"
> name="P2">
> <packageImport xmi:id="_-a-vcOjHEd6Wx9-kamIeQw"
> importedPackage="_4n_dIOjHEd6Wx9-kamIeQw"/>
> </packagedElement>
> </uml:Package>
>
> - Nicolas.
>
Re: [QVT] How to process element/package imports to href models/libraries? [message #504045 is a reply to message #503620] Wed, 16 December 2009 22:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Nicolas.F.Rouquette.jpl.nasa.gov

FYI

I solved this problem by adding a 'modeltype' declaration for the primitive
types library.

- Nicolas.


On 12/14/09 4:26 PM, in article
C74C17A6.EEC4%Nicolas.F.Rouquette@jpl.nasa.gov, "Rouquette, Nicolas F
(316A)" <nicolas.f.rouquette@jpl.nasa.gov> wrote:

> In a QVT transformation for UML models, how do I copy from the source model
> to the target model an element/package import where the imported
> element/package is specified via an href to an external resource?
>
>
> Below is an example of a model with a package import to an external resource
> (the uml primitive types library) and another one where the imported package
> is in the model.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Package xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML"
> xmi:id="_HBip8Og2Ed6AGZMjiodrGw" name="M3">
> <packageImport xmi:id="_Dxjv0OhKEd6AGZMjiodrGw">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packagedElement xmi:type="uml:Package" xmi:id="_4n_dIOjHEd6Wx9-kamIeQw"
> name="P1">
> <packagedElement xmi:type="uml:Class" xmi:id="_OJ7B4Og2Ed6AGZMjiodrGw"
> name="C1">
> <ownedAttribute xmi:id="_OyMBIOhJEd6AGZMjiodrGw" name="size">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> </packagedElement>
> </packagedElement>
> <packagedElement xmi:type="uml:Package" xmi:id="_6916MOjHEd6Wx9-kamIeQw"
> name="P2">
> <packageImport xmi:id="_-a-vcOjHEd6Wx9-kamIeQw"
> importedPackage="_4n_dIOjHEd6Wx9-kamIeQw"/>
> </packagedElement>
> </uml:Package>
>
> - Nicolas.
>
Re: [QVT] How to process element/package imports to href models/libraries? [message #504061 is a reply to message #504045] Wed, 16 December 2009 23:05 Go to previous message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Nicolas,

Seems like I misunderstood your issue.

The modeltype declaration gives you an access, does not solve copying
which you have mentioned in the original post.
The primitive type library is accessible via the model you have posted,
so I only outlined how to copy imported packages from the source
to the target model, thinking your uml model is the input.

Regards,
/Radek


On Wed, 16 Dec 2009 23:23:52 +0100, Nicolas F Rouquette
<Nicolas.F.Rouquette@jpl.nasa.gov> wrote:

> FYI
>
> I solved this problem by adding a 'modeltype' declaration for the
> primitive
> types library.
>
> - Nicolas.
>
>
> On 12/14/09 4:26 PM, in article
> C74C17A6.EEC4%Nicolas.F.Rouquette@jpl.nasa.gov, "Rouquette, Nicolas F
> (316A)" <nicolas.f.rouquette@jpl.nasa.gov> wrote:
>
>> In a QVT transformation for UML models, how do I copy from the source
>> model
>> to the target model an element/package import where the imported
>> element/package is specified via an href to an external resource?
>>
>>
>> Below is an example of a model with a package import to an external
>> resource
>> (the uml primitive types library) and another one where the imported
>> package
>> is in the model.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <uml:Package xmi:version="2.1"
>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>> xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML"
>> xmi:id="_HBip8Og2Ed6AGZMjiodrGw" name="M3">
>> <packageImport xmi:id="_Dxjv0OhKEd6AGZMjiodrGw">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>> </packageImport>
>> <packagedElement xmi:type="uml:Package"
>> xmi:id="_4n_dIOjHEd6Wx9-kamIeQw"
>> name="P1">
>> <packagedElement xmi:type="uml:Class"
>> xmi:id="_OJ7B4Og2Ed6AGZMjiodrGw"
>> name="C1">
>> <ownedAttribute xmi:id="_OyMBIOhJEd6AGZMjiodrGw" name="size">
>> <type xmi:type="uml:PrimitiveType"
>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>> </ownedAttribute>
>> </packagedElement>
>> </packagedElement>
>> <packagedElement xmi:type="uml:Package"
>> xmi:id="_6916MOjHEd6Wx9-kamIeQw"
>> name="P2">
>> <packageImport xmi:id="_-a-vcOjHEd6Wx9-kamIeQw"
>> importedPackage="_4n_dIOjHEd6Wx9-kamIeQw"/>
>> </packagedElement>
>> </uml:Package>
>>
>> - Nicolas.
>>
>
Previous Topic:[ATL] Refining Mode with two input models?
Next Topic:[ATL] Character keeps 'disappearing'
Goto Forum:
  


Current Time: Tue Oct 15 22:09:57 GMT 2019

Powered by FUDForum. Page generated in 0.02490 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top