1

Do you know how to translate recursion in SWRL. For example, this type of Prolog rules : (an ancestor is a parent or an ancestor of a parent.

ancestor(X,Y):- parent (X,Y).
ancestor(X,Y):- parent(X,Z), ancestor(Z,Y).
false
  • 10,264
  • 13
  • 101
  • 209
Hana
  • 101
  • 10

1 Answers1

0

In essence, SWRL is Datalog. Just reverse heads and bodies:

hasParent(?x, ?y) -> hasAncestor(?x, ?y)
hasAncestor(?y, ?z) ^ hasParent(?x, ?y) -> hasAncestor(?x, ?z)

SWRLTab in Protégé:

swrltab

Initial assertions:

asserted

Inferred (via Pellet) assertions:

inferred

Of course, pure OWL solution also exists.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58