Transformation of UML datatypes
In this section are specified transformation rules for UML datatypes and enumerations. Table 1 provides an overview of the section coverage.
UML element | Rules in core ontology layer | Rules in data shape layer | Rules in reasoning layer |
---|---|---|---|
Primitive datatype |
|||
Structured datatype |
|||
Enumeration |
|||
Enumeration item |
Primitive datatype
The UML primitive type defines a predefined datatype without any substructure. The UML specification [uml2.5] predefines five primitive types: String, Integer, Boolean, UnlimitedNatural and Real. Here we extended those to the list provided in Table 2.
Specify datatype declaration axiom for UML datatype as follows:
-
UML primitive datatypes are declared as the mapped XSD datatype in Table 2.
-
XSD and RDF(S) datatypes are declared as such.
-
Model specific datatypes are declared as such.
Ideally, in the implementation, this rule would be combined with the relevant rules (those for the core ontology layer) in the Transformation of UML descriptors section, to provide labels and documentation for the datatype at the time of its creation. |
UML datatype | XSD datatype |
---|---|
Boolean |
xsd:boolean |
Float |
xsd:float |
Integer |
xsd:integer |
Char |
xsd:string |
String |
xsd:string |
Short |
xsd:short |
Long |
xsd:long |
Decimal |
xsd:decimal |
Real |
xsd:float |
Date |
xsd:date |
Numeric |
xsd:integer |
Text |
xsd:string |
Listing 1. UML primitive datatype declaration (String) in Turtle syntax
|
Listing 2. UML primitive datatype declaration (String) in RDF/XML syntax
|
Listing 3. XSD and RDF(S) datatype declaration in Turtle syntax
|
Listing 4. XSD and RDF(S) datatype declaration in RDF/XML syntax
|
Listing 5. Model specific datatype declaration in Turtle syntax
|
Listing 6. Model specific datatype declaration in RDF/XML syntax
|
Structured datatypes
The UML structured datatype [uml2.5] has attributes and is used to define complex data types. The structured datatypes should be treated as classes.
Specify OWL class declaration axiom for UML structured datatype.
See applicable rules in Section on Class Rules.
Enumeration
UML Enumerations [uml2.5] are kinds of datatypes, whose values correspond to one of user-defined literals. They should be transformed into SKOS [skos-spec] concept schemes comprising the concepts corresponding to enumerated items.
Normally, the controlled list represented by UML Enumerations will be defined externally. In order to be ale to validate some data against the generate SHACL shapes, these controlled lists need to be imported into the SHACL shapes. Moreover, the restriction module should be also imported into the SHACL module, alongside the OWL core module. |
Specify SKOS concept scheme instantiation axiom for a UML enumeration.
Ideally, in the implementation, this rule would be combined with the relevant rules (those for the core ontology layer) in the Transformation of UML descriptors section, to provide labels and documentation for the class/individual representing the enumeration at the time of its creation. |
Listing 7. Concept scheme instantiation in Turtle syntax
|
Listing 8. Concept scheme instantiation in RDF/XML syntax
|
For a UML enumeration, specify an equivalent class restriction covering the set of individuals that are skos:inScheme
of this enumeration.
Listing 9. In-scheme equivalent class in Turtle syntax
|
Listing 10. In-scheme equivalent class in RDF/XML syntax
|
Specify SKOS concept instantiation axiom for each UML enumeration item.
Ideally, in the implementation, this rule would be combined with the relevant rules (those for the core ontology layer) in the Transformation of UML descriptors section, to provide labels and documentation for the individual representing the enumeration item at the time of its creation. |
Listing 11. Concept scheme items instantiation in Turtle syntax
|
Listing 12. Concept scheme items instantiation in RDF/XML syntax
|