Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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). C subClassOf (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. p(c,v)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...