Chris@14
|
1 :- module(classical_mapping,[]).
|
Chris@14
|
2
|
Chris@14
|
3 /**
|
Chris@14
|
4 * Classical mapping for 303 redirects
|
Chris@14
|
5 */
|
Chris@14
|
6
|
Chris@14
|
7 :- use_module(mapping).
|
Chris@14
|
8
|
Chris@14
|
9 sparql_end_point('http://dbtune.org/classical/sparql/').
|
Chris@14
|
10 directory('http://dbtune.org/classical/all/').
|
Chris@14
|
11 namespace('http://dbtune.org/classical/').
|
Chris@14
|
12
|
Chris@14
|
13 /**
|
Chris@14
|
14 * Redirecting resources whithin the namespace
|
Chris@14
|
15 */
|
Chris@14
|
16
|
Chris@14
|
17 mapping:see_other_rdf(requested_pattern(T),redirect_pattern([SparqlEndPoint,'?query=describe%20%3C',NameSpace,Path,'%3E'])) :-
|
Chris@14
|
18 T\=[all,_],
|
Chris@14
|
19 sparql_end_point(SparqlEndPoint),
|
Chris@14
|
20 namespace(NameSpace),
|
Chris@14
|
21 concat_atom(T,'/',Path).
|
Chris@14
|
22 mapping:see_other(requested_pattern(T),redirect_pattern([Renderer,NameSpace,Path])) :-
|
Chris@14
|
23 T\=[all,_],
|
Chris@14
|
24 html_renderer(Renderer),
|
Chris@14
|
25 namespace(NameSpace),
|
Chris@14
|
26 concat_atom(T,'/',Path).
|
Chris@14
|
27
|
Chris@14
|
28
|
Chris@14
|
29 /**
|
Chris@14
|
30 * directories
|
Chris@14
|
31 */
|
Chris@14
|
32 directory_query(Concept,
|
Chris@14
|
33 [SparqlEndPoint,
|
Chris@14
|
34 '?query=construct { %3fx a ', Concept,
|
Chris@14
|
35 '} where { %3fx a ', Concept, '.}'
|
Chris@14
|
36 ]) :-
|
Chris@14
|
37 sparql_end_point(SparqlEndPoint).
|
Chris@14
|
38
|
Chris@14
|
39 mapping:see_other_rdf(requested_pattern([all,artist]), redirect_pattern(Query)) :-
|
Chris@14
|
40 directory_query('%3Chttp://dbtune.org/classical/resource/type/Composer%3E', Query).
|
Chris@14
|
41
|
Chris@14
|
42 mapping:see_other(requested_pattern([all,Concept]),redirect_pattern([Renderer,Directory,Concept])) :-
|
Chris@14
|
43 html_renderer(Renderer),
|
Chris@14
|
44 directory(Directory).
|