Skip to content
Snippets Groups Projects
Commit 866a07e6 authored by Stein Magne Bjorklund's avatar Stein Magne Bjorklund
Browse files

Remove dead code from serviceModule.php

Cleanup that improve code readability.
parent 578cd1f8
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !16. Comments created here will be created in the context of that merge request.
......@@ -139,13 +139,11 @@ class ServiceModule extends abstractModule
$context = array();
$context['contentType'] = $acceptContentType;
$context['endpoints'] = $endpoints;
//$f = $this->getFunction($localUri);
$params = $this->getParams($localUri);
//$params[] = $context;
//$acceptContentType = Utils::getBestContentType($_SERVER['HTTP_ACCEPT']);
$extension = Utils::getExtension($acceptContentType, $conf['http_accept']);
$args = array();
list($modelFile, $viewFile) = $service;
try {
$prefixHeader = array();
......@@ -160,7 +158,6 @@ class ServiceModule extends abstractModule
$segmentConnector = "";
for ($i = 0; $i < sizeof($params); $i++) {
Utils::curie2uri($params[$i]);
//echo $params[$i]." ".Utils::curie2uri($params[$i]);exit(0);
$auxPrefix = Utils::getPrefix($params[$i]);
if ($auxPrefix['ns'] != null) {
$prefixHeader[] = $auxPrefix;
......@@ -186,7 +183,6 @@ class ServiceModule extends abstractModule
$lodspk['local']['curie'] = Utils::uri2curie($localUri);
$lodspk['contentType'] = $acceptContentType;
$lodspk['endpoint'] = $conf['endpoint'];
$lodspk['type'] = $modelFile;
$lodspk['header'] = $prefixHeader;
$lodspk['args'] = $args;
......@@ -196,13 +192,12 @@ class ServiceModule extends abstractModule
if ($viewFile == null) {
$lodspk['transform_select_query'] = true;
}
// chdir($lodspk['model']);
Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults);
if (!$lodspk['resultRdf']) {
$results = Utils::internalize($results);
$firstAux = Utils::getfirstResults($results);
// chdir($conf['home']);
if (is_array($results)) {
$resultsObj = Convert::array_to_object($results);
$results = $resultsObj;
......@@ -213,9 +208,7 @@ class ServiceModule extends abstractModule
} else {
$resultsObj = $results;
}
//Need to redefine viewFile as 'local' i.e., inside service.foo/ so I can load files with the relative path correctly
//$viewFile = $extension.".template";
//chdir($conf['home']);
Utils::processDocument($viewFile, $lodspk, $results);
} catch (Exception $ex) {
echo $ex->getMessage();
......@@ -233,17 +226,17 @@ class ServiceModule extends abstractModule
$count = 1;
$prefixUri = $conf['basedir'];
$functionAndParams = explode('/', str_replace($prefixUri . $lodspk['serviceName'], '', $uri, $count));
if (sizeof($functionAndParams) > 1) {
array_shift($functionAndParams);
return $functionAndParams;
} else {
return array(null);
}
return array(null);
}
protected function readScaffold($scaffold, $serviceArgs)
{
global $conf;
$parser = ARC2::getTurtleParser();
$parser->parse($scaffold);
$triples = $parser->getTriples();
......@@ -253,19 +246,21 @@ class ServiceModule extends abstractModule
);
$scaffoldUri = $aux[0][0];
$aux = Utils::filterTriples($triples, array($scaffoldUri, "http://lodspeakr.org/vocab/scaffold", null));
foreach ($aux as $r) {
$patterns = Utils::filterTriples($triples, array($r[2], "http://lodspeakr.org/vocab/uriPattern", null));
$pattern = stripcslashes($patterns[0][2]);
if (preg_match("|$pattern|", $serviceArgs) > 0) {
// echo "match ! \n ".$pattern."\n";
$patternDir = Utils::filterTriples(
$triples,
array($r[2], "http://lodspeakr.org/vocab/subComponent", null)
);
return $patternDir[0][2];
}
}
// exit(0);
return "";
}
......
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