Changeset 34956
- Timestamp:
- 2021-03-03T00:27:10+13:00 (3 years ago)
- Location:
- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/css/eurovision.css
r34942 r34956 81 81 display: none; 82 82 } 83 84 85 .sgvizler-form textarea { 86 width:100%; 87 min-width:100%; 88 max-width: 100%; 89 min-height: 24px; 90 padding-left: 6px; 91 padding-right: 6px; 92 } 93 .sgvizler-form pre { 94 margin-top: 9px; 95 margin-bottom: 3px; 96 } 97 -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/eurovision.js
r34942 r34956 211 211 } 212 212 213 function ssq_execute( query_text_id)213 function ssq_execute() 214 214 { 215 215 $('#sample-sparql-query-form').submit(); … … 217 217 218 218 219 219 220 function ssv_execute(query_text_id) 220 221 { 221 222 222 223 var sgvizler_div_raw_text = $('#sample-sgvizler-div').val(); 224 225 // var data_sgvizler_query_raw_text = $('#sample-data-sgvizler-query').val(); 226 //var $sgvizler_div1 = $(sgvizler_div_raw_text); 227 228 var data_sgvizler_endpoint = $('#sample-data-sgvizler-endpoint').val().trim(); 229 var data_sgvizler_chart = $('#sample-data-sgvizler-chart').val().trim(); 230 var data_sgvizler_chart_options = $('#sample-data-sgvizler-chart-options').val().trim(); 231 232 var div_style = $('#sample-div-style').val(); 233 234 var $sgvizler_div2 = $('<div>').attr("id","sgvizler-div"); 235 $sgvizler_div2.attr("data-sgvizler-endpoint",data_sgvizler_endpoint); 236 $sgvizler_div2.attr("data-sgvizler-chart",data_sgvizler_chart); 237 $sgvizler_div2.attr("data-sgvizler-chart-options",data_sgvizler_chart_options); 238 $sgvizler_div2.attr("data-sgvizler-log","2"); 239 240 $sgvizler_div2.attr("style",div_style); 241 223 242 var data_sgvizler_query_raw_text = $('#sample-data-sgvizler-query').val(); 224 //console.log("*** sgvizer_div_raw_text = " + sgvizler_div_raw_text); 225 226 var $sgvizler_div = $(sgvizler_div_raw_text); 227 $sgvizler_div.attr('data-sgvizler-query',data_sgvizler_query_raw_text); 228 229 $sgvizler_div.attr('style',"width:900px; height:300px; margin-left: auto; margin-right: auto; overflow-y: scroll; overflow-x: hidden;"); 230 231 $('#sgvizler-div-outer').empty().append($sgvizler_div); 243 //$sgvizler_div1.attr('data-sgvizler-query',data_sgvizler_query_raw_text); 244 $sgvizler_div2.attr('data-sgvizler-query',data_sgvizler_query_raw_text); 245 246 247 //$sgvizler_div1.attr('style',"width:900px; height:300px; margin-left: auto; margin-right: auto; overflow-y: scroll; overflow-x: hidden;"); 248 249 /* 250 console.log("**** sgvizler_div1 = "); 251 console.log($sgvizler_div1[0]); 252 253 console.log("**** sgvizler_div2 = "); 254 console.log($sgvizler_div2[0]); 255 */ 256 257 $('#sgvizler-div-outer').empty().append($sgvizler_div2); 232 258 233 259 sgvizler2.containerDraw('sgvizler-div'); 234 260 } 261 262 263 function ssv_load(query_text_id) 264 { 265 $('#sample-data-sgvizler-query').text($('#'+query_text_id).text().trim()); 266 $('.exec-ssq').hide(); 267 $('#exec-'+query_text_id).show(); 268 } 269 -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/sgvizler.xsl
r34942 r34956 65 65 66 66 <div class="page moreindent"> 67 <form id="sample-sparql-query-form" action="/greenstone3-lod/greenstone/query" target="_blank" 67 <form class="sgvizler-form" id="sample-sparql-query-form" 68 action="/greenstone3-lod/greenstone/query" target="_blank" 68 69 method="GET" accept-charset="UTF-8"> 69 70 70 <pre>data-sgvizler-query:</pre> 71 <textarea id="sample-data-sgvizler-query" name="query" style="width:100%; min-width:100%; max-width: 100%;" rows="10">71 <textarea id="sample-data-sgvizler-query" name="query" class="sgvizler" rows="10"> 72 72 <!-- --> 73 73 <xsl:text> … … 77 77 WHERE { 78 78 GRAPH <http://localhost:3030/greenstone/data/eurovision> { 79 ?s gsextracted:Country ?country 79 ?s gsextracted:Country ?country. 80 80 } 81 81 } 82 GROUP BY ?country ORDER BY asc(?country)83 </xsl:text> 84 </textarea> 85 82 GROUP BY ?country ORDER BY DESC(?freqCount) 83 </xsl:text> 84 </textarea> 85 <!-- 86 86 <pre>sgvizler-div:</pre> 87 <textarea id="sample-sgvizler-div" name="sgvizler-div" style="width:100%; min-width:100%; max-width: 100%;" rows="7">88 <!-- --> 87 <textarea id="sample-sgvizler-div" name="sgvizler-div" class="sgvizler" rows="7"> 88 89 89 <xsl:text> 90 90 <div id="sgvizler-div" 91 91 data-sgvizler-endpoint="//sowemustthink.space/greenstone3-lod/greenstone/query" 92 92 data-sgvizler-chart="google.visualization.BarChart" 93 XXdata-sgvizler-chart-options="title=Number of Songs from each Country|legend.position=none" 94 data-sgvizler-chart-options="title=Number of Songs from each Country|legend.position=none|height=900|chartArea.height=840|fontSize=11" 93 data-sgvizler-chart-options="title=Number of Songs from each Country (sorted by size)|legend.position=none|height=900|chartArea.height=840|fontSize=11" 95 94 data-sgvizler-log="2"> 96 95 </div> 97 96 </xsl:text> 98 97 </textarea> 99 100 <!-- 101 <div> 102 <input type="submit" value="Show Visualization" /> 103 </div> 104 --> 98 --> 99 100 101 <pre>data-sgvizler-endpoint:</pre> 102 <textarea id="sample-data-sgvizler-endpoint" name="sgvizler-endpoint" class="sgvizler" rows="1"> 103 <!-- --> 104 <xsl:text> 105 //sowemustthink.space/greenstone3-lod/greenstone/query 106 </xsl:text> 107 </textarea> 108 109 <pre>data-sgvizler-chart:</pre> 110 <textarea id="sample-data-sgvizler-chart" name="sgvizler-chart" class="sgvizler" rows="1"> 111 <!-- --> 112 <xsl:text> 113 google.visualization.BarChart 114 </xsl:text> 115 </textarea> 116 117 118 <pre>data-sgvizler-chart-options:</pre> 119 <textarea id="sample-data-sgvizler-chart-options" name="sgvizler-chart-options" class="sgvizler" rows="2"> 120 <!-- --> 121 <xsl:text> 122 title=Number of Songs from each Country (sorted by size)|legend.position=none|height=900|chartArea.height=840|fontSize=11 123 </xsl:text> 124 </textarea> 125 126 <pre>div-style:</pre> 127 <textarea id="sample-div-style" name="sgvizler-style" class="sgvizler" rows="2"> 128 <!-- --> 129 <xsl:text> 130 width:900px; height:300px; margin-left: auto; margin-right: auto; overflow-y: scroll; overflow-x: hidden; 131 </xsl:text> 132 </textarea> 105 133 106 134 <div class="page ssq"> … … 111 139 </div> 112 140 113 114 141 115 142 <div id="sgvizler-div-outer"> 116 <!-- 117 <div id="sgvizler-div" 118 data-sgvizler-endpoint="//sowemustthink.space/greenstone3-lod/greenstone/query" 119 data-sgvizler-chart="google.visualization.BarChart" 120 data-sgvizler-chart-options="title=Number of Songs from each Country|legend.position=none|height=900|chartArea.height=840|fontSize=11" 121 data-sgvizler-log="2" 122 style="width:100%; height:300px; margin-left: auto; margin-right: auto; overflow-y: scroll; overflow-x: hidden;"> 123 <xsl:attribute name="data-sgvizler-query"> 124 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 125 PREFIX gsextracted: <http://greenstone.org/gsextracted#> 126 SELECT (?country) (COUNT(?country) AS ?freqCount) 127 WHERE { 128 GRAPH <http://localhost:3030/greenstone/data/eurovision> { 129 ?s gsextracted:Country ?country 130 } 131 } 132 GROUP BY ?country ORDER BY asc(?country) 133 </xsl:attribute> 134 <xsl:text> Loading ...</xsl:text> 135 </div> 136 --> 143 <xsl:text>Loading ...</xsl:text> 137 144 </div> 138 145 … … 140 147 <xsl:text disable-output-escaping="yes"> 141 148 $(document).ready( 142 function() {149 function() { 143 150 ssv_execute(); 144 145 /* 146 var sgvizler_div_raw_text = $('#sample-sgvizler-div').text(); 147 var data_sgvizler_query_raw_text = $('#sample-data-sgvizler-query').text(); 148 149 var $sgvizler_div = $(sgvizler_div_raw_text); 150 $sgvizler_div.attr('data-sgvizler-query',data_sgvizler_query_raw_text); 151 152 $sgvizler_div.attr('style',"width:900px; height:300px; margin-left: auto; margin-right: auto; overflow-y: scroll; overflow-x: hidden;"); 153 154 $('#sgvizler-div-outer').empty().append($sgvizler_div); 155 156 sgvizler2.containerDraw('sgvizler-div'); 157 */ 158 } 151 } 159 152 ); 160 153 </xsl:text> 161 154 </script> 162 155 163 164 156 <div class="page"> 165 157 <h2>Sample Queries</h2> 166 158 167 159 <p> 168 The sample queries provided below gradually increase in 169 the query syntax complexity used. They are intended 170 primarily for illustrative purposes, to introduce 171 a user unfamiliar to various aspects of 172 SPARQL query syntax. Click on one of the links below 160 The samples provided below show a range 161 of vizisualizations related to the 162 Eurovision Song Contest, sourced from the raw 163 data in the triple-store, and converted into 164 a visualization using SGVizler. 165 166 Click on one of <i>Load query above</i> buttons to load 173 167 to load the relevant query syntax into the SPARQL 174 Query textbox above, then press <i>Get Results</i> 175 to initiate the query. 168 Query textbox above, accompanied with SGVizler 169 attributes that control the visualization, 170 then press <i>Get Results</i> 171 to initiate the visualization. 176 172 </p> 177 178 <div id="ssq-restrict-year" style="display: none;"> 179 <!-- --> 180 <xsl:text> 173 174 <div id="ssv-made-the-final" style="display: none;"> 175 176 <!-- Made the finals --> 177 <xsl:text> 178 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 181 179 PREFIX gsextracted: <http://greenstone.org/gsextracted#> 182 183 SELECT ?subject ?predicate ?object WHERE { 184 GRAPH <http://localhost:3030/greenstone/data/eurovision> { 185 ?subject ?predicate ?object 186 187 # The following removed a triple that stores JSON data that 188 # is voluminous but not very interesting to look at 189 FILTER (?predicate != gsextracted:JSON). 190 ?subject gsextracted:Year "2000". 191 } 180 SELECT (?country) (COUNT(?country) AS ?freqCount) 181 WHERE { 182 GRAPH <http://localhost:3030/greenstone/data/eurovision> { 183 ?s gsextracted:Country ?country. 184 ?s gsextracted:Final "true" 185 } 192 186 } 193 OFFSET 0 LIMIT 200 187 GROUP BY ?country ORDER BY DESC(?freqCount) 194 188 </xsl:text> 195 189 </div> 196 190 197 198 <div id="ssq-restrict-country-and-year" style="display: none;">199 <!-- -->200 <xsl:text>201 PREFIX gsextracted: <http://greenstone.org/gsextracted#>202 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>203 204 SELECT ?subject ?predicate ?object WHERE {205 GRAPH <http://localhost:3030/greenstone/data/eurovision> {206 ?subject ?predicate ?object207 208 # The following removed a triple that stores JSON data that209 # is voluminous but not very interesting to look at210 FILTER (?predicate != gsextracted:JSON).211 212 ?subject gsextracted:Year ?year.213 ?subject gsextracted:Country ?country.214 FILTER (?country = "France").215 FILTER (xsd:integer(?year) >= 1996 && xsd:integer(?year) <= 2000).216 217 }218 }219 OFFSET 0 LIMIT 200220 </xsl:text>221 </div>222 223 224 <div id="ssq-esc-entrants" style="display: none;">225 <!-- -->226 <xsl:text>227 PREFIX gsextracted: <http://greenstone.org/gsextracted#>228 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>229 PREFIX dc: <http://purl.org/dc/elements/1.1/>230 231 SELECT ?esc_entrant_uri ?country ?year WHERE {232 GRAPH <http://localhost:3030/greenstone/data/eurovision> {233 ?esc_entrant_uri dc:Relation.isPartOf <http://127.0.0.1:8383/greenstone3/library/collection/eurovision>.234 235 ?esc_entrant_uri gsextracted:Year ?year.236 ?esc_entrant_uri gsextracted:Country ?country.237 }238 }239 ORDER BY ASC(?year) ?country240 </xsl:text>241 </div>242 243 244 <div id="ssq-jury-votes-totals-1975" style="display: none;">245 <!-- -->246 <xsl:text>247 PREFIX gsextracted: <http://greenstone.org/gsextracted#>248 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>249 PREFIX dc: <http://purl.org/dc/elements/1.1/>250 251 SELECT ?country ?year ?total WHERE {252 GRAPH <http://localhost:3030/greenstone/data/eurovision> {253 ?esc_entrant_uri dc:Relation.isPartOf <http://127.0.0.1:8383/greenstone3/library/collection/eurovision>.254 255 ?esc_entrant_uri gsextracted:JuryVotesTotal ?total.256 BIND(xsd:integer(?total) AS ?total_int).257 258 ?esc_entrant_uri gsextracted:Year ?year259 FILTER(xsd:integer(?year) = 1975).260 ?esc_entrant_uri gsextracted:Country ?country.261 }262 }263 ORDER BY DESC(?total_int)264 </xsl:text>265 </div>266 267 268 <div id="ssq-jury-votes-1975" style="display: none;">269 <!-- -->270 <xsl:text>271 PREFIX gsextracted: <http://greenstone.org/gsextracted#>272 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>273 PREFIX dc: <http://purl.org/dc/elements/1.1/>274 275 SELECT ?country ?year ?jury_country ?jury_vote WHERE {276 GRAPH <http://localhost:3030/greenstone/data/eurovision> {277 ?esc_entrant_uri dc:Relation.isPartOf <http://127.0.0.1:8383/greenstone3/library/collection/eurovision>.278 279 ?esc_entrant_uri ?gsextracted_jury_country_uri ?jury_vote.280 BIND(STRENDS(str(?gsextracted_jury_country_uri),"-J") AS ?is_jury_vote)281 FILTER (?is_jury_vote).282 BIND(REPLACE(str(?gsextracted_jury_country_uri), ".*#(.*?)-J$", "$1") AS ?jury_country).283 284 ?esc_entrant_uri gsextracted:Year ?year285 FILTER(xsd:integer(?year) = 1975).286 ?esc_entrant_uri gsextracted:Country ?country.287 288 289 }290 }291 ORDER BY ASC(?year) ?country292 </xsl:text>293 </div>294 191 295 192 <ul class="ssq"> 296 193 <li> 297 Year Restricted (raw data rows):<br/>298 <button type="button" class="load-ssq" id="load-ss q-restrict-year" onclick="ssq_load('ssq-restrict-year')">Load query above</button>299 <button type="button" class="exec-ssq" id="exec-ss q-restrict-year" onclick="ssq_execute()">GetResults</button><br/>300 Similar to the default query (all results returned) but restricted to entries associated with the year 2000.194 Made the Finals:<br/> 195 <button type="button" class="load-ssq" id="load-ssv-made-the-final" onclick="ssv_load('ssv-made-the-final')">Load query above</button> 196 <button type="button" class="exec-ssq" id="exec-ssv-made-the-final" onclick="ssv_execute()">Visualize Results</button><br/> 197 Plot as a bar graph the number of times each country has made it to the finals. 301 198 </li> 302 199 303 <li>304 Country and Year Restricted (raw data rows):<br/>305 <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>306 <button type="button" class="exec-ssq" id="exec-ssq-restrict-country-and-year" onclick="ssq_execute()">Get Results</button><br/>307 308 Similar to the default query but restricted to entries about the country France, in the years 1996-2000.309 </li>310 311 <li>312 Eurovison Song Contest (ESC) entrants:<br/>313 <button type="button" class="load-ssq" id="load-ssq-esc-entrants" onclick="ssq_load('ssq-esc-entrants')">Load query above</button>314 <button type="button" class="exec-ssq" id="exec-ssq-esc-entrants" onclick="ssq_execute()">Get Results</button><br/>315 316 List all the entrants (country and year) sorted by year, then by country.317 </li>318 319 <li>320 Jury Voting Totals in 1975:<br/>321 <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>322 <button type="button" class="exec-ssq" id="exec-ssq-jury-votes-totals-1975" onclick="ssq_execute()">Get Results</button><br/>323 324 The jury vote totals countries received in 1975, ranked to score.325 </li>326 327 328 <li>329 Jury Votes Cast by Country in 1975:<br/>330 <button type="button" class="load-ssq" id="load-ssq-jury-votes-1975" onclick="ssq_load('ssq-jury-votes-1975')">Load query above</button>331 <button type="button" class="exec-ssq" id="exec-ssq-jury-votes-1975" onclick="ssq_execute()">Get Results</button><br/>332 333 List all votes case in the 1975 competition.334 </li>335 200 336 201 </ul> -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/sparql.xsl
r34942 r34956 144 144 The sample queries provided below gradually increase in 145 145 the query syntax complexity used. They are intended 146 primarily for illustrative purposes, to introduce 147 a user unfamiliar to various aspects of148 SPARQL query syntax. Click on one of the links below149 t o load the relevant query syntax into the SPARQL150 Query textbox above, then press <i>Get Results</i>151 to initiate thequery.146 primarily for illustrative purposes, to introduce a user 147 unfamiliar to various aspects of SPARQL query syntax. 148 Click on one of <i>Load query above</i> buttons to load 149 the relevant query syntax into the SPARQL Query textbox 150 above, then press <i>Get Results</i> to initiate the 151 query. 152 152 </p> 153 153 … … 268 268 </xsl:text> 269 269 </div> 270 271 272 <div id="ssq-country-info" style="display: none;"> 273 <!-- 274 Adapted from: 275 https://stackoverflow.com/questions/40069644/retrieve-information-about-all-european-countries 276 --> 277 <xsl:text> 278 279 PREFIX gsextracted: <http://greenstone.org/gsextracted#> 280 281 PREFIX dbo: <http://dbpedia.org/ontology/> 282 PREFIX dbp: <http://dbpedia.org/property/> 283 PREFIX dct: <http://purl.org/dc/terms/> 284 #PREFIX geo: <http://www.opengis.net/ont/geosparql#> 285 286 PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 287 288 SELECT DISTINCT ?country_uri ?capital ?area ?populationTotal ?lat ?long 289 ?currency ?gdpPppPerCapita ?giniCoefficient WHERE { 290 291 # SERVICE <https://dbpedia.demo.openlinksw.com/sparql> { 292 SERVICE <https://dbpedia.org/sparql> { 293 294 ?db_country_uri dbo:capital ?db_capital. 295 296 BIND(?db_country_uri AS ?country_uri). 297 BIND(str(?db_country_uri) AS ?country_uri_str). 298 BIND(?db_capital AS ?capital). 299 300 # OPTIONAL { 301 # ?country_uri dbp:areaKm ?area. 302 # ?country_uri dbo:populationTotal ?populationTotal. 303 # ?country_uri geo:lat ?lat. 304 # ?country_uri geo:long ?long. 305 # } 306 307 OPTIONAL { ?country_uri dbp:areaKm ?area. } 308 OPTIONAL { ?country_uri dbo:populationTotal ?populationTotal. } 309 OPTIONAL { ?capital geo:lat ?lat. } 310 OPTIONAL { ?capital geo:long ?long. } 311 312 OPTIONAL { ?country_uri dbp:currencyCode ?currency. } 313 OPTIONAL { ?country_uri dbp:gdpPppPerCapita ?gdpPppPerCapita. } 314 315 OPTIONAL { ?country_uri dbo:giniCoefficient ?giniCoefficient. } 316 } 317 318 ?esc_entrant_uri gsextracted:CountryDBURI ?country_uri_str. 319 320 } 321 ORDER BY ASC(?country_uri) 322 </xsl:text> 323 </div> 324 325 270 326 271 327 <ul class="ssq"> … … 301 357 </li> 302 358 303 304 359 <li> 305 360 Jury Votes Cast by Country in 1975:<br/> … … 309 364 List all votes case in the 1975 competition. 310 365 </li> 366 367 <li> 368 Facts and Figures About Competing Countries:<br/> 369 <button type="button" class="load-ssq" id="load-ssq-country-info" onclick="ssq_load('ssq-country-info')">Load query above</button> 370 <button type="button" class="exec-ssq" id="exec-ssq-country-info" onclick="ssq_execute()">Get Results</button><br/> 371 372 Demographics about other related information about the countries the song constest entries are from. 373 </li> 311 374 312 375 </ul>
Note:
See TracChangeset
for help on using the changeset viewer.