-
Notifications
You must be signed in to change notification settings - Fork 0
/
people.php
87 lines (79 loc) · 2.7 KB
/
people.php
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* User: Hans-Gert Gräbe
* last update: 2020-11-06
*/
require 'vendor/autoload.php';
require_once 'helper.php';
require_once 'layout.php';
function thePeople()
{
setNamespaces();
global $sparql;
$query='
PREFIX od: <http://opendiscovery.org/rdf/Model#>
describe ?a
from <http://opendiscovery.org/rdf/People/>
from <http://opendiscovery.org/rdf/MATRIZ-Certificates/>
where { ?a a foaf:Person .}';
try {
$graph = $sparql->query($query);
} catch (Exception $e) {
print "<div class='error'>".$e->getMessage()."</div>\n";
}
$a=array();
foreach ($graph->allOfType('foaf:Person') as $autor) {
$c=array();
foreach ($autor->all("od:hasCertificate") as $v) {
$v=str_replace("http://opendiscovery.org/rdf/Certificate/","Level ",$v);
$v=str_replace("_"," no. ",$v);
$c[]=$v;
}
$b=array();
foreach ($autor->all("foaf:name") as $e) {
$url='http://wumm.uni-leipzig.de/displayuri.php?uri='.$autor->getURI();
$value='<strong><span itemprop="name" class="foaf:name">'
.$e->getValue().'</span></strong>';
$b[]=createLink($url,$value);
}
foreach ($autor->all("foaf:affil") as $e) {
$b[]='<span itemprop="affiliation" class="foaf:affil">'
.$e->getValue().'</span>';
}
foreach ($autor->all("foaf:homepage") as $e) {
$b[]=createLink($e,$e);
}
$f=$autor->all("dbo:deathDate");
if (!empty($f)) { $b[]='Died on '.join(", ",$f) ; }
if (!empty($c)) { $b[]='MATRIZ Certificates: '.join(", ",$c); }
$d=$autor->all("od:hasMATRIZAward");
if (!empty($d)) { $b[]='MATRIZ Awards: '.join(", ",$d); }
$a[$autor->getUri()]=
'<div itemscope itemtype="http://schema.org/Person" class="creator">'
.join('<br/>',$b).'</p></div>';
}
ksort($a);
$out='<h3>People in the TRIZ Social Network</h3>
<div class="people">
'.join("\n", $a).'
</div> <!-- end class people -->';
return '<div class="container">'.$out.'</div>';
}
function getCertificate($graph,$author) {
$s=array();
foreach ($graph->allOfType('od:CertificateLevel4') as $c) {
if (strcmp($c->get("od:owner"),$author)==0) {
$s[]=str_replace("http://opendiscovery.org/rdf/Certificate/","",
$c->getURI());
}
}
foreach ($graph->allOfType('od:CertificateLevel5') as $c) {
if (strcmp($c->get("od:owner"),$author)==0) {
$s[]=str_replace("http://opendiscovery.org/rdf/Certificate/","",
$c->getURI());
}
}
return join(", ",$s);
}
echo showpage(thePeople());
?>