递归:从Prolog到SWRL

时间:2017-04-08 18:13:50

标签: prolog swrl

您知道如何在SWRL中翻译递归吗?例如,这种类型的Prolog规则:(祖先是父母或父母的祖先。

ancestor(X,Y):- parent (X,Y).
ancestor(X,Y):- parent(X,Z), ancestor(Z,Y).

1 个答案:

答案 0 :(得分:0)

实质上,SWRL是Datalog。只需转动头部和身体:

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

Protégé的SWRLTab:

swrltab

初始断言:

asserted

推断(通过Pellet)断言:

inferred

当然,纯OWL解决方案也存在。