使用SWRL规则进行OWL 2推理 [英] OWL 2 reasoning with SWRL rules

查看:806
本文介绍了使用SWRL规则进行OWL 2推理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 HermiT推理程序为包含一个OWL公理集和SWRL规则:

I'm trying to use the HermiT reasoner to compute inferences for an ontology which contains a set of OWL axioms and a SWRL rule:

Ontology(
  ClassAssertion( :Student :Bob )
  ClassAssertion( :Professor :DrBoffin )
  ClassAssertion( :University :UF )
  ObjectPropertyAssertion( :supervises :DrBoffin :Bob )
  ObjectPropertyAssertion( :worksAt :DrBoffin :UF )

  EquivalentClasses( :Student ObjectHasSelf( :r1 ))
  EquivalentClasses(
    ObjectHasSelf( :r2 )
    ObjectSomeValuesFrom( :worksAt :University ))
  SubObjectPropertyOf(
    ObjectPropertyChain( :r2 :supervises :r1 ) :professorOf )

  DLSafeRule(Body(ObjectPropertyAtom( :professorOf Variable( ?x ) Variable( ?y )))
             Head(ObjectPropertyAtom( :instructorOf Variable( ?x ) Variable( ?y ))))
)

基本上,OWL部分正在尝试表达这样的规则:

Basically, the OWL part is trying to express such a rule:

worksAt(x, y), University(y), supervises(x, z), Student(z) -> professorOf(x, z)

使用财产链和精化技术:

SWRL部分是:

professorOf(x, y) -> instructorOf(x, y)

预期输出应同时包含ObjectPropertyAssertion( :professorOf :DrBoffin :Bob )ObjectPropertyAssertion( :instructorOf :DrBoffin :Bob ).但是,实际输出是(仅显示对象属性)

The expected output should contain both ObjectPropertyAssertion( :professorOf :DrBoffin :Bob ) and ObjectPropertyAssertion( :instructorOf :DrBoffin :Bob ). However, the actual output is (showing only object properties)

ObjectPropertyAssertion( :r1 :Bob :Bob )
ObjectPropertyAssertion( :professorOf :DrBoffin :Bob )
ObjectPropertyAssertion( :r2 :DrBoffin :DrBoffin )
ObjectPropertyAssertion( :supervises :DrBoffin :Bob )
ObjectPropertyAssertion( :worksAt :DrBoffin :UF)

为什么未显示预期的SWRL结果?有什么建议吗?

Why isn't the expected SWRL result showing up? Any suggestions?

推荐答案

重新阅读您的问题后,我意识到您要代表的规则是

After re-reading your question, I realized that the rule you are trying to represent is

worksAt(x,y),University(y),主管(x,z),Student(z)→ ProfessorOf(x,z)

worksAt(x, y), University(y), supervises(x, z), Student(z) → professorOf(x, z)

但是您实际上是要用

(在某所大学工作)(x),主管(x,z),学生(z)→ ProfessorOf(x,z)

(worksAt some University)(x), supervises(x, z), Student(z) → professorOf(x, z)

这实际上是有效的SWRL规则,即使它具有复杂的类表达式也是如此. (请参阅可以在SWRL规则中使用OWL类表达式吗?更多信息.即使它们有效,Protégé编辑器也不会接受该输入,尽管如果它们已经在本体中,它将正确显示规则.)

which is actually a valid SWRL rule, even though it has a complex class expression. (See Can OWL Class Expressions be used in SWRL Rules? for more information. Even though they're valid, the Protégé editor didn't accept that input, though it would display rules correctly if they are already in the ontology.)

尽管可以用SWRL表示,但这仅涵盖个人被命名的情况,因此基于rolification的解决方案将涵盖更多的情况.因此,我们的想法是创建一个角色rWorksAtSomeUniversity(worksAt some University的化)和一个角色rStudent(Student的化),然后断言

Although it can be expressed in SWRL, that will only cover cases where the individuals are named, so the rolification based solution will cover more cases. So, the idea is to create a role rWorksAtSomeUniversity (the rolification of worksAt some University) and a role rStudent (the rolification of Student, and then to assert that

rWorksAtSomeUniversity o supervises o rStudent SubPropertyOf professorOf

然后,要关联professorOfinstructorOf,您可以使用SWRL规则

Then, to relate professorOf and instructorOf, you can either use a SWRL rule

professorOf(x,y)→讲师Of(x,y)

professorOf(x,y) → instructorOf(x,y)

或子财产公理

professorOf SubPropertyOf instructorOf

与基于巡回规则的规则一样,非SWRL规则将涵盖更多情况,并且不需要推理机具有SWRL支持.

As with rolification-based rule, the non-SWRL rule will cover more cases, and does not require that the reasoner have SWRL support.

这是一个包含这些类和公理的OWL功能语法的本体.它不是很容易让人理解的,但是它是完整的.您应该可以下载它并使用推理机进行测试.

Here's an ontology that contains these classes and axioms, in the OWL functional syntax. It's not wonderfully human readable, but it's complete; you should be able to download it and test it out with your reasoner.

Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(ex:=<http://www.example.com/university#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)

Ontology(<http://www.example.com/university>

Declaration(Class(ex:Professor))
Declaration(Class(ex:Student))
EquivalentClasses(ex:Student ObjectHasSelf(ex:rStudent))
Declaration(Class(ex:University))
Declaration(ObjectProperty(ex:instructorOf))
Declaration(ObjectProperty(ex:professorOf))
SubObjectPropertyOf(ex:professorOf ex:instructorOf)
Declaration(ObjectProperty(ex:rStudent))
Declaration(ObjectProperty(ex:rWorksAtSomeUniversity))
Declaration(ObjectProperty(ex:supervises))
Declaration(ObjectProperty(ex:worksAt))
Declaration(NamedIndividual(ex:Bob))
ClassAssertion(ex:Student ex:Bob)
Declaration(NamedIndividual(ex:DrBoffin))
ClassAssertion(ex:Professor ex:DrBoffin)
ObjectPropertyAssertion(ex:supervises ex:DrBoffin ex:Bob)
ObjectPropertyAssertion(ex:worksAt ex:DrBoffin ex:UF)
Declaration(NamedIndividual(ex:UF))
ClassAssertion(ex:University ex:UF)
EquivalentClasses(ObjectHasSelf(ex:rWorksAtSomeUniversity) ObjectSomeValuesFrom(ex:worksAt ex:University))
SubObjectPropertyOf(ObjectPropertyChain(ex:rWorksAtSomeUniversity ex:supervises ex:rStudent) ex:professorOf)
)

Pellet和HermiT 1.3.7均可产生推论:

Both Pellet and HermiT 1.3.7 can produce the inferences:

DrBoffin professorOf Bob
DrBoffin instructorOf Bob

这篇关于使用SWRL规则进行OWL 2推理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆