annotate cmn/urispace/cmn_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 b6fb37c8b8d3
children
rev   line source
Chris@21 1 :- module(cmn_mapping,[]).
Chris@21 2
Chris@21 3 /**
Chris@21 4 * Cmn mapping for 303 redirects
Chris@21 5 */
Chris@21 6
Chris@21 7 :- use_module(mapping).
Chris@21 8
Chris@21 9 sparql_end_point('http://dbtune.org/cmn/sparql/').
Chris@21 10 html_renderer('http://dig.csail.mit.edu/2005/ajar/ajaw/tab.html?uri=').
Chris@21 11 directory('http://dbtune.org/cmn/all/').
Chris@21 12 namespace('http://dbtune.org/cmn/').
Chris@21 13
Chris@21 14 /**
Chris@21 15 * Redirecting resources whithin the namespace
Chris@21 16 */
Chris@21 17
Chris@21 18 mapping:see_other_rdf(requested_pattern(T),redirect_pattern([SparqlEndPoint,'?query=describe%20%3C',NameSpace,Path,'%3E'])) :-
Chris@21 19 T\=[all,_],
Chris@21 20 sparql_end_point(SparqlEndPoint),
Chris@21 21 namespace(NameSpace),
Chris@21 22 concat_atom(T,'/',Path).
Chris@21 23 mapping:see_other(requested_pattern(T),redirect_pattern([Renderer,NameSpace,Path])) :-
Chris@21 24 T\=[all,_],
Chris@21 25 html_renderer(Renderer),
Chris@21 26 namespace(NameSpace),
Chris@21 27 concat_atom(T,'/',Path).
Chris@21 28
Chris@21 29
Chris@21 30 /**
Chris@21 31 * directories
Chris@21 32 */
Chris@21 33 directory_query(Concept,
Chris@21 34 [SparqlEndPoint,
Chris@21 35 '?query=construct { %3fx a ', Concept,
Chris@21 36 '} where { %3fx a ', Concept, '.}'
Chris@21 37 ]) :-
Chris@21 38 sparql_end_point(SparqlEndPoint).
Chris@21 39
Chris@21 40 mapping:see_other_rdf(requested_pattern([all,composer]), redirect_pattern(Query)) :-
Chris@24 41 directory_query('%3Chttp://purl.org/ontology/mo/Composer%3E', Query).
Chris@21 42
Chris@21 43 mapping:see_other(requested_pattern([all,Concept]),redirect_pattern([Renderer,Directory,Concept])) :-
Chris@21 44 html_renderer(Renderer),
Chris@21 45 directory(Directory).