Why is this DL-Query not returning any individuals?

后端 未结 1 2089
终归单人心
终归单人心 2021-01-13 10:50

This DL-Query is not returning any individuals:

  • Query (Protégé syntax) : hasPet exactly 1 DomesticAnimal

Here\'s part of the ontolo

相关标签:
1条回答
  • 2021-01-13 11:39

    The class expression hasPet exactly 1 DomesticAnimal has as instances exactly those individuals which are related by the property hasPet to exactly one DomesticAnimal. Exactly one means at least one and no more than one. Based on the triples

    :Joe :hasPet :Lassy .
    :Bob :hasPet :Sparkey ;
         :hasPet :Lucky .
    

    we know that Joe and Bob each have at least one pet, but we do not know anything about how many they might have. Joe might have pets other than Lassy, so we don't know that Joe has exactly one pet. It is possible that Sparkey and Lucky happen to be the same individual, so Bob has at least one pet, but we do not have an upper bound on the number of pets that Bob has.

    OWL, as well as RDF, makes the open world assumption, which means that OWL does not assume that the data provided is an exhaustive enumeration of everything in the world that is true. If it did, there would be no point in inference. The absence of an assertion of s p o does not imply that NOT( s p o ), but rather just that there is no judgment yet on s p o.

    You can add some more knowledge to your data to get the conclusions that you want, though. You describe Joe with the following:

    Joe a Human ;
        hasPet Lassy ;
        hasPet only { Lassy } .
    
    Lassy a DomesticAnimal .
    

    From this you will be able to infer that

    Joe a (hasPet exactly 1 DomesticAnimal) .
    

    For Bob, it looks like you expect that Sparkey and Lucky are different animals, so you'll need owl:differentFrom:

    Bob a Human ;
        hasPet Sparkey, Lucky .
    
    Sparkey a DomesticAnimal .
    
    Lucky a DomesticAnimal ; 
          owl:differentFrom Sparkey .
    

    I did not include Bob hasPet only { Sparkey, Lucky } in these axioms, because they are not necessary to infer that Bob has more than one pet, but you could include it. I also included just one of the owl:differentFrom assertions that could have been made. Now Bob is known to have two distinct pets, and thus known to not be a hasPet exactly 1 DomesticAnimal. With this data loaded into Protégé, the DL query hasPet exactly 1 DomesticAnimal works as expected:

    enter image description here

    Example Ontology

    In case you want to be able to quickly load this structure into Protégé, here's an ontology with individuals, property, and axioms as described above. I did not define the petOf property, but you can still run your first two queries as inverse hasPet value Joe and inverse hasPet value Bob and get the expected results.

    @prefix :        <http://www.example.com/owa#> .
    @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#> .
    @prefix owa:     <http://www.example.com/owa#> .
    
    owa:Bob
          a       owl:NamedIndividual , owa:Human ;
          owa:hasPet owa:Sparkey , owa:Lucky .
    
    owa:Sparkey
          a       owl:NamedIndividual , owa:DomesticAnimal .
    
    owa:Lassy
          a       owl:NamedIndividual , owa:DomesticAnimal .
    
    []    a       owl:AllDifferent ;
          owl:distinctMembers (owa:Lucky owa:Sparkey) .
    
    owa:Joe
          a       owl:NamedIndividual , owa:Human ;
          a       [ a       owl:Restriction ;
                    owl:allValuesFrom
                            [ a       owl:Class ;
                              owl:oneOf (owa:Lassy)
                            ] ;
                    owl:onProperty owa:hasPet
                  ] ;
          owa:hasPet owa:Lassy .
    
    <http://www.example.com/owa>
          a       owl:Ontology .
    
    owa:Lucky
          a       owl:NamedIndividual , owa:DomesticAnimal .
    
    owa:Human
          a       owl:Class .
    
    owa:hasPet
          a       owl:ObjectProperty .
    
    owa:DomesticAnimal
          a       owl:Class .
    
    0 讨论(0)
提交回复
热议问题