annotate peel/urispace/peel_mapping.pl @ 27:d95e683fbd35 tip

Enable CORS on urispace redirects as well
author Chris Cannam
date Tue, 20 Feb 2018 14:52:02 +0000
parents 6c62142a8b93
children
rev   line source
Chris@8 1 :- module(peel_mapping,[]).
Chris@7 2
Chris@7 3 /**
Chris@8 4 * Peel mapping for 303 redirects
Chris@7 5 */
Chris@7 6
Chris@7 7
Chris@7 8 :- use_module(mapping).
Chris@7 9
Chris@7 10
Chris@7 11 sparql_end_point('http://dbtune.org/bbc/peel/sparql/').
Chris@7 12 html_renderer('http://dig.csail.mit.edu/2005/ajar/ajaw/tab.html?uri=').
Chris@7 13 directory('http://dbtune.org/bbc/peel/all/').
Chris@7 14 namespace('http://dbtune.org/bbc/peel/').
Chris@7 15
Chris@7 16 /**
Chris@7 17 * Redirecting resources whithin the namespace
Chris@7 18 */
Chris@7 19
Chris@7 20 mapping:see_other_rdf(requested_pattern(T),redirect_pattern([SparqlEndPoint,'?query=describe%20%3C',NameSpace,Path,'%3E'])) :-
Chris@7 21 T\=[all,_],
Chris@7 22 sparql_end_point(SparqlEndPoint),
Chris@7 23 namespace(NameSpace),
Chris@7 24 concat_atom(T,'/',Path).
Chris@7 25 mapping:see_other(requested_pattern(T),redirect_pattern([Renderer,NameSpace,Path])) :-
Chris@7 26 T\=[all,_],
Chris@7 27 html_renderer(Renderer),
Chris@7 28 namespace(NameSpace),
Chris@7 29 concat_atom(T,'/',Path).
Chris@7 30
Chris@7 31
Chris@7 32 /**
Chris@7 33 * directories
Chris@7 34 */
Chris@7 35 directory_query(Concept,
Chris@7 36 [SparqlEndPoint,
Chris@7 37 '?query=construct { %3fx a ', Concept,
Chris@7 38 '} where { %3fx a ', Concept, '.}'
Chris@7 39 ]) :-
Chris@7 40 sparql_end_point(SparqlEndPoint).
Chris@7 41
Chris@7 42 mapping:see_other_rdf(requested_pattern([all,artist]), redirect_pattern(Query)) :-
Chris@7 43 directory_query('%3Chttp://purl.org/ontology/mo/MusicArtist%3E', Query).
Chris@7 44
Chris@7 45 mapping:see_other_rdf(requested_pattern([all,track]), redirect_pattern(Query)) :-
Chris@7 46 directory_query('%3Chttp://purl.org/ontology/mo/Track%3E', Query).
Chris@7 47
Chris@7 48 mapping:see_other_rdf(requested_pattern([all,record]), redirect_pattern(Query)) :-
Chris@7 49 directory_query('%3Chttp://purl.org/ontology/mo/Record%3E', Query).
Chris@7 50
Chris@7 51 mapping:see_other_rdf(requested_pattern([all,performance]), redirect_pattern(Query)) :-
Chris@7 52 directory_query('%3Chttp://purl.org/ontology/mo/Performance%3E', Query).
Chris@7 53
Chris@7 54 mapping:see_other_rdf(requested_pattern([all,signal]), redirect_pattern(Query)) :-
Chris@7 55 directory_query('%3Chttp://purl.org/ontology/mo/Signal%3E', Query).
Chris@7 56
Chris@7 57 mapping:see_other_rdf(requested_pattern([all,timeline]), redirect_pattern(Query)) :-
Chris@7 58 directory_query('%3Chttp://purl.org/NET/c4dm/timeline.owl#TimeLine%3E', Query).
Chris@7 59
Chris@7 60 mapping:see_other(requested_pattern([all,Concept]),redirect_pattern([Renderer,Directory,Concept])) :-
Chris@7 61 html_renderer(Renderer),
Chris@7 62 directory(Directory).