The cardinality constraint owl:cardinality
is a built-in OWL property that links a restriction class to a data value
belonging to the range of the XML Schema datatype
xsd:nonNegativeInteger.
A restriction containing an owl:cardinality constraint describes a class of all individuals that have exactly N semantically distinct values (individuals or data values) for the property concerned, where N is the value of the cardinality constraint.
owl:cardinality has owl:Restriction as domain, and xsd:nonNegativeInteger as range.
<rdf:Property rdf:ID="cardinality">
<rdfs:label>cardinality</rdfs:label>
<rdfs:domain rdf:resource="#Restriction"/>
<rdfs:range rdf:resource="&xsd;nonNegativeInteger"/>
</rdf:Property>
The following example describes a class of individuals that have exactly two parents:
<owl:Restriction>
<owl:onProperty rdf:resource="#hasParent" />
<owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">2</owl:cardinality>
</owl:Restriction>
In OWL, like in RDF, it is assumed that any instance of a class may have an arbitrary number (zero or more) of values for a particular property. To make a property required (at least one), to allow only a specific number of values for that property, or to insist that a property must not occur, cardinality constraints can be used. OWL provides three constructs for restricting the cardinality of properties locally within a class context.
NOTE: OWL Lite includes the use of all three types of cardinality constraints, but only when used with the values "0" or "1".
This construct is in fact redundant as it can always be replaced by a pair of
matching owl:minCardinality and
owl:maxCardinality constraints
with the same value. It is included as a convenient shorthand for the user.
Syntactically, the cardinality constraint is represented as an RDF
property element with the corresponding rdf:datatype attribute.