-
Notifications
You must be signed in to change notification settings - Fork 0
/
person_details.html
114 lines (98 loc) · 4.1 KB
/
person_details.html
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<html>
<script src="https://rdf.js.org/comunica-browser/versions/1/packages/actor-init-sparql/comunica-browser.js"></script>
<body>
<h1 id="title"> </h1>
<h2 id="title2"> </h2>
<h3 id="title3"> </h3>
<h2>Participated Productions</h2>
<table id="test" border=1>
<tr>
<th>Production name</th>
<th>Role</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 ?personLabel ?website
WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nl,fr,de".
?person rdfs:label ?personLabel.
}
BIND(wd:Q${q} as ?person)
wd:Q${q} rdfs:label ?personLabel.
OPTIONAL { ?person wdt:P856 ?website.}
}
ORDER BY ?personLabel
LIMIT 1
`, {
sources: [{ type: 'sparql', value: 'https://query.wikidata.org/sparql' }],
}).then(function (result) {
result.bindingsStream.on('data', function (data) {
document.getElementById("title").innerHTML += "<b>" + data.get('?personLabel').value + "</b>";
document.getElementById("title2").innerHTML += "<img src=" + 'https://commons.wikimedia.org/wiki/Special:FilePath/'+ data.get('?personLabel').value.split(' ')[0] + '_' + data.get('?personLabel').value.split(' ')[1] + '.jpg '+ "width='200'/>" ;
document.getElementById("title3").innerHTML += "<b><a target='_blank' href=" + data.get('?website').value + ">" + "Go To Website" + "</a></b>";
});
});
</script>
<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 ?roleLabel; SEPARATOR=", ") AS ?role)
WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nl,fr,de".
?role rdfs:label ?roleLabel.
?production rdfs:label ?productionLabel.
?person rdfs:label ?personLabel. }
wd:Q${q} rdfs:label ?personLabel.
?production ?role_ wd:Q${q};
wdt:P31 wd:Q43099500.
?role wikibase:directClaim ?role_ .
}
GROUP BY ?production ?productionLabel
ORDER BY ?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>" + data.get('?role').value + "</td></tr>";
});
});
</script>