Import UML Diagrams from .uml / MARTE Support [message #1860673] |
Thu, 24 August 2023 17:11  |
Eclipse User |
|
|
|
Hi there Papyrus Community,
in my work I try to create UML models and would like to view them in Papyrus.
To be exact, my goal is to create sequence diagrams from traces of an existing system.
I have two approaches understanding sequence diagrams:
* looking at the *.uml (or rather the pure XML it contaisn) I created and contain sequence diagrams
* looking at the spec from the Object Management Group
Here are some of my questions regarding papyrus and UML Diagrams (without Profiles):
* can I view UML files (*.uml) without having the other filetypes (*.di, *.properties, *.notation) mentioned in the documentation (Chapter 7.1 Papyrus resources in the workspace) and create some sort of standard view for them?
* Is it possible to validate the *.uml in some way?
The sequence diagrams shall also have performance information. The performance information is to be added with MARTE.
In the documentation there is a menu-entry mentioned "Help > Install Papyrus Additional Components" in which it should be possible to install MARTE, however in the release I have there is no such entry.
Questions regarding MARTE:
* How can I install MARTE?
* Is there an Instruction on how to add MARTE support to UML-Diagrams?
In a not so distant future step, I would like to use the Epsilon ETL (model2model transformation Language), where can I find the Meta-Model (probably the .ecore files) of UML?
Papyrus Version:
Version: 2023-03 (4.27)
Build id: 2023-03-20T09:16:56Z
Best regards.
|
|
|
|
Re: Import UML Diagrams from .uml / MARTE Support [message #1860861 is a reply to message #1860748] |
Wed, 06 September 2023 09:08  |
Eclipse User |
|
|
|
Hi Vincent, thanks for the answer and the information.
The program I'm trying to build is (for the creation of the UML2 Model) standalone.
I've worked myself through the UML2 Examples and parts of the git repository.
However, when I try to add MARTE as a Import to my Model it fails.
Here is the sample code:
public class UmlProfileMain {
private static final ResourceSet resourceSet = new ResourceSetImpl();
static {
UMLResourcesUtil.init(resourceSet);
}
public static void main(String[] args) throws IOException {
final Model model = createModel("ModelWithMarteImport");
// Import of primitive Types (works fine)
importProfile(model, URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI));
// Some MARTE init or else an exception is thrown. (only one is required, doesn't matter which one)
MARTEPackageImpl.init();
MARTEFactoryImpl.init();
MARTE_AnalysisModelPackageImpl.init();
GQAMPackageImpl.init();
// Import of MARTE namespaces. (not working)
// Reason: the "EcoreUtil.getObjectByType" returns null
importProfile(model, URI.createURI(MARTEPackage.eNS_URI));
importProfile(model, URI.createURI(MARTE_AnalysisModelPackageImpl.eNS_URI));
importProfile(model, URI.createURI(GQAMPackage.eNS_URI));
// Write model to file
save(model);
}
protected static void importProfile(Model model, URI uri) {
final Resource resource = resourceSet.getResource(uri, true);
final org.eclipse.uml2.uml.Package umlLibrary = (org.eclipse.uml2.uml.Package) EcoreUtil.getObjectByType(resource.getContents(), UMLPackage.Literals.PACKAGE);
model.createPackageImport(umlLibrary);
}
protected static Model createModel(String name) {
Model model = UMLFactory.eINSTANCE.createModel();
model.setName(name);
return model;
}
protected static void save(org.eclipse.uml2.uml.Package package_) throws IOException {
URI outputURI = URI.createFileURI(Paths.get("model-output").toString())
.appendSegment("ModelWithMarte")
.appendFileExtension(UMLResource.FILE_EXTENSION);
Resource resource = resourceSet.createResource(outputURI);
resource.getContents().add(package_);
resource.save(null);
}
}
On the classpath there are the required Jars from the UML2 example and the MARTE static profile jar: org.eclipse.papyrus.marte.static.profile_1.2.3.202303241341.jar
In this jar there is also a dummy class of which I cannot make any sense and which sees weird.
However on the output there is no MARTE profile but only empty package imports:
<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_rgT50Ey0Ee6kCcBEqOtj3Q" name="ModelWithMarteImport">
<packageImport xmi:id="_rgT50Uy0Ee6kCcBEqOtj3Q">
<importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packageImport xmi:id="_rgT50ky0Ee6kCcBEqOtj3Q"/>
<packageImport xmi:id="_rgT500y0Ee6kCcBEqOtj3Q"/>
<packageImport xmi:id="_rgT51Ey0Ee6kCcBEqOtj3Q"/>
</uml:Model>
Quote:
To be clear, the performance information will be provided by a Marte stereotype, applied on your UML Model elements. The diagram is only a view of the model.
precisely
Quote:The diagrams visualization are owned by the *.notation file. If you don't have this file, you won't be able to have diagrams.
Is there an API to create this .notation file?
|
|
|
Powered by
FUDForum. Page generated in 0.03381 seconds