Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » URI Registering for Registered Profiles in Papyrus
URI Registering for Registered Profiles in Papyrus [message #1853329] Tue, 28 June 2022 05:53 Go to next message
Issam Al-Azzoni is currently offline Issam Al-AzzoniFriend
Messages: 7
Registered: June 2022
Junior Member
I appreciate any help provided. I am trying to use a registered UML profile in a Java program in Papyrus. My question is how to define the URI.

I have tried something like the following:
Map<URI,URI> uriMap = resourceSet.getURIConverter().getURIMap();
UMLResourcesUtil.init(resourceSet);

URI ulProfile = URI.createURI("contracts.profile.uml");
URI upProfile = URI.createFileURI("contracts.profile.uml");
ExtensibleURIConverterImpl converter = new ExtensibleURIConverterImpl();

resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
.put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap()
.put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);

uriMap.put(ulProfile, upProfile);


But nothing has worked with me. The profile's model file is in a plugin.
Should I use pathmap? platform URIs?

Thank you.
Re: URI Registering for Registered Profiles in Papyrus [message #1853337 is a reply to message #1853329] Tue, 28 June 2022 12:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

"But nothing has worked with me" is very close to the ever unhelpful "it doesn't work". What doesn't work; does your machine catch fire?

"converter" seems dead.

Registering "uml" should be redundant after UMLResourcesUtil.init

Not sure what you are trying to do with the uriMap.

When baffled, it is often good to start from a working example so that you can gradually evolve it to your requirements.

I would suggest the Eclipse UML2 profiles tutorial as your first example, and/or org.eclipse.ocl.pivot.uml/model/OCLforUML.profile.uml as exercised by test_umlValidation_Bug467192 in /org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/UMLValidateTest.java

Regards

Ed Willink
Re: URI Registering for Registered Profiles in Papyrus [message #1853361 is a reply to message #1853337] Wed, 29 June 2022 08:32 Go to previous messageGo to next message
Issam Al-Azzoni is currently offline Issam Al-AzzoniFriend
Messages: 7
Registered: June 2022
Junior Member
Hi Ed. Here is an improved code:

RESOURCE_SET = new ResourceSetImpl();
converter = (ExtensibleURIConverterImpl) RESOURCE_SET.getURIConverter();
converter.getURIMap().put(URI.createURI("pathmap://UML_LIBRARIES/solidity_types.uml/"), URI.createURI("platform:/plugin/de.urszeidler.eclipse.solidity.ui/model/types.uml"));
converter.getURIMap().put(URI.createURI("pathmap://UML_PROFILE/solidity_profiles.uml/"), URI.createURI("platform:/plugin/de.urszeidler.eclipse.solidity.ui/model/contracts.profile.uml"));
converter.getURIMap().put(URI.createURI("pathmap://UML_LIBRARIES/StandardizedContractAPI.uml/"), URI.createURI("platform:/plugin/de.urszeidler.eclipse.solidity.ui/model/StandardizedContractAPI.uml"));

UMLResourcesUtil.init(RESOURCE_SET);


I want to use the profile (solidity_profiles.uml) in the plugin de.urszeidler.eclipse.solidity.ui. However, when the following statement is executed:

Profile profile = (Profile)RESOURCE_SET.getResource(URI.createURI("pathmap://UML_PROFILE/solidity_profiles.uml/"), true).getContents().get(0);

I get the exception:

Cannot create a resource for 'pathmap://UML_PROFILE/solidity_profiles.uml/'; a registered resource factory is needed

I just want to load the registered profile in my Java program which applies the profile's stereotypes on certain uml models.

Any help is appreciated. The link at the end of your reply is not valid.

Re: URI Registering for Registered Profiles in Papyrus [message #1853396 is a reply to message #1853361] Thu, 30 June 2022 12:48 Go to previous messageGo to next message
Vincent Lorenzo is currently offline Vincent LorenzoFriend
Messages: 248
Registered: June 2010
Location: Paris Saclay, France
Senior Member
Hello, UML_LIBRARIES and UML_PROFILES pathmaps come from UML2 plugins, so the system will look for your profile inside it and won't find your profiles.
You need to create your own pathmap with the extension point
org.eclipse.emf.ecore.uri_mapping

If you created a static profile, these extensions points will be filled by the generator (I think):
org.eclipse.emf.ecore.generated_package
for the generated EPackage
org.eclipse.uml2.uml.generated_package
for the generated Profile
In addition, to see your Profile in Papyrus UI and to be able to apply it from the Papyrus Property View, you need to fill this extension point:
org.eclipse.papyrus.uml.extensionpoints.UMLProfile
.

I advise you to explore the git org.eclipse.papyrus-sysml16 to see how we use these extension points with SysML.

You also could read the Papyrus documentation about Profile:
https://help.eclipse.org/latest/topic/org.eclipse.papyrus.uml.diagram.profile.doc/target/generated-eclipse-help/users/generatingStaticProfiles.html?cp=69_0_1_8_5

HTH,
/Vincent
Re: URI Registering for Registered Profiles in Papyrus [message #1853404 is a reply to message #1853396] Thu, 30 June 2022 13:48 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Why does Papyrus introduce a new extension point? Why doesn't it use the standard EClipse UML2 extension point, at least as a fallback. If it's really necessary then surely some pop-up should be active?

Regards

Ed Willink
Re: URI Registering for Registered Profiles in Papyrus [message #1853427 is a reply to message #1853404] Fri, 01 July 2022 13:24 Go to previous messageGo to next message
Issam Al-Azzoni is currently offline Issam Al-AzzoniFriend
Messages: 7
Registered: June 2022
Junior Member
Hi Vincent. Thank you for your answer.
The profile is already registered (I can see it in the Papyrus registered profiles).
I just want to load the profile in my Java application.
Re: URI Registering for Registered Profiles in Papyrus [message #1853430 is a reply to message #1853427] Fri, 01 July 2022 13:57 Go to previous messageGo to next message
Issam Al-Azzoni is currently offline Issam Al-AzzoniFriend
Messages: 7
Registered: June 2022
Junior Member
To give an example, let us say I have followed the following tutorial:
https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.papyrus.uml.diagram.profile.doc%2Ftarget%2Fgenerated-eclipse-help%2Fusers%2FgeneratingStaticProfiles.html&cp%3D69_0_1_8_5

After registering the profile MYLANGUAGE, how can I load it in a Java program and be able to apply its stereotypes?
Re: URI Registering for Registered Profiles in Papyrus [message #1853435 is a reply to message #1853430] Fri, 01 July 2022 15:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

See http://wiki.eclipse.org/MDT/UML2/Introduction_to_UML2_Profiles?cp=10_0_1 which works from a 4.23 installation's Help Contents.

Strangely the corresponding link from https://help.eclipse.org/latest/index.jsp to http://wiki.eclipse.org/MDT/UML2/Introduction_to_UML2_Profiles?cp=85_0_1 fails.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=580317 raised.

Regards

Ed Willink
Re: URI Registering for Registered Profiles in Papyrus [message #1853441 is a reply to message #1853435] Fri, 01 July 2022 18:52 Go to previous messageGo to next message
Issam Al-Azzoni is currently offline Issam Al-AzzoniFriend
Messages: 7
Registered: June 2022
Junior Member
Hi Ed. Thank you. I have looked at the suggested link, however it does not address the problem I am facing. It presents how to create a profile and save it. My question concerns an already created (and registered) profile. How can this be loaded in a standalone Java application?

Any suggestion is appreciated.

Re: URI Registering for Registered Profiles in Papyrus [message #1853447 is a reply to message #1853441] Sat, 02 July 2022 04:40 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Ok. Then perhaps you have to resort to the second part of my earlier advice for an example...

Quote:
I would suggest the Eclipse UML2 profiles tutorial as your first example, and/or org.eclipse.ocl.pivot.uml/model/OCLforUML.profile.uml as exercised by test_umlValidation_Bug467192 in /org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/UMLValidateTest.java


Regards

Ed Willink
Re: URI Registering for Registered Profiles in Papyrus [message #1853541 is a reply to message #1853447] Thu, 07 July 2022 12:01 Go to previous message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 341
Registered: July 2009
Location: Paris Saclay, France
Senior Member
Hi,
You can follow this tuto https://wiki.eclipse.org/MDT/UML2/Getting_Started_with_UML2
Have you verified your dependencies?

I don't know why your code does not run.
Patrick
Previous Topic:Cannot import Spring State Machine UML example into Papyrus
Next Topic:[C++ Code Gen] Discussion about signal deletion
Goto Forum:
  


Current Time: Thu Apr 25 01:02:42 GMT 2024

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

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

Back to the top