Skip to content
Snippets Groups Projects
Commit 9ee5825b authored by Alvaro Graves's avatar Alvaro Graves
Browse files

trying different output depending if it is a select or describe

parent cee49b86
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,14 @@ class Endpoint{
$this->params = $params;
}
public function query($q, $output){
$aux = $this->params['output'];
$this->params['output'] = $output;
$r = $this->query($q);
$this->params['output'] = $aux;
return $r;
}
public function query($q){
global $conf;
$context = stream_context_create(array(
......
<?
include_once('settings.inc.php');
$conf['endpoint']['config']['output'] = 'json';
$conf['endpoint']['config']['select']['output'] = 'json';
$conf['endpoint']['config']['describe']['output'] = 'xml';
$conf['endpoint']['config']['output'] = $conf['endpoint']['config']['select']['output'];
$conf['endpoint']['config']['named_graph'] = '';
$conf['endpoint']['config']['show_inline'] = 0;
$conf['metaendpoint']['config']['output'] = 'json';
$conf['metaendpoint']['config']['select']['output'] = 'json';
$conf['metaendpoint']['config']['describe']['output'] = 'xml';
$conf['metaendpoint']['config']['output'] = $conf['metaendpoint']['config']['select']['output'];
$conf['metaendpoint']['config']['show_inline'] = 0;
$conf['metaendpoint']['config']['named_graph'] = 'http://slodps.org/metadata';
$conf['ns']['rdf'] = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
$conf['ns']['rdfs'] = 'http://www.w3.org/2000/01/rdf-schema#';
$conf['ns']['dcterms'] = 'http://purl.org/dc/terms/';
......
......@@ -60,10 +60,10 @@ if($res != NULL && $page == NULL){ // Original URI is a page
}
$query = file_get_contents($modelFile);
$query = preg_replace("|".$conf['resource']['url_delimiter']."|", "<".$uri.">", $query);
$results = $endpoint->query($query);
header('Content-Type: '.$acceptContentType);
if(preg_match("/describe/i", $query)){
$results = $endpoint->query($query);
require('lib/arc2/ARC2.php');
$parser = ARC2::getRDFParser();
$parser->parse($conf['basedir'], $results);
......@@ -84,7 +84,8 @@ if($res != NULL && $page == NULL){ // Original URI is a page
echo $doc;
exit(0);
}
if(preg_match("/select/i", $query)){
elseif(preg_match("/select/i", $query)){
$results = $endpoint->query($query);
if(sizeof($results['results']['bindings']) == 0){
Utils::send404($uri);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment