Defining cardinality of data property in OWL

前端 未结 1 620
南方客
南方客 2020-12-22 07:39

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

相关标签:
1条回答
  • 2020-12-22 08:27

    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.

    0 讨论(0)
提交回复
热议问题