diff --git a/classes/BasicSpecialFunction.php b/classes/BasicSpecialFunction.php index 93dde2673700ce127152eb91dfcce4f0f45328f9..28d3ac5a265d4843db3fcf3c0c8b014c034acd75 100644 --- a/classes/BasicSpecialFunction.php +++ b/classes/BasicSpecialFunction.php @@ -73,7 +73,8 @@ class SpecialFunction extends AbstractSpecialFunction{ $base['this']['contentType'] = $acceptContentType; $base['model']['directory'] = $conf['model']['directory']; $base['view']['directory'] = $conf['view']['directory']; - $base['ns'] = $conf['ns']; $base['ns'] = $conf['ns']; + $base['ns'] = $conf['ns']; + $base['sparqlendpoint'] = $conf['endpoint']; $base['type'] = $modelFile; $base['header'] = $prefixHeader; $base['args'] = $args; @@ -83,7 +84,8 @@ class SpecialFunction extends AbstractSpecialFunction{ $base['view']['directory'] = $conf['home'].$conf['view']['directory']; $base['model']['directory'] = $conf['home'].$conf['model']['directory']; chdir($conf['model']['directory']); - Utils::queryFile($modelFile, $endpoints['local'], $data); + $first = array(); + Utils::queryFile($modelFile, $endpoints['local'], $data, $first); chdir($conf['home']); $data = Utils::internalize($data); diff --git a/classes/MetaDb.php b/classes/MetaDb.php index 6bed8c9096fdccb8c1a7496d379ebd4d5e230ae8..5cf0d89a8d04cc9a2cd58341c2edf11b09912946 100644 --- a/classes/MetaDb.php +++ b/classes/MetaDb.php @@ -30,13 +30,13 @@ class MetaDb{ global $conf; try{ $db = new PDO('sqlite:'.$this->dbLocation); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - - $results = $db->exec($q); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $results = $db->exec($q); $db = NULL; - }catch(PDOException $e){ - print 'Exception exec: '.$e->getMessage()."\n\n"; - exit(10); + }catch(Exception $e){ + echo "Can't write in SQLite database. Please check you have granted write permissions to <tt>meta/</tt> and <tt>meta/db.sqlite</tt>."; + trigger_error('Exception exec: '.$e->getMessage(), E_USER_ERROR); + exit(1); } return $results; } diff --git a/classes/Utils.php b/classes/Utils.php index 6002caa4a753b2d472e250bd8fa01a4068c14a15..2c7581fd54bca5b4accc910fee429ab5075d4802 100644 --- a/classes/Utils.php +++ b/classes/Utils.php @@ -22,9 +22,12 @@ class Utils{ exit(0); } - public static function send500($uri){ + public static function send500($msg = null){ header("HTTP/1.0 500 Internal Server Error"); echo "An internal error ocurred. Please try later\n\n"; + if($msg != null){ + echo $msg; + } exit(0); } diff --git a/views/header.inc b/views/header.inc index 2f26f6f401cc1fbda895c3e1e787bfe528d8e4c6..7aad9cf624b51f51958f89a9f147644f8df296c6 100644 --- a/views/header.inc +++ b/views/header.inc @@ -1,4 +1,5 @@ +<h4>Endpoint: {{base.sparqlendpoint.local}}</h4> <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> +<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.classes.view.html b/views/special.classes.view.html index 0f25575e1de1fad85e6b7d893e5dd692541b4f01..8a7777fe863303235d9f846e0be11cfbb70b9f00 100644 --- a/views/special.classes.view.html +++ b/views/special.classes.view.html @@ -11,14 +11,8 @@ <h1>Classes available</h1> {%include "header.inc"%} <ul> - {% if r.resource.value != null %} - <!-- Only one class available --> - <li><a href='{{base.baseUrl}}special/instances/{{ r.resource.curie }}'>{{r.resource.curie}}</a></li> - {% endif %} {% for row in r %} - {% if row.resource.value %} <li><a href='{{base.baseUrl}}special/instances/{{ row.resource.curie }}'>{{row.resource.curie}}</a></li> - {% endif %} {% endfor %} </ul> </body> diff --git a/views/special.namedGraphs.view.html b/views/special.namedGraphs.view.html index e7eca6c297aa76144fdbb0ffe674176f28cceca0..65ee0d422589ded5522de1f6a0330367f293fefc 100644 --- a/views/special.namedGraphs.view.html +++ b/views/special.namedGraphs.view.html @@ -8,7 +8,7 @@ <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> + <h1>Graphs available</h1> {%include "header.inc"%} <ul> {% for row in r %}