Skip to main content



      Home
Home » Modeling » Papyrus » Import UML Diagrams from .uml / MARTE Support
Import UML Diagrams from .uml / MARTE Support [message #1860673] Thu, 24 August 2023 17:11 Go to next message
Eclipse UserFriend
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 #1860748 is a reply to message #1860673] Thu, 31 August 2023 08:36 Go to previous messageGo to next message
Eclipse UserFriend
Quote:
can I view UML files (*.uml) without having the other filetypes[...]
. You can open the *.uml file with the default Ecore editor or with the uml editor. The diagrams visualization are owned by the *.notation file. If you don't have this file, you won't be able to have diagrams. The *.di file is required by Papyrus. It is uses to store some user preferences.
Quote:
Is it possible to validate the *.uml in some way?
Yes, you can open the file with the Ecore editor (or UML editor) and in the contextual menu you will find a Validate action. This action will validate the model using rules at emf level and and uml level if the UML contraints haven been implemented by UML2 or Papyrus.

Here a snapshot of the preferences for EMF validation:
index.php/fa/43458/0/

Quote:
The sequence diagrams shall also have performance information.
. 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.

Quote:
How can I install MARTE?
You can install Marte from this update site: https://ci.eclipse.org/papyrus/job/papyrus-marte-2022-03/lastSuccessfulBuild/artifact/releng/org.eclipse.papyrus.marte.p2/target/repository/

Quote:
Is there an Instruction on how to add MARTE support to UML-Diagrams?
. Just install MARTE from the previous update site. MARTE uses standard UML diagram. You just need to apply the MARTE Profile on your model, then apply required MARTE stereotypes on your elements.

Quote:
Where can I find the Meta-Model (probably the .ecore files) of UML?
You will find the uml.ecore file on the UML2 git repository https://git.eclipse.org/r/uml2/org.eclipse.uml2.git and the last version here: https://git.eclipse.org/c/uml2/org.eclipse.uml2.git/tree/plugins/org.eclipse.uml2.uml/model.

Regards,
Vincent

[Updated on: Thu, 31 August 2023 08:45] by Moderator

Re: Import UML Diagrams from .uml / MARTE Support [message #1860861 is a reply to message #1860748] Wed, 06 September 2023 09:08 Go to previous message
Eclipse UserFriend
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?
Previous Topic:source code build failure
Next Topic:Building a Profile DSML
Goto Forum:
  


Current Time: Tue Jul 08 16:22:59 EDT 2025

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

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

Back to the top