Skip to content
Snippets Groups Projects
Commit 6bdd6f19 authored by Alvaro Graves's avatar Alvaro Graves
Browse files

Adding rdfs:Class and owl:Class templates

parent b9a473b6
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ Manual Installation
* mv settings.default.inc.php settings.inc.php
* chmod 777 compiled
* chmod 777 cache
That's it. You should be able to serve tour data in RDF/XML, Turtle, Ntriples and RDFa.
......
......@@ -18,8 +18,12 @@ class Queries{
}
public static function getClass($uri, $e){
$q = "SELECT DISTINCT ?class WHERE{
<$uri> a ?class .
$q = "SELECT DISTINCT ?class ?inst WHERE{
{
<$uri> a ?class .
}UNION{
?inst a <$uri> .
}
} LIMIT 1";
$r = $e->query($q);
if(sizeof($r['results']['bindings'])>0){
......
......@@ -60,7 +60,9 @@ class Utils{
$row['uri'][$k] = 1;
}
}
array_push($obj, $row);
if(sizeof($row) >0){
array_push($obj, $row);
}
}
return $obj;
}
......@@ -68,15 +70,15 @@ class Utils{
public static function showView($uri, $data, $view){
global $conf;
$base = $conf['view']['standard'];
$base['value']['this'] = $uri;
$base['curie']['this'] = Utils::uri2curie($uri);
$base['this']['value'] = $uri;
$base['this']['curie'] = Utils::uri2curie($uri);
$base['ns'] = $conf['ns'];
require('lib/Haanga/lib/Haanga.php');
Haanga::configure(array(
'template_dir' => './',
'cache_dir' => 'compiled/',
'cache_dir' => 'cache/',
));
$r = Utils::sparqlResult2Obj($data);
$r = Utils::sparqlResult2Obj($data);
$vars = compact('base', 'r');
Haanga::Load($view, $vars);
......
No preview for this file type
rdfs:Class.model.html
\ No newline at end of file
SELECT DISTINCT ?instances WHERE {
?instances a %u .
}
......@@ -4,34 +4,40 @@
<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.value.this}}</title>
<title>Page about {{base.this.value}}</title>
<link href="{{base.baseUrl}}/lodspeakr/css/basic.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<h1>Page about <a href='{{base.value.this}}'>{{base.curie.this}}</a></h1>
<h1>Page about <a href='{{base.this.value}}'>{{base.this.curie}}</a></h1>
<div>
<h2>Information from {{base.curie.this}}</h2>
<table about="{{base.value.this}}">
<h2>Information from {{base.this.curie}}</h2>
<table about="{{base.this.value}}">
{% for row in r %}
{% if row.value.s1 != null %}
<tr>
<td><a href='{{row.value.s1}}'>{{row.curie.s1}}</a></td>
<td><a href='{{ row.value.s1 }}'>{{row.curie.s1}}</a></td>
{% if row.uri.p1 == 1 %}
<td><a rel='{{row.curie.s1}}' href='{{row.value.p1}}'>{{row.curie.p1}}</a></td>
<td><a rel='{{row.s1.curie}}' href='{{row.value.p1}}'>{{row.curie.p1}}</a></td>
{% else %}
<td><span property='{{row.curie.s1}}'>{{row.value.p1}}</span></td>
<td><span property='{{row.s1.curie}}'>{{row.value.p1}}</span></td>
{% endif %}
</tr>
{% endif %}
{% if row.s2 != null %}
<tr>
</tr>
{%endif %}
{% endfor %}
</table>
<br/><br/>
<h2>Information pointing to {{base.curie.this}}</h2>
<table about="{{base.value.this}}">
<h2>Information pointing to {{base.this.curie}}</h2>
<table about="{{base.this.value}}">
{% for row in r %}
{% if row.value.s2 != null %}
{% if row.value.p2 != null %}
<tr>
<td><a rev='{{row.curie.p2}}' href='{{row.value.s2}}'>{{row.curie.s2}}</a></td>
<td><a href='{{row.value.s2 }}'>{{ row.curie.s2 }}</a></td>
<td><a href='{{row.value.p2}}'>{{row.curie.p2}}</a></td>
</tr>
{%endif %}
......
<?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 {% for i, ns in base.ns %}xmlns:{{i}}="{{ns}}"
{%endfor%}version="XHTML+RDFa 1.0" xml:lang="en">
<head>
<title>Page about {{base.value.this}}</title>
<link href="{{base.baseUrl}}css/basic.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<h1>Page about <a href='{{base.value.this}}'>{{base.curie.this}}</a></h1>
<br/>
<br/>
<div>
<h2>Information from {{base.curie.this}}</h2>
<table about="{{base.value.this}}">
{% for row in r %}
{% if row.value.s1 != null %}
<tr>
<td><a href='{{row.value.s1}}'>{{row.curie.s1}}</a></td>
{% if row.uri.p1 == 1 %}
<td><a rel='{{row.curie.s1}}' href='{{row.value.p1}}'>{{row.curie.p1}}</a></td>
{% else %}
<td><span property='{{row.curie.s1}}'>{{row.value.p1}}</span></td>
{% endif %}
</tr>
{% endif %}
{% endfor %}
</table>
<br/><br/>
<h2>Information pointing to {{base.curie.this}}</h2>
<table about="{{base.value.this}}">
{% for row in r %}
{% if row.value.s2 != null %}
<tr>
<td><a rev='{{row.curie.p2}}' href='{{row.value.s2}}'>{{row.curie.s2}}</a></td>
<td><a href='{{row.value.p2}}'>{{row.curie.p2}}</a></td>
</tr>
{%endif %}
{% endfor %}
</table>
</div>
</body>
</html>
rdfs:Class.view.html
\ No newline at end of file
<?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 {% for i, ns in base.ns %}xmlns:{{i}}="{{ns}}"
<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 {{row.value.name}}</title>
<link href="{{base.baseUrl}}css/basic.css" rel="stylesheet" type="text/css" media="screen" />
<title>Page about {{base.this.value}}</title>
</head>
<body>
<h1>Page about <a href='{{base.this.value}}'>{{base.this.curie}}</a></h1>
<div>
<h2>Instances of {{base.this.curie}}</h2>
<ul>
{% for row in r %}
{{row.value.name}}
{% if row.value.instances != null %}
<li><a href='{{ row.value.instances }}'>{{row.curie.instances}}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
</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