Skip to content

jQAssistant XMI Plugin provides scanners and rules for importing UML models from XMI files.

License

Notifications You must be signed in to change notification settings

jqassistant-plugin/jqassistant-xmi-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQAssistant XMI Plugin

The jQAssistant XMI Plugin provides scanners and rules for importing UML models, e.g. from XMI files. These models may be used by constraints to verify

Prerequisites

  • Java 8 or higher

  • Maven 3.5.x or higher

  • jQAssistant 1.10.0 or higher (see below)

Setup

Maven

The plugin can be enabled by adding it as a dependency to the jQAssistant Maven plugin.

pom.xml
<project>
  <properties>
    <jqassistant.version>1.10.0</jqassistant.version>
    <jqassistant-xmi-plugin.version>1.10.0</jqassistant-xmi-plugin.version>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>com.buschmais.jqassistant</groupId>
        <artifactId>jqassistant-maven-plugin</artifactId>
        <version>${jqassistant.version}</version>
        <executions>
          <execution>
            <id>default-cli</id>
            <goals>
              <goal>scan</goal>
              <goal>analyze</goal>
            </goals>
            <configuration>
              <scanIncludes>                                                   <!--(1)-->
                <scanInclude>
                  <path>${project.basedir}/src/main/xmi</path>
                </scanInclude>
              </scanIncludes>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>                                                         <!--(2)-->
            <groupId>org.jqassistant.contrib.plugin</groupId>
            <artifactId>jqassistant-xmi-plugin</artifactId>
            <version>${jqassistant-xmi-plugin.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
</project>
  1. Adds a folder to be scanned by the jQAssistant Maven plugin, any contained .xmi file will be scanned.

  2. Declares the UML plugin as dependency.

Command Line Utility

Download the JAR file from Maven Central and put it into the /plugins folder of the distribution.

Executing the command jqassistant.sh scan -f src/xmi/ (Linux) or jqassistant.cmd scan -f src/xmi/ will scan any file with the extension .xmi located in the given folder.

Sprint PetClinic Example

The folder src/example/spring-petclinic of this project contains a Spring PetClinic based example for using the XMI plugin to define components and their dependencies. Refer to the file jqassistant/index.adoc for a detailed step-by-step description of the jQAssistant setup and rules.

Tip
To view full metadata of embedded rules (e.g. required concepts) switch to Raw mode.

Reference Documentation

XMI File Scanner

The plugin provides a scanner which accepts files with the extension .xmi and creates the structure as described in this section, using :XMI:File as entry point.

:XMI:File

Represents a XMI file.

Table 1. Properties of :XMI:File
Name Description

fileName

The file name, relative to the scanned directory.

Table 2. Relations of :XMI:File
Name Target label(s) Cardinality Description

CONTAINS_DOCUMENTATION

:XMI:Documentation

0..1

References the documentation.

CONTAINS_UML_MODEL

:UML:Model

0..1

References the contained UML model.

CONTAINS_STEREOTYPE

:XMI:Stereotype

0..n

References the contained stereotypes.

:XMI:Documentation

Provides meta-information about the XMI file.

Table 3. Properties of :XMI:Documentation
Name Description

exporter

The name of the tool which exported the XMI file, e.g. Enterprise Architect.

exporterVersion

The version of the tool which exported the XMI file, e.g. 6.5.

exporterID

The identifier of the tool which exported the XMI file, e.g. 1558.

:XMI:Element

Represents an XMI element.

Note
All UML elements described below (including the :UML:Model itself) are :XMI:Elements.
Table 4. Properties of :XMI:Element
Name Description

xmiId

(optional) The unique id of the XMI element (any character sequence, e.g. a GUID)

xmiType

The type of the XMI element, e.g. uml:PackagedElement.

name

The name of the XMI element, e.g. My Package.

Table 5. Relations of :XMI:Element
Name Target label(s) Cardinality Description

HAS_CHILD

:XMI:Element

0..n

References the children of this element, thus forming a tree-structured model.

:UML:Model

Inherits from :XMI:Element and represents a UML model, where the model elements are children of this node, i.e. :UML:PackagedElement or :UML:ProfileApplication

:UML:PackagedElement

Inherits from :XMI:Element and represents a packaged element. The type is determined by the property xmiType of :XMI:Element, e.g. uml:Package, uml:Component, uml:Association, uml:Dependency or uml:Usage.

Table 6. Properties of :UML:PackagedElement
Name Description

visibility

(optional) The visibility of this packaged element, e.g. public.

Table 7. Relations of :UML:PackagedElement
Name Target label(s) Cardinality Description

HAS_CLIENT

:XMI:Element

0..1

References the client of this element if its type is a relation (e.g. uml:Dependency).

HAS_SUPPLIER

:XMI:Element

0..1

References the supplier for this element if its type is a relation (e.g. uml:Dependency)

HAS_INFORMATION_SOURCE

:XMI:Element

0..1

References the information source of this element if its type is an information flow (i.e. uml:InformationFlow).

HAS_INFORMATION_TARGET

:XMI:Element

0..1

References the information target for this element if its type is an information flow (e.g. uml:InformationFlow)

:UML:OwnedAttribute

Inherits from :XMI:Element and represents an owned attribute of a :UML:PackagedElement, e.g. a uml:Property or uml:Port.

Table 8. Properties of :UML:OwnedAttribute
Name Description

aggregation

(optional) The aggregation type of this attribute, e.g. composite.

Table 9. Relations of :UML:OwnedAttribute
Name Target label(s) Cardinality Description

FOR_ASSOCIATION

:XMI:Element

0..1

References a :UML:PackagedElement with xmiType uml:Association if this owned attribute is part of an association.

OF_TYPE

:XMI:Element

0..1

References the type of this owned property.

:UML:OwnedEnd

Inherits from :XMI:Element and represents an owned end of a :UML:PackagedElement, e.g. a uml:Property.

Table 10. Properties of :UML:OwnedEnd
Name Description

aggregation

(optional) The aggregation type of this attribute, e.g. composite.

Table 11. Relations of :UML:OwnedEnd
Name Target label(s) Cardinality Description

FOR_ASSOCIATION

:XMI:Element

0..1

References a :UML:PackagedElement with xmiType uml:Association if this owned attribute is part of an association.

OF_TYPE

:XMI:Element

0..1

References the type of this owned property.

:UML:Interface:Required

Inherits from :XMI:Element and represents an required interface of a :UML:PackagedElement, :UML:OwnedAttribute or :UML:OwnedEnd.

:UML:Interface:Provided

Inherits from :XMI:Element and represents an provided interface of a :UML:PackagedElement, :UML:OwnedAttribute or :UML:OwnedEnd.

:UML:ProfileApplication

Inherits from :XMI:Element and represents a profile application.

Table 12. Relations of :UML:ProfileApplication
Name Target label(s) Cardinality Description

APPLIES_PROFILE

:UML:AppliedProfile

1

References the applied profile.

:UML:AppliedProfile

Inherits from :XMI:Element and represents an applied profile.

Table 13. Properties of :UML:AppliedProfile
Name Description

href

The HREF of the applied profile, e.g. https://www.sparxsystems.com/profiles/thecustomprofile/1.0#thecustomprofile.

:XMI:Stereotype

Represents a stereotype.

Table 14. Properties of :XMI:Stereotype
Name Description

name

The name of the stereotype.

namespaceUri

The namespace URI of the stereotype, e.g. https://www.sparxsystems.com/profiles/thecustomprofile/1.0.

namespacePrefix

The namespace prefix of the stereotype, e.g. thecustomprofile.

:XMI:AppliedStereotype

Inherits from :XMI:Element and represents an application of a :XMI:Stereotype to an :XMI:Element

Table 15. Relations of :UML:AppliedStereotype
Name Target label(s) Cardinality Description

OF_STEREOTYPE

:XMI:Stereotype

1

References the applied stereotype.

APPLIED_TO

:XMI:Element

1

References the element to which the stereotype is applied.

Rules

The plugin provides concepts for extracting UML models, e.g. for

  • labeling :UML:PackagedElement nodes having xmiType=uml:Component as :UML:Component.

  • creating (:UML:Component)-[:HAS_DEPENDENCY]→(:UML:Component) relations from :PackagedElement nodes having xmiType=uml:Dependency.

Furthermore a group xmi:UML is provided which allows easily applying all UML related concepts.

The rules including their descriptions are defined in the file /META-INF/jqassistant-rules/xmi.xml.

Feedback

Please report any issues here.