Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does UML have an XSD for it's XMI?

Tags:

xml

uml

xsd

Is there a XSD for UML XMI files?

The header just contains namespace references.

<xmi:XMI xmi:version="2.1"
    xmlns:uml="http://schema.omg.org/spec/UML/2.1"
    xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
    xmlns:thecustomprofile="http://www.sparxsystems.com/profiles/thecustomprofile/1.0">

The only file I've managed to track down is this http://www.omg.org/spec/XMI/20131001/XMI.xsd however this is just description of the XMI itself (Difference/Documentation), but not the UML.

That means that I have no knowledge of how the process the following

<generalization
    xmi:type="uml:Generalization" 
    xmi:id="EAID_8CC13F09_BD19_406b_A4B4_37FB8B315EF0" 
    general="EAID_E1F9FAD6_2BDB_40ad_AAE2_E3935ADD1CDC"/>

as I have no way of knowing what is the type of general (of course I can check against a global ID table, but that seems stupid to do for every single attribute and TextElement).

I would expect to have something like

<xsd:complexType name="Generalization">
    <xsd:attribute name="general" type="xsd:IDREFS" use="optional"/>
    ...
</xsd:complexType>

Does the UML's XMI has such description?

like image 571
Peter Uhnak Avatar asked Apr 25 '16 16:04

Peter Uhnak


People also ask

Is XSD mandatory for XML?

An Attribute can appear 0 or 1 times within a given element in the XML document. Attributes are either optional or mandatory (by default they are optional). The "use" property in the XSD definition is used to specify if the attribute is optional or mandatory.

What XSD is used for?

The XML Schema definition language (XSD) enables you to define the structure and data types for XML documents. An XML Schema defines the elements, attributes, and data types that conform to the World Wide Web Consortium (W3C) XML Schema Part 1: Structures Recommendation for the XML Schema Definition Language.

Is XSD a schema?

XML Schema Definition or XSD is a recommendation by the World Wide Web Consortium (W3C) to describe and validate the structure and content of an XML document. It is primarily used to define the elements, attributes and data types the document can contain.

Which attribute is used to reference an XMI schema in an XML document?

The 'schemaLocation' attribute is used to reference XML Schema(s) that are defined in a target-namespace.


2 Answers

After some more digging, my conclusion is not only that such XSD doesn't exist, but that it can't exist at all, because it is not powerful enough to properly express all the OCL constrains and rules of UML.

The correct approach should be to validate/process it through a conforming UML model, so the necessary information to properly process the XML has to be somehow derived from the model.

Update:

Per @Thomas' suggestion I wrote to Sparx and got the following response

It's derived from the UML metamodel.

No, we don't have an XSD for the XMI format.

Which confirms my assumption that the information should be derived from the metamodel.

like image 63
Peter Uhnak Avatar answered Sep 23 '22 23:09

Peter Uhnak


Yes, there is an official specification for XMI, including an XSD.
For the latest version (v 2.5.1) this is the xsd but this xsd will not validate the UML syntax of the model.

The meta-model of UML is available as well in xmi format

More info on http://www.omg.org/spec/XMI/

like image 42
Geert Bellekens Avatar answered Sep 21 '22 23:09

Geert Bellekens