UML to RDF/OWL (based on ISO/DIS 19150-2)
Overview
(NOTE: the target behavior documented on this page is available up until and including to ShapeChange version 2.1.0)
ISO/DIS 19150-2 defines rules for mapping ISO geographic information UML models to OWL ontologies. This target derives an ontology representation from an application schema in UML based upon these rules, with a number of changes.
When this target was implemented, the ISO standard was a Draft International Standard (DIS). A number of comments still had to be resolved. The final standard differs from the DIS version (for details, see Annex A of the OGC Testbed 12 ShapeChange Engineering Report, OGC 16-020). As a result, this target is considered a draft. An updated version is available since ShapeChange v2.2.0. Its implementation is different to what is described on this page and not backwards compatible. It is documented here.
Summary of the changes and extensions to ISO/DIS 19150-2 supported by this target
The table below provides a summary how additional conversion rules differ from the standard rules specified in ISO/DIS 19150-2.
Sub-clause of ISO/DIS 19150-2 | Changes, extensions, limitations | Remarks |
6.2.2 Ontology Name | change and extensions |
|
6.2.3 RDF namespace | – | |
6.2.4 Class name | – | |
6.2.5 Datatype name | – | |
6.2.6 Property name | change |
|
6.2.7 Names for codelists | extension |
|
6.3 Package | changes |
|
6.4 Class | changes and extension |
|
6.5 Abstract class | – | |
6.6 Class stereotype | change |
|
6.7 Attribute7.6 GF_PropertyType | changes, extensions and a limitations |
|
6.8.1 Enumeration | changes, extensions |
|
6.8.2 Codelist | changes, extensions |
|
6.9 Union | limitation |
|
6.10 Multiplicity | extensions |
|
6.11.1 Generalization7.9 GF_InheritanceRelation | – | |
6.11.2 Association7.7 GF_AssociationType | changes, extensions and a limitations |
|
6.11.3 Aggregation7.8 GF_AggregationType | – | |
6.12 Constraint7.10 GF_Constraint | extension |
|
6.13 Tagged value | change |
|
7.2 Rules for identification | – | |
7.3 Rules for documentation | changes, extensions |
|
7.4 Rules for integration | – | |
7.5 GF_FeatureType | changes, extensions |
|
Configuration
Class
The class for the Target implementation is de.interactive_instruments.ShapeChange.Target.Ontology.OWLISO19150.
Parameters
The <targetParameters> recognized for this target include the following:
Parameter Name | Required / Optional | Type | Default Value | Explanation |
outputDirectory | Optional | String | <the current run directory> | The path to which the ontology file(s) will be written. |
defaultEncodingRule | Optional | String | iso19150_2014 | The identifier of the default encoding rule governing the conversion into the ontology representation. This default value may be overridden by tagged values set on individual modeling elements. |
globalProperties | Optional | Comma separated list of strings | – | List of property names. If the name of a model property equals one of the names in this list, the according property is represented in the ontology as a global one. No domain information is declared for a global property. If the list contains the value ‘*’, then all properties will be represented as global properties. |
language | Optional | String | en | The language code to be used for generating the ontology representation. |
ontologyName_TaggedValue_Name | Optional | String | – (see explanation) | Name of the tagged value which, if present on a package, defines the ontologyName (see 19150-2owl:ontologyName) of the package.The ontologyName is defined via the following rules, in descending priority:
|
source | Optional | String | FIXME | Parameter relevant to identify the value for the dc:source that qualifies an ontology element. That value is computed according to the following instructions, in descending order:
|
sourceTaggedValueName | Optional | String | – | Name of the tagged value relevant to identify the value for the dc:source that qualifies an ontology element. That value is computed according to the following instructions, in descending order:
|
URIbase | Optional | URI | – | Defines the global URIbase for construction of the ontologyName (see 19150-2owl:ontologyName).The ontologyName is defined via the following rules, in descending priority:
|
Encoding Rules
An <EncodingRule> element defines an encoding rule.
Example:
<EncodingRule extends="iso19150_2014" name="myencodingrule"> <rule name="rule-owl-all-constraints"/> <rule name="rule-owl-cls-geosparql-features"/> <rule name="rule-owl-cls-19150-2-features"/> <rule name="rule-owl-prop-voidable-as-minCardinality0"/> <rule name="rule-owl-prop-suppress-cardinality-restrictions"/> <rule name="rule-owl-prop-suppress-allValuesFrom-restrictions"/> <rule name="rule-owl-all-suppress-dc-source"/> <rule name="rule-owl-pkg-singleOntologyPerSchema"/> <rule name="rule-owl-cls-codelist-external"/> <rule name="rule-owl-pkg-app-schema-code"/> <rule name="rule-owl-prop-suppress-asociation-names"/> </EncodingRule>
The name attribute of the <EncodingRule> element defines the identifier of the encoding rule to be used in the defaultEncodingRule parameter or owlEncodingRule tagged values on specific model elements.
The optional extends attribute of the <EncodingRule> element includes all rules from the referenced encoding rule in this encoding rule, too.
Each <rule> references either a conversion rule or – possibly in the future – a requirement or recommendation to be tested during the validation before the conversion process. The following rules are supported by this target:
Rule Name | Required /Optional | Explanation |
rule-owl-pkg-singleOntologyPerSchema | Optional | If this rule is enabled, ontologies will be created for selected schema, but not for all of their child packages. |
rule-owl-pkg-pathInOntologyName | Optional | If this rule is enabled, ontology names will be constructed using the path of packages (usually from a leaf package to its main schema package). This rule changes ontology names only if the rule “rule-owl-pkg-singleOntologyPerSchema” is not in effect (because otherwise child packages will not be considered). |
rule-owl-all-constraints | Optional | If this rule is included, the target will create constraint definitions. Constraints on properties (not for union properties) and classes are supported. |
rule-owl-cls-geosparql-features | Optional | If this rule is included, each feature type definition gets a subClassOf declaration to the GeoSPARQL defined FeatureType class. |
rule-owl-cls-19150-2-features | Optional | If this rule is included, each feature type definition gets a subClassOf declaration to the ISO 19150-2 defined FeatureType class (which defines the according stereotype) as well as AnyFeature. |
rule-owl-cls-codelist-external | Optional | If this rule is included, code lists are not represented as part of the RDF vocabulary and where available the vocabulary or codelist tagged value is used for the rdfs:range. If not set, owl:Class is used. |
rule-owl-prop-suppress-cardinality-restrictions | Optional | If this rule is included, cardinality restrictions are not included in the ontology. |
rule-owl-prop-suppress-allValuesFrom-restrictions | Optional | If this rule is included, allValuesFrom restrictions are not included in the ontology. |
rule-owl-prop-voidable-as-minCardinality0 | Optional | If this rule is included, minCardinality is set to 0 for voidable properties |
rule-owl-all-suppress-dc-source | Optional | If this rule is included, dc:source in not included except on the ontology subject. |
rule-owl-prop-suppress-asociation-names | Optional | If this rule is included, association names are not included in the ontology. |
rule-owl-pkg-app-schema-code | Optional | Note: this rule only applies if rule-owl-pkg-singleOntologyPerSchema is in effect.If this rule is included, the namespace abbreviation defined for an application schema package is used for constructing the ontology name of this package as well as the filename for that ontology – instead of the package name (normalized according to 19150-2owl:ontologyName). |
Map Entries
<mapEntries> contain individual <MapEntry> elements, which represent mappings from UML types (classes) to corresponding ontology resources.
Examples:
<mapEntries> <MapEntry type="CharacterString" rule="myencodingrule" targetType="xsd:string" param="datatype"/> <MapEntry type="GeographicalName" rule="myencodingrule" targetType="rdfs:label" param="propertyByValueType"/> <MapEntry type="geometry" rule="myencodingrule" targetType="geo:hasGeometry" param="property"/> <MapEntry type="Any" rule="iso19150_2014" targetType="owl:Class" param="class"/> </mapEntries>
A <MapEntry> element contains the following attributes:
Attribute Name | Required / Optional | Explanation |
type | Required | In general, the UML type/class name to be mapped. For map entries with param=”property”, however, the value is an attribute name or a role name. |
rule | Required | The encoding rule to which this mapping applies. May be “*” to indicate that the mapping applies to all encoding rules. |
targetType | Optional | The identifier of an RDF class or property to which the type will be mapped.Note: the value is expected to be given as a QName, with the namespace prefix matching the namespace abbreviation of a namespace declared in the configuration (see next section). |
param | Optional | A parameter for the mapping. Allowed values and their interpretation are as follows:
|
The file StandardMapEntries-owl.xml defines mappings for a number of types and properties of the ISO Harmonized Model and OGC standards. It can be included in ShapeChange configuration files (via XInclude). Additional XInclude files, or individual <MapEntry> elements added to the <mapEntries> section of the configuration file, may be used to customize the map entries to support additional pre-defined conceptual UML classes, encoding rules, and existing ontologies.
Namespaces
A <Namespace> element defines a namespace and its properties.
Example:
<namespaces> <Namespace nsabr="geo" ns="http://www.opengis.net/ont/geosparql#" location="http://www.opengis.net/ont/geosparql"/> </namespaces>
The attributes for <Namespace> are as follows:
Attribute Name | Required / Optional | Default Value | Explanation |
ns | Required | – | The full namespace of an ontology. |
nsabr | Required | – | The namespace abbreviation. |
location | Optional | – | The location of the ontology document. |
The file StandardNamespaces-owl.xml contains a series of standard namespace definitions for the derivation of an ontology representation. This file can be included (via XInclude) in configuration files.
Stereotype Mappings
According to ISO 19150-2, the ontology representation of a class (from the application schema) with a specific stereotype shall include an rdfs:subClassOf declaration, referencing the identifier of the ontological definition of that stereotype. Therefore, the mapping between a stereotype used in the model and this identifier must be declared in the configuration.
Example:
<stereotypeMappings> <StereotypeMapping wellknown="FeatureType" mapsTo="http://def.isotc211.org/iso19150-2/2012/base#FeatureType"/> </stereotypeMappings>
The attributes for <StereotypeMapping> are as follows:
Attribute Name | Required / Optional | Default Value | Explanation |
wellknown | Required | – | Well-known stereotype (see here for further information). |
mapsTo | Required | – | Identifier of the ontological defintion of the stereotype. |
The file StandardStereotypeMappings-owl.xml contains a series of standard stereotype mappings. This file can be included (via XInclude) in configuration files.
Sample Configuration
<TargetOwl class="de.interactive_instruments.ShapeChange.Target.Ontology.OWLISO19150" mode="enabled"> <targetParameter name="outputDirectory" value="examples/rdf/inspire"/> <targetParameter name="defaultEncodingRule" value="owltest"/> <targetParameter name="URIbase" value="http://example.com/ont/inspire"/> <targetParameter name="source" value="INSPIRE application schemas, Revision 4618, derived according to ISO/DIS 19150-2 with several modification using ShapeChange."/> <targetParameter name="globalProperties" value="*"/> <rules> <EncodingRule extends="iso19150_2014" name="owltest"> <rule name="rule-owl-all-constraints"/> <rule name="rule-owl-cls-geosparql-features"/> <rule name="rule-owl-cls-19150-2-features"/> <rule name="rule-owl-prop-voidable-as-minCardinality0"/> <rule name="rule-owl-prop-suppress-cardinality-restrictions"/> <rule name="rule-owl-prop-suppress-allValuesFrom-restrictions"/> <rule name="rule-owl-all-suppress-dc-source"/> <rule name="rule-owl-pkg-singleOntologyPerSchema"/> <rule name="rule-owl-cls-codelist-external"/> <rule name="rule-owl-pkg-app-schema-code"/> <rule name="rule-owl-prop-suppress-asociation-names"/> </EncodingRule> </rules> <xi:include href="https://shapechange.net/resources/config/StandardStereotypeMappings-owl.xml"/> <xi:include href="https://shapechange.net/resources/config/StandardNamespaces-owl.xml"/> <xi:include href="https://shapechange.net/resources/config/StandardMapEntries-owl.xml"/> <namespaces> <Namespace location="http://example.com/ont/inspire/common" ns="http://example.com/ont/inspire/common#" nsabr="common"/> </namespaces> <mapEntries> <MapEntry param="datatype" rule="owltest" targetType="xsd:string" type="LocalisedCharacterString"/> <MapEntry param="datatype" rule="owltest" targetType="xsd:string" type="PT_FreeText"/> <MapEntry param="datatype" rule="owltest" targetType="xsd:anyURI" type="URL"/> </mapEntries> <mapEntries> <MapEntry param="propertyByValueType" rule="owltest" targetType="rdfs:label" type="GeographicalName"/> </mapEntries> <mapEntries> <MapEntry param="property" rule="owltest" targetType="" type="inspireId"/> <MapEntry param="property" rule="owltest" targetType="prov:generatedAtTime" type="beginLifespanVersion"/> <MapEntry param="property" rule="owltest" targetType="prov:invalidatedAtTime" type="endLifespanVersion"/> <MapEntry param="property" rule="owltest" targetType="common:validFrom" type="validFrom"/> <MapEntry param="property" rule="owltest" targetType="common:validTo" type="validTo"/> <MapEntry param="property" rule="owltest" targetType="geo:hasGeometry" type="geometry"/> <MapEntry param="property" rule="owltest" targetType="rdfs:label" type="label"/> <MapEntry param="property" rule="owltest" targetType="rdfs:label" type="name"/> <MapEntry param="property" rule="owltest" targetType="rdf:value" type="value"/> </mapEntries> </TargetOwl>