-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtbk.php
More file actions
61 lines (56 loc) · 1.69 KB
/
tbk.php
File metadata and controls
61 lines (56 loc) · 1.69 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
55
56
57
58
59
60
61
<?php
/**
* User: Hans-Gert Gräbe
* last update: 2020-11-06
*/
require 'vendor/autoload.php';
require_once 'helper.php';
require_once 'layout.php';
function theTBK($src,$people)
{
setNamespaces();
$graph = new \EasyRdf\Graph('http://opendiscovery.org/rdf/Books/');
$graph->parseFile($src);
$graph->parseFile($people);
$theBooks=array();
$res = $graph->allOfType('od:TRIZ-Book');
foreach ($res as $book) {
$titel=showLanguage($book->all("dcterms:title"),"<br/>");
$id=join("",$book->all("dcterms:creator")).$book->get("dcterms:issued").$titel;
$theBooks[$id]=listBook($book)."<p>Referenced in ".getReferences($book)."</p>" ;
}
$thePapers=array();
$res = $graph->allOfType('od:Reference');
foreach ($res as $book) {
$titel=showLanguage($book->all("dcterms:title"),"<br/>");
$id=join("",$book->all("dcterms:creator")).$book->get("dcterms:issued").$titel;
$thePapers[$id]=listBook($book)."<p>Referenced in ".getReferences($book)."</p>";
}
ksort($theBooks);
ksort($thePapers);
return '
<div class="container">
<h3>TRIZ Books</h3>
<div class="books">
'.join("\n<hr/>\n",$theBooks).'
</div> <!-- end class books -->
<h3>TRIZ Papers</h3>
<div class="papers">
'.join("\n<hr/>\n",$thePapers).'
</div> <!-- end class papers -->
</div> <!-- class container >
';
}
function getReferences($book) {
$a=array();
foreach($book->all("od:hatVerweis") as $v) {
$v=str_replace("http://opendiscovery.org/rdf/","",$v);
$v=str_replace("Verweis.","",$v);
$a[]=$v;
}
return join(", ",$a);
}
$src="rdf/TBK-References.rdf";
$people="rdf/People.rdf";
echo showpage(theTBK($src,$people));
?>