Skip to content
Snippets Groups Projects
Commit c2756eac authored by alangrafu's avatar alangrafu
Browse files

Added instance and named graphs services

parent df70b016
No related branches found
No related tags found
No related merge requests found
...@@ -69,6 +69,7 @@ class SpecialFunction extends AbstractSpecialFunction{ ...@@ -69,6 +69,7 @@ class SpecialFunction extends AbstractSpecialFunction{
} }
$args["arg".$i]=$params[$i]; $args["arg".$i]=$params[$i];
} }
$results['params'] = $params; $results['params'] = $params;
$base = $conf['view']['standard']; $base = $conf['view']['standard'];
$base['type'] = $modelFile; $base['type'] = $modelFile;
...@@ -87,7 +88,7 @@ class SpecialFunction extends AbstractSpecialFunction{ ...@@ -87,7 +88,7 @@ class SpecialFunction extends AbstractSpecialFunction{
$base['baseUrl'] = $conf['basedir']; $base['baseUrl'] = $conf['basedir'];
$base['this']['value'] = $uri; $base['this']['value'] = $uri;
$base['this']['contentType'] = $acceptContentType; $base['this']['contentType'] = $acceptContentType;
$base['view']['directory'] = $conf['home'].$conf['view']['directory']; $base['view']['directory'] = $conf['home'].$conf['view']['directory'].$conf['service']['prefix'].$f.'/';
$base['model']['directory'] = $conf['home'].$conf['model']['directory']; $base['model']['directory'] = $conf['home'].$conf['model']['directory'];
chdir($conf['model']['directory']); chdir($conf['model']['directory']);
$first = array(); $first = array();
...@@ -98,7 +99,11 @@ class SpecialFunction extends AbstractSpecialFunction{ ...@@ -98,7 +99,11 @@ class SpecialFunction extends AbstractSpecialFunction{
if(is_array($results)){ if(is_array($results)){
$results = Convert::array_to_object($results); $results = Convert::array_to_object($results);
} }
Utils::processDocument($viewFile, $base, $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";
Utils::processDocument($viewFile, $base, $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);
......
{%for h in base.header %}
PREFIX {{h.prefix}}: <{{h.ns}}>
{%endfor%}
SELECT DISTINCT ?resource WHERE {
?resource a {{base.args.arg0}}
}
SELECT DISTINCT ?g WHERE {
GRAPH ?g{
[] ?p ?resource .
}
}
...@@ -6,7 +6,7 @@ class ServiceModule extends abstractModule{ ...@@ -6,7 +6,7 @@ class ServiceModule extends abstractModule{
public function match($uri){ public function match($uri){
global $conf; global $conf;
global $acceptContentType; global $acceptContentType;
$q = preg_replace('|^'.$conf['basedir'].'|', '', $uri); $q = preg_replace('|^'.$conf['basedir'].'|', '', $uri);
$qArr = explode('/', $q); $qArr = explode('/', $q);
if(sizeof($qArr)==0){ if(sizeof($qArr)==0){
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
<body> <body>
<h1>Services available</h1> <h1>Services available</h1>
<ul> <ul>
<li><a href='special/classes'>List of classes in the triple store</a></li> <li><a href='classes'>List of classes in the triple store</a></li>
<li><a href='special/namedGraphs'>Named graphs in the triple store</a></li> <li><a href='namedGraphs'>Named graphs in the triple store</a></li>
</ul> </ul>
</body> </body>
</html> </html>
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
</head> </head>
<body> <body>
<h1>Classes available</h1> <h1>Classes available</h1>
{%include "../header.inc"%}
<ul> <ul>
{% for row in r.main %} {% for row in r.main %}
<li><a href="{{base.baseUrl}}special/instances/{{ row.resource.curie }}">{{row.resource.curie}}</a></li> <li><a href="{{base.baseUrl}}instances/{{ row.resource.curie }}">{{row.resource.curie}}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</body> </body>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" {% for i, ns in base.ns %}xmlns:{{i}}="{{ns}}"
{%endfor%}version="XHTML+RDFa 1.0" xml:lang="en">
<head>
<title>Instances of {{base.args.arg0}}</title>
<link href="{{base.baseUrl}}/lodspeakr/css/basic.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<h1>Instances of class {{base.args.arg0}}</h1>
{%include "../header.inc"%}
<ul>
{% for row in r.main %}
<li><a href="{{ row.resource.value }}">{{row.resource.curie}}</a></li>
{% endfor %}
</ul>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" {% for i, ns in base.ns %}xmlns:{{i}}="{{ns}}"
{%endfor%}version="XHTML+RDFa 1.0" xml:lang="en">
<head>
<title>Named Graphs</title>
<link href="{{base.baseUrl}}/lodspeakr/css/basic.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<h1>Named graphs available</h1>
{%include "../header.inc"%}
<ul>
{% for row in r.main %}
<li>{{row.g.value}}</li>
{% endfor %}
</ul>
</body>
</html>
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