-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathowl2_fol.pl
142 lines (105 loc) · 3.34 KB
/
owl2_fol.pl
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
:- [def_mm].
:- [owl2_operators].
to_fol(A equivalent B, (all New: ((Fa) <=> (Fb)))) :-
to_fol(New, A, Fa), to_fol(New, B, Fb).
to_fol(A is_a B, (all New: ((Fa) => (Fb)))) :-
to_fol(New, A, Fa), to_fol(New, B, Fb).
to_fol(A disjoint B, (all New: (Fa => ~Fb))) :-
to_fol(New, A, Fa),
to_fol(New, B, Fb).
to_fol(A assert B, F) :-
to_fol(B, A, F).
to_fol(P assert_p [A, B], F) :-
F=..[P,A,B].
to_fol(P negative_p [A, B], ~F) :-
F=..[P,A,B].
to_fol(A same B, A = B).
to_fol(A domain B, (all NewA: (Fa => Fb))) :-
Fa=..[A,NewA,_],
to_fol(NewA, B, Fb).
to_fol(A range B, (all NewA: (Fa => Fb))) :-
Fa=..[A,_,NewA],
to_fol(NewA, B, Fb).
to_fol(A subproperty B, (all X: (all Y: (Fa => Fb)))) :-
Fa=..[A,X,Y],
Fb=..[B,X,Y].
to_fol(A equivalent_p B, (all X: (all Y: (Fa <=> Fb)))) :-
Fa=..[A,X,Y],
Fb=..[B,X,Y].
to_fol(A disjoint_p B, (all X: (all Y: (Fa <=> ~Fb)))) :-
Fa=..[A,X,Y],
Fb=..[B,X,Y].
to_fol(A inverse B, (all X: (all Y: (Fa => Fb)))) :-
Fa=..[A,X,Y],
Fb=..[B,Y,X].
to_fol(symmetric A, (all X: (all Y: (Fa <=> Fb)))) :-
Fa=..[A,X,Y],
Fb=..[A,Y,X].
to_fol(asymmetric A, (all X: (all Y: (Fa => ~Fb)))) :-
Fa=..[A,X,Y],
Fb=..[A,Y,X].
to_fol(transitive A, (all X: (all Y: (all Z: (Fa, Fb => Fc))))) :-
Fa=..[A,X,Y],
Fb=..[A,Y,Z],
Fc=..[A,X,Z].
to_fol(functional A, (all X: (all Y: (all Z: ((Fa, Fb) => (Y=Z)))))) :-
Fa=..[A,X,Y],
Fb=..[A,X,Z].
to_fol(inverse_functional A, (all X: (all Y: (all Z: ((Fa, Fb) => (X=Z)))))) :-
Fa=..[A,X,Y],
Fb=..[A,Z,Y].
to_fol(reflexive A, (all X: Fa)) :-
Fa=..[A,X,X].
to_fol(irreflexive A, (all X: ~Fa)) :-
Fa=..[A,X,X].
to_fol(_ disjoint_union _, []) :- !. % FIXME
to_fol(individual _, []) :- !.
to_fol(class _, []) :- !. % does not generate clauses
to_fol(property _, []) :- !. % does not generate clauses
% individual
to_fol(A, A) :-
atom(A).
% equality
to_fol((A different B), (A=Fb)) :- % WRONG
to_fol(B, Fb).
% class expessions
to_fol(New, A and B, (Fa , Fb)) :-
to_fol(New, A, Fa),
to_fol(New, B, Fb).
to_fol(New, A or B, (Fa ; Fb)) :-
to_fol(New, A, Fa),
to_fol(New, B, Fb).
to_fol(New, A some B, (ex NewNew: (Fa, Fb))) :-
to_fol(New, NewNew, A, Fa),
to_fol(NewNew, B, Fb).
to_fol(New, A any B, (all NewNew: (Fa => Fb))) :-
to_fol(New, NewNew, A, Fa),
to_fol(NewNew, B, Fb).
to_fol(New, not A, (~(Fa))) :-
to_fol(New, A, Fa).
to_fol(New, A one B, (New = A; New = B)) :-
atom(A), atom(B).
to_fol(New, A one B, (New = A; Fb)) :-
to_fol(New, B, Fb).
to_fol(New, A value B, (Fa)) :-
Fa=..[A,New,B].
to_fol(New, self A, (Fa)) :-
Fa=..[A,New,New].
% TODO: cardinality axioms
to_fol(_New, [_Number, _P] min _A, unknow).
to_fol(_New, _Number min _A, unknow).
to_fol(_New, [_Number, _P] min_d _A, unknow).
to_fol(_New, _Number min_d _A, unknow).
to_fol(_New, [_Number, _P] max _A, unknow).
to_fol(_New, _Number max _A, unknow).
to_fol(_New, [_Number, _P] max_d _A, unknow).
to_fol(_New, _Number max_d _A, unknow).
to_fol(_New, [_Number, _P] exact _A, unknow).
to_fol(_New, _Number exact _A, unknow).
to_fol(_New, [_Number, _P] exact_d _A, unknow).
to_fol(_New, _Number exact_d _A, unknow).
to_fol(New, A, (Fa)) :-
Fa=..[A,New].
% to_fol with 4 args
to_fol(New, NewNew, A, (Fa)) :-
Fa=..[A,New, NewNew].