source: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/sgvizler.xsl@ 35089

Last change on this file since 35089 was 35089, checked in by davidb, 3 years ago

Added in new mir-content based example

  • Property svn:executable set to *
File size: 18.3 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 xmlns:gslib="http://www.greenstone.org/skinning"
7 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8 extension-element-prefixes="java util"
9 exclude-result-prefixes="java util">
10
11 <!-- use the 'main' layout -->
12 <xsl:import href="layouts/main.xsl"/>
13
14
15 <xsl:variable name="graphURI">https://so-we-must-think.space<xsl:value-of select="$siteURL"/><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/></xsl:variable>
16
17 <xsl:include href="dataviz/made-the-final.xsl"/>
18 <xsl:include href="dataviz/list-of-winners.xsl"/>
19 <xsl:include href="dataviz/list-of-losers.xsl"/>
20 <xsl:include href="dataviz/top-3-with-mir-content.xsl"/>
21 <xsl:include href="dataviz/got-nul-point.xsl"/>
22 <xsl:include href="dataviz/got-nul-point-after-winning.xsl"/>
23 <xsl:include href="dataviz/voting-dataflow-jury.xsl"/>
24 <xsl:include href="dataviz/voting-dataflow-tele.xsl"/>
25 <xsl:include href="dataviz/jury-tele-diff.xsl"/>
26 <xsl:include href="dataviz/draw-bias.xsl"/>
27 <xsl:include href="dataviz/draw-bias-normalized.xsl"/>
28
29 <xsl:variable name="groupPath"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/></xsl:variable>
30 <!-- set page title -->
31 <xsl:template name="pageTitle">SPARQL Visualizer</xsl:template>
32
33 <!-- set page breadcrumbs -->
34 <xsl:template name="breadcrumbs"><gslib:siteLink/><gslib:rightArrow/>
35 <xsl:if test="$groupPath != ''">
36 <xsl:for-each select="/page/pageResponse/pathList/group">
37 <xsl:sort data-type="number" select="@position"/>
38 <a>
39 <xsl:attribute name="href"><gslib:groupHref path="{@path}"/></xsl:attribute>
40 <xsl:attribute name="title"><gslib:groupName path="{@path}"/></xsl:attribute>
41 <gslib:groupName path="{@path}"/>
42 </a>
43 <gslib:rightArrow/>
44 </xsl:for-each>
45 </xsl:if>
46 <a href="{$library_name}/collection/{$collName}/page/about"><gslib:collectionName/></a>
47 </xsl:template>
48
49 <!-- the page content -->
50 <xsl:template match="/page">
51 <!--
52 <link rel="stylesheet" href="sites/{$site_name}/collect/{$collName}/style/fuseki.css" type="text/css" />
53 -->
54 <gsf:script src="sites/{$site_name}/collect/{$collName}/js/eurovision.js"/>
55 <gsf:script src="sites/{$site_name}/collect/{$collName}/js/dataviz.js"/>
56
57 <link rel="stylesheet" href="sites/{$site_name}/collect/{$collName}/css/eurovision.css" type="text/css" />
58 <link rel="stylesheet" href="sites/{$site_name}/collect/{$collName}/css/dataviz.css" type="text/css" />
59 <style>
60 div.page { margin-left: 12px; margin-right: 12px; margin-top: 6px; margin-bottom: 6px;}
61
62 p { padding-top: 6px; padding-bottom: 6px;}
63 a { text-decoration: underline; }
64 li { padding-bottom: 6px; margin-bottom: 6px; }
65 </style>
66
67 <div class="page">
68 <h2>Visualize the Eurovision Linked-Data</h2>
69
70 <p>
71 Explore the Linked Data stored in this collection
72 through the samples provided that produce a range of
73 visualizations. For a given sample visualization, the
74 approach used is to first load in a SPARQL query that
75 extracts and manipulates the linked data in the
76 underlying triplestore that represents all the metadata
77 stored in the collection.
78 This is then passed on to
79 <i>SGVizler</i>, a JavaScript visualization library, to
80 display in graphical form the generated data.
81 </p>
82
83 <p>
84 In terms of operating the user interface, this is
85 achieved by pressing the <i>Load query above</i> button
86 for a sample visualization that has piqued your interest
87 (listed below). This causes a <i>Visualize Results</i>
88 button to appear alongside the load button you have just
89 pressed, which when clicked runs the loaded-in query and
90 visualizes the result.
91 </p>
92
93 <p>
94 We use this two-step process so it is possible to
95 change what query is run, and how the resulting data is visualized.
96 The first text-box below is for the SPARQL query. The following
97 3 text-boxes control aspects of the visualization.
98 If you haven't worked with the underlying tools before,
99 we suggest you work your way through the sample visualizations
100 provided, trying out small edits to see how that affects
101 what is produced.
102 </p>
103 <p>
104 Rather than visualize results, if you would like to
105 directly access and/or export the data to peroforms
106 other forms of analysis, then you'll probably want to
107 use the:
108 <ul>
109 <li>
110 <a href="{$library_name}/collection/{$collName}/page/sparql">Data Analysis page</a>
111 </li>
112 </ul>
113 </p>
114
115 </div>
116
117 <div class="page">
118 <h2>SGVizler Query</h2>
119 </div>
120
121 <script type="text/javascript" src="ext/jena/sgvizler2/sgvizler2.js"><xsl:text> </xsl:text></script>
122 <div class="page moreindent">
123 <form class="sgvizler-form" id="sample-sparql-query-form"
124 action="/greenstone3-lod3/greenstone/query" target="_blank"
125 method="GET" accept-charset="UTF-8">
126 <pre>data-sgvizler-query:</pre>
127 <textarea id="sample-data-sgvizler-query" name="query" class="sgvizler" rows="10">
128<!-- -->
129<xsl:text>
130</xsl:text>
131 </textarea>
132
133 <div style="display:none;">
134 <pre>data-sgvizler-endpoint:</pre>
135 <textarea id="sample-data-sgvizler-endpoint" name="sgvizler-endpoint" class="sgvizler" rows="1">
136<!-- -->
137<xsl:text>
138//sowemustthink.space/greenstone3-lod3/greenstone/query
139</xsl:text>
140 </textarea>
141 </div>
142
143 <pre>data-sgvizler-chart:</pre>
144 <textarea id="sample-data-sgvizler-chart" name="sgvizler-chart" class="sgvizler" rows="1">
145<!-- -->
146<xsl:text>
147google.visualization.BarChart
148</xsl:text>
149 </textarea>
150
151
152 <pre>data-sgvizler-chart-options:</pre>
153 <textarea id="sample-data-sgvizler-chart-options" name="sgvizler-chart-options" class="sgvizler" rows="2">
154<!-- -->
155<xsl:text>
156title=Number of Songs from each Country (sorted by size)|legend.position=none|height=900|chartArea.height=840|fontSize=11
157</xsl:text>
158 </textarea>
159
160 <pre>div-style:</pre>
161 <textarea id="sample-div-style" name="sgvizler-style" class="sgvizler" rows="2">
162<!-- -->
163<xsl:text>
164width:900px; height:300px; margin-left: auto; margin-right: auto; overflow-y: scroll; overflow-x: hidden;
165</xsl:text>
166 </textarea>
167
168 <!-- locate this anchor tag a bit ealiler in the page, so there's a bit of breathing space
169 at the top of the page, before the sgvizler-div-outer starts -->
170 <a name="sgvizler-plot" ><xsl:text> </xsl:text></a>
171
172 <div class="page ssq">
173 <button type="button" onclick="ssv_execute()">Show Visualization</button>
174 </div>
175
176 </form>
177 </div>
178
179 <div id="sgvizler-div-outer">
180 <xsl:text>Loading ...</xsl:text>
181 </div>
182
183 <script type="text/javascript">
184 <xsl:text disable-output-escaping="yes">
185 $(document).ready(
186 function() {
187 ssv_load("ssv-orig");
188 ssv_execute();
189 }
190 );
191 </xsl:text>
192 </script>
193
194 <div class="page">
195 <h2>Sample Visualizations</h2>
196
197 <p>
198 The samples provided below show a range
199 of visualizations related to the
200 Eurovision Song Contest, sourced from the raw
201 data in the triple-store, and converted into
202 a visualization using SGVizler.
203
204 Click on one of the <i>Load query above</i> buttons
205 to load the relevant query syntax into the SPARQL
206 Query textbox above, accompanied with SGVizler
207 attributes that control the visualization,
208 then press <i>Get Results</i>
209 to initiate the visualization.
210 </p>
211
212
213
214 <div id="ssv-orig" style="display: none;">
215<!-- -->
216<xsl:text>
217PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
218PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
219
220SELECT ?country (COUNT(?country) AS ?freqCount)
221WHERE {
222 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
223 {
224 SELECT DISTINCT ?country ?year WHERE {
225 ?s gsdlextracted:Country ?country.
226 ?s gsdlextracted:Year ?year.
227 } ORDER BY ?country ?year
228 }
229 }
230}
231GROUP BY ?country ORDER BY DESC(?freqCount)
232</xsl:text>
233 </div>
234 <div id="ssv-orig-endpoint" style="display: none;">
235<!-- -->
236<xsl:text>
237//sowemustthink.space/greenstone3-lod3/greenstone/query
238</xsl:text>
239 </div>
240 <div id="ssv-orig-chart" style="display: none;">
241<!-- -->
242<xsl:text>
243google.visualization.BarChart
244</xsl:text>
245 </div>
246 <div id="ssv-orig-chart-options" style="display: none;">
247<!-- -->
248<xsl:text>
249title=Number of Songs from each Country (sorted by size)|legend.position=none|height=900|chartArea.height=840|fontSize=11
250</xsl:text>
251 </div>
252 <div id="ssv-orig-div-style" style="display: none;">
253<!-- -->
254<xsl:text>
255width:900px; height:300px; margin-left: auto; margin-right: auto; overflow-y: scroll; overflow-x: hidden;
256</xsl:text>
257 </div>
258
259
260 <xsl:call-template name="ssv-made-the-final"/>
261 <xsl:call-template name="ssv-list-of-winners"/>
262 <xsl:call-template name="ssv-list-of-losers"/>
263 <xsl:call-template name="ssv-top-3-with-mir-content"/>
264 <xsl:call-template name="ssv-got-nul-point"/>
265 <xsl:call-template name="ssv-got-nul-point-after-winning"/>
266 <xsl:call-template name="ssv-voting-dataflow-jury"/>
267 <xsl:call-template name="ssv-voting-dataflow-tele"/>
268 <xsl:call-template name="ssv-jury-tele-diff"/>
269 <xsl:call-template name="ssv-draw-bias"/>
270 <xsl:call-template name="ssv-draw-bias-normalized"/>
271
272
273 <ul class="ssq">
274 <li>
275 <b>Number of times entered, sorted by frequency:</b><br/>
276 <button type="button" class="load-ssq" id="load-ssv-orig" onclick="ssv_load('ssv-orig')">Load query above</button>
277 <button type="button" class="exec-ssq" id="exec-ssv-orig" onclick="ssv_execute()">Visualize Results</button><br/>
278 <p>
279 Plot as a bar graph the number of times each country has competed in the
280 Eurovision Song Contest, sorted by frequency.
281 </p>
282 </li>
283
284 <li>
285 <b>Made the Finals:</b><br/>
286 <button type="button" class="load-ssq" id="load-ssv-made-the-final" onclick="ssv_load('ssv-made-the-final')">Load query above</button>
287 <button type="button" class="exec-ssq" id="exec-ssv-made-the-final" onclick="ssv_execute()">Visualize Results</button><br/>
288 <p>Plot as a bar graph the number of times each country has made it to the finals.</p>
289 </li>
290
291 <li>
292 <b>List of Winners:</b><br/>
293 <button type="button" class="load-ssq" id="load-ssv-list-of-winners" onclick="ssv_load('ssv-list-of-winners')">Load query above</button>
294 <button type="button" class="exec-ssq" id="exec-ssv-list-of-winners" onclick="ssv_execute()">Visualize Tabulated Results</button><br/>
295 <p>The songs that have won through the ages.</p>
296 </li>
297
298 <li>
299 <b>List of Last Place Entrants:</b><br/>
300 <button type="button" class="load-ssq" id="load-ssv-list-of-losers" onclick="ssv_load('ssv-list-of-losers')">Load query above</button>
301 <button type="button" class="exec-ssq" id="exec-ssv-list-of-losers" onclick="ssv_execute()">Visualize Tabulated Results</button><br/>
302 <p>The songs that have won through the ages.</p>
303 </li>
304
305 <li>
306 <b>Top 3 Acts per Year with (where available) Details of Musical Content:</b><br/>
307 <button type="button" class="load-ssq" id="load-ssv-top-3-with-mir-content" onclick="ssv_load('ssv-top-3-with-mir-content')">Load query above</button>
308 <button type="button" class="exec-ssq" id="exec-ssv-top-3-with-mir-content" onclick="ssv_execute()">Visualize Tabulated Results</button><br/>
309 <p>List the Top 3 entries per year, including musical details such as tempo, time-signature, and key where alignment with content in MusicBrainz was possible.</p>
310 </li>
311
312 <li>
313 <b>The ignominy of &quot;nul point&quot;:</b><br/>
314 <button type="button" class="load-ssq" id="load-ssv-got-nul-point" onclick="ssv_load('ssv-got-nul-point')">Load query above</button>
315 <button type="button" class="exec-ssq" id="exec-ssv-got-nul-point" onclick="ssv_execute()">Visualize Results</button><br/>
316 <p>
317 Plot a bar graph showing which countries, and how
318 often they have, competed in the final but received
319 zero points as their final total score.
320 </p>
321 </li>
322
323 <li>
324 <b>The even more galling circumstance of getting &quot;nul point&quot; having won the previous year:</b><br/>
325 <button type="button" class="load-ssq" id="load-ssv-got-nul-point-after-winning" onclick="ssv_load('ssv-got-nul-point-after-winning')">Load query above</button>
326 <button type="button" class="exec-ssq" id="exec-ssv-got-nul-point-after-winning" onclick="ssv_execute()">Visualize Results</button><br/>
327 <p>
328 Have any countries ever been in the situation of going from Hero (i.e., winning) to Zero (nul point) in back to back years in
329 the contest.
330 </p>
331 </li>
332
333
334 <li>
335 <b>Dataflow Voting Patterns of Juries:</b><br/>
336 <div>
337 <button type="button" class="load-ssq" id="load-ssv-voting-dataflow-jury" onclick="ssv_load('ssv-voting-dataflow-jury')">Load query above</button>
338 <div style="display: inline-block; padding-right: 12px;">
339 <label style="padding-right: 6px;" for="ssv-voting-dataflow-jury-startyear">Start Year:</label>
340 <input type="text" id="ssv-voting-dataflow-jury-startyear" value="2010" style="width: 80px; padding-left: 6px"/>
341 <label style="padding-right: 6px; padding-left: 12px;" for="ssv-voting-dataflow-jury-endyear">End Year:</label>
342 <input type="text" id="ssv-voting-dataflow-jury-endyear" value="2019" style="width: 80px; padding-left: 6px"/>
343 </div>
344 <button type="button" class="exec-ssq" id="exec-ssv-voting-dataflow-jury" onclick="ssv_execute('ssv-voting-dataflow-jury')">Visualize Results</button>
345 </div>
346 <p>
347 Plot as a Sankey Dataflow Graph how juries allocate
348 their votes to countries over the years 2010-2019.
349 Note: to help emphasize the voting patterns, we plot
350 the <i>square</i> of the voting totals.
351 </p>
352
353 <p>
354 Experiment with editing the date range specified in
355 the <i>Start Year</i> and <i>End Year</i> text-input
356 boxes. Alternatively, the the SPARQL query itself
357 edit
358 the <tt>FILTER(xsd:integer(?year) &gt; 2010
359 &amp;&amp; xsd:integer(?year) &lt;= 2019)</tt> clause
360 in the above text box and then press <i>Show
361 Visualization</i> to see how the voting by jury has
362 changed over the decades.
363 </p>
364 </li>
365
366
367 <li>
368 <b>Dataflow Voting Patterns in Televoting:</b><br/>
369 <div>
370 <button type="button" class="load-ssq" id="load-ssv-voting-dataflow-tele" onclick="ssv_load('ssv-voting-dataflow-tele')">Load query above</button>
371 <span style="padding-right: 12px;">
372 Start Year: <input type="text" id="ssv-voting-dataflow-tele-startyear" value="2016" style="width: 80px; padding-left: 6px"/>
373 End Year: <input type="text" id="ssv-voting-dataflow-tele-endyear" value="2019" style="width: 80px; padding-left: 6px"/>
374 </span>
375
376 <button type="button" class="exec-ssq" id="exec-ssv-voting-dataflow-tele" onclick="ssv_execute('ssv-voting-dataflow-tele')">Visualize Results</button><br/>
377 </div>
378 <p>
379 Plot as a Sankey Dataflow Graph of the televoting
380 data by country. Years plotted are 2016-2019
381 as these are the only years the data has been
382 published separate to jury voting. As with
383 the Jury Sankey visual above, we plot
384 the <i>square</i> of the voting totals to
385 help emphasize where differences occur.
386 </p>
387 </li>
388
389
390 <li>
391 <b>Differences between Jury and Televoting:</b><br/>
392 <div>
393 <button type="button" class="load-ssq" id="load-ssv-jury-tele-diff" onclick="ssv_load('ssv-jury-tele-diff')">Load query above</button>
394 <span style="padding-right: 12px;">
395 For the country: <input type="text" id="ssv-jury-tele-diff-tocountry" value="The Netherlands" style="width: 180px; padding-left: 6px"/>
396 In the year: <input type="text" id="ssv-jury-tele-diff-inyear" value="2019" style="width: 80px; padding-left: 6px"/>
397 </span>
398
399 <button type="button" class="exec-ssq" id="exec-ssv-jury-tele-diff" onclick="ssv_execute('ssv-jury-tele-diff')">Visualize Results</button><br/>
400 </div>
401 <p>
402 Plot as a Tree-map how the various juries have cast
403 their votes for a specific country. The area of the
404 block represents the number of points awarded by
405 the jury. To this we add colouring
406 to the block to show how much in agreement
407 the televote was: red indicates the televote was
408 higher than the the jury vote; green is when the
409 votes are similar (neutral); and
410 blue indicates the televote was lower then the
411 jury vote.
412 </p>
413 </li>
414
415
416 <li>
417 <b>The Curse of Being the Second Performer in the Lineup?</b><br/>
418 <button type="button" class="load-ssq" id="load-ssv-draw-bias" onclick="ssv_load('ssv-draw-bias')">Load query above</button>
419 <button type="button" class="exec-ssq" id="exec-ssv-draw-bias" onclick="ssv_execute()">Visualize Results</button><br/>
420 <p>
421 Plot as a bar graph how many times an entrant
422 performing in a given position in the lineup has
423 gone on to win the competition. Performing second
424 in the line-up historically has been considered an
425 unlucky draw position to perform in, but are there
426 any others? Any draw positions that seem to
427 prove favourable to winning?
428 </p>
429 </li>
430
431 <li>
432 <b>Normalized Plot of ... The Curse of Being the Second Performer in the Lineup?</b><br/>
433 <button type="button" class="load-ssq" id="load-ssv-draw-bias-normalized" onclick="ssv_load('ssv-draw-bias-normalized')">Load query above</button>
434 <button type="button" class="exec-ssq" id="exec-ssv-draw-bias-normalized" onclick="ssv_execute()">Visualize Results</button><br/>
435 <p>
436 Same as the above, only to better take account of
437 the fact that an increasing number of countries have
438 been taking part in the final, in this version of
439 the plot the values have normalized to express as a
440 percentage the number of times an entrant has won in
441 that position of the draw, as a percentage of the
442 total number of times there has been an entrant
443 performing at that position of the draw.
444 </p>
445 </li>
446
447
448 </ul>
449
450 </div>
451 </xsl:template>
452
453</xsl:stylesheet>
454
Note: See TracBrowser for help on using the repository browser.