SWRL规则内的析取 [英] Disjunction inside SWRL rule

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

问题描述

我正在使用Protege 4.3制定一些SWRL规则. 是否可以编写其中包含析取的规则 例如:

I am using Protege 4.3 to make some SWRL rules. Is it possible to write a rule that contains a disjunction in it For instance :

Person(?x), Age(?x,?age), (?age < 10 or ?age > 30) -> blabla(?x)

表示所有年龄< 10 OR > 30

Meaning all people having age < 10 OR > 30

推荐答案

不幸的是,您无法在规则主体中直接表达析取关系,但是有一些解决方法.最直接的解决方案是编写两个规则:

You can't directly express a disjunction in the rule body the way that you'd like to, unfortunately, but there are some workarounds. The most direct solution is to write two rules:

人(?x),年龄(?x,?age)、? age< 10-> blah(?x)
人(?x),年龄(?x,?age)、? age> 30-> blah(?x)

Person(?x), Age(?x,?age), ?age < 10 -> blah(?x)
Person(?x), Age(?x,?age), ?age > 30 -> blah(?x)

SWRL支持使用类表达式(请参阅Martin Kuba的 OWL 2和SWRL教程 ),因此您可以执行以下操作:

SWRL does support the use of class expressions (see more in Martin Kuba's OWL 2 and SWRL Tutorial), so you could do this:

Person(?x),((某年龄xsd:integer [<10])或(某年龄xsd:integer [> 30]))(?x)-> blah(?x)

Person(?x), ((some Age xsd:integer[< 10]) or (some Age xsd:integer[> 30]))(?x) -> blah(?x)

但是您不能在Protege中输入该规则,即使您在其他本体编辑器中编写或手动编写该规则,Protege也可以显示正确.您可以简单地做到这一点,然后执行以下操作:

but you won't be able to enter that rule in Protege, even though if you write it in some other ontology editor, or write it by hand, Protege can display it correctly. You could simply that even more and do this:

Person(?x),((某年龄(xsd:integer [<10]或xsd:integer [> 30]))(?x)-> blah(?x)

Person(?x), ((some Age (xsd:integer[< 10] or xsd:integer[> 30]))(?x) -> blah(?x)

甚至是父亲,请这样做:

or even father and do this:

(人和(某年龄(xsd:integer [<10]或xsd:integer [> 30])))(?x)-> blah(?x)

(Person and (some Age (xsd:integer[< 10] or xsd:integer[> 30])))(?x) -> blah(?x)

当然,在这一点上,根据 blah(?x)是什么,您也许可以仅使用Protege将接受的通用类公理.例如,如果 blah 实际上是 Not10To30YearOldPerson 类,则可以使用如下公理:

Of course, at this point, depending on what blah(?x) is, you might be able to just use a general class axiom that Protege will accept. E.g., if blah is actually a class, Not10To30YearOldPerson, you can use an axiom like:

人员(年龄一些(xsd:integer [< 10] xsd:integer [> 30])) subClassOf不是 TenToThirtyYearOldPerson

Person and (age some (xsd:integer[< 10] or xsd:integer[> 30])) subClassOf not TenToThirtyYearOldPerson

这篇关于SWRL规则内的析取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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