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
The plugin can be enabled by adding it as a dependency to the jQAssistant Maven plugin.
<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>
-
Adds a folder to be scanned by the jQAssistant Maven plugin, any contained
.xmi
file will be scanned. -
Declares the UML plugin as dependency.
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.
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.
|
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.
The scanner creates nodes with the following labels:
Represents a XMI file.
Name | Description |
---|---|
fileName |
The file name, relative to the scanned directory. |
Name | Target label(s) | Cardinality | Description |
---|---|---|---|
CONTAINS_DOCUMENTATION |
0..1 |
References the documentation. |
|
CONTAINS_UML_MODEL |
0..1 |
References the contained UML model. |
|
CONTAINS_STEREOTYPE |
0..n |
References the contained stereotypes. |
Provides meta-information about the XMI file.
Name | Description |
---|---|
exporter |
The name of the tool which exported the XMI file, e.g. |
exporterVersion |
The version of the tool which exported the XMI file, e.g. |
exporterID |
The identifier of the tool which exported the XMI file, e.g. |
Represents an XMI element.
Note
|
All UML elements described below (including the :UML:Model itself) are :XMI:Elements. |
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. |
name |
The name of the XMI element, e.g. |
Name | Target label(s) | Cardinality | Description |
---|---|---|---|
HAS_CHILD |
0..n |
References the children of this element, thus forming a tree-structured 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
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
.
Children of a :UML:PackagedElement may be :UML:OwnedAttribute, :UML:OwnedEnd, :UML:Interface:Required or :UML:Interface:Provided.
Name | Description |
---|---|
visibility |
(optional) The visibility of this packaged element, e.g. |
Name | Target label(s) | Cardinality | Description |
---|---|---|---|
HAS_CLIENT |
0..1 |
References the client of this element if its type is a relation (e.g. |
|
HAS_SUPPLIER |
0..1 |
References the supplier for this element if its type is a relation (e.g. |
|
HAS_INFORMATION_SOURCE |
0..1 |
References the information source of this element if its type is an information flow (i.e. |
|
HAS_INFORMATION_TARGET |
0..1 |
References the information target for this element if its type is an information flow (e.g. |
Inherits from :XMI:Element and represents an owned attribute of a :UML:PackagedElement, e.g. a uml:Property
or uml:Port
.
Children of a :UML:OwnedAttribute may be :UML:Interface:Required or :UML:Interface:Provided.
Name | Description |
---|---|
aggregation |
(optional) The aggregation type of this attribute, e.g. |
Name | Target label(s) | Cardinality | Description |
---|---|---|---|
FOR_ASSOCIATION |
0..1 |
References a :UML:PackagedElement with xmiType |
|
OF_TYPE |
0..1 |
References the type of this owned property. |
Inherits from :XMI:Element and represents an owned end of a :UML:PackagedElement, e.g. a uml:Property
.
Children of a :UML:OwnedEnd may be :UML:Interface:Required or :UML:Interface:Provided.
Name | Description |
---|---|
aggregation |
(optional) The aggregation type of this attribute, e.g. |
Name | Target label(s) | Cardinality | Description |
---|---|---|---|
FOR_ASSOCIATION |
0..1 |
References a :UML:PackagedElement with xmiType |
|
OF_TYPE |
0..1 |
References the type of this owned property. |
Inherits from :XMI:Element and represents an required interface of a :UML:PackagedElement, :UML:OwnedAttribute or :UML:OwnedEnd.
Inherits from :XMI:Element and represents an provided interface of a :UML:PackagedElement, :UML:OwnedAttribute or :UML:OwnedEnd.
Inherits from :XMI:Element and represents a profile application.
Name | Target label(s) | Cardinality | Description |
---|---|---|---|
APPLIES_PROFILE |
1 |
References the applied profile. |
Inherits from :XMI:Element and represents an applied profile.
Name | Description |
---|---|
href |
The HREF of the applied profile, e.g. |
Represents a stereotype.
Name | Description |
---|---|
name |
The name of the stereotype. |
namespaceUri |
The namespace URI of the stereotype, e.g. |
namespacePrefix |
The namespace prefix of the stereotype, e.g. |
Inherits from :XMI:Element and represents an application of a :XMI:Stereotype to an :XMI:Element
Name | Target label(s) | Cardinality | Description |
---|---|---|---|
OF_STEREOTYPE |
1 |
References the applied stereotype. |
|
APPLIED_TO |
1 |
References the element to which the stereotype is applied. |
The plugin provides concepts for extracting UML models, e.g. for
-
labeling
:UML:PackagedElement
nodes havingxmiType=uml:Component
as:UML:Component
. -
creating
(:UML:Component)-[:HAS_DEPENDENCY]→(:UML:Component)
relations from:PackagedElement
nodes havingxmiType=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.
Please report any issues here.