source: gs3-installations/eurovision-lod/trunk/sites/eurovision/collect/eurovision/prepare/errata-lod/local--countries-in-esc-by-year-after-1956--with-errata.sparql@ 37319

Last change on this file since 37319 was 35922, checked in by davidb, 2 years ago

Filter adjusted to include 2021, but not 2020 (where no contesnt ran)

File size: 4.6 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
16
17SELECT ?countries_in_esc_by_year ?country_in_year (?year AS ?Year) (?country AS ?Country)
18 ?entrant_robust (?entrant_label AS ?Creator) ?song_robust (?song_label AS ?Title)
19 (?country_in_year_abstract_en AS ?Abstract_en)
20 (?song_abstract_en AS ?TitleAbstract_en) (?entrant_abstract_en AS ?CreatorAbstract_en)
21 (?was_derived_from AS ?WikipediaURL)
22WHERE {
23 SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
24 ?countries_in_esc_by_year skos:broader dbc:Countries_in_the_Eurovision_Song_Contest_by_year.
25
26 ?country_in_year dct:subject ?countries_in_esc_by_year.
27## Useful example
28# FILTER (?country_in_year = dbr:Bosnia_and_Herzegovina_in_the_Eurovision_Song_Contest_2010).
29## Useful example
30# FILTER (?country_in_year = dbr:Germany_in_the_Eurovision_Song_Contest_2010).
31
32 bind( REPLACE(str(?country_in_year), ".*(\\d{4})", "$1") AS ?year).
33 FILTER ( xsd:integer(?year) > 1956 && xsd:integer(?year) != 2020 && xsd:integer(?year) < 2022).
34
35 ?country_in_year dbp:country ?country.
36
37 ?country_in_year dbp:entrant ?entrant
38 FILTER (?entrant != ""@en && ?entrant != dbr:Eurovision_Song_Contest_1985).
39 }
40
41 OPTIONAL {
42 ?entrant_errata_uri dct:source ?entrant.
43 }
44
45 BIND (IF(isIRI(?entrant),?entrant,?entrant_errata_uri) AS ?entrant_robust).
46
47 SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
48
49 ?country_in_year dbp:song ?song
50 FILTER (?song != ""@en).
51 }
52
53 OPTIONAL {
54 ?song_errata_uri dct:source ?song.
55 }
56
57 BIND (IF(isIRI(?song),?song,?song_errata_uri) AS ?song_robust).
58
59 # Create more DL friendly entrant-title metadata from Wikipedia entrant-uri/label
60 BIND(REPLACE(REPLACE(str(?entrant_robust), "^.*/(.*?)(_+\\(.*(singer|duo|band|group|musician)\\))?$", "$1"),"_"," ") AS ?entrant_label).
61
62 # Create more DL friendly song-title metadata from Wikipedia song-uri/label
63 BIND(REPLACE(REPLACE(str(?song_robust), "^.*/(.*?)(_+\\(.*song\\))?$", "$1"),"_"," ") AS ?song_label).
64
65# DBpedia incorrectly maps some songs/entrants to integer numbers
66# Most of these can be fixed with the usual errata approach,
67# however there are a few examples that map to identical
68# integer vals, and therefore are not unique.
69#
70# The chosen solution to address this is to include some
71# bespoke filtering to explicitly rule in the song+entrant combination
72# we want (i.e., the filter has the affect of ruling out the
73# (incorrect) combination we don't want.
74
75#dbr:Macedonia_in_the_Eurovision_Song_Contest_2000
76# song: "100"^^xsd:integer
77# dbr:100%25_te_ljubam
78# dbr:XXL_\(Macedonian_band\))
79#
80#Luxembourg_in_the_Eurovision_Song_Contest_1984
81# song: "100"^^xsd:integer
82# dbr:100%25_d%27amour
83# dbr:Sophie_Carle
84
85#dbr:Belarus_in_the_Eurovision_Song_Contest_2010
86# entrant: "3"^^xsd:integer
87# dbr:3%2B2_\(band\)
88# dbr:Butterflies_\(3%2B2_song\)
89#
90#dbr:Netherlands_in_the_Eurovision_Song_Contest_2011
91# entrant: "3"^^xsd:integer
92# dbr:3JS
93# dbr:Je_vecht_nooit_alleen
94
95 FILTER(
96 (?song != "100"^^xsd:integer && ?entrant != "3"^^xsd:integer)
97 ||
98 (?song = "100"^^xsd:integer
99 && ?song_robust = dbr:100%25_te_ljubam && ?entrant = dbr:XXL_\(Macedonian_band\))
100 ||
101 (?song = "100"^^xsd:integer
102 && ?song_robust = dbr:100%25_d%27amour && ?entrant = dbr:Sophie_Carle)
103 ||
104 (?entrant = "3"^^xsd:integer
105 && ?entrant_robust = dbr:3\+2_\(band\) && ?song_robust = dbr:Butterflies_\(3\+2_song\))
106 ||
107 (?entrant = "3"^^xsd:integer
108 && ?entrant_robust = dbr:3JS && ?song_robust = dbr:Je_vecht_nooit_alleen)
109 ).
110
111# && ?entrant_robust = dbr:3%2B2_\(band\) && ?song_robust = dbr:Butterflies_\(3%2B2_song\))
112
113
114 SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
115
116 OPTIONAL {
117 ?song_robust prov:wasDerivedFrom ?was_derived_from.
118
119 ?country_in_year dbo:abstract ?country_in_year_abstract_en
120 FILTER (lang(?country_in_year_abstract_en) = 'en').
121
122 ?entrant_robust dbo:abstract ?entrant_abstract_en
123 FILTER (lang(?entrant_abstract_en) = 'en').
124
125 ?song_robust dbo:abstract ?song_abstract_en
126 FILTER (lang(?song_abstract_en) = 'en').
127
128 }
129 }
130}
131ORDER BY ASC(?countries_in_esc_by_year) ?country
132
Note: See TracBrowser for help on using the repository browser.