Login | Register
My pages Projects Community openCollabNet

Wiki: Diff for "eUML"

Edit this page | Links to this page | Page information | Attachments | Refresh page


Differences between revisions 8 and 9

Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
=== Profile creation ===

In UML 2.x, a profile is a separate metamodel element. Both metamodel elements "Model" and "Profile" are packages. In ArgoUML, they are top level packages. You can see this in the XMI files created by ArgoUML: a model begins with a {{{<uml:Model ...>}}} node, while a profile begins with a {{{<uml:Profile ...>}}} node (after the XMI header).

Such a profile object is created in ArgoUML via the "New Profile" functionality. It is then displayed in the explorer pane, and elements like stereotypes or datatypes can be added to it. Since ArgoUML saves this in a project file (.zargo), even diagrams can be added to the profile project.

Elements in a profile can only be applied to model elements, when the profile is "deployed" as an XMI file. This is performed via the "Deploy" menu item when you right-click on a profile in the explorer, which then does three things:
 1. In eUML, a method {{{define()}}} is called on the profile package, which adds (nonstandard) Ecore extensions to it.
 1. Export the defined profile as a (to be chosen) XMI file.
 1. Load it as a read-only profile so that it's available in the "Profile Configuration".

Let's create a sample profile with one stereotype 'myStereotype', which can be
applied to a class. The XMI representation is (xmi:id values made more readable, some parts omitted):

{{{<uml:Profile ... xmi:id="ID_myProfile" name="myProfile" metaclassReference="ID_ElementImport">
  <elementImport xmi:type="uml:ElementImport" xmi:id="ID_ElementImport" importingNamespace="ID_myProfile">
    <importedElement xmi:type="uml:Class" href="http://schema.omg.org/spec/UML/2.2/uml.xml#Class"/>
  <packagedElement xmi:type="uml:Stereotype" xmi:id="ID_myStereotype" name="myStereotype">
    <ownedAttribute xmi:type="uml:Property" xmi:id="ID_base_Class" name="base_Class" association="ID_Extension">
      <type xmi:type="uml:Class" href="http://schema.omg.org/spec/UML/2.2/uml.xml#Class"/>
  <packagedElement xmi:type="uml:Extension" xmi:id="ID_Extension" name="Class_myStereotype"
      memberEnd="ID_ExtensionEnd ID_base_Class">
    <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="ID_ExtensionEnd" name="extension_myStereotype"
        type="ID_myStereotype" aggregation="composite" owningAssociation="ID_Extension"

This cannot be applied to a model, because in eclipse UML2 the profile needs to
be "defined" first. This step introduces an Ecore package in the profile, that
represents the whole profile. (Without that Ecore package, ArgoUML cannot use any
profile element of the profile!) In XMI, only that Ecore package is added in
comparison to the previous listing:

{{{<uml:Profile ... xmi:id="ID_myProfile" name="myProfile" metaclassReference="ID_ElementImport">
  <xmi:Extension extender="http://www.eclipse.org/emf/2002/Ecore">
    <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_0X4jIPNCEd-9Y50SrfMS2A" ...>
      <contents xmi:type="ecore:EPackage" xmi:id="_0X4jIfNCEd-9Y50SrfMS2A" name="myProfile" ...>
        <eClassifiers xmi:type="ecore:EClass" xmi:id="_0X4jIvNCEd-9Y50SrfMS2A" name="myStereotype">
          <xmi:Extension extender="http://www.eclipse.org/emf/2002/Ecore">
            <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_0X4jI_NCEd-9Y50SrfMS2A" ...
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_0X4jJPNCEd-9Y50SrfMS2A" name="base_Class"
              ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EClass" .../>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_0X4jJvNCEd-9Y50SrfMS2A" name="myProperty"
              ordered="false" lowerBound="1"/>
<-------------- from here it's exactly the same as in the previous listing}}}

Such a defined profile can then be used, which is presented next.

=== Profile application ===

In ArgoUML, a profile is applied via the "Profile Configuration". Applying a profile basically means referring it in the model. As an example, we create a very simple model with just one minimalistic class, here are it's main XMI parts (simplyfied again):

{{{<uml:Model ... xmi:id="ID_myModel" name="myModel">
  <packagedElement xmi:type="uml:Class" xmi:id="ID_myClass" name="myClass"/>

Applying the profile and stereotyping the class with myStereotype yields the following:

{{{<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI ...>
  <uml:Model xmi:id="ID_myModel" name="myModel">
    <packagedElement xmi:type="uml:Class" xmi:id="ID_myClass" name="myClass"/>
    <profileApplication xmi:type="uml:ProfileApplication" xmi:id="ID_profileApplication" applyingPackage="ID_myModel">
      <xmi:Extension extender="http://www.eclipse.org/emf/2002/Ecore">
        <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_k-TQ8PO5Ed-p9Nu3qLl7Zw" source="http://www.eclipse.org/uml2/2.0.0/UML">
          <references xmi:type="ecore:EPackage" href="http://argouml.org/user-profiles/myProfile_defined_once.xmi#_vOqHcPOuEd-ZR_t966HNrQ"/>
      <appliedProfile xmi:type="uml:Profile" href="http://argouml.org/user-profiles/myProfile_defined_once.xmi#ID_myProfile"/>
  <myProfile:myStereotype xmi:id="_phd6IPO5Ed-p9Nu3qLl7Zw" base_Class="ID_myClass"/>

To be continued...

TODO: changing the profile and apply it again, watching what happens to the old stereotype application
We have separate page for more information on ["UML2, Profiles and XMI"].

The model implementation "eUML" is our first UML 2.x model subsystem implementation. It uses eclipse UML2 and EMF. This page describes some of the most important concepts of it.

How to enable it

In order to make ArgoUML use eUML, check if the org.eclipse.<...>.jar files are available in the ArgoUML installation directory (should be the case since the 0.29.x releases). At startup, make sure that the parameters -Dargouml.model.implementation=org.argouml.model.euml.EUMLModelImplementation -DeUML.resources=org.eclipse.uml2.uml.resources_<version>.jar are set, which is the case in the argouml2.<bat|sh> startup scripts.

For using eUML in eclipse, use one of the available launch configurations that include "eUML" or "UML2" in their name.


No need to further configure eUML by users! This section describes how ArgoUML internally configures UML2/EMF.

TODO: Describe how things are set up, especially in org.argouml.model.euml.EUMLModelImplementation.


ArgoUML supports both modeling of UML models and UML profiles. Please note that since UML 2.x models and profiles are different things, so ArgoUML makes a distinction between a model and a profile project (as long as ArgoUML has the "one project one model" restriction).

We have separate page for more information on UML2, Profiles and XMI.

eUML (last edited 2010-12-14 12:19:50 -0800 by thn)