-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbooks.php
More file actions
54 lines (49 loc) · 1.3 KB
/
books.php
File metadata and controls
54 lines (49 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* User: Hans-Gert Gräbe
* last update: 2020-12-16
*/
require 'vendor/autoload.php';
require_once 'helper.php';
require_once 'layout.php';
function theBooks($author)
{
setNamespaces();
global $sparql;
$query='
PREFIX od: <http://opendiscovery.org/rdf/Model#>
describe ?a ?b
from <http://opendiscovery.org/rdf/People/>
from <http://opendiscovery.org/rdf/TRIZ-References/>
where {
?a a foaf:Person .
?b a od:Reference .
}';
try {
$graph = $sparql->query($query);
} catch (Exception $e) {
print "<div class='error'>".$e->getMessage()."</div>\n";
}
$thebooks=array();
foreach($graph->allOfType('od:TRIZ-Book') as $book) {
$titel=showLanguage($book->all("dcterms:title"),"<br/>");
$aut=$book->all("dcterms:creator"); // yet to be fixed to get them in alphabetic order.
$theAuthors=join("",$aut);
$id=$theAuthors.$book->get("dcterms:issued").$titel;
if (empty($author) or strpos($theAuthors,$author)) {
$thebooks[$id]=listBook($book);
}
}
ksort($thebooks);
return '
<div class="container">
<h3>TRIZ Books</h3>
<div class="books">
'.join("\n<hr/>\n",$thebooks).'
</div> <!-- end class books -->
</div> <!-- class container >
';
}
$author=$_GET["author"];
echo showpage(theBooks($author));
?>