Defining cardinality of data property in OWL

2019-03-05 23:42发布

Is it possible to define the cardinality of data property in OWL? For instance considering a class "Person" with the data property "Age", is there a way to declare that the data property "Age" must have a single value?

标签: rdf owl ontology
1条回答
家丑人穷心不美
2楼-- · 2019-03-05 23:56

You use the axiom that you would with an object property (DL and Manchester syntaxes):

Person ⊑ =1.hasAge
Person subClassOf hasAge exactly 1

Here's a small ontology with just such axioms:

@prefix :      <http://stackoverflow.com/q/24188632/1281433/people-have-exactly-one-age#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .

:Person  a               owl:Class ;
        rdfs:subClassOf  [ a                owl:Restriction ;
                           owl:cardinality  "1"^^xsd:nonNegativeInteger ;
                           owl:onProperty   :hasAge
                         ] .

<http://stackoverflow.com/q/24188632/1281433/people-have-exactly-one-age>
        a       owl:Ontology .

:hasAge  a      owl:DatatypeProperty .

Using exact cardinality restrictions with datatype properties is actually a little more convenient with datatype properties than with object properties in some situations, because reasoners (should be able to) recognize inequality among literals (e.g., 2 ≠ 3 and "foo" ≠ "bar") automatically, whereas individuals can have multiples names.

查看更多
登录 后发表回答