diff --git a/classes/BasicSpecialFunction.php b/classes/BasicSpecialFunction.php index 93b1122b24d326417a47f00561198b0207385d05..602c7eec8af535d9499aa2971d2c08ad71e45d10 100644 --- a/classes/BasicSpecialFunction.php +++ b/classes/BasicSpecialFunction.php @@ -64,7 +64,7 @@ class SpecialFunction extends AbstractSpecialFunction{ $prefixHeader = array(); for($i=0;$i<sizeof($params);$i++){ - if($conf['use_external_uris']){ + if($conf['mirror_external_uris']){ $altUri = Utils::curie2uri($params[$i]); $altUri = preg_replace("|^".$conf['basedir']."|", $conf['ns']['local'], $altUri); $params[$i] = Utils::uri2curie($altUri); diff --git a/classes/Importer.php b/classes/Importer.php index e774e55f2b1eb8af0dc6c138378737fb5a736797..43931d962875d5791a90e9dd2407160495672388 100644 --- a/classes/Importer.php +++ b/classes/Importer.php @@ -51,7 +51,7 @@ class Importer{ $app = $appArr[0]['s']; $this->external_basedir = $app; $compArr = $this->search($triples, null, SKOS.'broader', $app); - $content = "<?\n\$conf['debug'] = false;\n\$conf['use_external_uris'] = true;\n\n"; + $content = "<?\n\$conf['debug'] = false;\n\$conf['mirror_external_uris'] = true;\n\n"; $this->basedir = preg_replace('/import$/', '', (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); diff --git a/classes/Queries.php b/classes/Queries.php index 3d4a47540f1f86ef6a11e7bb860cd8b141ef9d20..3e2451ef27cd2afbd6355fd179ccf254ebbd007e 100644 --- a/classes/Queries.php +++ b/classes/Queries.php @@ -31,6 +31,9 @@ class Queries{ echo $ex->getMessage(); } $result = array(); + if(sizeof($r['results']['bindings']) == 0){ + return 'http://www.w3.org/2000/01/rdf-schema#Resource'; //default value if no type is present + } foreach($r['results']['bindings'] as $v){ $result[]= $v['class']['value']; } diff --git a/classes/Utils.php b/classes/Utils.php index 2a4621f932914585cfb1ed53ae99705726a53d72..285c1876387066df23167ff35e07d5bd4e552404 100644 --- a/classes/Utils.php +++ b/classes/Utils.php @@ -159,6 +159,19 @@ class Utils{ $parser = ARC2::getRDFParser(); $parser->parse($conf['basedir'], $data); $triples = $parser->getTriples(); + if($conf['mirror_external_uris']){ + global $uri; + global $localUri; + $t = array(); + $t['s'] = $uri; + $t['s_type'] = 'uri'; + $t['p'] = "http://www.w3.org/2002/07/owl#sameAs"; + $t['o'] = $localUri; + $t['o_type'] = 'uri'; + array_push($triples, $t); + $t['p'] = "http://www.w3.org/2000/10/swap/pim/contact#preferredURI"; + array_push($triples, $t); + } $ser; switch ($extension){ case 'ttl': @@ -390,9 +403,9 @@ class Utils{ 'cache_dir' => $conf['home'].'cache/', )); $r = $data; - $f = $base['first']; + $first = $base['first']; unset($base['first']); - $vars = compact('base', 'r', 'f'); + $vars = compact('base', 'r', 'first'); if($conf['debug']){ var_dump($vars); } diff --git a/common.inc.php b/common.inc.php index 80682e783d2d9ee7244dc9f942968cbbbb6721f4..deccb0ff9d9f98283d6dc1e48a5970acf6d22e1f 100644 --- a/common.inc.php +++ b/common.inc.php @@ -14,11 +14,11 @@ include_once('namespaces.php'); $conf['model']['directory'] = 'models/'; #include trailing slash! $conf['model']['extension'] = '.model'; -$conf['model']['default'] = 'default'; +$conf['model']['default'] = 'rdfs:Resource'; $conf['view']['directory'] = 'views/'; #include trailing slash! $conf['view']['extension'] = '.view'; -$conf['view']['default'] = 'default'; +$conf['view']['default'] = 'rdfs:Resource'; $conf['static']['directory'] = 'static/'; #include trailing slash! diff --git a/index.php b/index.php index b62f651818dff6e43f7aaf74fcfbed70be1bdd21..2e7d3076f41ecaeb3c1eea4545701b9a8f6e02bc 100755 --- a/index.php +++ b/index.php @@ -69,7 +69,7 @@ if($uri == $conf['basedir']){ $sp->execute($uri, $context); exit(0); } -if($conf['use_external_uris']){ +if($conf['mirror_external_uris']){ $uri = $conf['ns']['local'].$_GET['q']; $localUri = $conf['basedir'].$_GET['q']; } @@ -95,7 +95,7 @@ if($res == $localUri){ } $uri = $res; -if($conf['use_external_uris']){ +if($conf['mirror_external_uris']){ $localUri = preg_replace("|^".$conf['basedir']."|", $conf['ns']['local'], $uri); } $extension = Utils::getExtension($format); diff --git a/install.sh b/install.sh index 5397a57cd403ac208c68d1b478ce921c186d1711..793b9875aeb29e8749c8bd2d8d2e8dde1fe911e6 100755 --- a/install.sh +++ b/install.sh @@ -81,7 +81,7 @@ LODSPEAKR_HOME=`pwd`/ \$conf['home'] = '$LODSPEAKR_HOME'; \$conf['basedir'] = '$basedir'; \$conf['debug'] = false; -\$conf['use_external_uris'] = false; +\$conf['mirror_external_uris'] = false; /*ATTENTION: By default this application is available to * be exported and copied (its configuration) @@ -104,16 +104,14 @@ cp $root_htaccess $parent_htaccess #Creating symlinks for turtle and ntriples cd views -ln -s default.view.rdf default.view.nt -ln -s default.view.rdf default.view.ttl -ln -s default.view.rdf default.view.json -ln -s owl:Class.view.html rdfs:Class.view.html +ln -s rdfs:Resource.view.rdf rdfs:Resource.view.nt +ln -s rdfs:Resource.view.rdf rdfs:Resource.view.ttl +ln -s rdfs:Resource.view.rdf rdfs:Resource.view.json cd ../models -ln -s default.model.rdf default.model.nt -ln -s default.model.rdf default.model.ttl -ln -s default.model.rdf default.model.json -ln -s owl:Class.model.html rdfs:Class.view.html +ln -s rdfs:Resource.model.rdf rdfs:Resource.model.nt +ln -s rdfs:Resource.model.rdf rdfs:Resource.model.ttl +ln -s rdfs:Resource.model.rdf rdfs:Resource.model.json cd .. diff --git a/models/default.model.html b/models/default.model.html deleted file mode 100644 index 5e8f44e2f6e46c5d1bb4858707c27526d1b5e405..0000000000000000000000000000000000000000 --- a/models/default.model.html +++ /dev/null @@ -1,8 +0,0 @@ -SELECT ?s2 ?p2 ?s1 ?p1 WHERE { - { - <{{uri}}> ?s1 ?p1 . - }UNION{ - ?s2 ?p2 <{{uri}}> . - } -} - diff --git a/models/default.model.rdf b/models/default.model.rdf deleted file mode 100644 index 61df9dc82ae823fb1ebafe746788f4ebecb6f20c..0000000000000000000000000000000000000000 --- a/models/default.model.rdf +++ /dev/null @@ -1 +0,0 @@ -DESCRIBE <{{uri}}> diff --git a/views/default.view.html b/views/default.view.html deleted file mode 100644 index b0cb351b4c3c9055da6cfef476274da9601f3a67..0000000000000000000000000000000000000000 --- a/views/default.view.html +++ /dev/null @@ -1,47 +0,0 @@ -<?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>Page about {{base.this.value}}</title> - <link href="{{base.baseUrl}}/lodspeakr/css/basic.css" rel="stylesheet" type="text/css" media="screen" /> - </head> - <body about="{{base.this.value}}"> - <h1>Page about <a href='{{base.this.value}}'>{{base.this.curie}}</a></h1> - <div> - <h2>Information from {{base.this.curie}}</h2> - <table> - {% for row in r %} - - {% if row.s1%} - <tr> - <td><a href='{{row.s1.value}}'>{{row.s1.curie}}</a></td> - - {% if row.p1.uri == 1 %} - <td><a rel='{{row.s1.curie}}' href='{{row.p1.value}}'>{{row.p1.curie}}</a></td> - {% else %} - <td><span property='{{row.s1.curie}}'>{{row.p1.value}}</span></td> - {% endif %} - - </tr> - {% endif %} - {% endfor %} - </table> - - <br/><br/> - <h2>Information pointing to {{base.this.curie}}</h2> - <table> - {% for row in r %} - {% if row.s2%} - <tr> - <td><a href='{{row.s2.value}}'>{{row.s2.curie}}</a></td> - <td><a rev='[{{row.p2.curie}}]' href='{{row.s2.value}}'>{{row.p2.curie}}</a></td> - </tr> - {%endif %} - {% endfor %} - </table> - </div> - </body> -</html> - diff --git a/views/default.view.rdf b/views/default.view.rdf deleted file mode 100644 index ca994557126054d192c1e40eca4f28f5e635bab8..0000000000000000000000000000000000000000 --- a/views/default.view.rdf +++ /dev/null @@ -1 +0,0 @@ -{{r|safe}}