Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataDictionary transform : produce SysML using papyrus commands. #360

Closed
lfronc opened this issue May 9, 2014 · 11 comments
Closed

DataDictionary transform : produce SysML using papyrus commands. #360

lfronc opened this issue May 9, 2014 · 11 comments

Comments

@lfronc
Copy link
Contributor

lfronc commented May 9, 2014

The actual transformation is done using org.eclipse.uml2 and produces an UML model. In order to produce SysML, papyrus commands should be used. This needs a Papyrus expert to provide some guidelines.

@lfronc lfronc added this to the ToolSprint 11 (ends 23-May-14) milestone May 9, 2014
@lfronc lfronc changed the title DataDictionary : produce SysML using papyrus commands. DataDictionary transform : produce SysML using papyrus commands. May 9, 2014
@jastram
Copy link
Member

jastram commented May 12, 2014

@lfronc - can you please elaborate on (1) the criticality of this, and (2) what the impact on the current approach is? Is it just "ugly", or is it producing real problems?

@lfronc
Copy link
Contributor Author

lfronc commented May 13, 2014

The data dictionary model we produce is a UML model, if we want to produce SysML we need to use Papyrus ( according to @MatthieuPERIN ). Unless someone provide a SysML profile usable with org.eclipse.uml2 there is no alternative.

The current approach is not ugly, it is just UML. However, as it was mentioned in issue #327 another transform from SysML (or UML) to SCADE will be needed because of types that cannot be inferred from the spec so this is not critical.

@lfronc
Copy link
Contributor Author

lfronc commented May 15, 2014

I'm trying to apply the SysML profile in my own way (with lots of google help...).

The things I achieve

  • load the SysML profile
  • apply the SysML profile on my model
  • retrieve the ValueType stereotype from the profile

The problem

The stereotype application succeeds but is not added to the model.

The way I setup the URIs: (this is xtend code but is understandable for java developers)

var resourceSet = new ResourceSetImpl
var uriMap = resourceSet.getURIConverter().getURIMap();
var SysmlProfileUri = URI.createURI(SysmlResource.SYSML_PROFILE_URI)

resourceSet.getPackageRegistry().put(SysmlPackage.eNS_URI, SysmlPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(BlocksPackage.eNS_URI, BlocksPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), URI.createURI(SysmlResource.LIBRARIES_PATHMAP))
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), URI.createURI(SysmlResource.PROFILES_PATHMAP))

Then I load the profile and apply it on the model:

SysMLProfile = UMLUtil.load(resourceSet, SysmlProfileUri, UMLPackage.Literals.PROFILE);
gstereotype = SysMLProfile.getStereotype("ValueType")

val umlModel = UMLFactory.eINSTANCE.createModel
umlModel.applyProfile(SysMLProfile)

Then later I apply the stereotype

var datatype = variablesPkg.createDataType(type_identifier(v.name))
UMLUtil.safeApplyStereotype(datatype, gstereotype)

Debugging insights

During the application of the stereotype, correct objects are created (papyrus ValueTypeImpl, etc.). What happens is that during the last step a call in the library

EList<EObject> containmentList = getContainmentList(element, stereotypeApplication.eClass());

returns null, thus the application cannot be added to element.

Remark: The stereotype itself is of type org.eclipse.uml2.uml.internal.impl.StereotypeImpl.

@MatthieuPERIN
Copy link

Well, I will just provide here some basic help, and try to reach @lfronc directly on phone to give a more precise help.

  • Firts, UML: In papyrus, the uml model is handled using service edit that garantee the coherence of teh entire model (e.g. creating a link between object have to, depending the visibility attributes, create some properties of each object in one another).

The org.eclipse.uml2 do not provide such high level point of view and most of the UML model coherence have to be enforced directly.

  • secondly, SysML: profiles are almost NOT handled by org.eclipse.uml2, which make SysML support by this plugin almost impossible. Papyrus dev team have provided the service edit that allow to use of profile, in particular SysML. Please note that this support have some great impact as nowhere in the UML/SysML norm can be found the details of serialization of UML profile and the UML object related to profile (profileApplication object in Papyrus). A lot of work have been done here by Papyrus guys and so if you need to generate a *.uml file with profile you are almost oblige to use Papyrus plugins.

I am afraid that no documentation have been made on such subject as the "standard" users of Papyrus are more likely to create, manage and apply profiles within the GUI of Papyrus, but I can give some directions based on my own usage of Papyrus.

@cecilebraun
Copy link

@MatthieuPERIN Does somebody from your team may help @lfronc on this point ?

@cecilebraun
Copy link

@MatthieuPERIN
Copy link

Some information may be found on the papyrus developer wiki:
https://wiki.eclipse.org/Papyrus_Developer_Guide,
https://wiki.eclipse.org/Papyrus_Developer_Guide#Papyrus_Command_Execution.2C_History.2C_Undo.2FRedo
and also https://wiki.eclipse.org/Papyrus_Developer_Guide/How_To_Code_Examples#How_to_get_the_ServicesRegistry to start with "basic" Eclipse commands to act on UML models.

I am working on the commands to modify UML elements and play with stereotypes application (to build SysML elements)

@MatthieuPERIN
Copy link

Working with @lfronc on that.

@lfronc
Copy link
Contributor Author

lfronc commented Oct 10, 2014

I implemented the transformation from Bitwalker to SysML. The transformation is done for subsets 26-7, 26-8 and it produces a valid SysML model that can be used in Papyrus. The tool found some inconsistencies in the bitwalker (see here) and the model is available here.

@cecilebraun
Copy link

@lfronc could we close this issue ?

@lfronc
Copy link
Contributor Author

lfronc commented Nov 18, 2014

closing.

@lfronc lfronc closed this as completed Nov 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants