Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Papyrus model to emf/uml2 - stereotypes get lost
Papyrus model to emf/uml2 - stereotypes get lost [message #1341611] Thu, 08 May 2014 15:14 Go to next message
Mathias Krill is currently offline Mathias KrillFriend
Messages: 6
Registered: May 2014
Junior Member
Hi,

iam total newbie to emf and papyrus. I have a given payprus model in emf/uml2. (.uml).

//Problem:

The model with the "platform:/" has lost all its stereotypes and profiles, especially the needed sysML one.
There are still packages "pathmap:/" around.

Is there a way to fix that stereotype-lost problem?
Are there may plugins wich could do that ?



//speculation
In my search for a solution i found for example that:
http://www.eclipse.org/forums/index.php/t/354631/

It is often recommended to fix the pathmap or register the profiles of papyrus to the emf-model. I don't understand the example in the link , how that pathmap are fixed , how do i find wich should be fixed and so on.

May some could give me hints

best wishes

Mathias
Re: Papyrus model to emf/uml2 - stereotypes get lost [message #1343663 is a reply to message #1341611] Fri, 09 May 2014 11:55 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1206
Registered: July 2009
Location: Canada
Senior Member

Hi, Mathias,

If you are loading UML (or any EMF-based) resources in a "stand-alone"
JVM (without the Eclipse run-time and workspace), then you will simply
have to have a priori knowledge of the mappings of all
platform:/resource/<project>/... URIs to locations in the filesystem or
wherever.

The usual way to set up these mappings is using the
URIConverter::getURIMap() of the URI converter provided by the
ResourceSet in which you are loading your resources. Note that the
keys and the values of these mappings should both be *prefix* URIs,
that is, hierarchical URIs ending with a slash ('/'). These map
logical "folders".

URIs of the platform:/plugins/<symbolic-name>/... and
pathmap://<token>/... form indicate library models and profiles
deployed in Eclipse plug-ins. For any such resources provided by the
Eclipse UML plug-ins, the UMLResourcesUtil::init(ResourceSet) utility
API should set up the mappings that you need. I don't think that
Papyrus provides any comparable utility for the SysML profiles and
libraries, so you'll need to set that up. Probably the implementation
of UMLResourceUtil can be a guide.

HTH,

Christian


On 2014-05-08 15:51:45 +0000, Mathias Krill said:

> Hi,
>
> iam total newbie to emf and papyrus. I have a given payprus model in
> emf/uml2. (.uml).
>
> //Problem:
>
> The model with the "platform:/" has lost all its stereotypes and
> profiles, especially the needed sysML one. There are still packages
> "pathmap:/" around.
> Is there a way to fix that stereotype-lost problem?
> Are there may plugins wich could do that ?
>
>
>
> //speculation
> In my search for a solution i found for example that:
> http://www.eclipse.org/forums/index.php/t/354631/
>
> It is often recommended to fix the pathmap or register the profiles of
> papyrus to the emf-model. I don't understand the example in the link ,
> how that pathmap are fixed , how do i find wich should be fixed and so
> on.
> May some could give me hints
> best wishes
>
> Mathias
Re: Papyrus model to emf/uml2 - stereotypes get lost [message #1349439 is a reply to message #1343663] Mon, 12 May 2014 07:37 Go to previous messageGo to next message
Mathias Krill is currently offline Mathias KrillFriend
Messages: 6
Registered: May 2014
Junior Member
Hi Christian and thank you for your explanations. May you could give me some futher hints, i'll start with the Ressource-Set:

"The usual way to set up these mappings is using the
URIConverter::getURIMap() of the URI converter provided by the
ResourceSet in which you are loading your resources."


The ResourceSet in which iam loading the resources - how do i define/get that ?

I have seen some code like that:

ResourceSet resourceSet = new ResourceSetImpl();

resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
resourceSet.getPackageRegistry().put(Ecore2XMLPackage.eNS_URI, Ecore2XMLPackage.eINSTANCE);

resourceSet.getPackageRegistry().put(SysmlPackage.eNS_URI, SysmlPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(ModelelementsPackage.eNS_URI, BlocksPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(BlocksPackage.eNS_URI, BlocksPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(PortandflowsPackage.eNS_URI, PortandflowsPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(ConstraintsPackage.eNS_URI, ConstraintsPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(ActivitiesPackage.eNS_URI, ActivitiesPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(AllocationsPackage.eNS_URI, AllocationsPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(RequirementsPackage.eNS_URI, RequirementsPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(InteractionsPackage.eNS_URI, InteractionsPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(StatemachinesPackage.eNS_URI, StatemachinesPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(UsecasesPackage.eNS_URI, UsecasesPackage.eINSTANCE);


I suppose thet profilSet.getPackageRegistry() is the part of getting the actual resource-set in wich i have to load the resources?

So profilSet is a Hashmap :(key, URI) and i register for the actual instance:

.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE); ?

[Updated on: Mon, 12 May 2014 08:40]

Report message to a moderator

Re: Papyrus model to emf/uml2 - stereotypes get lost [message #1349941 is a reply to message #1349439] Mon, 12 May 2014 12:20 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1206
Registered: July 2009
Location: Canada
Senior Member

Hi, Mathias,

To get a resource set, you just create it like so:

ResourceSet rset = new ResourceSetImpl();

A resource set has a local package registry in which you can put
EPackages for the EMF run-time to find when loading resources that
contain instances of the EClasses in those packages.

Much of the basics of working with EMF should be explained in the EMF
tutorials [1] on the Eclipse website and/or in the FAQ [2].

HTH,

Christian

[1] http://www.eclipse.org/modeling/emf/docs/
[2] https://wiki.eclipse.org/EMF/FAQ



On 2014-05-12 07:37:23 +0000, Mathias Krill said:

> Hi Christian and thank you for your explanations. May you could give me
> some futher hints, i'll start with the Ressource-Set:
>
> "The usual way to set up these mappings is using the
> URIConverter::getURIMap() of the URI converter provided by the
> ResourceSet in which you are loading your resources."
> The ResourceSet in which iam loading the resources - how do i define/get that ?
>
> I have seen some code like that:
>
> // Load the profile
> URI profileUri = URI.createURI(PROFILE_NAME);
> ResourceSet profileSet = new ResourceSetImpl();
> profileSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
> profileSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> profileSet.createResource(profileUri);
> Resource profileResource = profileSet.getResource(profileUri, true);
> Profile profile =
> (Profile)EcoreUtil.getObjectByType(profileResource.getContents(),
> UMLPackage.Literals.PROFILE);
> [...]from
> stackoverflow.com/questions/15374753/eclipse-uml2-obtain-value-of-a-property-defined-in-a-profile
>
>
>
> I suppose thet profilSet.getPackageRegistry() is the part of getting
> the actual resource-set in wich i have to load the resources?
Re: Papyrus model to emf/uml2 - stereotypes get lost [message #1359118 is a reply to message #1349941] Fri, 16 May 2014 07:16 Go to previous message
Mathias Krill is currently offline Mathias KrillFriend
Messages: 6
Registered: May 2014
Junior Member
thank you Smile
Previous Topic:parsing file.uml annotated through MARTE profile
Next Topic:Executable UML
Goto Forum:
  


Current Time: Mon Jul 06 06:13:27 GMT 2020

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

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

Back to the top