-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdynamic_productions.html
More file actions
68 lines (60 loc) · 2.42 KB
/
dynamic_productions.html
File metadata and controls
68 lines (60 loc) · 2.42 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
<html>
<script src="https://rdf.js.org/comunica-browser/versions/1/packages/actor-init-sparql/comunica-browser.js"></script>
<body>
<h1>Productions</h1>
<table id="test" border=1>
<tr>
<th>Production name</th>
<th>Kunstenpunt entry</th>
<th>Instance</th>
</tr>
</table>
<script language="JavaScript">
function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
};
var q = GetURLParameter('q')
Comunica.newEngine().query(`
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT
?production ?productionLabel
(GROUP_CONCAT(DISTINCT ?instanceLabel; SEPARATOR=", ") AS ?instance)
(GROUP_CONCAT(DISTINCT ?kporgidLabel; SEPARATOR=", ") AS ?kporgid)
WHERE {
?production wdt:P272 wd:Q${q}.
?production wdt:P31 ?instance.
?production wdt:P5935 ?kporgid.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,nl,fr,de".
?production rdfs:label ?productionLabel.
?instance rdfs:label ?instanceLabel.
?kporgid rdfs:label ?kporgidLabel.
}
}
GROUP BY ?production ?productionLabel
ORDER BY ASC(UCASE(str(?productionLabel)))
`, {
sources: [{ type: 'sparql', value: 'https://query.wikidata.org/sparql' }],
}).then(function (result) {
result.bindingsStream.on('data', function (data) {
document.getElementById("test").innerHTML += "<tr><td><a target='_blank' href= dynamic_details_credits.html?q=" + data.get('?production').value.split("Q").pop() + ">" + data.get('?productionLabel').value + "</a></td><td><a href=http://data.kunsten.be/organisations/" + data.get('?kporgid').value + ">Kunstenpunt</a></td><td>" + data.get('?instance').value + "</td></tr>";
});
});
</script>
</html>