Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Papyrus SysML model to text
Papyrus SysML model to text [message #1795438] Sat, 22 September 2018 12:28
Robbert Jongeling is currently offline Robbert JongelingFriend
Messages: 3
Registered: September 2018
Junior Member
Hi,

I'm trying to use Xtend to create a model-to-text transformation where the model is a Papyrus SysML model.

I'm running into a problem regarding the stereotypes of the elements in the model file. As input I use the model.uml file as created by Papyrus, but for all elements, the getAppliedStereotypes list is empty, even though there are applied stereotypes when I check it in the Papyrus model properties. (In the attached example Block and FlowPort)

I have also tried to call the same getAppliedStereotype functions in a QVTo transformation using the same input model and there, I do get all the applied stereotypes as expected.

From checking these and the Papyrus forums I think my problem is related to the registration of the SysML resources. But I've not been able to find out what I'm missing exactly.

Before loading the resource I initialise the UML resources using
		UMLResourcesUtil.init(resourceSet)


As far as I know (https://bugs.eclipse.org/bugs/show_bug.cgi?id=531840), there is no such equivalent for SysML resources. Therefore, I call the following three methods to try to register the SysML resources:

1:
def void initURIConverterURIMap() {
		val baseUri = URI.createURI(SYSML_JAR_PATH)
		val um = URIConverter.URI_MAP
		um.put(URI.createURI(SysMLResource.PROFILES_PATHMAP), baseUri.appendSegment("model").appendSegment(""))
		um.put(URI.createURI(SysMLResource.LIBRARIES_PATHMAP), baseUri.appendSegment("libraries").appendSegment(""))
	}

Here, SYSML_JAR_PATH is the following:
val static SYSML_JAR_PATH = "jar:file:/Applications/Eclipse-P2.app/Contents/Eclipse/plugins/org.eclipse.papyrus.sysml14_1.3.0.jar!/"


2:
	def void initPackageRegistry() {
		val packageRegistry = EPackage.Registry.INSTANCE
		packageRegistry.put(sysmlPackage.eNS_URI, sysmlPackage.eINSTANCE)
		packageRegistry.put(BlocksPackage.eNS_URI, BlocksPackage.eINSTANCE)
		packageRegistry.put(RequirementsPackage.eNS_URI, RequirementsPackage.eINSTANCE)
		packageRegistry.put(ActivitiesPackage.eNS_URI, ActivitiesPackage.eINSTANCE)
		packageRegistry.put(AllocationsPackage.eNS_URI, AllocationsPackage.eINSTANCE)
		packageRegistry.put(ModelelementsPackage.eNS_URI, ModelelementsPackage.eINSTANCE)
		packageRegistry.put(PortsandflowsPackage.eNS_URI, PortsandflowsPackage.eINSTANCE)
	}


3:
	def void initProfileLocationMap() {
		val plm = UMLPlugin.EPackageNsURIToProfileLocationMap
		plm.put(sysmlPackage.eNS_URI, URI.createURI(SysMLResource.PROFILE_URI + "#_Sg5BQL5BEeiU9bakHvTSew"))
		plm.put(BlocksPackage.eNS_URI, URI.createURI(SysMLResource.PROFILE_URI + "#_ShCyQr5BEeiU9bakHvTSew"))
		plm.put(PortsandflowsPackage.eNS_URI, URI.createURI(SysMLResource.PROFILE_URI + "#_ShEAYr5BEeiU9bakHvTSew"))
	}

Here, the #_<blabla> strings are the xmi:id's of the profile applications from the uml file.

I have also attached an export of the project.

I would greatly appreciate any hints that can help me solve this problem of retrieving the stereotypes from the model.
Previous Topic:Papyrus UML to Java using Acceleo
Next Topic:Papyrus SysML model to text
Goto Forum:
  


Current Time: Wed Oct 23 00:58:38 GMT 2019

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

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

Back to the top