-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minimal documentation added with example use.
- Loading branch information
1 parent
b6dbb73
commit 157ab5a
Showing
11 changed files
with
270 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
`uml2semantics` is an application that allows you to convert a UML class diagram to an OWL 2 ontology. Translating a UML | ||
class diagram to an OWL 2 ontology allows one to reason over the ontology and thereby discover possible | ||
inconsistencies or unintended consequences. The UML to OWL translation we use is based on | ||
[UML to OWL](https://henrietteharmse.com/uml-vs-owl/uml-class-diagram-to-owl-and-sroiq-reference/), which | ||
provides the related Manchester syntax and SROIQ semantics. | ||
|
||
|
||
# Project status | ||
`uml2semantics` is in the very early stages of development and thus is missing many features. Currently it has support | ||
for specifying classes and attributes/associations using TSV files. | ||
|
||
|
||
# Assumption | ||
This tool assumes that the UML class diagrams are conceptual models and as such they contain no implementation related | ||
details like interfaces, access modifiers or operations. | ||
|
||
# Downloading | ||
|
||
# Quick Start | ||
## Employer and Employee example | ||
As a quick start here is a small UML class diagram that we will convert to OWL. We define a `Person` class | ||
that has attributes `name`, `surname` and `dateOfBirth`. The types we use are `name` and `surname` is `xsd:string` | ||
and for `dateOfBirth` we use `xsd:dateTime`. `Employee` and `Employer` extends `Person`. An employee has exactly 1 | ||
employer and an employer has 1 or more employees. | ||
|
||
![Employer Example](./docs/SimpleEmployerExample.png) | ||
|
||
## TSV representation | ||
Classes and attributes are created using 2 separate TSV files. First create | ||
the TSV file for your classes. It has the following format: | ||
|
||
|
||
| Curie | Name | Definition | ParentNames | | ||
|-------|----------|------------|-------------| | ||
| | Person | | | | ||
| | Employee | | Person | | ||
| | Employer | | Person | | ||
|
||
Here we only specify the name for each class, hence the reason we used the **Name** column to define our classes. Since | ||
`Employee` and `Employer` both extend the `Person` class, we add `Person` to **ParentNames** column. Multiple parents are | ||
separated by `|`. Curie refer to compact URI based on the [W3C CURIE syntax](https://www.w3.org/TR/2010/NOTE-curie-20101216/). | ||
|
||
To specify attributes we use the following format. | ||
|
||
| ClassName | Curie | Name | ClassOrPrimitive | MinMultiplicity | MaxMultiplicity | Definition | | ||
|------------|-------|-------------|------------------|-----------------|-----------------|------------| | ||
| Person | | name | xsd:string | | | | | ||
| Person | | surname | xsd:string | | | | | ||
| Person | | dateOfBirth | Person | xsd:dateTime | | | | ||
| Employee | | employedBy | Employer | 1 | 1 | | | ||
| Employer | | employes | Employee | 1 | * | | | ||
|
||
**ClassName** refers to the classname for which we are defining the attributes. Attributes can also be defined using curies, | ||
but we again only used names for now. The type of an attribute can be a primitive or a class. Currenlty XML primitive data | ||
types used in [Protege Desktop](https://protege.stanford.edu/) as data types are supported. When no multiplicity is given, | ||
[1..1] is assumed. `*` is to refer to infinite as per usual. | ||
|
||
A Google spreadsheet for this UML class diagram can be found [here](https://docs.google.com/spreadsheets/d/1FXpbc52Ag24Htj3Qq36Z743QB5SzlShzjeg98uxd2Xo/edit?usp=sharing). | ||
Save the classes and attributes tabs as TSV files. | ||
|
||
## Run uml2semantics | ||
Assuming you have download uml2semantics to a`$uml2semantics` directory and saved the .tsv files to this directory as well, | ||
you can run it as follows: | ||
|
||
`` | ||
java -jar uml2semantics.jar \ | ||
-c "$uml2semantics/Employer - Classes.tsv" \ | ||
-a "$uml2semantics/Employer - Attributes.tsv" \ | ||
-o "$uml2semantics/employer.owl" \ | ||
-p "emp:http://uml2semantics.org/examples/employer#" \ | ||
-i "http://uml2semantics.org/examples/employer/v.0.1" | ||
org.uml2semantics.uml2owl | ||
`` | ||
|
||
This will cause the ontology to be written out to `$uml2semantics/employer.owl`. An example of this file can be seen | ||
[here](./examples/employer/employer.owl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ClassName Curie Name ClassOrPrimitiveType MinMultiplicity MaxMultiplicity Definition | ||
Person name xsd:string | ||
Person surname xsd:string | ||
Person dateOfBirth xsd:dateTime | ||
Employee employedBy Employer 1 1 | ||
Employer employes Employee 1 * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Curie Name Definition ParentNames | ||
Person | ||
Employee Person | ||
Employer Person |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
<?xml version="1.0"?> | ||
<rdf:RDF xmlns="http://uml2semantics.org/examples/employer/v.0.1#" | ||
xml:base="http://uml2semantics.org/examples/employer/v.0.1" | ||
xmlns:owl="http://www.w3.org/2002/07/owl#" | ||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:xml="http://www.w3.org/XML/1998/namespace" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema#" | ||
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> | ||
<owl:Ontology rdf:about="http://uml2semantics.org/examples/employer/v.0.1"/> | ||
|
||
|
||
|
||
<!-- | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Object Properties | ||
// | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
--> | ||
|
||
|
||
|
||
|
||
|
||
<!-- http://uml2semantics.org/examples/employer#Employee/employedBy --> | ||
|
||
|
||
<owl:ObjectProperty rdf:about="http://uml2semantics.org/examples/employer#Employee/employedBy"> | ||
<rdfs:domain rdf:resource="http://uml2semantics.org/examples/employer#Employee"/> | ||
<rdfs:range rdf:resource="http://uml2semantics.org/examples/employer#Employer"/> | ||
<rdfs:label>employedBy</rdfs:label> | ||
</owl:ObjectProperty> | ||
|
||
|
||
|
||
<!-- http://uml2semantics.org/examples/employer#Employer/employes --> | ||
|
||
|
||
<owl:ObjectProperty rdf:about="http://uml2semantics.org/examples/employer#Employer/employes"> | ||
<rdfs:domain rdf:resource="http://uml2semantics.org/examples/employer#Employer"/> | ||
<rdfs:range rdf:resource="http://uml2semantics.org/examples/employer#Employee"/> | ||
<rdfs:label>employes</rdfs:label> | ||
</owl:ObjectProperty> | ||
|
||
|
||
|
||
<!-- | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Data properties | ||
// | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
--> | ||
|
||
|
||
|
||
|
||
|
||
<!-- http://uml2semantics.org/examples/employer#Person/dateOfBirth --> | ||
|
||
|
||
<owl:DatatypeProperty rdf:about="http://uml2semantics.org/examples/employer#Person/dateOfBirth"> | ||
<rdfs:domain rdf:resource="http://uml2semantics.org/examples/employer#Person"/> | ||
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/> | ||
<rdfs:label>dateOfBirth</rdfs:label> | ||
</owl:DatatypeProperty> | ||
|
||
|
||
|
||
<!-- http://uml2semantics.org/examples/employer#Person/name --> | ||
|
||
|
||
<owl:DatatypeProperty rdf:about="http://uml2semantics.org/examples/employer#Person/name"> | ||
<rdfs:domain rdf:resource="http://uml2semantics.org/examples/employer#Person"/> | ||
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> | ||
<rdfs:label>name</rdfs:label> | ||
</owl:DatatypeProperty> | ||
|
||
|
||
|
||
<!-- http://uml2semantics.org/examples/employer#Person/surname --> | ||
|
||
|
||
<owl:DatatypeProperty rdf:about="http://uml2semantics.org/examples/employer#Person/surname"> | ||
<rdfs:domain rdf:resource="http://uml2semantics.org/examples/employer#Person"/> | ||
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> | ||
<rdfs:label>surname</rdfs:label> | ||
</owl:DatatypeProperty> | ||
|
||
|
||
|
||
<!-- | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Classes | ||
// | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
--> | ||
|
||
|
||
|
||
|
||
|
||
<!-- http://uml2semantics.org/examples/employer#Employee --> | ||
|
||
|
||
<owl:Class rdf:about="http://uml2semantics.org/examples/employer#Employee"> | ||
<rdfs:subClassOf rdf:resource="http://uml2semantics.org/examples/employer#Person"/> | ||
<rdfs:subClassOf> | ||
<owl:Restriction> | ||
<owl:onProperty rdf:resource="http://uml2semantics.org/examples/employer#Employee/employedBy"/> | ||
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality> | ||
<owl:onClass rdf:resource="http://uml2semantics.org/examples/employer#Employer"/> | ||
</owl:Restriction> | ||
</rdfs:subClassOf> | ||
<rdfs:label>Employee</rdfs:label> | ||
</owl:Class> | ||
|
||
|
||
|
||
<!-- http://uml2semantics.org/examples/employer#Employer --> | ||
|
||
|
||
<owl:Class rdf:about="http://uml2semantics.org/examples/employer#Employer"> | ||
<rdfs:subClassOf rdf:resource="http://uml2semantics.org/examples/employer#Person"/> | ||
<rdfs:subClassOf> | ||
<owl:Restriction> | ||
<owl:onProperty rdf:resource="http://uml2semantics.org/examples/employer#Employer/employes"/> | ||
<owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:minQualifiedCardinality> | ||
<owl:onClass rdf:resource="http://uml2semantics.org/examples/employer#Employee"/> | ||
</owl:Restriction> | ||
</rdfs:subClassOf> | ||
<rdfs:label>Employer</rdfs:label> | ||
</owl:Class> | ||
|
||
|
||
|
||
<!-- http://uml2semantics.org/examples/employer#Person --> | ||
|
||
|
||
<owl:Class rdf:about="http://uml2semantics.org/examples/employer#Person"> | ||
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> | ||
<rdfs:subClassOf> | ||
<owl:Restriction> | ||
<owl:onProperty rdf:resource="http://uml2semantics.org/examples/employer#Person/dateOfBirth"/> | ||
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality> | ||
<owl:onDataRange rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/> | ||
</owl:Restriction> | ||
</rdfs:subClassOf> | ||
<rdfs:subClassOf> | ||
<owl:Restriction> | ||
<owl:onProperty rdf:resource="http://uml2semantics.org/examples/employer#Person/name"/> | ||
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality> | ||
<owl:onDataRange rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> | ||
</owl:Restriction> | ||
</rdfs:subClassOf> | ||
<rdfs:subClassOf> | ||
<owl:Restriction> | ||
<owl:onProperty rdf:resource="http://uml2semantics.org/examples/employer#Person/surname"/> | ||
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality> | ||
<owl:onDataRange rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> | ||
</owl:Restriction> | ||
</rdfs:subClassOf> | ||
<rdfs:label>Person</rdfs:label> | ||
</owl:Class> | ||
</rdf:RDF> | ||
|
||
|
||
|
||
<!-- Generated by the OWL API (version 0.1.0-SNAPSHOT) https://github.com/owlcs/owlapi/ --> | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters