view classical/urispace/classical_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 c14a90b92260
children
line wrap: on
line source
:- module(classical_mapping,[]).

/**
 * Classical mapping for 303 redirects
 */

:- use_module(mapping).

sparql_end_point('http://dbtune.org/classical/sparql/').
html_renderer('http://dig.csail.mit.edu/2005/ajar/ajaw/tab.html?uri=').
directory('http://dbtune.org/classical/all/').
namespace('http://dbtune.org/classical/').

/**
 * Redirecting resources whithin the namespace
 */

mapping:see_other_rdf(requested_pattern(T),redirect_pattern([SparqlEndPoint,'?query=describe%20%3C',NameSpace,Path,'%3E'])) :-
	T\=[all,_],
	sparql_end_point(SparqlEndPoint),
	namespace(NameSpace),
	concat_atom(T,'/',Path).
mapping:see_other(requested_pattern(T),redirect_pattern([Renderer,NameSpace,Path])) :-
	T\=[all,_],
	html_renderer(Renderer),
	namespace(NameSpace),
	concat_atom(T,'/',Path).


/**
 * directories
 */
directory_query(Concept,
                [SparqlEndPoint,
                 '?query=construct { %3fx a ', Concept,
                 '} where { %3fx a ', Concept, '.}'
                ]) :-
    sparql_end_point(SparqlEndPoint).

mapping:see_other_rdf(requested_pattern([all,composer]), redirect_pattern(Query)) :-
    directory_query('%3Chttp://dbtune.org/classical/resource/type/Composer%3E', Query).

mapping:see_other_rdf(requested_pattern([all,composition]), redirect_pattern(Query)) :-
    directory_query('%3Chttp://purl.org/ontology/mo/Composition%3E', Query).

mapping:see_other_rdf(requested_pattern([all,work]), redirect_pattern(Query)) :-
    directory_query('%3Chttp://purl.org/ontology/mo/MusicalWork%3E', Query).

mapping:see_other_rdf(requested_pattern([all,conductor]), redirect_pattern(Query)) :-
    directory_query('%3Chttp://dbtune.org/classical/resource/type/Conductor%3E', Query).

mapping:see_other(requested_pattern([all,Concept]),redirect_pattern([Renderer,Directory,Concept])) :-
	html_renderer(Renderer),
	directory(Directory).