-
Notifications
You must be signed in to change notification settings - Fork 0
/
rewrite_gtaa.pl
96 lines (78 loc) · 1.23 KB
/
rewrite_gtaa.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
:- module(rewrite_gtaa,
[ rewrite/0,
rewrite/1,
rewrite/2,
list_rules/0
]).
:- use_module(library(semweb/rdf_db)).
:- use_module(library(xmlrdf/rdf_convert_util)).
:- use_module(library(xmlrdf/cvt_vocabulary)).
:- use_module(library(xmlrdf/rdf_rewrite)).
:- use_module(library(http/http_open)).
:- debug(rdf_rewrite).
%% rewrite
%
% Apply all rules on the graph =data=
rewrite :-
rdf_rewrite(data).
%% rewrite(+Rule)
%
% Apply the given rule on the graph =data=
rewrite(Rule) :-
rdf_rewrite(data, Rule).
%% rewrite(+Graph, +Rule)
%
% Apply the given rule on the given graph.
rewrite(Graph, Rule) :-
rdf_rewrite(Graph, Rule).
%% list_rules
%!
% List the available rules to the console.
list_rules :-
rdf_rewrite_rules.
:- discontiguous
rdf_mapping_rule/5.
useuri
@@
{S, rdf:about, literal(URI)}\
{S}
<=>
{URI}.
predbn
@@
{S, Pred, BN},
{BN, rdf:type, _},
{BN, rdf:resource, literal(R)}
<=>
rdf_is_bnode(BN),
{S, Pred, R}.
clean_desc
@@
{_, rdf:description, _}
<=>
true.
clean_desc
@@
{_, rdf:type, rdf:'Description'}
<=>
true.
clean_oai
@@
{_, oai:server, _}
<=>
true.
clean_oai
@@
{_, oai:datestamp, _}
<=>
true.
clean_oai
@@
{_, oai:identifier, _}
<=>
true.
clean_oai
@@
{_, rdf:type, oai:'Record'}
<=>
true.