W3C

Qualified cardinality restrictions (QCRs): Constraining the number of values of a particular type for a property

NOTE: this document is NOT a W3C draft, it is intended for discussion only.

Editor's Draft 8 May 2006

This version:
...
Latest version:
...
Previous versions:
..
Editors:
Alan Rector, University of Manchester
Guus Schreiber, Vrije Universiteit Amsterdam

Copyright © 2006 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply.


Abstract

It is often useful to express constraints such as "has exactly four parts that are legs", "has at least two groups that are  phosphate groups", "has exactly one feature that is temperature", etc.  In each of these cases, we want to constrain not the total number of values for a property, but rather the number of values of a given type.  Such restrictions are called "qualified cardinality restrictions" ("QCRs") because they are "qualified" by the type of the value.  They are supported in most modern description logics but were omitted from the final version of the OWL standard.  This note discusses the uses of such constraints, a partial "work around" within the OWL standard, and a natural extension to the OWL standard to allow it to express QCRs correctly.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document os produced by the "Ontology Engineering and Patterns" (OEP) Task Force of the Semantic Web Best Practices and Deployment Working Group.

This document is not yet a W3C Working Draft and is expected to change. The SWBPD WG does not expect this document to become a Recommendation. Rather, after further development, review and refinement, it is intended to be published and maintained as a WG Note.

We encourage public comments. Please send comments to public-swbp-wg@w3.org

Open issues, todo items:

Publication as a draft does not imply endorsement by the W3C Membership. This document is a draft and may be updated, replaced or made obsolete by other documents at any time. It is inappropriate to cite this document as other than work in progress.


Contents

1. General issues

Cardinality restrictions are commonly used to constrain the number of values of a particular property, irrespective of the value type. For example, we can state that a "Minimal Italian Dinner" contains exactly three courses:

:MinimalItalianDinner
    a owl:Class ;
    rdfs:subClassOf
        [ a owl:Restriction ;
          owl:onProperty :hasCourse ;
          owl:cardinality "3"^^xsd:nonNegativeInteger ] .

NOTE: Some Italian restaurants in the US consider you a dummy when you skip either primo or secondo, but it is quite common in contemporary Italy

However, suppose we wanted to add the following constraints for minimal Italian dinners:

To express these constraints we need a way to restrict the valujes of a particular type (e.g., starters) to a particular value (e.g. 1). We call such constraints "qualified cardinality restrictions", where the term "qualified" indicates that they apply only to a specific type of value rather than to the property overall.

2. Use cases

Rector [Rector, 2003] mentions a number of use cases, and others have arisen in the course of developing ontologies for various communities. In general the use cases occur where there are many different kinds of parts, features, chemical groups, legal statuses, qualities, etc. In such cases defining a separate property or 'slot' for each is cumbersome at best and difficult to extend.

  1. Anatomy:
  2. Bio-ontologies and chemistry:
  3. Many legal strictures, e.g. the British Nationality Act:
  4. Administrative structures:
  5. Drug interactions:
  6. N-ary relations [Noy and Rector, 2006]:

3. Pattern I: Use owl:someValuesFrom

The OWL construct owl:someValuesFrom is actually a qualified restriction in disguise. It is equivalent to a qualified cardinality restriction with a minimum cardinality of i.e. "this property must have at least one value of this type.". The Mcode>someValuesFrom constructor can be used to constrain an Italian dinner to have at least one antipasto:

:ItalianDinner
    a owl:Class ;
    rdfs:subClassOf
        [ a owl:Restriction ;
          owl:onProperty :hasCourse ;
          owl:someValuesFrom :AntiPasto ] .

The example in use case 3 above could also be expressed simply using owl:someValuesfrom:

:PersonWithBritishParent
    a owl:Class ;
    owl:equivalentClass
        [ a owl:Class ;
          owl:intersectionOf 
            ( :Person 
              [ a owl:Restriction ;
                owl:onProperty :hasParent ;
                owl:someValuesFrom :BritishCitizen ] ) ] .

However, this approach is not useful for values other than "at least one" or for imposing maximum cardinalities.  It therefore cannot deal with the other uses cases or generalisations of 3 such as "at least two grandparents who were British citizens".

4. Pattern II: Work around using subPropertyOf

A common 'work around' to deal with other cardinalities is to introduce a subproperty of the primary property and then to introduce an unqualified cardinality restriction on that subproperty. For example, we might represent the "normal hand" example from use case 1 by:

:BodyPart
    a owl:Class .

:Finger
    a owl:Class ;
    rdfs:subClassOf :BodyPart .

:Thumb
    a :Class ;
    rdfs:subClassOf :Finger .

:hasPart
    a owl:ObjectProperty ;
    rdfs:range :BodyPart .

:hasFinger
    a owl:ObjectProperty ;
    rdfs:range :Finger ;
    rdfs:subPropertyOf :hasPart .

:hasThumb
    a owl:ObjectProperty ;
    rdfs:range :Thumb ;
    rdfs:subPropertyOf :hasFinger .

We would then hve the property hierarchy:

    hasPart
        hasFinger
            hasThumb

We could then represent the "normal hand" by:

:NormalHand
    a owl:Class ;
    rdfs:subClassOf :Hand ;
    owl:equivalentClass
        [ a owl:Class ;
          owl:intersectionOf (
              [ a owl:Restriction ;
                owl:onProperty :hasFinger ;
                owl:cardinality "5"^^xsd:nonNegativeInteger ] 
              [ a owl:Restriction ;
                owl:onProperty :hasThumb ;
                owl:cardinality "1"^^xsd:nonNegativeInteger ] ) ] .

This workaround can also be used to represent the constraints on "Minimal Italian Dinner":

:AntiPasto
    a owl:Class ;    
    rdfs:subClassOf :Course .
:PrimoOrSecundoPiatto    
    a owl:Class ;    
    rdfs:subClassOf :Course .
:Dolce
    a owl:Class ;
    rdfs:subClassOf :Course .

:hasAntiPasto
    a owl:ObjectProperty ;
    rdfs:subPropertyOf :hasCourse .
:hasPrimoOrSecundo
    a owl:ObjectProperty ;
    rdfs:subPropertyOf :hasCourse .
:hasDolce
    a owl:ObjectProperty ;
    rdfs:subPropertyOf :hasCourse .

:MinimalItalianDinner
    a owl:Class ;
    owl:equivalentClass
        [ a owl:Class ;
          owl:intersectionOf (
            [ a owl:Restriction ;
              owl:onProperty :hasAntiPasto ; 
              owl:cardinality "1"^^xsd:nonNegativeInteger ]
            [ a owl:Restriction ;
              owl:onProperty :hasPrimoOrSecundo ; 
              owl:cardinality "1"^^xsd:nonNegativeInteger ]
            [ a owl:Restriction ;
              owl:onProperty :hasDolce ;
              owl:cardinality "1"^^xsd:nonNegativeInteger ] ) ] .

Discussion

This pattern suffices for simple cases but presents several problems:

  1. The constraints are incomplete because the range of the super property must subsume the ranges of the subproperties. Therefore, there is no way to prevent the use of the parent property inappropriately.For example, we could add another dessert to the "Minimal Italian Dinner":
             .....
             [ a owl:Restriction ;
               owl:onProperty :hasDolce ;
               owl:someValuesFrom :Tiramisu ]
             [ a owl:Restriction ;
               owl:onProperty :hasCourse ;
               owl:someValuesFrom :IceCream ]
    	 .....
    
    Assuming that IceCream is a kind of Dolce is a kind of Course, this is legal according to the OWL constraints but not their intent, which was to restrict the "minimal" dinner to exactly one each of starter, main, and dessert. There is no way to constrain the range of the property hasCourse without that constraint also applying to its subproperties, so there is no way around this problem except to use tools to impose additional constraints based on annotations or meta properties which are outside the OWL syntax.
  2. In cases where there are many different kinds of things to be constrained, this pattern gives rise to vast numbers of subproperties. For example, for the anatomy example, there would have to be one subproperty for each kind of body part.  And again, the parent property cannot be constrained so that there is no way of preventing expressions analogous to the extra desert in 1 above.
  3. In the case of n-ary relations, a separate property is similarly required for each feature type, which similarly gives rise to vast numbers of properties,e.g. hasTemperatureFeature, hasHeightFeature, etc.

5. Pattern III: Use a non-endorsed OWL extension

The Web Ontology Working Group has postponed the issue of full representation of QCR [WebOnt QCR issue], but has at the same time already suggestd an OWL representation for them [WebOnt QCR resolution]. It is not unlikely that this extension will be incoporatd into a future version of the language.  OWL users who require QCRs for use cases not well served by the work around in Pattern II may want to use this extension, even though they are not yet endorsed. (At least one widely used tool already supports QCRs as do many of the widely used classifiers.)

The syntax looks like this. Qualified restrictions resemble regular restrictions but contain one extra triple in the RDF representation and an extra argument in the abstract syntax. A simple cardinality constraint contains just two triples:

  1. owl:onProperty, pointing to the property concerned
  2. a cardinality constraint (owl:cardinality, owl:minCardinality or owl:maxCardinality), which restricts the number of values the property can take.

To this a qualified cardinality constraint need only add a third triple:

  1. owl:valuesFrom, pointing to the value type being restricted.

In the abstract syntax, we need only add an additional argument to the cardinality restrictions.

TODO: include ref plus discussion OWL 1.1 abstract syntax

The class "minimal italilan dinner" might be represented as:

:MinimalItalianDinner
    a owl:Class ;
    owl:equivalentClass
        [ a owl:Class ;
          owl:intersectionOf (
            [ a owl:Restriction ;
              owl:onProperty :hasCourse ; 
              owl:cardinality "3"^^xsd:nonNegativeInteger ]
            [ a owl:Restriction ;
              owl:onProperty :hasCourse ; 
              owl:cardinality "1"^^xsd:nonNegativeInteger ;
	      owl:valuesFrom :AntiPasto ]
            [ a owl:Restriction ;
              owl:onProperty :hasCourse ; 
              owl:cardinality "1"^^xsd:nonNegativeInteger ;
	      owl:valuesFrom :PrimoOrSecundoPiatto ]]
            [ a owl:Restriction ;
              owl:onProperty :hasCourse ;
              owl:cardinality "1"^^xsd:nonNegativeInteger 
	      owl:valuesFrom :Dolce ] ) ] .

The normal hand example can be expressed in a similar way:

:NormalHand
    a owl:Class ;
    rdfs:subClassOf :Hand ;
    owl:equivalentClass
        [ a owl:Class ;
          owl:intersectionOf (
              [ a owl:Restriction ;
                owl:onProperty :hasPart ;
                owl:cardinality "5"^^xsd:nonNegativeInteger ;
		owl:valuesFrom :Finger ] 
              [ a owl:Restriction ;
                owl:onProperty :hasPart ;
                owl:cardinality "1"^^xsd:nonNegativeInteger ;
		owl:valuesFrom :Thumb ] ) ] .

In this representation the pattern for many n-ary relations (use case 6) is illustrated by:

TODO

where hasLevel and hasTrend are functional properties but has_feature is not functional. Hence any patient might have many features (of which just two are shown here), but each Feature could have just one level and one trend.

A still more complex case, illustrated by use case 4 would be:

:MedicalOversightCommittee
    a owl:Class ;
    rdfs:subClassOf :Committee ;
    owl:equivalentClass
        [ a owl:Class ;
          owl:intersectionOf (
            [ a owl:Restriction ;
              owl:onProperty :hasMember ; 
              owl:minCardinality "5"^^xsd:nonNegativeInteger ]
            [ a owl:Restriction ;
              owl:onProperty :hasMember ; 
              owl:minCardinality "2"^^xsd:nonNegativeInteger ;
	      owl:valuesFrom :MedicalStaff ]
            [ a owl:Restriction ;
              owl:onProperty :hasMember ; 
              owl:cardinality "1"^^xsd:nonNegativeInteger ;
	      owl:valuesFrom :ManagerStaff ]]
            [ a owl:Restriction ;
              owl:onProperty :hasMember ;
              owl:cardinality "2"^^xsd:nonNegativeInteger 
	      owl:valuesFrom :MemberOfPublic ] ) ] .

Expressing this complex constraint using the work around in Representation Pattern II would require defining three separate subproperties of hasMember and would still not fully capture the constraints required.

Discussion

  1. This represtation is legal in OWL Full according to the current standard. According to the OWL Reference [OWL Reference], RDF/OWL parsers should produce a warning message when non-endorsed OWL vocabulary is used, but should otherwise proceed normally. However, the semantics will only be treated correctly by parsers and classifiers which are 'QCR aware'.
  2. As of the time of writing, Racer is known to support QCRs. FaCT++ is expected to do so shortly. Protege-OWL and the CO-ODE plugins provide syntactic and user interface support for an extension to OWL including QCRs.

  3. The intended semantics fully capture the intent of the use cases given.
  4. Simple cardinalty restrictions can be taken as a special case of Qualified Cardinality Restrictions where qualifying argument is valuesFrom(owl:Thing).

Appendix A: References

[Noy and Rector, 2006] Defining N-ary Relations on the Semantic Web. W3C Working Group Note 12 April 2006, Noy and Rector (eds.) http://www.w3.org/TR/swbp-n-aryRelations/.

[OWL Reference] OWL Web Ontology Language Reference. Mike Dean and Guus Schreiber, Editors. W3C Recommendation, 10 February 2004. Latest version available at http://www.w3.org/TR/owl-ref/.

[Rector, 2003] Alan Rector. Message to public-webont-comments@w3.org: "Case for Reinstatement of Qualified Cardinality Restrictions", http://lists.w3.org/Archives/Public/public-webont-comments/2003Apr/0040.html

[WebOnt QCR issue] Web Ontology Working Group, Issues list, November 2003. Issue 3,2 Qualified Restrictions. http://www.w3.org/2001/sw/WebOnt/webont-issues.html#I3.2-Qualified-Restrictions

[WebOnt QCR resolution] Web Ontology Working Group, message to www-webont-wg@w3.org: "Issue 3.2 QCR: proposal to POSTPONE" http://lists.w3.org/Archives/Public/www-webont-wg/2003May/0072.html

Appendix B: Change historys

Version May 8, 2006

Version November 2, 2005