source: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/fix-problem-songs-and-entrants--using-errata.sparql@ 34945

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

Further refinements as number of errata entries (dealing with both song and entrant being strings) grows

File size: 1.8 KB
Line 
1prefix skos: <http://www.w3.org/2004/02/skos/core#>
2prefix dct: <http://purl.org/dc/terms/>
3prefix xsd: <http://www.w3.org/2001/XMLSchema#>
4
5PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
6PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
7
8prefix dbc: <http://dbpedia.org/resource/Category:>
9prefix dbr: <http://dbpedia.org/resource/>
10prefix dbp: <http://dbpedia.org/property/>
11
12PREFIX dbo: <http://dbpedia.org/ontology/>
13
14PREFIX prov: <http://www.w3.org/ns/prov#>
15
16SELECT ?country_in_year (?year AS ?Year) (?country AS ?Country) ?entrant ?entrant_label ?song
17
18WHERE {
19 SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
20 ?countries_in_esc_by_year skos:broader dbc:Countries_in_the_Eurovision_Song_Contest_by_year.
21
22 ?country_in_year dct:subject ?countries_in_esc_by_year.
23 bind( REPLACE(str(?country_in_year), ".*(\\d{4})", "$1") as ?year).
24 FILTER ( xsd:integer(?year) < 2020).
25
26 ?country_in_year dbp:country ?country.
27
28 ?country_in_year dbp:entrant ?entrant_errata.
29 FILTER (isLITERAL(?entrant_errata)).
30
31 ?country_in_year dbp:song ?song_errata
32 FILTER (isLITERAL(?song_errata)).
33 }
34
35 ?country_in_year dbp:song ?song.
36 ?country_in_year dct:source ?song_errata.
37
38 ?country_in_year dbp:entrant ?entrant.
39 ?country_in_year dct:source ?entrant_errata.
40
41# SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
42# ?song dbp:artist|dbp:as ?entrant.
43# }
44 ?song dct:source ?song_errata.
45 ?entrant dct:source ?entrant_errata.
46
47 OPTIONAL {
48 SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
49 ?entrant rdfs:label ?entrant_opt_label
50 FILTER (lang(?entrant_opt_label) = 'en').
51 }
52 }
53 BIND(IF(bound(?entrant_opt_label),?entrant_opt_label,?entrant_errata) AS ?entrant_label)
54}
55ORDER BY DESC(?countries_in_esc_by_year)
56
57
Note: See TracBrowser for help on using the repository browser.