-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflowdevpat.php
More file actions
79 lines (69 loc) · 2.2 KB
/
flowdevpat.php
File metadata and controls
79 lines (69 loc) · 2.2 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* User: Hans-Gert Gräbe
* last update: 2022-08-15
* Lyubomirsky's Flow Development Pattern
*/
require 'vendor/autoload.php';
require_once 'helper.php';
require_once 'layout.php';
function theFlowDevelopmentPatterns() {
setNamespaces();
global $sparql;
$query='
PREFIX od: <http://opendiscovery.org/rdf/Model#>
PREFIX tc: <http://opendiscovery.org/rdf/Concept/>
describe ?a
from <http://opendiscovery.org/rdf/FlowDevelopmentPattern/>
where { ?a a tc:FlowDevelopmentPattern .}
';
try {
$graph = $sparql->query($query);
} catch (Exception $e) {
print "<div class='error'>".$e->getMessage()."</div>\n";
}
$a=array();
foreach($graph->allOfType('tc:FlowDevelopmentPattern') as $node) {
$uri=str_replace('http://opendiscovery.org/rdf/','',$node->getURI());
$a[$uri]=displayNode($node);
}
$out='<h2>The Flow Development Patterns proposed by Alex Lyubomirsky (2006)</h2>
<div class="concept">
<ul style="list-style: none;">
'.$a["FDP/P_Core"].'
</ul>
</div> <!-- end concept list -->';
return '<div class="container">'.$out.'</div>';
}
function displayNode($node) {
$children=array();
foreach($node->all("skos:narrower") as $child) {
$uri=str_replace("http://opendiscovery.org/rdf/","",$child->getURI());
$children[$uri]=displayNode($child);
}
ksort($children);
$out='';
if(!empty($children)) {
$out='<ul style="list-style: none;">'.join("\n",$children).'</ul>';
}
return '<p>'.displayEntry($node).$out."</p>";
}
function displayEntry($node) {
$uri=str_replace('http://opendiscovery.org/rdf/','',$node->getURI());
$definition=$node->get("skos:definition");
$notes=join("; ",$node->all("skos:note"));
$examples=join("<br/>",$node->all("skos:example"));
$out="<h3>".$uri.": ".$node->get("skos:prefLabel")."</h3>\n";
if(!empty($definition)) {
$out.="<p><strong>Definition:</strong> $definition </p>";
}
if(!empty($notes)) {
$out.="<p><strong>Notes:</strong> $notes </p>";
}
if(!empty($examples)) {
$out.="<p><strong>Examples:</strong> $examples </p>";
}
return "<li>\n$out\n</li>\n";
}
echo showpage(theFlowDevelopmentPatterns());
?>