Skip to content

Commit

Permalink
For attribute types allow curies referencing arbitrary vocabularies a…
Browse files Browse the repository at this point in the history
…nd attributes without types. Initial DCAT example
  • Loading branch information
henrietteharmse committed Aug 28, 2023
1 parent 5dbab78 commit c321fa9
Show file tree
Hide file tree
Showing 16 changed files with 510 additions and 78 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ This will cause the ontology to be written out to `$uml2semantics/employer.owl`.
[here](./examples/employer/employer.rdf)

## DCAT version 2 Example
Initial DCAT version 2 example is defined [here](./examples/dcat2/README.md).



2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / version := "v0.0.2"

ThisBuild / scalaVersion := "3.2.2"

Expand Down
7 changes: 7 additions & 0 deletions examples/dcat2/DCATv2 - Attributes.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ClassName Curie Name ClassOrPrimitiveType MinMultiplicity MaxMultiplicity Definition
Relationship hadRole dcat:Relationship The function of an entity or agent with respect to another entity or resource
Relationship dct:relation dct:relation SHOULD be used where the nature of the relationship between a cataloged item and related resources is not known. A more specific sub-property SHOULD be used if the nature of the relationship of the link is known. The property dcat:distribution SHOULD be used to link from a dcat:Dataset to a representation of the dataset, described as a dcat:Distribution
Resource contactPoint vcard:Kind Relevant contact information for the cataloged resource
Resource keyword rdfs:Literal A keyword or tag describing the resource.
Resource landingPage foaf:Document A Web page that can be navigated to in a Web browser to gain access to the catalog, a dataset, its distributions and/or additional information.
Catalog catalog Catalog
7 changes: 7 additions & 0 deletions examples/dcat2/DCATv2 - Classes.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Curie Name Definition ParentNames
Resource Resource published or curated by a single agent.
Dataset A collection of data, published or curated by a single agent, and available for access or download in one or more representations. Resource
Catalog A curated collection of metadata about resources (e.g., datasets and data services in the context of a data catalog) Dataset
DataService A collection of operations that provides access to one or more datasets or data processing functions. Resource
CatalogRecord Represents a metadata item in the catalog, primarily concerning the registration information, such as who added the item and when
Relationship An association class for attaching additional information to a relationship between DCAT Resources.
15 changes: 15 additions & 0 deletions examples/dcat2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Instruction to generate the DCAT v2 ontology

```
java -jar $uml2semantics/target/scala-3.2.2/uml2semantics.jar \
-c "$uml2semantics/examples/dcat2/DCATv2 - Classes.tsv" \
-a "$uml2semantics/examples/dcat2/DCATv2 - Attributes.tsv" \
-o "$uml2semantics/examples/dcat2/dcat-v2.rdf" \
-p "dcat:http://www.w3.org/ns/dcat#" \
-i "http://www.w3.org/ns/dcat#v2" \
-x "foaf:http://xmlns.com/foaf/0.1/,vcard:http://www.w3.org/2006/vcard/ns#,dct:http://purl.org/dc/terms/,dctype:http://purl.org/dc/dcmitype/,dct:http://purl.org/dc/terms/,prov:http://www.w3.org/ns/prov#,skos:http://www.w3.org/2004/02/skos/core#,sdo:http://schema.org/"
```

Note that using option `-x` we specify all prefixes that are used in the UML class diagram.
242 changes: 242 additions & 0 deletions examples/dcat2/dcat-v2.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.w3.org/ns/dcat#v2#"
xml:base="http://www.w3.org/ns/dcat#v2"
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://www.w3.org/ns/dcat#v2"/>



<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->





<!-- http://www.w3.org/ns/dcat#Catalog/catalog -->


<owl:ObjectProperty rdf:about="http://www.w3.org/ns/dcat#Catalog/catalog">
<rdfs:domain rdf:resource="http://www.w3.org/ns/dcat#Catalog"/>
<rdfs:range rdf:resource="http://www.w3.org/ns/dcat#Catalog"/>
<rdfs:label>catalog</rdfs:label>
</owl:ObjectProperty>



<!-- http://www.w3.org/ns/dcat#Relationship/hadRole -->


<owl:ObjectProperty rdf:about="http://www.w3.org/ns/dcat#Relationship/hadRole">
<rdfs:domain rdf:resource="http://www.w3.org/ns/dcat#Relationship"/>
<rdfs:range rdf:resource="http://www.w3.org/ns/dcat#Relationship"/>
<rdfs:comment>The function of an entity or agent with respect to another entity or resource</rdfs:comment>
<rdfs:label>hadRole</rdfs:label>
</owl:ObjectProperty>



<!-- http://www.w3.org/ns/dcat#Relationship/dct:relation -->


<owl:ObjectProperty rdf:about="http://www.w3.org/ns/dcat#Relationship/dct:relation">
<rdfs:domain rdf:resource="http://www.w3.org/ns/dcat#Relationship"/>
<rdfs:comment>dct:relation SHOULD be used where the nature of the relationship between a cataloged item and related resources is not known. A more specific sub-property SHOULD be used if the nature of the relationship of the link is known. The property dcat:distribution SHOULD be used to link from a dcat:Dataset to a representation of the dataset, described as a dcat:Distribution</rdfs:comment>
<rdfs:label>dct:relation</rdfs:label>
</owl:ObjectProperty>



<!-- http://www.w3.org/ns/dcat#Resource/contactPoint -->


<owl:ObjectProperty rdf:about="http://www.w3.org/ns/dcat#Resource/contactPoint">
<rdfs:domain rdf:resource="http://www.w3.org/ns/dcat#Resource"/>
<rdfs:range rdf:resource="http://www.w3.org/2006/vcard/ns#Kind"/>
<rdfs:comment>Relevant contact information for the cataloged resource</rdfs:comment>
<rdfs:label>contactPoint</rdfs:label>
</owl:ObjectProperty>



<!-- http://www.w3.org/ns/dcat#Resource/landingPage -->


<owl:ObjectProperty rdf:about="http://www.w3.org/ns/dcat#Resource/landingPage">
<rdfs:domain rdf:resource="http://www.w3.org/ns/dcat#Resource"/>
<rdfs:range rdf:resource="http://xmlns.com/foaf/0.1/Document"/>
<rdfs:comment>A Web page that can be navigated to in a Web browser to gain access to the catalog, a dataset, its distributions and/or additional information.</rdfs:comment>
<rdfs:label>landingPage</rdfs:label>
</owl:ObjectProperty>



<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Data properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->





<!-- http://www.w3.org/ns/dcat#Resource/keyword -->


<owl:DatatypeProperty rdf:about="http://www.w3.org/ns/dcat#Resource/keyword">
<rdfs:domain rdf:resource="http://www.w3.org/ns/dcat#Resource"/>
<rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/>
<rdfs:comment>A keyword or tag describing the resource.</rdfs:comment>
<rdfs:label>keyword</rdfs:label>
</owl:DatatypeProperty>



<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->





<!-- http://www.w3.org/2006/vcard/ns#Kind -->


<owl:Class rdf:about="http://www.w3.org/2006/vcard/ns#Kind"/>



<!-- http://www.w3.org/ns/dcat#Catalog -->


<owl:Class rdf:about="http://www.w3.org/ns/dcat#Catalog">
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/dcat#Dataset"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.w3.org/ns/dcat#Catalog/catalog"/>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
<owl:onClass rdf:resource="http://www.w3.org/ns/dcat#Catalog"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:comment>A curated collection of metadata about resources (e.g., datasets and data services in the context of a data catalog)</rdfs:comment>
<rdfs:label>Catalog</rdfs:label>
</owl:Class>



<!-- http://www.w3.org/ns/dcat#CatalogRecord -->


<owl:Class rdf:about="http://www.w3.org/ns/dcat#CatalogRecord">
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<rdfs:comment>Represents a metadata item in the catalog, primarily concerning the registration information, such as who added the item and when</rdfs:comment>
<rdfs:label>CatalogRecord</rdfs:label>
</owl:Class>



<!-- http://www.w3.org/ns/dcat#DataService -->


<owl:Class rdf:about="http://www.w3.org/ns/dcat#DataService">
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/dcat#Resource"/>
<rdfs:comment>A collection of operations that provides access to one or more datasets or data processing functions.</rdfs:comment>
<rdfs:label>DataService</rdfs:label>
</owl:Class>



<!-- http://www.w3.org/ns/dcat#Dataset -->


<owl:Class rdf:about="http://www.w3.org/ns/dcat#Dataset">
<rdfs:subClassOf rdf:resource="http://www.w3.org/ns/dcat#Resource"/>
<rdfs:comment>A collection of data, published or curated by a single agent, and available for access or download in one or more representations.</rdfs:comment>
<rdfs:label>Dataset</rdfs:label>
</owl:Class>



<!-- http://www.w3.org/ns/dcat#Relationship -->


<owl:Class rdf:about="http://www.w3.org/ns/dcat#Relationship">
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.w3.org/ns/dcat#Relationship/hadRole"/>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
<owl:onClass rdf:resource="http://www.w3.org/ns/dcat#Relationship"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.w3.org/ns/dcat#Relationship/dct:relation"/>
<owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:comment>An association class for attaching additional information to a relationship between DCAT Resources.</rdfs:comment>
<rdfs:label>Relationship</rdfs:label>
</owl:Class>



<!-- http://www.w3.org/ns/dcat#Resource -->


<owl:Class rdf:about="http://www.w3.org/ns/dcat#Resource">
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.w3.org/ns/dcat#Resource/contactPoint"/>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
<owl:onClass rdf:resource="http://www.w3.org/2006/vcard/ns#Kind"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.w3.org/ns/dcat#Resource/landingPage"/>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
<owl:onClass rdf:resource="http://xmlns.com/foaf/0.1/Document"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.w3.org/ns/dcat#Resource/keyword"/>
<owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:comment>Resource published or curated by a single agent.</rdfs:comment>
<rdfs:label>Resource</rdfs:label>
</owl:Class>



<!-- http://xmlns.com/foaf/0.1/Document -->


<owl:Class rdf:about="http://xmlns.com/foaf/0.1/Document"/>
</rdf:RDF>



<!-- Generated by the OWL API (version 5.5.0.2023-01-14T12:41:38Z) https://github.com/owlcs/owlapi/ -->


7 changes: 7 additions & 0 deletions examples/dcat2/generateDCATv2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
java -jar $uml2semantics/target/scala-3.2.2/uml2semantics.jar \
-c "$uml2semantics/examples/dcat2/DCATv2 - Classes.tsv" \
-a "$uml2semantics/examples/dcat2/DCATv2 - Attributes.tsv" \
-o "$uml2semantics/examples/dcat2/dcat-v2.rdf" \
-p "dcat:http://www.w3.org/ns/dcat#" \
-i "http://www.w3.org/ns/dcat#v2" \
-x "foaf:http://xmlns.com/foaf/0.1/,vcard:http://www.w3.org/2006/vcard/ns#,dct:http://purl.org/dc/terms/,dctype:http://purl.org/dc/dcmitype/,dct:http://purl.org/dc/terms/,prov:http://www.w3.org/ns/prov#,skos:http://www.w3.org/2004/02/skos/core#,sdo:http://schema.org/"
11 changes: 11 additions & 0 deletions examples/employer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Instruction to generate the Employer ontology
```
java -jar $uml2semantics/target/scala-3.2.2/uml2semantics.jar \
-c "$uml2semantics/examples/employer/Employer - Classes.tsv" \
-a "$uml2semantics/examples/employer/Employer - Attributes.tsv" \
-o "$uml2semantics/examples/employer/employer.rdf" \
-p "emp:http://uml2semantics.org/examples/employer#" \
-i "http://uml2semantics.org/examples/employer/v.0.1"
```
14 changes: 7 additions & 7 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@
<logger name="org.uml2semantics.Main" level="debug" />

<!-- org.uml2semantics.TSVReader.scala -->
<logger name="parseClasses" level="trace" />
<logger name="parseAttributes" level="trace" />
<logger name="parseClasses" level="error" />
<logger name="parseAttributes" level="error" />

<!-- org.uml2semantics.model.UMLClassDiagram.scala -->
<logger name="org.uml2semantics.model.UMLClassCurie" level="error" />
<logger name="org.uml2semantics.model.UMLClassAttributeName" level="error" />
<logger name="org.uml2semantics.model.UMLClassAttributeCurie" level="error" />
<logger name="org.uml2semantics.model.UMLClassParentNamedElements" level="trace" />
<logger name="org.uml2semantics.model.UMLClassParentNamedElements" level="error" />
<logger name="org.uml2semantics.model.UMLClassAttributeIdentity" level="error" />
<logger name="org.uml2semantics.model.UMLClassIRI" level="error" />
<logger name="org.uml2semantics.model.UMLClassAttributeIRI" level="error" />
<logger name="org.uml2semantics.model.UMLCardinality" level="error" />
<logger name="org.uml2semantics.model.UMLMultiplicity" level="error" />
<logger name="org.uml2semantics.model.UMLClassIdentity" level="error" />
<logger name="org.uml2semantics.model.UMLClassAttributeType" level="error" />
<logger name="org.uml2semantics.model.UMLClassDiagram" level="trace" />
<logger name="org.uml2semantics.model.UMLClassDiagram" level="error" />

<!-- org.uml2semantics.model.XMLDataType.scala -->
<logger name="org.uml2semantics.model.XMLDataType" level="error" />
<logger name="org.uml2semantics.model.SupportedDataType" level="error" />

<!-- org.uml2semantics.model.PrefixNamespace.scala -->
<logger name="org.uml2semantics.model.PrefixNamespace" level="error" />
<logger name="org.uml2semantics.model.Curie" level="error" />
<logger name="org.uml2semantics.model.Curie" level="trace" />


<!-- org.uml2semantics.model.owl.UmlToOWLWriter.scala -->
<logger name="org.uml2semantics.owl.UML2OWLWriter" level="trace" />
<logger name="org.uml2semantics.owl.UML2OWLWriter" level="error" />

<!-- <logger name="org.uml2semantics.model." level="debug" />-->

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/org/uml2semantics/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ val argParser =
.withFallback(() => PrefixNamespace.predefinedPrefixNamespacesAsStrings())
.valueName("<prefixname:prefix>,<prefixname:prefix>...")
.action((a, c) => c.copy(prefixes = a))
.text("A list of all the prefixes used in the UML class representation")
.text("A list of all the prefixes used in the UML class representation separated by commas.")
)


Expand Down
Loading

0 comments on commit c321fa9

Please sign in to comment.