There are situations where it would be desirable to restrict the values of a datatype when it appears in a profile. This is a proposal to use XML Schema constraining facets to define such restrictions.

Background

It is current practice to restrict allowed values of an association or enumeration attribute in a profile. In an OWL representation, these are the ObjectProperty definitions.

In contrast, the values of an ordinary attribute are defined by the schema (the CIM) and are not restricted in profiles. In OWL, these are the DatatypeProperty definitions.

OWL does not provide a language for datatype restrictions but XML Schema does and those concepts can be borrowed for profile definitions.

Use Cases

The the following general use cases are envisaged:

The following specific scenarios illustrate the use cases:

Solution

The proposed solution is to allow a profile definition to include XML Schema constraining facets which are defined section 4.3 of the W3C XML Schema Part 2 Recommendation: http://www.w3.org/TR/xmlschema-2/#rf-facets

Constraining Facets

The constraining facets proposed for use in profiles and their XML Schema Part 2 sections are:

4.3.1 length
4.3.2 minLength
4.3.3 maxLength
4.3.4 pattern
4.3.5 enumeration
4.3.7 maxInclusive
4.3.8 maxExclusive
4.3.9 minExclusive
4.3.10 minInclusive
4.3.11 totalDigits
4.3.12 fractionDigits

Facet Annotations in OWL Profiles

When a profile is represented as OWL, a constraining facet, except enumeration, will appear as an Annotation Property on the associated profile Datatype definition. The Annotation Property will have the same name and namespace as the XML Schema element and accept the same values as the value attribute of that element.

A fragment of an OWL profile definition illustrates this for the minInclusive facet:


<owl:Restriction>
<owl:onProperty resource="&cim;IdentifiedObject.description"/>
<owl:allValuesFrom>
<rdfs:Datatype>
<rdfs:subClassOf resource="&cim;Reactance"/>
<xsd:minInclusive>0.0</xsd:minInclusive>

</rdfs:Datatype>
</allValuesFrom>
</owl:Restriction>

Enumeration Facet in OWL Profiles

An enumeration facet will be represented by an OWL oneOf definition.


<owl:Restriction>
<owl:onProperty resource="&cim;Organisation.currentStatus"/>
<owl:allValuesFrom>
<owl:DataRange>
<rdfs:subClassOf resource="&xsd;string"/>
<owl:oneOf>

<rdf:List>
<rdf:first>AllowedStatusValue1</rdf:first>
<rdf:rest>
...
<rdf:rest>
</rdf:List>
</owl:oneOf>

</rdfs:DataRange>
</allValuesFrom>
</owl:Restriction>

Shared Definitions

It is anticipated that a datatype definition could be used in more than one place within in a profile or throughout a family of related profiles. Therefore it will be possible to name datatype definitions in profiles.

Notes

CIMTool Implementation

Rationale and Alternatives

Use of XML Schema Datatypes

The solution assumes that profile datatypes are defined in terms of the XML Schema recommendation. This is the current practice for OWL profile definitions and it is clearly an acceptable choice if the ultimate implementation will use RDF or XML Schema.

When some other implementation technology is used, a mapping will be required between its native datatypes those in the profile.

In the latter case, the XML Schema recommendation is a good candidate for a canonical set of datatypes. The datatypes are well defined, widely used, and do not depend on any other aspects of XML technology.

Use of a Rule Language

An alternative to the proposed solution would be to introduce a rule language. Such a language has been discussed among CIM tool implementers as a more powerful alternative to schema languages for describing restrictions on profiles. Several validation tools use a bespoke rule language internally.

However, the proposed solution continues the schema-oriented approach and merely adds definitions. This has the advantage of simplicity and consistency with current profile definitions.

This style of definition can also be used for a variety purposes in addition to validation, for example, to generate a database schema or an XML schema. The facet definitions can in the profile be trivially converted to rules for validation.