Is it possible to make property assertions on class level in OWL 2?

半城伤御伤魂 提交于 2019-12-18 09:28:45

问题


I have an OWL 2 ontology containing several named individuals belonging to a class that need to have the same object property with the same value.

I would like to make this property assertion "on the class" in such a way that a reasoner could infer the property to be had by all of its members, thus without needing an explicit assertion for each. (obtaining something similar to a class-based object-oriented property inheritance)

A simple example could be an ontology containing the individuals milkBottle1, milkBottle2, milkBottle3 that belong to the class Milk. They should all have the property containsNutrient with the value protein, but clearly this is something that is shared by all members of the Milk class and should only be explicitly asserted once.

I have found the same question only here, but the only answer suggests an inappropriate solution: to make the class a subclass of a property restriction class. This leads the reasoner to infer the class to be equivalent to the Nothing class (since there are no named individuals with such property), thus creating an inconsistence because of the assignment of individuals to it.

I am aware that this is a straightforward task using a SWRL rule like

Milk(?a) → containsNutrient(?a, protein)

but I'd like to avoid them if possible.

Is this possible without workarounds in OWL 2? If so, how can it be done?


回答1:


I would like to make this property assertion "on the class" in such a way that a reasoner could infer the property to be had by all of its members, thus without needing an explicit assertion for each. (obtaining something similar to a class-based object-oriented property inheritance)

If you want to say that every member of some class C has individual v as the value for property p, you can write:

C subClassOf (p value v)

Now, regarding your additional comment:

I have found the same question only here, but the only answer suggests an inappropriate solution: to make the class a subclass of a property restriction class. This leads the reasoner to infer the class to be equivalent to the Nothing class (since there are no named individuals with such property), thus creating an inconsistence because of the assignment of individuals to it.

What I've just suggested is the same as what's described in that answer. There's nothing inconsistent about saying "C subClassOf (p value v)", even if there are no declared named individuals of type C. If you're running into some particular problem with this type of solution, you may want to elaborate on it (and perhaps ask an additional question); the axiom C subClassOf (p value v) subsumes the SWRL rule C(?c) → p(?c,v). (The SWRL rule is less general because it only applies to named individuals, whereas the axiom applies to all individuals.)

Example

Figure 1: C is a subclass of (p value v).

Figure 2: When a reasoner has been enabled, individual c of type C is inferred to have v as a value for property p.

Ontology (TTL and RDF/XML)

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

:c      a       owl:NamedIndividual , :C .

:C      a                owl:Class ;
        rdfs:subClassOf  [ a               owl:Restriction ;
                           owl:hasValue    :v ;
                           owl:onProperty  :p
                         ] .

:p      a       owl:ObjectProperty .

:       a       owl:Ontology .

:v      a       owl:Thing , owl:NamedIndividual .
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns="http://stackoverflow.com/q/29075078/1281433#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
  <owl:Ontology rdf:about="http://stackoverflow.com/q/29075078/1281433#"/>
  <owl:Class rdf:about="http://stackoverflow.com/q/29075078/1281433#C">
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty>
          <owl:ObjectProperty rdf:about="http://stackoverflow.com/q/29075078/1281433#p"/>
        </owl:onProperty>
        <owl:hasValue>
          <owl:Thing rdf:about="http://stackoverflow.com/q/29075078/1281433#v">
            <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
          </owl:Thing>
        </owl:hasValue>
      </owl:Restriction>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:NamedIndividual rdf:about="http://stackoverflow.com/q/29075078/1281433#c">
    <rdf:type rdf:resource="http://stackoverflow.com/q/29075078/1281433#C"/>
  </owl:NamedIndividual>
</rdf:RDF>


来源:https://stackoverflow.com/questions/29075078/is-it-possible-to-make-property-assertions-on-class-level-in-owl-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!