Skip to content
Snippets Groups Projects
Commit babde289 authored by alvaro's avatar alvaro
Browse files

Including RDF exporting in processDocument.

Fixing bug with Contenttype returned
parent 68150c60
No related branches found
No related tags found
No related merge requests found
...@@ -224,9 +224,13 @@ class Utils{ ...@@ -224,9 +224,13 @@ class Utils{
global $conf; global $conf;
$contentType = $lodspk['contentType']; $contentType = $lodspk['contentType'];
$extension = Utils::getExtension($contentType); $extension = Utils::getExtension($contentType);
header('Content-Type: '.$contentType); header('Content-Type: '.$contentType);
Utils::showView($lodspk, $data, $viewFile); if($lodspk['resultRdf']){
echo Utils::serializeRdf($data, $extension);
}else{
Utils::showView($lodspk, $data, $viewFile);
}
} }
public static function getResultsType($query){ public static function getResultsType($query){
......
...@@ -105,24 +105,24 @@ class ServiceModule extends abstractModule{ ...@@ -105,24 +105,24 @@ class ServiceModule extends abstractModule{
chdir($lodspk['model']); chdir($lodspk['model']);
Utils::queryFile($modelFile, $endpoints['local'], $results, $first); Utils::queryFile($modelFile, $endpoints['local'], $results, $first);
if($lodspk['resultRdf']){ if(!$lodspk['resultRdf']){
echo Utils::serializeRdf($results, $extension); $results = Utils::internalize($results);
exit(0); $lodspk['first'] = Utils::getFirsts($results);
}else{
$results = Utils::internalize($results); chdir($conf['home']);
} if(is_array($results)){
$resultsObj = Convert::array_to_object($results);
$lodspk['first'] = Utils::getFirsts($results); }else{
chdir($conf['home']); $resultsObj = $results;
if(is_array($results)){ }
$results = Convert::array_to_object($results); }else{
} $resultsObj = $results;
}
//Need to redefine viewFile as 'local' i.e., inside service.foo/ so I can load files with the relative path correctly //Need to redefine viewFile as 'local' i.e., inside service.foo/ so I can load files with the relative path correctly
//$viewFile = $extension.".template"; //$viewFile = $extension.".template";
chdir($conf['home']);
Utils::processDocument($viewFile, $lodspk, $results); Utils::processDocument($viewFile, $lodspk, $results);
}catch (Exception $ex){ }catch (Exception $ex){
echo $ex->getMessage(); echo $ex->getMessage();
trigger_error($ex->getMessage(), E_ERROR); trigger_error($ex->getMessage(), E_ERROR);
......
...@@ -84,19 +84,18 @@ class TypeModule extends abstractModule{ ...@@ -84,19 +84,18 @@ class TypeModule extends abstractModule{
$lodspk['this']['curie'] = Utils::uri2curie($uri); $lodspk['this']['curie'] = Utils::uri2curie($uri);
$lodspk['this']['local'] = $localUri; $lodspk['this']['local'] = $localUri;
$lodspk['this']['extension'] = $extension; $lodspk['this']['extension'] = $extension;
chdir($conf['home'].$conf['model']['directory']); chdir($conf['home'].$conf['model']['directory']);
Utils::queryFile($modelFile, $endpoints['local'], $results, $first); Utils::queryFile($modelFile, $endpoints['local'], $results, $first);
if($lodspk['resultRdf']){ if(!$lodspk['resultRdf']){
echo Utils::serializeRdf($results, $extension);
exit(0);
}else{
$results = Utils::internalize($results); $results = Utils::internalize($results);
} $lodspk['first'] = Utils::getFirsts($results);
$lodspk['first'] = Utils::getFirsts($results);
chdir($conf['home']); chdir($conf['home']);
if(is_array($results)){ if(is_array($results)){
$resultsObj = Convert::array_to_object($results); $resultsObj = Convert::array_to_object($results);
}else{
$resultsObj = $results;
}
}else{ }else{
$resultsObj = $results; $resultsObj = $results;
} }
......
...@@ -101,19 +101,20 @@ class UriModule extends abstractModule{ ...@@ -101,19 +101,20 @@ class UriModule extends abstractModule{
chdir($conf['home'].$conf['model']['directory']); chdir($conf['home'].$conf['model']['directory']);
Utils::queryFile($modelFile, $endpoints['local'], $results, $first); Utils::queryFile($modelFile, $endpoints['local'], $results, $first);
if($lodspk['resultRdf']){ if(!$lodspk['resultRdf']){
echo Utils::serializeRdf($results, $extension);
exit(0);
}else{
$results = Utils::internalize($results); $results = Utils::internalize($results);
} $lodspk['first'] = Utils::getFirsts($results);
$lodspk['first'] = Utils::getFirsts($results);
chdir($conf['home']); chdir($conf['home']);
if(is_array($results)){ if(is_array($results)){
$resultsObj = Convert::array_to_object($results); $resultsObj = Convert::array_to_object($results);
}else{
$resultsObj = $results;
}
}else{ }else{
$resultsObj = $results; $resultsObj = $results;
} }
chdir($conf['home']);
if($conf['debug']){ if($conf['debug']){
trigger_error("Using template ".$viewFile, E_USER_NOTICE); trigger_error("Using template ".$viewFile, E_USER_NOTICE);
echo("TEMPLATE: ".$viewFile."\n\n"); echo("TEMPLATE: ".$viewFile."\n\n");
......
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