annotate jamendo/urispace/jamendo_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 8c3cb5fb7843
children
rev   line source
Chris@0 1 :- module(jamendo_mapping,[]).
Chris@0 2
Chris@0 3 /**
Chris@0 4 * Jamendo mapping for 303 redirects
Chris@0 5 */
Chris@0 6
Chris@0 7
Chris@0 8 :- use_module(mapping).
Chris@0 9
Chris@0 10
Chris@6 11 sparql_end_point('http://dbtune.org/jamendo/sparql/').
Chris@0 12 html_renderer('http://dig.csail.mit.edu/2005/ajar/ajaw/tab.html?uri=').
Chris@0 13 directory('http://dbtune.org/jamendo/all/').
Chris@0 14 namespace('http://dbtune.org/jamendo/').
Chris@0 15
Chris@0 16 /**
Chris@0 17 * Redirecting doc
Chris@0 18 */
Chris@0 19 mapping:see_other(requested_pattern([]),redirect_pattern(['http://moustaki.org/','jamendo/'])).
Chris@0 20
Chris@0 21 /**
Chris@0 22 * Redirecting end point
Chris@0 23 */
Chris@0 24 mapping:see_other(requested_pattern([sparql]),redirect_pattern(['http://dbtune.org:2105/sparql/'])):-!.
Chris@0 25
Chris@0 26 /**
Chris@0 27 * Redirecting end point web interface
Chris@0 28 */
Chris@0 29 mapping:see_other(requested_pattern([wsparql]),redirect_pattern(['http://dbtune.org:2105/'])):-!.
Chris@0 30
Chris@0 31 /**
Chris@0 32 * Redirecting resources whithin the namespace
Chris@0 33 */
Chris@0 34
Chris@0 35 mapping:see_other_rdf(requested_pattern(T),redirect_pattern([SparqlEndPoint,'?query=describe%20%3C',NameSpace,Path,'%3E'])) :-
Chris@0 36 T\=[all,_],
Chris@0 37 sparql_end_point(SparqlEndPoint),
Chris@0 38 namespace(NameSpace),
Chris@0 39 concat_atom(T,'/',Path).
Chris@0 40 mapping:see_other(requested_pattern(T),redirect_pattern([Renderer,NameSpace,Path])) :-
Chris@0 41 T\=[all,_],
Chris@0 42 html_renderer(Renderer),
Chris@0 43 namespace(NameSpace),
Chris@0 44 concat_atom(T,'/',Path).
Chris@0 45
Chris@0 46
Chris@0 47 /**
Chris@0 48 * directories
Chris@0 49 */
Chris@6 50 directory_query(Concept,
Chris@6 51 [SparqlEndPoint,
Chris@6 52 '?query=construct { %3fx a ', Concept,
Chris@6 53 '} where { %3fx a ', Concept, '.}'
Chris@6 54 ]) :-
Chris@6 55 sparql_end_point(SparqlEndPoint).
Chris@6 56
Chris@6 57 mapping:see_other_rdf(requested_pattern([all,artist]), redirect_pattern(Query)) :-
Chris@6 58 directory_query('%3Chttp://purl.org/ontology/mo/MusicArtist%3E', Query).
Chris@6 59
Chris@6 60 mapping:see_other_rdf(requested_pattern([all,track]), redirect_pattern(Query)) :-
Chris@6 61 directory_query('%3Chttp://purl.org/ontology/mo/Track%3E', Query).
Chris@6 62
Chris@6 63 mapping:see_other_rdf(requested_pattern([all,record]), redirect_pattern(Query)) :-
Chris@6 64 directory_query('%3Chttp://purl.org/ontology/mo/Record%3E', Query).
Chris@6 65
Chris@6 66 mapping:see_other_rdf(requested_pattern([all,performance]), redirect_pattern(Query)) :-
Chris@6 67 directory_query('%3Chttp://purl.org/ontology/mo/Performance%3E', Query).
Chris@6 68
Chris@6 69 mapping:see_other_rdf(requested_pattern([all,signal]), redirect_pattern(Query)) :-
Chris@6 70 directory_query('%3Chttp://purl.org/ontology/mo/Signal%3E', Query).
Chris@6 71
Chris@6 72 mapping:see_other_rdf(requested_pattern([all,timeline]), redirect_pattern(Query)) :-
Chris@6 73 directory_query('%3Chttp://purl.org/NET/c4dm/timeline.owl#TimeLine%3E', Query).
Chris@0 74
Chris@0 75 mapping:see_other(requested_pattern([all,Concept]),redirect_pattern([Renderer,Directory,Concept])) :-
Chris@0 76 html_renderer(Renderer),
Chris@0 77 directory(Directory).