Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,22 @@ This rule implements the conversion of enumerations as defined by ISO
The enumeration corresponds to an RDFS datatype that specifies the
restricted list of literals using an owl:oneOf declaration.

By default, the owl:oneOf declaration is added to the named RDFS
datatype itself. The OWL 2 mapping to RDF does not read this as an
enumeration of literals: an OWL 2 datatype is given a value space by a
datatype definition, which in RDF is an owl:equivalentClass from the
named datatype to an anonymous data range (see the
https://www.w3.org/TR/owl2-mapping-to-rdf/#Translation_of_Axioms_without_Annotations[OWL 2 Mapping to RDF Graphs, Section 2.1, Table 1]).
With target parameter
xref:./UML_to_RDF_OWL_based_on_ISO_IS_19150_2.adoc#iso191502EnumerationAsDatatypeDefinition[_iso191502EnumerationAsDatatypeDefinition_]
set to _true_, the enumeration is encoded in this form:

[source,turtle,linenumbers]
----------
ex:Colour a rdfs:Datatype ;
owl:equivalentClass [ a rdfs:Datatype ; owl:oneOf ( "red" "green" ) ] .
----------

[[rule-owl-cls-iso191502IsAbstract]]
==== rule-owl-cls-iso191502IsAbstract

Expand Down Expand Up @@ -1119,6 +1135,44 @@ Applies to Rule(s):

_none_ - this is a common target parameter

[[iso191502EnumerationAsDatatypeDefinition]]
==== iso191502EnumerationAsDatatypeDefinition

(since v4.1.0)

Type: Boolean

Default Value: _false_

Explanation:

If _true_, an enumeration is encoded as an OWL 2 datatype definition
(https://www.w3.org/TR/owl2-syntax/#Datatype_Definitions[OWL 2
Structural Specification, Section 9.4]): the named RDFS datatype is
owl:equivalentClass to an anonymous RDFS datatype, which carries the
owl:oneOf list of the enumeration's literals. OWL 2 tools then see the
enumeration as `DatatypeDefinition( DT DataOneOf( ... ) )`, as OWL 2 DL
requires of a datatype that is not built in
(https://www.w3.org/TR/owl2-syntax/#The_Restrictions_on_the_Axiom_Closure[OWL
2 Structural Specification, Section 11.2]). By default, the owl:oneOf
list is added to the named datatype itself, which the OWL API, for
example, reads as an empty enumeration of individuals.

This does not hold if a stereotype or type conversion parameter adds
rdfs:subClassOf to the enumeration. OWL 2 has no subclass relation
between datatypes, so the datatype is then also used as a class, and
the OWL API, for example, again reads an empty enumeration of
individuals.

An enumeration without any literals is encoded as a named RDFS datatype
without a definition, whether or not this parameter is set, because
DataOneOf needs at least one literal. Such a datatype is not valid in
OWL 2 DL.

Applies to Rule(s):

* xref:./UML_to_RDF_OWL_based_on_ISO_IS_19150_2.adoc#rule-owl-cls-iso191502Enumeration[rule-owl-cls-iso191502Enumeration]

[[language]]
==== language

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@prefix ex: <http://example.org/ontology/test#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

ex:Road.name rdf:type owl:DatatypeProperty;
rdfs:domain ex:Road;
rdfs:range xsd:string .

ex:Road rdf:type owl:Class;
rdfs:subClassOf [ rdf:type owl:Restriction;
owl:onDataRange ex:ExampleEnumeration;
owl:onProperty ex:Road.surface;
owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger
];
rdfs:subClassOf [ rdf:type owl:Restriction;
owl:onDataRange xsd:string;
owl:onProperty ex:Road.name;
owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger
];
rdfs:subClassOf [ rdf:type owl:Restriction;
owl:onClass ex:ExampleCodeList;
owl:onProperty ex:Road.category;
owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger
] .

ex:Road.category rdf:type owl:ObjectProperty;
rdfs:domain ex:Road;
rdfs:range ex:ExampleCodeList .

ex:ExampleCodeList rdf:type owl:Class;
rdfs:subClassOf skos:Concept .

ex:ExampleEnumeration
rdf:type rdfs:Datatype;
owl:equivalentClass [ rdf:type rdfs:Datatype;
owl:oneOf ( "alpha" "beta" "gamma" )
] .

ex:Road.surface rdf:type owl:DatatypeProperty;
rdfs:domain ex:Road;
rdfs:range ex:ExampleEnumeration .

<http://example.org/ontology/test>
rdf:type owl:Ontology .
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@prefix dct: <http://purl.org/dc/terms/> .
@prefix ex: <http://example.org/ontology/test#> .
@prefix excode: <http://example.org/ontology/test/code#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.org/ontology/test/code>
rdf:type owl:Ontology .

excode:ExampleCodeList
rdf:type skos:ConceptScheme;
dct:isFormatOf ex:ExampleCodeList .

<http://example.org/ontology/test/code#ExampleCodeList/codeOne>
rdf:type ex:ExampleCodeList;
skos:inScheme excode:ExampleCodeList .

<http://example.org/ontology/test/code#ExampleCodeList/codeTwo>
rdf:type ex:ExampleCodeList;
skos:inScheme excode:ExampleCodeList .
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?><ShapeChangeConfiguration xmlns="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1" xmlns:sc="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1 ../../../../sc-resources/schema/ShapeChangeConfiguration.xsd">
<input id="INPUT">
<parameter name="inputModelType" value="EA7"/>
<parameter name="inputFile" value="src/integrationtests/owl/enumerationDatatypeProperty/test_enumerationDatatypeProperty.qea"/>
<parameter name="appSchemaName" value="Test Schema"/>
<parameter name="publicOnly" value="true"/>
<parameter name="checkingConstraints" value="disabled"/>
<parameter name="sortedSchemaOutput" value="true"/>
<stereotypeAliases xmlns="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1">


<StereotypeAlias alias="applicationSchema" wellknown="Application Schema"/>
<StereotypeAlias alias="requirementsClass" wellknown="Application Schema"/>
<StereotypeAlias alias="bundle" wellknown=""/>
<StereotypeAlias alias="leaf" wellknown=""/>

<StereotypeAlias alias="abstract" wellknown=""/>
<StereotypeAlias alias="conceptScheme" wellknown="CodeList"/>
<StereotypeAlias alias="vocabulary" wellknown="CodeList"/>
<StereotypeAlias alias="request" wellknown="DataType"/>
<StereotypeAlias alias="response" wellknown="DataType"/>
<StereotypeAlias alias="feature" wellknown="FeatureType"/>
<StereotypeAlias alias="interface" wellknown="Type"/>
<StereotypeAlias alias="attributeValueConcept" wellknown="valueConcept"/>

<StereotypeAlias alias="property" wellknown=""/>
<StereotypeAlias alias="enum" wellknown=""/>
</stereotypeAliases>
</input>
<log>
<parameter name="reportLevel" value="INFO"/>
<parameter name="logFile" value="testResults/owl/iso191502EnumerationAsDatatypeDefinition/log.xml"/>
</log>
<targets>
<TargetOwl class="de.interactive_instruments.shapechange.core.target.ontology.OWLISO19150" inputs="INPUT" mode="enabled">
<targetParameter name="outputDirectory" value="testResults/owl/iso191502EnumerationAsDatatypeDefinition/owl"/>
<targetParameter name="outputFormat" value="turtle"/>
<targetParameter name="sortedOutput" value="true"/>
<targetParameter name="defaultEncodingRule" value="MyRule"/>
<targetParameter name="language" value="en"/>
<targetParameter name="defaultTypeImplementation" value="owl:Class"/>
<targetParameter name="ontologyNameCode" value="test"/>
<targetParameter name="source" value="Test ontology"/>
<targetParameter name="URIbase" value="http://example.org/ontology"/>
<targetParameter name="iso191502EnumerationAsDatatypeDefinition" value="true"/>

<rdfMapEntries xmlns="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1" xmlns:xi="http://www.w3.org/2001/XInclude">
<rdfMapEntries xmlns="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1">


<RdfTypeMapEntry target="xsd:string" targetType="datatype" type="CharacterString"/>
<RdfTypeMapEntry target="xsd:date" targetType="datatype" type="Date"/>
<RdfTypeMapEntry target="xsd:dateTime" targetType="datatype" type="DateTime"/>
<RdfTypeMapEntry target="xsd:integer" targetType="datatype" type="Integer"/>
<RdfTypeMapEntry target="xsd:double" targetType="datatype" type="Decimal"/>
<RdfTypeMapEntry target="xsd:double" targetType="datatype" type="Real"/>
<RdfTypeMapEntry target="xsd:boolean" targetType="datatype" type="Boolean"/>
<RdfTypeMapEntry target="xsd:Name" targetType="datatype" type="GenericName"/>
<RdfTypeMapEntry target="xsd:NCName" targetType="datatype" type="LocalName"/>
<RdfTypeMapEntry target="rdfs:Resource" type="ScopedName"/>
<RdfTypeMapEntry target="xsd:NCName" targetType="datatype" type="TypeName"/>
<RdfTypeMapEntry target="xsd:Name" targetType="datatype" type="MemberName"/>

<RdfTypeMapEntry target="xsd:string" targetType="datatype" type="Character"/>
<RdfTypeMapEntry target="xsd:double" targetType="datatype" type="Number"/>
<RdfTypeMapEntry target="xsd:time" targetType="datatype" type="ClockTime"/>
<RdfTypeMapEntry target="xsd:boolean" targetType="datatype" type="Bit"/>

<RdfTypeMapEntry target="xsd:anyURI" targetType="datatype" type="URI"/>
<RdfTypeMapEntry target="xsd:time" targetType="datatype" type="Time"/>


<RdfTypeMapEntry target="sc:Measure" targetType="datatype" type="Measure"/>
<RdfTypeMapEntry target="sc:Measure" targetType="datatype" type="Length"/>
<RdfTypeMapEntry target="sc:Measure" targetType="datatype" type="Distance"/>
<RdfTypeMapEntry target="sc:Measure" targetType="datatype" type="Area"/>
<RdfTypeMapEntry target="sc:Measure" targetType="datatype" type="Volume"/>
<RdfTypeMapEntry target="sc:Measure" targetType="datatype" type="Velocity"/>

<RdfTypeMapEntry target="owl:Class" targetType="class" type="Any"/>


</rdfMapEntries>
<rdfMapEntries xmlns="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1">
<RdfTypeMapEntry target="sc:Sign" targetType="datatype" type="Sign"/>

</rdfMapEntries>
<rdfMapEntries xmlns="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1">

<RdfTypeMapEntry target="gsp:Geometry" type="DirectPosition"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_Object"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_Point"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_Curve"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_Surface"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_Solid"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_MultiPoint"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_MultiCurve"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_MultiSurface"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_MultiSolid"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_Aggregate"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_CompositePoint"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_CompositeCurve"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_CompositeSurface"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_CompositeSolid"/>
<RdfTypeMapEntry target="gsp:Geometry" type="GM_Complex"/>




</rdfMapEntries>
<rdfMapEntries xmlns="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1">

</rdfMapEntries>
<rdfMapEntries xmlns="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1">
<RdfTypeMapEntry target="gsp:Feature" type="GFI_Feature"/>

</rdfMapEntries>

</rdfMapEntries>
<namespaces xmlns="http://www.interactive-instruments.de/ShapeChange/Configuration/1.1">
<Namespace ns="http://www.w3.org/2001/XMLSchema#" nsabr="xsd"/>
<Namespace ns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" nsabr="rdf"/>
<Namespace ns="http://www.w3.org/2000/01/rdf-schema#" nsabr="rdfs"/>
<Namespace ns="http://www.w3.org/2002/07/owl#" nsabr="owl"/>
<Namespace ns="http://purl.org/dc/elements/1.1/" nsabr="dc"/>
<Namespace location="https://www.w3.org/ns/dcat.ttl" ns="http://www.w3.org/ns/dcat#" nsabr="dcat"/>
<Namespace ns="http://www.w3.org/ns/prov#" nsabr="prov"/>
<Namespace location="http://www.w3.org/2004/02/skos/core" ns="http://www.w3.org/2004/02/skos/core#" nsabr="skos"/>
<Namespace location="http://def.isotc211.org/iso19150/-2/2012/base" ns="http://def.isotc211.org/iso19150/-2/2012/base#" nsabr="iso19150-2"/>
<Namespace location="http://www.opengis.net/ont/geosparql" ns="http://www.opengis.net/ont/geosparql#" nsabr="gsp"/>
<Namespace location="http://www.opengis.net/ont/sf" ns="http://www.opengis.net/ont/sf#" nsabr="sfowl"/>
<Namespace location="http://www.opengis.net/ont/gml" ns="http://www.opengis.net/ont/gml#" nsabr="gmlowl"/>
<Namespace location="http://shapechange.net/resources/ont/base" ns="http://shapechange.net/resources/ont/base#" nsabr="sc"/>
<Namespace location="http://def.isotc211.org/iso19109/2013/GeneralFeatureModel" ns="http://def.isotc211.org/iso19109/2013/GeneralFeatureModel#" nsabr="gfm"/>
<Namespace location="https://www.w3.org/ns/locn.ttl" ns="https://www.w3.org/ns/locn#" nsabr="locn"/>
<Namespace location="www.w3.org/2006/time" ns="http://www.w3.org/2006/time#" nsabr="time"/>
</namespaces>

<rules>
<EncodingRule extends="*" name="MyRule">
<rule name="rule-owl-pkg-singleOntologyPerSchema"/>
<rule name="rule-owl-pkg-ontologyName-code"/>
<rule name="rule-owl-cls-encode-featuretypes"/>
<!-- with iso191502EnumerationAsDatatypeDefinition, encodes an enumeration as a named
rdfs:Datatype that is owl:equivalentClass to an anonymous rdfs:Datatype with owl:oneOf
over its literals -->
<rule name="rule-owl-cls-iso191502Enumeration"/>
<!-- the control: a code list keeps individuals, so its properties stay object properties -->
<rule name="rule-owl-cls-codelist-19150-2"/>
<rule name="rule-owl-prop-general"/>
<rule name="rule-owl-prop-range-global"/>
<rule name="rule-owl-prop-multiplicityAsQualifiedCardinalityRestriction"/>
</EncodingRule>
</rules>
</TargetOwl>
</targets>
</ShapeChangeConfiguration>
Loading