문제

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)

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:

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

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), ((some Age xsd:integer[< 10]) or (some Age xsd:integer[> 30]))(?x) -> blah(?x)

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), ((some Age (xsd:integer[< 10] or xsd:integer[> 30]))(?x) -> blah(?x)

or even father and do this:

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

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:

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

axiom instead of rule

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top