uml2semantic v0.0.3: XMI Support for UML-to-OWL Conversion

uml2semantics converts UML class diagrams into OWL 2 ontologies, enabling you to reason over your conceptual models and discover inconsistencies or unintended consequences. The UML-to-OWL translation is based on UML to OWL, which provides the related Manchester syntax and SROIQ semantics.

uml2semantics v0.0.3 now supports reading of XMI files. Previously, users had to manually create TSV files to describe their classes and attributes. With XMI support, you can now export your UML class diagram directly from a modelling tool like Enterprise Architect and feed it straight into uml2semantics.

Why does XMI matter? Many organisations already maintain UML class diagrams in modelling tools, such as Sparx Enterprise Architect, representing the core entities of their enterprise data. To make their data Findable, Accessible, Interoperable and Reusable (FAIR), and AI-Ready, being able to describe their data by ontologies, is an essential step.

Getting Started

  1. Download uml2semantics.jar from the latest release
  2. Requires Java 11+
  3. Run with your XMI file:
java -jar uml2semantics.jar \
-m "your-model.xml" \
-o "output.rdf" \
-p "prefix:http://your-ontology-iri#" \
-i "http://your-ontology-iri/v1"

See the README for the full CLI parameter reference and additional examples.

Example: Generating OWL from an XMI File

Consider the following UML class diagram, which includes a generalization set with Complete and Overlapping constraints:

In this diagram, Person is the superclass of Employee and Employer, with a generalization set marked as {complete, overlapping}. This means every Person is at least either an Employee or an Employer (complete), but it is also possible that Person are both (overlapping).

To convert this XMI file to an OWL ontology, run:

java -jar uml2semantics.jar \
-m "./examples/xmi/sparx/Employer-WithGeneralizationSet-CompleteOverlapping.xml" \
-o "./uml2semantics/examples/xmi/sparx/Employer-WithGeneralizationSet-CompleteOverlapping.rdf" \
-p "emp:http://uml2semantics.org/examples/employer#" \
-i "http://uml2semantics.org/examples/employer/v.0.1"

This produces an OWL ontology at the specified output path. Because the generalization set is Complete and Overlapping, uml2semantics generates an owl:equivalentClass axiom stating that Person is equivalent to the union of Employee and Employer.

Example: Combining TSV and XMI with TSV Override

A feature of uml2semantics is the ability to combine XMI and TSV inputs using the --overrides option. This is particularly useful when you want to integrate your UML model with existing linked data vocabularies, such as Schema.org.

For instance, suppose you want the Person class in your ontology to use the Schema.org IRI http://schema.org/Person, instead of the auto-generated http://uml2semantics.org/examples/employer#Person. You can achieve this with a TSV override file for classes:

CurieNameDefinitionParentNames
schema:PersonPerson

Similarly, you can map attributes to Schema.org properties. The following TSV override maps the name attribute to schema:givenName and surname to schema:familyName:

ClassCurieNameClassEnumOrPrivitiveTypeMinMultiplicityMaxMultiplicityDefinition
Personschema:givenNamenamexsd:string
Personschema:familyNamesurnamexsd:string

Now run uml2semantics with both the XMI file and the TSV overrides:

java -jar uml2semantics.jar \
-m "./examples/xmi/sparx/Employer-WithGeneralizationSet-CompleteOverlapping.xml" \
-c "./examples/xmi/sparx/Employer - Classes.tsv" \
-a "./examples/xmi/sparx/Employer - Attributes.tsv" \
--overrides TSV \
-o "./uml2semantics/examples/xmi/sparx/Employer-WithGeneralizationSet-CompleteOverlapping-TSVOverride.rdf" \
-p "emp:http://uml2semantics.org/examples/employer#" \
-i "http://uml2semantics.org/examples/employer/v.0.1"

The result: the Person class now has the IRI http://schema.org/Person, and its name and surname attributes use schema:givenName and schema:familyName respectively. The rest of the model — the generalization set, associations, and other classes — comes from the XMI file as before.

This approach is valuable when integrating existing UML class diagrams with linked data. Overrides are not limited to CURIEs — you can add entirely new classes and attributes via TSV that don’t exist in the XMI.

What XMI Features Are Supported

  • Classes with attributes — including name, type, and multiplicity
  • Generalizations (inheritance) — subclass/superclass relationships
  • Generalization sets with all four constraint combinations:
    • Complete + Disjoint — translated to owl:DisjointUnion
    • Complete + Overlapping — translated to owl:equivalentClass with owl:unionOf
    • Incomplete + Disjoint — translated to owl:AllDisjointClasses
    • Incomplete + Overlapping — translated to subclass relationships only
  • Associations between classes — translated to OWL object properties

Note: enumerations are not yet supported.

Conclusion

If uml2semantics is of interest to you, please let me know:

  1. What features will you like to see in this tool?
  2. If you are using a different modelling tool, it will be very helpful if you can provide an example XMI export and image of your UML class diagram. XMI is supposed to be standard, but as we all know, standards are made to be broken :-).

Introduction to ontology semantics and reasoning

I recently had the pleasure to present at the OntoSpot meeting at EBI to help my colleagues gain an intuitive understanding of ontology semantics and reasoning. In this talk I assume that you have a very basic understanding of what an ontology is, but I assume no previous knowledge wrt logic. I provide a number of examples and graphics to explain logic and description logic (DL) concepts.

Here I provide both the slides of this presentation and the link to the recording. If you have any questions or suggestions, please let me know in the comments. I have already had the very helpful suggestion for adding a reference of DL symbols, which I will do shortly.

Errata:

  1. In the section on speaking about propositional logic, I accidentally said predicate logic instead of propositional logic.
  2. At the end while answering questions, I said RFD rather than RDF.

This video will also be made available at the OBO Academy.

The difference between Schema.org and OWL

In this blog post I describe some of the main differences between Schema.org vocabularies and OWL ontologies, the implications of these differences and the kind of steps you will need to take to translate Schema.org vocabularies to OWL ontologies.

Overall I keep this discussion at a high-level. For in-depth reviews of the differences between Schema.org and OWL I provide relevant links at the end of this post.

Key differences

There are 2 main differences between OWL and Schema.org.

  1. Intended purpose: The primary purpose of Schema.org is to enable sharing of structured data on the internet. The primary purpose of OWL is to enable sophisticated reasoning across the structure of your data.
  2. Difference in language: Due to the difference in purpose, there are substantial differences in language. The main reason being that the language for OWL can be translated into precise mathematical logic axioms, which allows for much richer inferences to be drawn. This is the reason for OWL preferring rdfs:domain/rdfs:range to schema:domainIncludes/schema:rangeIncludes. The benefit of using rdfs:domain/rdfs:range is that they have precise defined mathematical logic meaning, whereas schema:domainIncludes/schema:rangeIncludes do not have mathematical meaning.

What does this mean?

Using Schema.org you could draw some limited inferences. For example a reasoner can determine that the SNOMED concept http://purl.bioontology.org/ontology/SNOMEDCT/116154003 is a schema:Patient which is a schema:Person. But the language used in Schema.org by itself is not rich enough to detect inconsistencies. I.e., there is no way to say that schema:Person is disjoint from schema:Product. This allows for stating myexample:john a schema:Person and myexample:john a schema:Product without a reasoner being able to detect the inconsistency. Using OWL it is possible to state that schema:Person and schema:Product are disjoint.

Does this mean you should prefer OWL to Schema.org? No, not if your intended purpose of your ontology is to share data. Then it is best to use concepts from Schema.org and add the axioms that will provide the inferences you need. If reasoning is not your reason for wanting to use Schema.org/OWL, then just use Schema.org.

Can you translate Schema.org to OWL?

Strictly speaking, since RDF & RDFS is a subset of OWL, Schema.org is an OWL definition already, albeit one with limited reasoning capability. Any “translation” to OWL will mean adding axioms to Schema.org to increase the inferences that can be drawn from Schema.org documents. It is a pity that Schema.org does not (the current link to the OWL file is dead) provide an OWL file with the additional axioms that will enable richer reasoning.

  • Add rdfs:domain and rdfs:range restrictions rather than replacing schema:domainIncludes and schema:rangeIncludes. Replacing schema:domainIncludes and schema:rangeIncludes could result in search engines not finding information.
  • Add owl:disjointWith and owl:disjointObjectProperties respectively for all classes and properties that do not share individuals.
  • By looking at the documentation of Schema.org it gives the impression that classes have attributes. I.e., schema:Person has an attribute schema:givenName. However, there is nothing in the definition of schema:Person that enforces that the schema:Person class must have a schema:givenName attribute. I describe here, here and here how to define “attributes” for classes in a way that can be used by OWL reasoners.

Conclusion

Schema.org is mainly for sharing structured data on the Internet. OWL is used mainly to reason over structured data to determine inconsistencies in the schema.

For in-depth discussions on the differences between Schema.org and OWL I highly recommend reading the papers by Patel-Schneider and Hernich et al.