Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (31 sloc) 1.3 KB
Simple proxy Sparql changer
for "translating" the query and results from one namespace to another.
For example:
Imagine you want installed LODSpeaKr in
But you want to test it with data from
Clearly, LODSPeaKr can't handle those URIs since they are in another namespace (and probably server). What you need then is that for any URI of the form
you want to have
This script acts like a proxy to the sparql endpoint where the original data is located and changes de namespaces properly, so from your point of view you have
data in your domain, without the need to download it from the original source and change it.
Since it is very simple, it may be prone to errors, but so far it is usable.
//The remote namespace
$remote = '';
//The local namespace (i.e., the one you want to resolve
$local = '';
//The SPARQL endpoint where the data is located
$url = '';
$newget = array();
foreach($_GET as $k => $v){
$newget[$k] = preg_replace("|$local|", $remote, $v);
$url .= '?';
$r = file_get_contents($url.http_build_query($newget));
echo preg_replace("|$remote|", $local, $r);
Something went wrong with that request. Please try again.