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

Added query times as model-like data structure that can be passed to visualization filters

parent 5653b1f5
No related branches found
No related tags found
No related merge requests found
...@@ -432,7 +432,7 @@ class Utils{ ...@@ -432,7 +432,7 @@ class Utils{
if($conf['debug']){ if($conf['debug']){
echo "\n-------------------------------------------------\nIn ".getcwd()."\n"; echo "\n-------------------------------------------------\nIn ".getcwd()."\n";
echo "$modelFile (against ".$e->getSparqlUrl().")\n"; echo "$modelFile (against ".$e->getSparqlUrl().")\n";
echo $query; echo $query."\n";
} }
trigger_error("Running query from ".$modelFile." on endpoint ".$e->getSparqlURL(), E_USER_NOTICE); trigger_error("Running query from ".$modelFile." on endpoint ".$e->getSparqlURL(), E_USER_NOTICE);
$initTime = microtime(true); $initTime = microtime(true);
...@@ -441,6 +441,12 @@ class Utils{ ...@@ -441,6 +441,12 @@ class Utils{
if($conf['debug']){ if($conf['debug']){
echo "Execution time: ".($endTime - $initTime)." seconds\n-------------------------------------------------\n\n"; echo "Execution time: ".($endTime - $initTime)." seconds\n-------------------------------------------------\n\n";
} }
$timeObj = new stdClass();
$timeObj->query = new stdClass();
$timeObj->query->value = $modelFile;
$timeObj->time = new stdClass();
$timeObj->time->value = ($endTime - $initTime);
$lodspk['queryTimes'][$modelFile] = $timeObj;
if($modelFile != $lodspk['type']){ if($modelFile != $lodspk['type']){
if(!isset($rPointer[$strippedModelFile])){ if(!isset($rPointer[$strippedModelFile])){
$rPointer[$strippedModelFile] = array(); $rPointer[$strippedModelFile] = array();
...@@ -537,6 +543,7 @@ class Utils{ ...@@ -537,6 +543,7 @@ class Utils{
if(isset($lodspkData['params'])){ if(isset($lodspkData['params'])){
$lodspk['this']['params'] = $lodspkData['params']; $lodspk['this']['params'] = $lodspkData['params'];
} }
$lodspk['queryTimes'] = Convert::array_to_object($lodspk['queryTimes']);
require_once($conf['home'].'lib/Haanga/lib/Haanga.php'); require_once($conf['home'].'lib/Haanga/lib/Haanga.php');
$viewAux = explode("/",$view); $viewAux = explode("/",$view);
$viewFile = array_pop($viewAux); $viewFile = array_pop($viewAux);
......
...@@ -144,11 +144,10 @@ class ServiceModule extends abstractModule{ ...@@ -144,11 +144,10 @@ class ServiceModule extends abstractModule{
$lodspk['firstResults'] = Convert::array_to_object($firstAux); $lodspk['firstResults'] = Convert::array_to_object($firstAux);
}else{ }else{
$resultsObj = $results; $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']); //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();
......
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