0

我有一个 OWL 本体,其中包含三个相互关联的个体:abc,并且还有两个孤立的个体xy

相互关联的个人

  1. 至少有一个出站对象属性断言。例如:a hasRelationWith b;或者
  2. 至少有入站对象属性断言,例如:如 c,如 b hasRelationWith c

孤立的个体

  1. 出站对象属性断言为零,例如:x hasRelationWith [no individual];和
  2. 具有零入站对象属性断言,例如:例如 x,如 [no individual] hasRelationWith x

是否可以使用 DL 查询(在 Protégé 4.3 中,如果有影响的话)对所有孤立的个体进行分类(通过逻辑推理,而不是通过枚举),如果有可能,我该怎么做?

我的直觉猜测是这样的:(hasRelationWith min 0 Thing)排除(hasRelationWith min 1 Thing),但DL-Query似乎不支持Set Subtraction语法......


更新:以下 SPARQL 可以做到,尽管它不能在类定义中使用。

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX my: <http://localhost:8080/ontology/untitled-ontology-26#>
SELECT DISTINCT ?src_obj
WHERE {
  ?src_obj a owl:NamedIndividual .
  minus {?src_obj my:hasRelationWith ?target_obj}
  minus {?target_obj my:hasRelationWith ?src_obj}
}
4

1 回答 1

1

You can query about what's logically provable. That means that if you can infer that some individual isn't related to any others by some property, you can ask about it. For instance, if you have disjoint classes Cat and Dog, so that nothing can be an instance of both, and you have a Person jim who also has the additional type hasPet only Cat and Dog, then a reasoner can infer that jim hasPet exactly 0.

In the DL query language, you can also use inverse properties. The previous example showed that jim has no pets (i.e., is an instance of hasPet exactly 0). You could ask for animals that aren't the pets of anyone by asking for instances of inverse hasPet exactly 0. For instance, if you add disjoint subclasses of Person, ThisKind and ThatKind, and say that missy the Cat inverse hasPet only ThisKind and ThatKind, then a reasoner can infer that no one is related to missy by the hasPet property. An ontology for these two examples is given at the end of this answer.

For your particular query, you just combine two class expressions of the forms I've just described:

hasRelationWith exactly 0 and inverse hasRelationWith exactly 0

or, with some parenthesis:

(hasRelationWith exactly 0) and ((inverse hasRelationWith) exactly 0)

It is very important to note, however, that this only returns individuals for which it can be proven that there are no such relations. It's not enough for the data to simply not contain such relations yet. OWL makes the open world assumption, meaning something that isn't explicitly stated or provable isn't assumed to be true or false.

Example ontology

@prefix :      <http://www.example.org/cardinality-example#> .
@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#> .

:fido   a       owl:NamedIndividual , :Dog .

:Dog    a       owl:Class .

:fluffy  a      owl:NamedIndividual , :Cat ;
        a       [ a                   owl:Class ;
                  owl:intersectionOf  ( :ThatKind [ a                  owl:Restriction ;
                                                    owl:allValuesFrom  :ThisKind ;
                                                    owl:onProperty     [ owl:inverseOf  :hasPet ]
                                                  ] )
                ] .

:ThatKind  a              owl:Class ;
        rdfs:subClassOf   :Person ;
        owl:disjointWith  :ThisKind .

:rover  a       owl:NamedIndividual , :Dog .

:hasPet  a      owl:ObjectProperty .

<http://www.example.org/cardinality-example>
        a       owl:Ontology .

:Person  a      owl:Class .

:jim    a       owl:NamedIndividual , :Person ;
        a       [ a                owl:Restriction ;
                  owl:cardinality  "0"^^xsd:nonNegativeInteger ;
                  owl:onProperty   :hasPet
                ] .

:missy  a       owl:NamedIndividual , :Cat .

:Cat    a                 owl:Class ;
        owl:disjointWith  :Dog .

:ThisKind  a             owl:Class ;
        rdfs:subClassOf  :Person .
于 2013-10-14T15:17:08.387 回答