- Timestamp:
- 2021-04-24T15:12:31+12:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/about.xsl
r35102 r35116 161 161 </p> 162 162 163 <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> 164 165 <!-- 166 Kudos to: 167 https://byabbe.se/2020/09/17/getting-random-results-in-sparql 168 --> 169 <div id="select-random-entrant-sparqlquery" style="display: none;"> 170 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 171 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 172 PREFIX gsdlextracted: <http://greenstone.org/gsdlextracted#> 173 174 SELECT ?random ?esc_entrant_uri ?country ?year WHERE { 175 GRAPH <<xsl:value-of select="$graphURI"/>> { 176 ?esc_entrant_uri gsdlextracted:Year ?year. 177 ?esc_entrant_uri gsdlextracted:Country ?country. 178 BIND(SHA512(CONCAT(STR(RAND()), STR(?esc_entrant_uri))) AS ?random). 179 } 180 } 181 ORDER BY ?random 182 </div> 183 <div id="select-random-entrant-div" style="display: none;"> 184 Or how about picking a song ... 185 <ul> 186 <li><a id="select-random-entrant-a">... at random</a></li> 187 </ul> 188 </div> 189 <gsf:script> 190 $(document).ready(function() { 191 var endpoint_url="//sowemustthink.space/greenstone3-lod3/greenstone/query"; 192 var sparql_query = $('#select-random-entrant-sparqlquery').text(); 193 $.ajax({ 194 type: "POST", 195 url: endpoint_url, 196 data: { query: sparql_query, output: "json" }, 197 success: function(json_data) { 198 var rand_result = json_data.results.bindings[0]; 199 var esc_entrant_uri = rand_result.esc_entrant_uri.value; 200 $('#select-random-entrant-a').attr("href",esc_entrant_uri); 201 $('#select-random-entrant-div').show(); 202 }, 203 dataType: "json" 204 }); 205 }); 206 </gsf:script> 163 207 164 208 <h2>Data Analysis and Visualization</h2> … … 180 224 </gsf:script> 181 225 182 <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>183 226 <div id="sgvizler2-country-count" 184 227 data-sgvizler-endpoint="//sowemustthink.space/greenstone3-lod3/greenstone/query" … … 528 571 529 572 <p> 530 Despite our best intentions work sole y with573 Despite our best intentions work solely with 531 574 machine-readable dataâprimarily as you have seen in the 532 575 form of Linked Open Data, but also utilizing a … … 570 613 in a given year does, however, appear in the 571 614 article page for the contest in that year. In fact 572 it's in the same table we target ted to extract out573 draw position and placement. We therefore615 it's in the same table we targeted to extract out 616 the draw position and placement. We therefore 574 617 wrote a further page-scraping program to compare 575 618 the countries in that table with the countries
Note:
See TracChangeset
for help on using the changeset viewer.