何检查类之间是否存在OWLObjectPropertyExpre

何检查类之间是否存在OWLObjectPropertyExpre

本文介绍了如何检查类之间是否存在OWLObjectPropertyExpression?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设有两种类型的类,一种(A)为"isManagedBy",另一种(B).摘下的以下猫头鹰说明了这种情况.有多个类型A的类(由其他类管理")和多个类型B的类.实际上,类型A的类bot和B之间的类之间也存在层次结构.

Assuming two types of classes, one (A) "isManagedBy" by the other (B). The following owl snipped illustrates this scenario. There are multiple classes of type A (which are "managed by" other classes) and multiple classes of B. In fact, there is also a hierarchy between between classes bot of type A and B.

<owl:ObjectProperty rdf:about="#isManagedBy"/>


<owl:Class rdf:about="#FunctionManagement">
 <rdfs:subClassOf rdf:resource="..."/>
 <rdfs:subClassOf>
   <owl:Restriction>
    <owl:onProperty rdf:resource="#isManagedBy"/>
    <owl:someValuesFrom rdf:resource="#SymposiumPlanner2013"/>
   </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>


<owl:Class rdf:about="#SymposiumPlanner2013"/>
...

问题:在给定任意类A的情况下,获取所有类型B的类.

Problem: Get all classes of type B given an arbitrary class A.

想法:遍历所有类型B的类.对于每个类B,请使用Reasoner的isSatisfiable()方法检查给定的A是否具有对类B的ObjectProperty"isManagedBy"(直接或继承).

Idea: Iterate over all classes of type B. For each class B, check whether a given A has an ObjectProperty "isManagedBy" (directly or inherited) to class B by using a Reasoner's isSatisfiable() method.

OWLObjectProperty objProp = df.getOWLObjectProperty(IRI.create("#isManagedBy"));
OWLClassExpression expression;
for (OWLClass B : SetOfAllBs) {
 expression = df.getOWLObjectIntersectionOf(A, df.getOWLObjectSomeValuesFrom(objProp, B));
 if (reasoner.isSatisfiable(expression)) {
   // do something
 }
}

不幸的是,推理机对于所有类型B的类都返回令人满意的结果.

Unfortunately, the reasoner returns satisfiable for all classes of type B.

问题:如何解决这个问题?

Question: How to solve this problem?

推荐答案

我可以为您的问题提供两种解决方案:

I can suggest two solutions to your problem:

  1. 遍历所有B,但要检查B的可满足性A and (isManagedBy only (not B)).如果某些B无法满足此表达式,则必须通过isManagedBy将此类B与给定的A连接.

  1. Go through all Bs, but instead check satisfiability ofA and (isManagedBy only (not B)). If this expression is unsatisfiable for some B, then such B has to be connected with a given A via isManagedBy.

如果使用FaCT ++进行推理,则可以使用OWLKnowledgeExplorerReasoner界面浏览在对类A进行满意度检查时生成的模型.想法是,如果模型中存在这样的B,则它必须连接到A.存在一些限制(它可能不适用于通过EquivalentClasses(B,...)定义的B,对于不确定的标签并不总是正确的(请参见getObjectLabel()调用中的flag true) ,但这是个主意.代码可能像这样:

If you are using FaCT++ for reasoning, you can use the OWLKnowledgeExplorerReasoner interface to explore the models produced during the satisfiability check of a class A. The idea is that if such B present in the model, then it has to be connected to A. There are some limitations (it might not work for Bs defined via EquivalentClasses(B,...), it is not always true for non-deterministic labels (see flag true in the getObjectLabel() call), but here is an idea. The code might looks like:

OWLReasoner factplusplus = new FactPlusPluReasonerFactore().createReasoner(o);
OWLKnowledgeExplorerReasoner ke = (OWLKnowledgeExplorerReasoner) factplusplus;
RootNode nodeForA = ke.getRoot(A);
for (RootNode filler: ke.getObjectNeighbours(nodeForA, isManagedBy))
    for (OWLClassExpression cls: ke.getObjectLabel(filler,true)
        if ( SetAllBs.contains(cls) )
            /* cls is what you are looking for */

这篇关于如何检查类之间是否存在OWLObjectPropertyExpression?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 18:20