source: gs2-extensions/apache-jena/trunk/src/transform/pages/sparql.xsl@ 37135

Last change on this file since 37135 was 37135, checked in by davidb, 17 months ago

A basic form-based page for Greenstone that allows SPARQL queries to be run

  • Property svn:executable set to *
File size: 26.0 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
12 <!-- use the 'main' layout -->
13 <xsl:import href="layouts/main.xsl"/>
14
15 <xsl:variable name="groupPath"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/></xsl:variable>
16 <!-- set page title -->
17 <xsl:template name="pageTitle">SPARQL Query</xsl:template>
18
19 <!-- set page breadcrumbs -->
20 <xsl:template name="breadcrumbs"><gslib:siteLink/><gslib:rightArrow/>
21 <xsl:if test="$groupPath != ''">
22 <xsl:for-each select="/page/pageResponse/pathList/group">
23 <xsl:sort data-type="number" select="@position"/>
24 <a>
25 <xsl:attribute name="href"><gslib:groupHref path="{@path}"/></xsl:attribute>
26 <xsl:attribute name="title"><gslib:groupName path="{@path}"/></xsl:attribute>
27 <gslib:groupName path="{@path}"/>
28 </a>
29 <gslib:rightArrow/>
30 </xsl:for-each>
31 </xsl:if>
32 <a href="{$library_name}/collection/{$collName}/page/about"><gslib:collectionName/></a>
33 </xsl:template>
34
35 <!-- the page content -->
36 <xsl:template match="/page">
37 <!--
38 <link rel="stylesheet" href="sites/{$site_name}/collect/{$collName}/style/fuseki.css" type="text/css" />
39 -->
40 <gsf:script src="sites/{$site_name}/collect/{$collName}/js/jquery.show-more.js"/>
41 <gsf:script src="sites/{$site_name}/collect/{$collName}/js/dataviz.js"/>
42
43 <!--
44 <link rel="stylesheet" href="sites/{$site_name}/collect/{$collName}/css/eurovision.css" type="text/css" />
45 -->
46 <gsf:style src="sites/{$site_name}/collect/{$collName}/css/dataviz.css" />
47
48 <div>
49 <h2>Query the Linked-Data and let its values Sparkle (aka SPARQL)</h2>
50
51 <p>
52 Using this page you can query the linked-data in the Greenstone3 <i>eurovision</i> triplestore
53 graph using <a href="https://en.wikipedia.org/wiki/SPARQL">SPARQL</a> query syntax.
54 The default query provided in the text box below is effectively issuing a query that
55 returns everything stored (a bit like matching with the wildcard '*' that some text-based search
56 systems have), limited to show just the first 500 entries that matched.
57 </p>
58
59 <p>
60 Use the default query to get a feel for the data that is
61 stored. Feel free to experiment with the syntax to vary
62 what is returned. For example, to view other "slices"
63 of the rows of data returned, change the values of
64 OFFSET and LIMIT. OFFSET controls how many result rows
65 are skipped over before rows are selected. LIMIT
66 controls how many rows are then taken.
67
68 </p>
69
70 <div id="sparql-show-more" class="showmore">
71 <p>
72 Alternatively, you might be interested in experimenting
73 with forms of access to the triplestore through the more powerful, but complex:
74 <ul>
75 <li>
76 <!-- endpoint -->
77 <a target="_blank" href="//{$sparqlEndpointHostAndOptPort}{$sparqlEndpointPrefix3}/dataset.html?tab=query&amp;ds=/greenstone">Fuseki interface</a>
78
79 </li>
80 </ul>
81 </p>
82 <p>
83 Or else export the entire triplestore to work on it with whichever Linked Data tools are your preference:
84 <ul>
85 <li>
86 <!-- endpoint -->
87 <a href="//{$sparqlEndpointHostAndOptPort}{$sparqlEndpointPrefix3}/greenstone/data" download="greenstone3-eurovision-lod.trig">Full Export in TriG Syntax</a>
88
89 </li>
90 <li>
91 <!-- endpoint -->
92 <a href="//{$sparqlEndpointHostAndOptPort}{$sparqlEndpointPrefix3}/greenstone/data" download="greenstone3-eurovision-lod.ttl">Full Export in Turtle Syntax</a>
93//{$sparqlEndpointHostAndOptPort}{$sparqlEndpointPrefix3}/greenstone/data
94 </li>
95 </ul>
96 </p>
97
98 </div>
99 <gsf:script>
100 $('#sparql-show-more').showMore({
101 minheight: 0,
102 buttontxtmore:"show more ...",
103 buttontxtless:"... show less"
104 });
105 </gsf:script>
106
107 </div>
108 <div>
109 <h2>SPARQL Query</h2>
110 <!--
111 <p>
112 Dataset: /greenstone<br/>
113 Graph: eurovision
114 </p>
115 -->
116
117 </div>
118
119 <div class="moreindent">
120 <!-- endpoint -->
121 <form id="sample-sparql-query-form"
122 action="//{$sparqlEndpointHostAndOptPort}{$sparqlEndpointPrefix3}/greenstone/query" target="_blank"
123 method="POST" accept-charset="UTF-8">
124
125 <textarea id="sample-sparql-query" name="query" style="width:100%; min-width:100%; max-width: 100%;" rows="14">
126<!-- -->
127<xsl:text>
128PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
129
130SELECT ?subject ?predicate ?object WHERE {
131 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
132 ?subject ?predicate ?object.
133 }
134}
135OFFSET 0 LIMIT 500
136</xsl:text>
137 </textarea>
138
139 <div style="display:none;">
140 <div>
141 Output:
142 <select name="output">
143 <option value="text">Text</option>
144 <option value="json">JSON</option>
145 <option value="xml" selected="selected">XML</option>
146 <option value="csv">CSV</option>
147 <option value="tsv">TSV</option>
148 </select>
149 </div>
150
151 <div>
152 If XML output, add XSLT style sheet (blank for none):
153 <select name="stylesheet">
154 <option value=""></option>
155 <!-- endpoint -->
156 <option value="//{$sparqlEndpointHostAndOptPort}{$sparqlEndpointPrefix1}/xml-to-html.xsl">xml-to-html</option>
157 <option value="//{$sparqlEndpointHostAndOptPort}{$sparqlEndpointPrefix1}/xml-to-html-links.xsl" selected="selected">xml-to-html-links</option>
158 <option value="//{$sparqlEndpointHostAndOptPort}{$sparqlEndpointPrefix1}/xml-to-html-plain.xsl">xml-to-html-plain</option>
159 </select>
160 </div>
161
162 <div>
163 <input type="checkbox" name="force-accept" value="text/plain" />
164 Force the accept header to <tt>text/plain</tt> regardless.
165 </div>
166 </div>
167
168 <div style="padding-top: 6px;">
169 <input type="submit" value="Get Results" />
170 </div>
171
172 </form>
173 </div>
174
175 <div>
176 <h2>Sample Queries</h2>
177
178 <p>
179 The sample queries provided below gradually increase in
180 the query syntax complexity used. They are intended
181 primarily for illustrative purposes, to introduce a user
182 unfamiliar to various aspects of SPARQL query syntax.
183 Click on one of the <i>Load query above</i> buttons to load
184 the relevant query syntax into the SPARQL Query textbox
185 above, then press <i>Get Results</i> to initiate the
186 query.
187 </p>
188
189 <div id="ssq-restrict-year" style="display: none;">
190<!-- -->
191<xsl:text>
192PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
193
194SELECT ?subject ?predicate ?object WHERE {
195 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
196 ?subject ?predicate ?object.
197 ?subject gsdlextracted:Year "2000".
198 }
199}
200OFFSET 0 LIMIT 200
201</xsl:text>
202 </div>
203
204 <div id="ssq-restrict-year-then-filter" style="display: none;">
205<!-- -->
206<xsl:text>
207PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
208
209SELECT ?subject ?predicate ?object WHERE {
210 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
211 ?subject ?predicate ?object.
212 ?subject gsdlextracted:Year "2000".
213
214 # The following removes a triple that stores JSON data that
215 # is voluminous but not very interesting to look at
216 FILTER (?predicate != gsdlextracted:JSON).
217 }
218}
219OFFSET 0 LIMIT 200
220</xsl:text>
221 </div>
222
223
224 <div id="ssq-restrict-country-and-year" style="display: none;">
225<!-- -->
226<xsl:text>
227PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
228PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
229
230SELECT ?subject ?predicate ?object WHERE {
231 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
232 ?subject ?predicate ?object
233
234 # The following removes a triple that stores JSON data that
235 # is voluminous but not very interesting to look at
236 FILTER (?predicate != gsdlextracted:JSON).
237
238 ?subject gsdlextracted:Year ?year.
239 ?subject gsdlextracted:Country ?country.
240 FILTER (?country = "France").
241 FILTER (xsd:integer(?year) >= 1996 &amp;&amp; xsd:integer(?year) &lt;= 2000).
242
243 }
244}
245OFFSET 0 LIMIT 200
246</xsl:text>
247 </div>
248
249
250
251 <div id="ssq-esc-entrants" style="display: none;">
252<!-- -->
253<xsl:text>
254PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
255PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
256PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
257
258SELECT ?esc_entrant_uri ?country ?year WHERE {
259 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
260 ?esc_entrant_uri dc:Relation.isPartOf &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt;.
261
262 ?esc_entrant_uri gsdlextracted:Year ?year.
263 ?esc_entrant_uri gsdlextracted:Country ?country.
264 }
265}
266ORDER BY ASC(?year) ?country
267</xsl:text>
268 </div>
269
270 <div id="ssq-esc-entrants-with-key" style="display: none;">
271<!-- -->
272<xsl:text>
273PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
274PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
275PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
276PREFIX essentia: &lt;http://upf.edu/essentia#&gt;
277
278SELECT ?esc_entrant_uri ?country ?year ?musical_key ?scale ?strength_estimate WHERE {
279 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
280 ?esc_entrant_uri dc:Relation.isPartOf &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt;.
281
282 ?esc_entrant_uri gsdlextracted:Year ?year.
283 ?esc_entrant_uri gsdlextracted:Country ?country.
284 ?esc_entrant_uri essentia:tonal_key_edma_key ?musical_key.
285 ?esc_entrant_uri essentia:tonal_key_edma_scale ?scale.
286 ?esc_entrant_uri essentia:tonal_key_edma_strength ?strength_estimate.
287 }
288}
289ORDER BY ASC(?year) ?country
290</xsl:text>
291 </div>
292
293
294 <div id="ssq-esc-winners-freq-count-scale" style="display: none;">
295<!-- -->
296<xsl:text>
297PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
298PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
299PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
300PREFIX essentia: &lt;http://upf.edu/essentia#&gt;
301
302
303SELECT ?scale (STR(COUNT(?scale)) as ?number_in_scale) WHERE {
304#SELECT ?scale ?country ?year WHERE {
305 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
306
307 ?esc_entrant_uri gsdlextracted:Place "1".
308 # ?esc_entrant_uri essentia:tonal_key_edma_key ?musical_key.
309 ?esc_entrant_uri essentia:tonal_key_edma_scale ?scale.
310
311 ?esc_entrant_uri gsdlextracted:Year ?year.
312 ?esc_entrant_uri gsdlextracted:Country ?country.
313 }
314}
315GROUP BY ?scale
316ORDER BY DESC(?number_in_scale)
317</xsl:text>
318 </div>
319
320
321 <div id="ssq-jury-votes-totals-1975" style="display: none;">
322<!-- -->
323<xsl:text>
324PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
325PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
326PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
327
328SELECT ?country ?year ?total WHERE {
329 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
330 ?esc_entrant_uri dc:Relation.isPartOf &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt;.
331
332 ?esc_entrant_uri gsdlextracted:SingVotesTotal ?total.
333 BIND(xsd:integer(?total) AS ?total_int).
334
335 ?esc_entrant_uri gsdlextracted:Year ?year
336 FILTER(xsd:integer(?year) = 1975).
337 ?esc_entrant_uri gsdlextracted:Country ?country.
338 }
339}
340ORDER BY DESC(?total_int)
341</xsl:text>
342 </div>
343
344
345 <div id="ssq-jury-votes-1975" style="display: none;">
346<!-- -->
347<xsl:text>
348PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
349PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
350PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
351
352SELECT ?country ?year ?jury_country ?jury_vote WHERE {
353 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
354 ?esc_entrant_uri dc:Relation.isPartOf &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt;.
355
356 ?esc_entrant_uri ?gsdlextracted_jury_country_uri ?jury_vote.
357 BIND(STRENDS(str(?gsdlextracted_jury_country_uri),"-J") AS ?is_jury_vote)
358 FILTER (?is_jury_vote).
359 BIND(REPLACE(str(?gsdlextracted_jury_country_uri), ".*#(.*?)-J$", "$1") AS ?jury_country).
360
361 ?esc_entrant_uri gsdlextracted:Year ?year
362 FILTER(xsd:integer(?year) = 1975).
363 ?esc_entrant_uri gsdlextracted:Country ?country.
364
365
366 }
367}
368ORDER BY ASC(?year) ?country
369</xsl:text>
370 </div>
371
372
373 <div id="ssq-winning-totals" style="display: none;">
374<!-- -->
375<xsl:text>
376PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
377PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
378PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
379
380SELECT ?year ?country ?total_max WHERE {
381 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
382
383 {
384 SELECT ?year (STR(MAX(?total_int_inner)) as ?total_max) WHERE {
385
386 ?esc_entrant_uri gsdlextracted:VoteGrandTotal ?total.
387 BIND(xsd:integer(?total) AS ?total_int_inner).
388
389 ?esc_entrant_uri gsdlextracted:Year ?year.
390 }
391 GROUP BY ?year
392 }
393
394 ?esc_entrant_uri gsdlextracted:VoteGrandTotal ?total_max.
395 ?esc_entrant_uri gsdlextracted:Year ?year.
396 ?esc_entrant_uri gsdlextracted:Country ?country.
397
398 BIND(xsd:integer(?total_max) as ?total_int).
399 }
400}
401ORDER BY DESC(?total_int)
402</xsl:text>
403 </div>
404
405
406 <div id="ssq-winning-freq-count" style="display: none;">
407<!-- -->
408<xsl:text>
409
410PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
411PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
412PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
413
414
415SELECT ?country (STR(COUNT(?country)) as ?number_of_vote_wins) WHERE {
416 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
417 {
418 SELECT ?year (STR(MAX(?total_int)) as ?total_max) WHERE {
419 ?esc_entrant_uri gsdlextracted:VoteGrandTotal ?total.
420 BIND(xsd:integer(?total) AS ?total_int).
421
422 ?esc_entrant_uri gsdlextracted:Year ?year.
423 }
424 GROUP BY ?year
425 }
426
427 ?esc_entrant_uri gsdlextracted:VoteGrandTotal ?total_max.
428 ?esc_entrant_uri gsdlextracted:Year ?year.
429 ?esc_entrant_uri gsdlextracted:Country ?country.
430 }
431}
432GROUP BY ?country
433ORDER BY DESC(?number_of_vote_wins)
434</xsl:text>
435 </div>
436
437
438
439 <div id="ssq-from-winning-to-losing" style="display: none;">
440<!-- -->
441<xsl:text>
442
443PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
444PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
445PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
446PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
447
448SELECT (?country as ?Country) (?year AS ?WinningYear) (?total as ?WinningGrandTotal) (?next_year AS ?LosingYear) (?next_total as ?LosingGrandTotal)
449WHERE {
450 GRAPH &lt;</xsl:text><xsl:value-of select="$graphURI"/><xsl:text>&gt; {
451 ?esc_entrant_uri gsdlextracted:Country ?country.
452 ?esc_entrant_uri gsdlextracted:VoteGrandTotal ?total.
453
454 ?esc_entrant_uri gsdlextracted:Place ?place.
455 BIND(xsd:integer(?place) AS ?place_int).
456 FILTER(?place_int = 1).
457
458 ?esc_entrant_uri gsdlextracted:Year ?year.
459 BIND(xsd:integer(?year) AS ?year_int).
460 BIND(?year_int + 1 AS ?next_year_int).
461 BIND(str(?next_year_int) AS ?next_year).
462
463 ?next_esc_entrant_uri gsdlextracted:Country ?country.
464 ?next_esc_entrant_uri gsdlextracted:Year ?next_year.
465
466 ?next_esc_entrant_uri gsdlextracted:VoteGrandTotal ?next_total.
467
468 ?next_esc_entrant_uri gsdlextracted:ReverseFinishingPos ?rev_finishing_pos.
469 BIND(xsd:integer(?rev_finishing_pos) AS ?rev_finishing_pos_int).
470 FILTER(?rev_finishing_pos_int = 1).
471
472
473 }
474}
475ORDER BY ?country
476</xsl:text>
477 </div>
478
479 <div id="ssq-country-info" style="display: none;">
480<!--
481 Adapted from:
482 https://stackoverflow.com/questions/40069644/retrieve-information-about-all-european-countries
483-->
484<xsl:text>
485
486PREFIX gsdlextracted: &lt;http://greenstone.org/gsdlextracted#&gt;
487
488PREFIX dbo: &lt;http://dbpedia.org/ontology/&gt;
489PREFIX dbp: &lt;http://dbpedia.org/property/&gt;
490PREFIX dct: &lt;http://purl.org/dc/terms/&gt;
491#PREFIX geo: &lt;http://www.opengis.net/ont/geosparql#&gt;
492
493PREFIX geo: &lt;http://www.w3.org/2003/01/geo/wgs84_pos#&gt;
494
495SELECT DISTINCT ?country_uri ?capital ?area ?populationTotal ?lat ?long
496 ?currency ?gdpPppPerCapita ?giniCoefficient WHERE {
497
498 SERVICE &lt;https://dbpedia.org/sparql&gt; {
499
500 ?db_country_uri dbo:capital ?db_capital.
501
502 BIND(?db_country_uri AS ?country_uri).
503 BIND(str(?db_country_uri) AS ?country_uri_str).
504 BIND(?db_capital AS ?capital).
505
506# OPTIONAL {
507# ?country_uri dbp:areaKm ?area.
508# ?country_uri dbo:populationTotal ?populationTotal.
509# ?country_uri geo:lat ?lat.
510# ?country_uri geo:long ?long.
511# }
512
513 OPTIONAL { ?country_uri dbp:areaKm ?area. }
514 OPTIONAL { ?country_uri dbo:populationTotal ?populationTotal. }
515 OPTIONAL { ?capital geo:lat ?lat. }
516 OPTIONAL { ?capital geo:long ?long. }
517
518 OPTIONAL { ?country_uri dbp:currencyCode ?currency. }
519 OPTIONAL { ?country_uri dbp:gdpPppPerCapita ?gdpPppPerCapita. }
520
521 OPTIONAL { ?country_uri dbo:giniCoefficient ?giniCoefficient. }
522 }
523
524 ?esc_entrant_uri gsdlextracted:CountryDBURI ?country_uri_str.
525
526}
527ORDER BY ASC(?country_uri)
528</xsl:text>
529 </div>
530
531
532
533 <ul class="ssq">
534 <li>
535 <b>Year Restricted (raw data rows):</b><br />
536 <button type="button" class="load-ssq" id="load-ssq-restrict-year" onclick="ssq_load('ssq-restrict-year')">Load query above</button>
537 <button type="button" class="exec-ssq" id="exec-ssq-restrict-year" onclick="ssq_execute()">Get Results</button><br />
538 <p>Similar to the default query (all results returned) but restricted to entries associated with the year 2000.</p>
539 </li>
540
541 <div id="raw-sparql-show-more" class="showmore">
542 <style>
543 #showmore-button-raw-sparql-show-more { width: 260px; }
544 </style>
545
546 <li>
547 <b>Year Restricted (raw data rows) then filter out <i>gsdlextracted:JSON</i> entries:</b><br/>
548 <button type="button" class="load-ssq" id="load-ssq-restrict-year-then-filter" onclick="ssq_load('ssq-restrict-year-then-filter')">Load query above</button>
549 <button type="button" class="exec-ssq" id="exec-ssq-restrict-year-then-filter" onclick="ssq_execute()">Get Results</button><br/>
550 <p>
551 Similar to the previous query (restricted to results from 2000) but filtering out the voluminous, but not very interesting to look at,
552 <i>gsdlextracted:JSON</i>.
553 </p>
554 <p>
555 This field is formed by Greenstone at ingest-time: it represents all the metadata fields for a particular country
556 stored in the JSON format. It is a handy item for the Greenstone3 runtime-system to access, but in the context of viewing the output
557 of SPARQL queries at HTML only serves to pollute the generated result set with large text items.
558 </p>
559 </li>
560
561 <li>
562 <b>Country and Year Restricted (raw data rows):</b><br/>
563 <button type="button" class="load-ssq" id="load-ssq-restrict-country-and-year" onclick="ssq_load('ssq-restrict-country-and-year')">Load query above</button>
564 <button type="button" class="exec-ssq" id="exec-ssq-restrict-country-and-year" onclick="ssq_execute()">Get Results</button><br/>
565
566 <p>Similar to the previous query, but restricted to entries about the country France, in the years 1996-2000.</p>
567 </li>
568 </div>
569 <gsf:script>
570 $('#raw-sparql-show-more').showMore({
571 minheight: 0,
572 buttontxtmore:"show further raw-data queries ...",
573 buttontxtless:"... show less"
574 });
575 </gsf:script>
576
577 <li>
578 <b>Eurovision Song Contest (ESC) entrants:</b><br/>
579 <button type="button" class="load-ssq" id="load-ssq-esc-entrants" onclick="ssq_load('ssq-esc-entrants')">Load query above</button>
580 <button type="button" class="exec-ssq" id="exec-ssq-esc-entrants" onclick="ssq_execute()">Get Results</button><br/>
581
582 <p>List all the entrants (country and year) sorted by year, then by country.</p>
583 </li>
584
585 <li>
586 <b>Eurovision Song Contest (ESC) entrants with (estimated) musical key:</b><br/>
587 <button type="button" class="load-ssq" id="load-ssq-esc-entrants-with-key" onclick="ssq_load('ssq-esc-entrants-with-key')">Load query above</button>
588 <button type="button" class="exec-ssq" id="exec-ssq-esc-entrants-with-key" onclick="ssq_execute()">Get Results</button><br/>
589
590 <p>
591 Similar to the above query that list all the entrants (country and year) sorted by year, then by country, but also displays
592 the estimated key signature of the song, which is pre-computed using the Essentia audio content analysis toolkit
593 when the collection is built.
594 </p>
595 </li>
596
597 <li>
598 <b>Musical scale comparison of winning entries:</b><br/>
599 <button type="button" class="load-ssq" id="load-ssq-esc-winners-freq-count-scale" onclick="ssq_load('ssq-esc-winners-freq-count-scale')">Load query above</button>
600 <button type="button" class="exec-ssq" id="exec-ssq-esc-winners-freq-count-scale" onclick="ssq_execute()">Get Results</button><br/>
601
602 <p>
603 Frequency count of the scale (major or minor) that
604 winning songs were in. The estimated musical scale
605 of the song is an estimate, pre-computed using the
606 Essentia audio content analysis toolkit when the
607 collection is built.
608 </p>
609 </li>
610
611
612 <li>
613 <b>Voting Totals in 1975:</b><br/>
614 <button type="button" class="load-ssq" id="load-ssq-jury-votes-totals-1975" onclick="ssq_load('ssq-jury-votes-totals-1975')">Load query above</button>
615 <button type="button" class="exec-ssq" id="exec-ssq-jury-votes-totals-1975" onclick="ssq_execute()">Get Results</button><br/>
616
617 <p>In 1975 all voting was done exclusively by jury. This query retrieves the
618 totals of this Single voting format, and orders them by that score.</p>
619 </li>
620
621
622
623 <li>
624 <b>Jury Votes Cast by Country in 1975:</b><br/>
625 <button type="button" class="load-ssq" id="load-ssq-jury-votes-1975" onclick="ssq_load('ssq-jury-votes-1975')">Load query above</button>
626 <button type="button" class="exec-ssq" id="exec-ssq-jury-votes-1975" onclick="ssq_execute()">Get Results</button><br/>
627
628 <p>List all votes case in the 1975 competition.</p>
629 </li>
630
631
632 <li>
633 <b>Most points won:</b><br/>
634 <button type="button" class="load-ssq" id="load-ssq-winning-totals" onclick="ssq_load('ssq-winning-totals')">Load query above</button>
635 <button type="button" class="exec-ssq" id="exec-ssq-winning-totals" onclick="ssq_execute()">Get Results</button><br/>
636
637 <p>List the countries which won and their voting totals, sorted by total score.</p>
638 </li>
639
640 <li>
641 <b>Number of Times Countries Have Won:</b><br/>
642 <button type="button" class="load-ssq" id="load-ssq-winning-freq-count" onclick="ssq_load('ssq-winning-freq-count')">Load query above</button>
643 <button type="button" class="exec-ssq" id="exec-ssq-winning-freq-count" onclick="ssq_execute()">Get Results</button><br/>
644
645 <p>
646 The number of times a country has won Eurovision
647 across the years. The includes the years when only
648 Juries voted (1956-2000) through to the introduction
649 of Televotes, where a variety of forms have been
650 used such as only Televotes, a pre-combined score
651 based on Televotes and Jury votes, to (from 2016
652 onwards) where the Jury and Tele votes are
653 explicitly given individually per country, then
654 combined.
655
656 </p>
657 <p>
658 This query works off the Voting Totals countries
659 received, and so if you run the query you'll see
660 that it computes (as of 2021) that France has won 6
661 times, when the official record puts this at 5 for
662 France. This is due to a tie that occurred between
663 Sweeden and France in the 1991 final, and how it was
664 resolved. From <a target="_blank"
665 href="https://en.wikipedia.org/wiki/France_in_the_Eurovision_Song_Contest_1991"
666 hrefXXXX="https://en.wikipedia.org/wiki/Le_Dernier_qui_a_parl%C3%A9...">Wikipedia</a>:
667 “After the four-way tie at the 1969 contest, a
668 tie-break system had been implemented, where a
669 count-back on the number of top points awarded was
670 used. Since both countries received four 12-points,
671 but Sweden gaining five 10-points over France's two,
672 Sweden was declared the winner with France coming
673 second.”
674
675
676 </p>
677 </li>
678
679
680
681 <li>
682 <b>From Hero to Zero!</b><br/>
683 <button type="button" class="load-ssq" id="load-ssq-from-winning-to-losing" onclick="ssq_load('ssq-from-winning-to-losing')">Load query above</button>
684 <button type="button" class="exec-ssq" id="exec-ssq-from-winning-to-losing" onclick="ssq_execute()">Get Results</button><br/>
685
686 <p>
687 List countries where, having won in one year, they
688 have gone on to lose with the lowest score of the
689 contest the following year. Note this definition
690 doesn't quite meet the given heading of <i>From Here
691 to Zero</i>. There is in fact only one country, to
692 date, where this has happened (nul-point the
693 following year). View the table to see who it is
694 ... then why not test out your SPARQL querying
695 skills and see if you can modify the query used so
696 it only returns the Hero to Zero case?
697 </p>
698 </li>
699
700 <li>
701 <b>Facts and Figures About Competing Countries:</b><br/>
702 <button type="button" class="load-ssq" id="load-ssq-country-info" onclick="ssq_load('ssq-country-info')">Load query above</button>
703 <button type="button" class="exec-ssq" id="exec-ssq-country-info" onclick="ssq_execute()">Get Results</button><br/>
704
705 <p>
706 Demographics about other related information about the countries the song contest entries are from.
707 Query takes a bit longer to run than the previous ones.
708 </p>
709 </li>
710
711 </ul>
712
713 <p>
714 Looking for something a bit more visual? Why not head over to our
715 <a href="{$library_name}/collection/{$collName}/page/sgvizler"><i>SGVizler page</i></a> and try the SPARQL-based visualization samples there.
716 </p>
717
718 </div>
719 </xsl:template>
720
721
722</xsl:stylesheet>
723
Note: See TracBrowser for help on using the repository browser.