-
Notifications
You must be signed in to change notification settings - Fork 0
/
translation-rules.n3
40 lines (35 loc) · 1.21 KB
/
translation-rules.n3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>.
@prefix : <http://eulersharp.sourceforge.net/2005/11swap/zebra#>.
@prefix aux: <http://example.org/aux#>.
aux:rule a aux:transrule.
#forward
{
aux:rule a aux:transrule.
?a => ?b.
?a log:notIncludes {aux:rule a aux:transrule.}.
{?a =>?b} e:labelvars ?out.
?out log:equalTo {?a2 => ?b2}.
?a2 e:graphList ?alist.
?b2 e:graphList ?blist.
?alist aux:varlist ?avars.
?blist aux:varlist ?bvars.
?avars list:removeDuplicates ?list.
?bvars list:removeDuplicates ?listb.
(?listb ?list) aux:difference ?restb.
(?a2 {?restb log:onNegativeSurface ?b2} ) log:conjunction ?c
}=>{?list log:onNegativeSurface ?c. }.
#backward
{
aux:rule a aux:transrule.
?b <= ?a.
?a log:notIncludes {aux:rule a aux:transrule.}.
{?b <= ?a} e:labelvars ?out.
# here we make the assumption that there are no new variables in the head of the rule since it is a backwards rule.
?out log:equalTo {?b2 <= ?a2}.
?a2 e:graphList ?alist.
?alist aux:varlist ?avars.
?avars list:removeDuplicates ?list.
(?a2 {() log:onQuerySurface ?b2} ) log:conjunction ?c
}=>{?list log:onNegativeSurface ?c. }.