annotate jamendo/sparql-archived/rdf_compile.pl @ 27:d95e683fbd35
tip
Enable CORS on urispace redirects as well
author |
Chris Cannam |
date |
Tue, 20 Feb 2018 14:52:02 +0000 |
parents |
df9685986338 |
children |
|
rev |
line source |
Chris@0
|
1 :- module(rdf_compile,[init_db/0,rdf_compile/0]).
|
Chris@0
|
2
|
Chris@0
|
3 /**
|
Chris@0
|
4 * Compile possible RDF statements to
|
Chris@0
|
5 * improve responsiveness of the sparql
|
Chris@0
|
6 * end point, but loose the dynamicity of
|
Chris@0
|
7 * the underlying data
|
Chris@0
|
8 */
|
Chris@0
|
9
|
Chris@0
|
10 :- use_module(p2r_entailment).
|
Chris@0
|
11 :- use_module(library('semweb/rdf_persistency')).
|
Chris@0
|
12 :- use_module(library('semweb/rdf_db')).
|
Chris@0
|
13
|
Chris@0
|
14 init_db :-
|
Chris@0
|
15 nl,writeln(' - Attaching DB...'),nl,
|
Chris@0
|
16 rdf_attach_db('db',[]),
|
Chris@0
|
17 settings:set_setting(serql_parms:default_entailment, rdfs).
|
Chris@0
|
18
|
Chris@0
|
19 rdf_compile :-
|
Chris@0
|
20 nl,writeln(' - Deriving all possible RDF statements'),nl,
|
Chris@0
|
21 setof(
|
Chris@0
|
22 rdf(A,B,C)
|
Chris@0
|
23 ,
|
Chris@0
|
24 p2r_entailment:rdf(A,B,C)
|
Chris@0
|
25 ,
|
Chris@0
|
26 Triples
|
Chris@0
|
27 ),
|
Chris@0
|
28 length(Triples,N),
|
Chris@0
|
29 nl,write(' - Number of derived RDF statements: '),write(N),nl,nl,
|
Chris@0
|
30 assert_l(Triples).
|
Chris@0
|
31
|
Chris@0
|
32 assert_l([]).
|
Chris@0
|
33 assert_l([rdf(A,B,C)|T]) :-
|
Chris@0
|
34 rdf_assert(A,B,C),
|
Chris@0
|
35 assert_l(T).
|
Chris@0
|
36
|