Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna
Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1502602] Sun, 07 December 2014 20:45 Go to next message
Francesco Chirico is currently offline Francesco ChiricoFriend
Messages: 8
Registered: December 2014
Junior Member
Hello,
I'm having problems in using package merge and accessing stereotypes in Acceleo 3.5.1 in Eclipse Luna.
In the following I used xxxx in place of http because I have less than 5 messages on the forum and profile uri are detected as external links, sorry.
I have two static profiles (you can find the related plugins in attached file profiles.tar.gz).
The profile xxxx://hwinterface.elt.elt/profile is applied to Model1 (in models.tar.gz).
Model2 (in models.tar.gz) merges model1 and applies the profile xxxx://hwinterface.elt.elt/vhdl/profile.
Model1 contains the sysml Block Register1 on which the stereotype Register is applied.
Model2 contains the sysml Block Register1 on which the stereotype RegisterVHDL is applied.
The transformation org.eclipse.acceleo.module.demo (in transformation.tar.gz) takes Model2 as input.
The file generate.mtl is pretty simple:

[comment encoding = UTF-8 /]
[module generate(... all metamodels here but I cannot post because I have less than 5 messages ... )]


[template public generateElement(model : Model)]
[comment @main/]
[file ('test.txt', false, 'UTF-8')]
[for (cls : Class | model.ownedMember->selectByType(Class))]
Class: [cls.name/]
Stereotypes: [cls.getAppliedStereotypes()/]
Hardware Elements: [HardwareElement.allInstances().base_Class.name/]
RegisterVHDL: [RegisterVHDL.allInstances().base_Class.name/]
[/for]
[/file]
[/template]

Running the transformation I get the following result:

Class: Register1
Stereotypes:
Hardware Elements:
RegisterVHDL: Register1

so the result is that package merge seems not taking place at all.
I don't see any HardwareElement stereotype (HardwareElement generalizes Register) and moreover I don't see model elements that are contained in Model1.

The other problem is that I getAppliedStereotypes() in Acceleo doesn't work anymore.

Thank you in advance,
Francesco

Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1503843 is a reply to message #1502602] Mon, 08 December 2014 20:54 Go to previous messageGo to next message
Francesco Chirico is currently offline Francesco ChiricoFriend
Messages: 8
Registered: December 2014
Junior Member
Trying to solve the "Package Merge" problem I changed the project this way:
Model1 owns Register1 with Stereotype "Register" from the first profile (hwinterface.elt.elt/profile)
Model2 owns Register1 with Stereotype "RegisterVHDL" from the second profile (hwinterface.elt.elt/vhdl/profile).
Model2 doesn't "Package Merge" anymore "Model1.
Model3 "Package Merges" both Model2 and Model1.
The transformation uses the class org.eclipse.uml2.uml.util.UMLUtil.PackageMerger to perform the merge.

The generate.mtl file became:

[comment encoding = UTF-8 /]
[module generate(--- cannot post, see the file pls --- )]


[query public packageMerge(pkg : Package) : Model =
invoke('org.eclipse.acceleo.module.demo.main.Utilities', 'mergePackages(org.eclipse.uml2.uml.Package)', Sequence{pkg})
/]


[template public generateElement(model : Model)]
[comment @main/]
[file ('test.txt', false, 'UTF-8')]
[generateModel(model.packageMerge())/]
[/file]
[/template]

[template public generateModel(model : Model)]
Other: [model.getOwnedTypes()->sep(',')/]
[let profile : EPackage = model.getAllProfileApplications().getAppliedDefinition()->any(name='HWSWInterface')]
Profile: [profile.eContents()->sep(',')/]
Stereotypes:
[for (cls : EClassifier | profile.eClassifiers)]
Classifier: [cls.name/]
[/for]
[for (cls : Class | model.ownedMember->selectByType(Class))]
======================================================================
Class: [cls.name/] Properties: [cls.attribute.name->sep(',')/]
Stereotypes: [cls.getAppliedStereotypes()/]
Hardware Elements: [HardwareElement.allInstances().base_Class.name->sep(',')/]
[/for]
RegisterVHDL: [RegisterVHDL.allInstances().base_Class.name/]
HardwareElement: [HardwareElement.allInstances()->sep(',')/]
[/let]
[/template]

This time I get the result:

Other: org.eclipse.uml2.uml.internal.impl.ClassImpl@51f49060 (name: BoardSection1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false),org.eclipse.uml2.uml.internal.impl.ClassImpl@687a762c (name: Block1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false),org.eclipse.uml2.uml.internal.impl.AssociationImpl@6815c5f2 (name: RegisterInstance1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isDerived: false),org.eclipse.uml2.uml.internal.impl.AssociationImpl@70925b45 (name: <unset>, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isDerived: false),org.eclipse.uml2.uml.internal.impl.ClassImpl@410954b (name: Board1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false),org.eclipse.uml2.uml.internal.impl.ClassImpl@23a9ba52 (name: Register1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false),org.eclipse.uml2.uml.internal.impl.AssociationImpl@7e1a1da6 (name: BoardSectionInstance1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isDerived: false)
Profile: org.eclipse.emf.ecore.impl.EClassImpl@4879f0f2 (name: BoardSection) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@47db5fa5 (name: Group) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@354fc8f0 (name: HardwareElement) (instanceClassName: null) (abstract: true, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@40499e4f (name: MemoryRegister) (instanceClassName: null) (abstract: true, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@7a791b66 (name: Field) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@4fc5e095 (name: GroupInstance) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@435871cb (name: HWElementAssociation) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@556d0826 (name: IndirectMemoryAddress) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@5bfa8cc5 (name: Board) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@efde75f (name: MemoryRegisterInstance) (instanceClassName: null) (abstract: true, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@3b220bcb (name: BoardSectionInstance) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@4a3329b9 (name: Register) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@160ac7fb (name: MemoryElement) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@12bfd80d (name: RegisterInstance) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EClassImpl@13e3c1c7 (name: MemoryInstance) (instanceClassName: null) (abstract: false, interface: false),org.eclipse.emf.ecore.impl.EEnumImpl@344344fa (name: enEndianess) (instanceClassName: null) (serializable: true),org.eclipse.emf.ecore.impl.EEnumImpl@2db2cd5 (name: enDataWidth) (instanceClassName: null) (serializable: true),org.eclipse.emf.ecore.impl.EEnumImpl@70e659aa (name: enMemoryType) (instanceClassName: null) (serializable: true),org.eclipse.emf.ecore.impl.EEnumImpl@615f972 (name: enReadMode) (instanceClassName: null) (serializable: true)
Stereotypes:
Classifier: BoardSection
Classifier: Group
Classifier: HardwareElement
Classifier: MemoryRegister
Classifier: Field
Classifier: GroupInstance
Classifier: HWElementAssociation
Classifier: IndirectMemoryAddress
Classifier: Board
Classifier: MemoryRegisterInstance
Classifier: BoardSectionInstance
Classifier: Register
Classifier: MemoryElement
Classifier: RegisterInstance
Classifier: MemoryInstance
Classifier: enEndianess
Classifier: enDataWidth
Classifier: enMemoryType
Classifier: enReadMode
======================================================================
Class: BoardSection1 Properties: board1_1,register1_1
Stereotypes:
Hardware Elements:
======================================================================
Class: Block1 Properties:
Stereotypes:
Hardware Elements:
======================================================================
Class: Board1 Properties: boardsection1_1
Stereotypes:
Hardware Elements:
======================================================================
Class: Register1 Properties: boardsection1_1,block1_1
Stereotypes:
Hardware Elements:
RegisterVHDL:
HardwareElement:

This is a bit better... profiles are applied and the merge is performed but I cannot find stereotypes (maybe I just don't know how to get them...).

I attached the new models and the new transformation (profiles didn't change).

Thank you in advance,
Francesco
Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1504842 is a reply to message #1503843] Tue, 09 December 2014 16:09 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7679
Registered: July 2009
Senior Member
Hi

Until you get it working, I recommend doing the PackageMerge manually.

Indeed even if it works, I would still recommend using an MWE2 workflow
to sequence your transformation steps.

IIRC PackageMerge has some options which you need to get right.

Practice with Java first before trying to get the same thing to work
with a layer of MtoT abstraction/obfuscation.

Regards

Ed Willik


On 08/12/2014 20:54, Francesco Chirico wrote:
> Trying to solve the "Package Merge" problem I changed the project this way:
> Model1 owns Register1 with Stereotype "Register" from the first profile (hwinterface.elt.elt/profile)
> Model2 owns Register1 with Stereotype "RegisterVHDL" from the second profile (hwinterface.elt.elt/vhdl/profile).
> Model2 doesn't "Package Merge" anymore "Model1.
> Model3 "Package Merges" both Model2 and Model1.
> The transformation uses the class org.eclipse.uml2.uml.util.UMLUtil.PackageMerger to perform the merge.
>
> The generate.mtl file became:
>
> [comment encoding = UTF-8 /]
> [module generate(--- cannot post, see the file pls --- )]
>
>
> [query public packageMerge(pkg : Package) : Model =
> invoke('org.eclipse.acceleo.module.demo.main.Utilities', 'mergePackages(org.eclipse.uml2.uml.Package)', Sequence{pkg})
> /]
>
>
> [template public generateElement(model : Model)]
> [comment @main/]
> [file ('test.txt', false, 'UTF-8')]
> [generateModel(model.packageMerge())/]
> [/file]
> [/template]
>
> [template public generateModel(model : Model)]
> Other: [model.getOwnedTypes()->sep(',')/]
> [let profile : EPackage = model.getAllProfileApplications().getAppliedDefinition()->any(name='HWSWInterface')]
> Profile: [profile.eContents()->sep(',')/]
> Stereotypes:
> [for (cls : EClassifier | profile.eClassifiers)]
> Classifier: [cls.name/]
> [/for]
> [for (cls : Class | model.ownedMember->selectByType(Class))]
> ======================================================================
> Class: [cls.name/] Properties: [cls.attribute.name->sep(',')/]
> Stereotypes: [cls.getAppliedStereotypes()/]
> Hardware Elements: [HardwareElement.allInstances().base_Class.name->sep(',')/]
> [/for]
> RegisterVHDL: [RegisterVHDL.allInstances().base_Class.name/]
> HardwareElement: [HardwareElement.allInstances()->sep(',')/]
> [/let]
> [/template]
>
> This time I get the result:
>
> Other: mailto:org.eclipse.uml2.uml.internal.impl.ClassImpl@51f49060 (name: BoardSection1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false),mailto:org.eclipse.uml2.uml.internal.impl.ClassImpl@687a762c (name: Block1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false),mailto:org.eclipse.uml2.uml.internal.impl.AssociationImpl@6815c5f2 (name: RegisterInstance1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isDerived: false),mailto:org.eclipse.uml2.uml.internal.impl.AssociationImpl@70925b45 (name: <unset>, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isDerived: false),mailto:org.eclipse.uml2.uml.internal.impl.ClassImpl@410954b (name: Board1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false),mailto:org.eclipse.uml2.uml.internal.impl.ClassImpl@23a9
ba52 (name: Register1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false),mailto:org.eclipse.uml2.uml.internal.impl.AssociationImpl@7e1a1da6 (name: BoardSectionInstance1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isDerived: false)
> Profile: mailto:org.eclipse.emf.ecore.impl.EClassImpl@4879f0f2 (name: BoardSection) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@47db5fa5 (name: Group) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@354fc8f0 (name: HardwareElement) (instanceClassName: null) (abstract: true, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@40499e4f (name: MemoryRegister) (instanceClassName: null) (abstract: true, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@7a791b66 (name: Field) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@4fc5e095 (name: GroupInstance) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@435871cb (name: HWElementAssociation) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.
impl.EClassImpl@556d0826 (name: IndirectMemoryAddress) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@5bfa8cc5 (name: Board) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@efde75f (name: MemoryRegisterInstance) (instanceClassName: null) (abstract: true, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@3b220bcb (name: BoardSectionInstance) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@4a3329b9 (name: Register) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@160ac7fb (name: MemoryElement) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@12bfd80d (name: RegisterInstance) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EClassImpl@13e3
c1c7 (name: MemoryInstance) (instanceClassName: null) (abstract: false, interface: false),mailto:org.eclipse.emf.ecore.impl.EEnumImpl@344344fa (name: enEndianess) (instanceClassName: null) (serializable: true),mailto:org.eclipse.emf.ecore.impl.EEnumImpl@2db2cd5 (name: enDataWidth) (instanceClassName: null) (serializable: true),mailto:org.eclipse.emf.ecore.impl.EEnumImpl@70e659aa (name: enMemoryType) (instanceClassName: null) (serializable: true),mailto:org.eclipse.emf.ecore.impl.EEnumImpl@615f972 (name: enReadMode) (instanceClassName: null) (serializable: true)
> Stereotypes:
> Classifier: BoardSection
> Classifier: Group
> Classifier: HardwareElement
> Classifier: MemoryRegister
> Classifier: Field
> Classifier: GroupInstance
> Classifier: HWElementAssociation
> Classifier: IndirectMemoryAddress
> Classifier: Board
> Classifier: MemoryRegisterInstance
> Classifier: BoardSectionInstance
> Classifier: Register
> Classifier: MemoryElement
> Classifier: RegisterInstance
> Classifier: MemoryInstance
> Classifier: enEndianess
> Classifier: enDataWidth
> Classifier: enMemoryType
> Classifier: enReadMode
> ======================================================================
> Class: BoardSection1 Properties: board1_1,register1_1
> Stereotypes:
> Hardware Elements:
> ======================================================================
> Class: Block1 Properties:
> Stereotypes:
> Hardware Elements:
> ======================================================================
> Class: Board1 Properties: boardsection1_1
> Stereotypes:
> Hardware Elements:
> ======================================================================
> Class: Register1 Properties: boardsection1_1,block1_1
> Stereotypes:
> Hardware Elements:
> RegisterVHDL:
> HardwareElement:
>
> This is a bit better... profiles are applied and the merge is performed but I cannot find stereotypes (maybe I just don't know how to get them...).
>
> I attached the new models and the new transformation (profiles didn't change).
>
> Thank you in advance,
> Francesco
>
Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1505070 is a reply to message #1504842] Tue, 09 December 2014 20:30 Go to previous messageGo to next message
Francesco Chirico is currently offline Francesco ChiricoFriend
Messages: 8
Registered: December 2014
Junior Member
Hi Ed,
Thank you for your advice.
I wrote a small java class (Utilities.java) to perform the package merge.
I get the models merged but I don't manage to get stereotypes at all.
You hinted that I could use some option in PackageMerger.merge .
Could you point me on the right option?

Once I solve the stereotype problem I think I've done.

Thank you,
Francesco
Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1505097 is a reply to message #1505070] Tue, 09 December 2014 20:50 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7679
Registered: July 2009
Senior Member
Hi

Follow the UML stereotype tutorial.

Regards

Ed Willink


On 09/12/2014 20:30, Francesco Chirico wrote:
> Hi Ed,
> Thank you for your advice.
> I wrote a small java class (Utilities.java) to perform the package merge.
> I get the models merged but I don't manage to get stereotypes at all.
> You hinted that I could use some option in PackageMerger.merge .
> Could you point me on the right option?
>
> Once I solve the stereotype problem I think I've done.
>
> Thank you,
> Francesco
Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1505125 is a reply to message #1505097] Tue, 09 December 2014 21:24 Go to previous messageGo to next message
Francesco Chirico is currently offline Francesco ChiricoFriend
Messages: 8
Registered: December 2014
Junior Member
Hi Ed,
do you mean www.eclipse.org/modeling/mdt/uml2/docs/articles/Introduction_to_UML2_Profiles/article.html ?
This tutorial is very old and it refers to UML 2.2.x implementation.
I suppose that my troubles depend on using UML 2.5.0 in Eclipse Luna.
For instance getAppliedStereotypes() in Luna gives back an empty collection.
It seems that the only way to find a stereotype instance given the UML Class instance is doing something like MyStereotype.allInstances()->select(base_Class=my_class).
Sadly it seems that allInstances() operates on the input model ResourceSet and not on imported/merged models.
Do you know if there is a way in UML 2.5.0 to find such deeply nested Stereotypes?

Regards,
Francesco


Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1505653 is a reply to message #1505125] Wed, 10 December 2014 07:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7679
Registered: July 2009
Senior Member
Hi

The articles have been updated recently and turned into tests and
installable examples; they work and you don't have to type all the
boring preamble to get to something useful to play with!

New->Project...->Examples->UML2

Regards

Ed Willink

On 09/12/2014 21:24, Francesco Chirico wrote:
> Hi Ed,
> do you mean
> www.eclipse.org/modeling/mdt/uml2/docs/articles/Introduction_to_UML2_Profiles/article.html
> ?
> This tutorial is very old and it refers to UML 2.2.x implementation. I
> suppose that my troubles depend on using UML 2.5.0 in Eclipse Luna.
> For instance getAppliedStereotypes() in Luna gives back an empty
> collection.
> It seems that the only way to find a stereotype instance given the UML
> Class instance is doing something like
> MyStereotype.allInstances()->select(base_Class=my_class).
> Sadly it seems that allInstances() operates on the input model
> ResourceSet and not on imported/merged models.
> Do you know if there is a way in UML 2.5.0 to find such deeply nested
> Stereotypes?
>
> Regards,
> Francesco
>
>
>
Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1509610 is a reply to message #1505653] Sat, 13 December 2014 11:04 Go to previous messageGo to next message
Francesco Chirico is currently offline Francesco ChiricoFriend
Messages: 8
Registered: December 2014
Junior Member
Hi Ed,
as you suggested I played with both UML2 examples (Getting Started and Intro to Profiles).
In this example the profile is created using the following code:

//
// Profile- and model-building utilities
//

protected static Profile createProfile(String name, String nsURI) {
Profile profile = UMLFactory.eINSTANCE.createProfile();
profile.setName(name);
profile.setURI(nsURI);

out("Profile '%s' created.", profile.getQualifiedName());

return profile;
}

Sadly I'm using UML 2.5.0 (the example uses UML 2.0.0) and static profiles.
I attached in my first posts both the models and the profiles (static profiles) that I'm using.

Thank you for your suggestions.
If you have any other idea about how to solve the problem I will read it carefully.

Regards,
Francesco
Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1509660 is a reply to message #1509610] Sat, 13 December 2014 12:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7679
Registered: July 2009
Senior Member
Hi

The example is released as part of UML 5.x were the primary support is
UML 2.5 with load compatibility with earlier versions.

If you find something in the example that is incompatible with UML 2.5
please raise a Bugzilla. I suspect it is just a vintage comment that is
confusing you, which may still be worth a Bugzilla to help the next
customer.

Regards

Ed Willink


On 13/12/2014 11:04, Francesco Chirico wrote:
> Hi Ed,
> as you suggested I played with both UML2 examples (Getting Started and
> Intro to Profiles).
> In this example the profile is created using the following code:
>
> //
> // Profile- and model-building utilities
> //
>
> protected static Profile createProfile(String name, String nsURI) {
> Profile profile = UMLFactory.eINSTANCE.createProfile();
> profile.setName(name);
> profile.setURI(nsURI);
>
> out("Profile '%s' created.", profile.getQualifiedName());
>
> return profile;
> }
>
> Sadly I'm using UML 2.5.0 (the example uses UML 2.0.0) and static profiles.
> I attached in my first posts both the models and the profiles (static
> profiles) that I'm using.
>
> Thank you for your suggestions.
> If you have any other idea about how to solve the problem I will read it
> carefully.
>
> Regards,
> Francesco
Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1509818 is a reply to message #1509660] Sat, 13 December 2014 15:09 Go to previous messageGo to next message
Francesco Chirico is currently offline Francesco ChiricoFriend
Messages: 8
Registered: December 2014
Junior Member
Hi Ed,
I tried to simplify the project to understand where is the root of the problem that I'm having.
Concerning stereotypes I tried to create a blank sysml project in Papyrus (I'm using Eclipse Luna).

If I create an acceleo transformation like this:

[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/uml2/5.0.0/UML', 'http://www.eclipse.org/papyrus/0.7.0/SysML')]


[template public generateElement(model : Model)]
[comment @main/]
[file ('test.txt', false, 'UTF-8')]
[model.profileApplication.appliedProfile.ownedStereotype/]
Applied Profiles: [model.profileApplication.appliedProfile->sep(',')/]
[for (cls : Class | Class.allInstances())]
getAppliedStereotypes(): [cls.getAppliedStereotypes()->size()/]
getStereotypeApplication():[cls.getStereotypeApplications()->size()/]
[/for]
[/file]
[/template]

I get the following output:

Applied Profiles: org.eclipse.uml2.uml.internal.impl.ProfileImpl@2756c0a7 (eProxyURI: platform:/plugin/elt.elt.hwinterface.profile/models/model.profile.uml#_FK3LcGt0EeSwlPKAc3aoyQ),org.eclipse.uml2.uml.internal.impl.ProfileImpl@15c25153 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_fSw28LX7EduFmqQsrNB9lw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@4d098f9b (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_5WYJ0LX7EduFmqQsrNB9lw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@83298d7 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_nAF5kLX8EduFmqQsrNB9lw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@62fad19 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_NxdG4LX8EduFmqQsrNB9lw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@55e8ec2f (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_OOJC4LX8EduFmqQsrNB9lw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@7e3060d8 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_C2zXMLX8EduFmqQsrNB9lw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@1433046b (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_TZ_nULU5EduiKqCzJMWbGw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@6b54655f (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_neZmMLX8EduFmqQsrNB9lw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@51e8e6e6 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_rpx28LX7EduFmqQsrNB9lw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@72445aba (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_Gx8MgLX7EduFmqQsrNB9lw),org.eclipse.uml2.uml.internal.impl.ProfileImpl@773f7880 (eProxyURI: pathmap://SysML_PROFILES/SysML.profile.uml#_meOioLX8EduFmqQsrNB9lw)
getAppliedStereotypes(): 0
getStereotypeApplication():0

Please notice that both getAppliedStereotypes() and getStereotypeApplication() give back empty sets.

Regards,
Francesco

Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1509823 is a reply to message #1509818] Sat, 13 December 2014 15:11 Go to previous messageGo to next message
Francesco Chirico is currently offline Francesco ChiricoFriend
Messages: 8
Registered: December 2014
Junior Member
I read somewhere that eProxyURI: is the symptom that a resource is not correctly loaded.
Then I changed the registerPackages method to contain the following code:

Map<URI,URI> uriMap = resourceSet.getURIConverter().getURIMap();
URI sysmlBaseUri=URI.createURI("platform:/plugin/org.eclipse.papyrus.sysml/");

uriMap.put(URI.createURI(SysmlResource.LIBRARIES_PATHMAP), sysmlBaseUri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(SysmlResource.PROFILES_PATHMAP), sysmlBaseUri.appendSegment("model").appendSegment(""));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(SysmlPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_TZ_nULU5EduiKqCzJMWbGw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ModelelementsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_Gx8MgLX7EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(BlocksPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_fSw28LX7EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(PortandflowsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_rpx28LX7EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ConstraintsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_5WYJ0LX7EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ActivitiesPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_C2zXMLX8EduFmqQsrNB9lw"));


UMLPlugin.getEPackageNsURIToProfileLocationMap().put(AllocationsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_NxdG4LX8EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(RequirementsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_OOJC4LX8EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(InteractionsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_meOioLX8EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(StatemachinesPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_nAF5kLX8EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(UsecasesPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_neZmMLX8EduFmqQsrNB9lw"));

Even in this case I didn't get it right.

Francesco
Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1509890 is a reply to message #1509823] Sat, 13 December 2014 16:32 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7679
Registered: July 2009
Senior Member
H

I am afraid that I have never used UML with Acceleo let alone
stereotypes. You haven't provided anything to practice on even if I had
time to look at it which I don't since I'm no longer an Acceleo user.

I hope someone else can be more helpful.

Regards

Ed Willink


On 13/12/2014 15:11, Francesco Chirico wrote:
> I read somewhere that eProxyURI: is the symptom that a resource is not
> correctly loaded.
> Then I changed the registerPackages method to contain the following code:
>
> Map<URI,URI> uriMap = resourceSet.getURIConverter().getURIMap();
> URI
> sysmlBaseUri=URI.createURI("platform:/plugin/org.eclipse.papyrus.sysml/");
> uriMap.put(URI.createURI(SysmlResource.LIBRARIES_PATHMAP),
> sysmlBaseUri.appendSegment("libraries").appendSegment(""));
> uriMap.put(URI.createURI(SysmlResource.PROFILES_PATHMAP),
> sysmlBaseUri.appendSegment("model").appendSegment(""));
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(SysmlPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_TZ_nULU5EduiKqCzJMWbGw"));
>
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ModelelementsPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_Gx8MgLX7EduFmqQsrNB9lw"));
>
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(BlocksPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_fSw28LX7EduFmqQsrNB9lw"));
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(PortandflowsPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_rpx28LX7EduFmqQsrNB9lw"));
>
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ConstraintsPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_5WYJ0LX7EduFmqQsrNB9lw"));
>
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ActivitiesPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_C2zXMLX8EduFmqQsrNB9lw"));
>
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(AllocationsPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_NxdG4LX8EduFmqQsrNB9lw"));
>
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(RequirementsPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_OOJC4LX8EduFmqQsrNB9lw"));
>
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(InteractionsPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_meOioLX8EduFmqQsrNB9lw"));
>
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(StatemachinesPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_nAF5kLX8EduFmqQsrNB9lw"));
>
>
> UMLPlugin.getEPackageNsURIToProfileLocationMap().put(UsecasesPackage.eNS_URI,
>
> URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_neZmMLX8EduFmqQsrNB9lw"));
>
> Even in this case I didn't get it right.
>
> Francesco
Re: Problems with static profiles and package merge with Acceleo 3.5.1 + Eclipse Luna [message #1521540 is a reply to message #1509890] Sun, 21 December 2014 21:57 Go to previous message
Francesco Chirico is currently offline Francesco ChiricoFriend
Messages: 8
Registered: December 2014
Junior Member
I finally found a solution and I wanted to share it with everybody.
It seems that the problem is related to the fact that I can't use the Acceleo Plug-in Runner and must use the Java Runner in Eclipse Luna.
The result is that many initializations must be performed by hand.
I had to change the method registerResourceFactories as follows:

super.registerResourceFactories(resourceSet);

if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
projectMap.initializeResourceSet(resourceSet);
}

where projectMap is inizialized as follows:

private static ProjectMap projectMap = new ProjectMap();

ProjectMap is imported from org.eclipse.ocl.examples.domain.utilities.ProjectMap.

I also added to registerPackages the following lines:

Map<URI,URI> uriMap = resourceSet.getURIConverter().getURIMap();
URI sysmlBaseUri=URI.createURI("platform:/plugin/org.eclipse.papyrus.sysml");

uriMap.put(URI.createURI(SysmlResource.LIBRARIES_PATHMAP), sysmlBaseUri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(SysmlResource.PROFILES_PATHMAP), sysmlBaseUri.appendSegment("model").appendSegment(""));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(SysmlPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_TZ_nULU5EduiKqCzJMWbGw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ModelelementsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_Gx8MgLX7EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(BlocksPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_fSw28LX7EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(PortandflowsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_rpx28LX7EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ConstraintsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_5WYJ0LX7EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(ActivitiesPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_C2zXMLX8EduFmqQsrNB9lw"));


UMLPlugin.getEPackageNsURIToProfileLocationMap().put(AllocationsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_NxdG4LX8EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(RequirementsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_OOJC4LX8EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(InteractionsPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_meOioLX8EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(StatemachinesPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_nAF5kLX8EduFmqQsrNB9lw"));

UMLPlugin.getEPackageNsURIToProfileLocationMap().put(UsecasesPackage.eNS_URI,
URI.createURI(SysmlResource.SYSML_PROFILE_URI+"#_neZmMLX8EduFmqQsrNB9lw"));


Bye,
Francesco
Previous Topic:Multiplicity - Association to Sql
Next Topic:EMTL
Goto Forum:
  


Current Time: Sat Nov 09 01:32:49 GMT 2024

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

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

Back to the top