diff --git a/classes/BasicSpecialFunction.php b/classes/BasicSpecialFunction.php index eed8fbee11fedf58d5cd78ee65f04199af573731..93dde2673700ce127152eb91dfcce4f0f45328f9 100644 --- a/classes/BasicSpecialFunction.php +++ b/classes/BasicSpecialFunction.php @@ -41,7 +41,7 @@ class SpecialFunction extends AbstractSpecialFunction{ $viewFile = $conf['special']['uri'].".".$f.$conf['view']['extension'].".".$extension; $modelFile = $conf['special']['uri'].".".$f.$conf['model']['extension'].".".$extension; if(!(is_dir($conf['model']['directory'].$modelFile) || is_file($conf['model']['directory'].$modelFile)) || !is_file($conf['view']['directory'].$viewFile)){ - throw new Exception('Method does not exist!'); + throw new Exception('<h1>Method does not exist!</h1><br/>This means that <tt>'.$conf['model']['directory'].$modelFile.'</tt> or <tt>'.$conf['view']['directory'].$viewFile."</tt> (or both) don't exist.<br/>Please refer to this tutorial to create one.<br/>"); } $endpoints = $context['endpoints']; array_pop($params); @@ -66,6 +66,8 @@ class SpecialFunction extends AbstractSpecialFunction{ $data['params'] = $params; $base = $conf['view']['standard']; $base['type'] = $modelFile; + $base['root'] = $conf['root']; + $base['home'] = $conf['basedir']; $base['this']['value'] = $uri; $base['this']['curie'] = Utils::uri2curie($uri); $base['this']['contentType'] = $acceptContentType; diff --git a/common.inc.php b/common.inc.php index 04ac77fa5fa6ccc31bc918f06be5df3aba7e2e47..5f443ea60be8a22eb0b4b75cf1848d00db45594d 100644 --- a/common.inc.php +++ b/common.inc.php @@ -36,7 +36,7 @@ $conf['special']['uri'] = 'special'; $conf['special']['class'] = 'classes/BasicSpecialFunction.php'; //Frontpage when user goes to http://example.org/ -$conf['root'] = 'special/index'; +$conf['root'] = 'index.html'; $conf['extension_connector'] = '.'; //Priority for rdfs:Resource (default). Priorities should be >=0 diff --git a/models/special.classes.model.html b/models/special.classes.model.html new file mode 100644 index 0000000000000000000000000000000000000000..754216a5d06ad3f63d94f16f9d259fb1a255a73a --- /dev/null +++ b/models/special.classes.model.html @@ -0,0 +1,8 @@ +{%for h in base.header %} +PREFIX {{h.prefix}}: <{{h.ns}}> +{%endfor%} +SELECT DISTINCT ?resource WHERE { + {%if base.args.arg0 %}GRAPH <{{base.args.arg0}}>{ {%endif%} + [] a ?resource . + {%if base.args.arg0 %} } {%endif%} +} diff --git a/models/special.index.model.html b/models/special.index.model.html deleted file mode 100644 index e32cb2a17ecb5248772260b936078ae00a52624b..0000000000000000000000000000000000000000 --- a/models/special.index.model.html +++ /dev/null @@ -1,3 +0,0 @@ -SELECT DISTINCT ?resource WHERE { - [] a ?resource . -} diff --git a/models/special.namedGraphs.model.html b/models/special.namedGraphs.model.html new file mode 100644 index 0000000000000000000000000000000000000000..b73ae66e3f2a16aed3d8342b2b913e4984f7885a --- /dev/null +++ b/models/special.namedGraphs.model.html @@ -0,0 +1,5 @@ +SELECT DISTINCT ?g WHERE { + GRAPH ?g{ + ?s ?p ?o . + } +} diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000000000000000000000000000000000000..7a29d7e7569c5b9b554bbd8ef752c5c68cf4b90f --- /dev/null +++ b/static/index.html @@ -0,0 +1,19 @@ +<?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" xmlns:local="http://localhost/lodspeakr/" + version="XHTML+RDFa 1.0" xml:lang="en"> + <head> + <title>Main</title> + <link href="http://localhost/lodspeakr//lodspeakr/css/basic.css" rel="stylesheet" type="text/css" media="screen" /> + </head> + <body> + <h1>Services available</h1> + <ul> + <li><a href='special/classes'>List of classes in the triple store</a></li> + <li><a href='special/namedGraphs'>Named graphs in the triple store</a></li> + </ul> + </body> +</html> + + diff --git a/views/header.inc b/views/header.inc new file mode 100644 index 0000000000000000000000000000000000000000..2f26f6f401cc1fbda895c3e1e787bfe528d8e4c6 --- /dev/null +++ b/views/header.inc @@ -0,0 +1,4 @@ +<div style='float:center'> +<a href='{{base.home}}'>Home</a> | <a href='{{base.home}}/special/classes'>Classes</a> | <a href='{{base.home}}/special/namedGraphs'>Named Graphs</a> +</div> + diff --git a/views/special.index.view.html b/views/special.classes.view.html similarity index 97% rename from views/special.index.view.html rename to views/special.classes.view.html index 7258ca945ff4944e18cd4778493d3482e3a157fa..0f25575e1de1fad85e6b7d893e5dd692541b4f01 100644 --- a/views/special.index.view.html +++ b/views/special.classes.view.html @@ -9,6 +9,7 @@ </head> <body> <h1>Classes available</h1> +{%include "header.inc"%} <ul> {% if r.resource.value != null %} <!-- Only one class available --> diff --git a/views/special.instances.view.html b/views/special.instances.view.html index 3a8247c16e73456ff2f6f174b70995afaeeebcf6..b164024cf0adbbd522503ca1bd7e72e2066057ae 100644 --- a/views/special.instances.view.html +++ b/views/special.instances.view.html @@ -9,6 +9,7 @@ </head> <body> <h1>Instances of {{base.args.arg0}}</h1> +{%include "header.inc"%} <ul> {% for row in r %} <li><a href='{{ row.resource.value }}'>{{row.resource.curie}}</a></li> diff --git a/views/special.namedGraphs.view.html b/views/special.namedGraphs.view.html new file mode 100644 index 0000000000000000000000000000000000000000..e7eca6c297aa76144fdbb0ffe674176f28cceca0 --- /dev/null +++ b/views/special.namedGraphs.view.html @@ -0,0 +1,20 @@ +<?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>Graphs available in the triple store</title> + <link href="{{base.baseUrl}}/lodspeakr/css/basic.css" rel="stylesheet" type="text/css" media="screen" /> + </head> + <body> + <h1>Graphs available in the triple store</h1> +{%include "header.inc"%} + <ul> + {% for row in r %} + <li>{{row.g.curie}}</li> + {% endfor %} + </ul> + </body> +</html> +