1 | prefix skos: <http://www.w3.org/2004/02/skos/core#>
|
---|
2 | prefix dct: <http://purl.org/dc/terms/>
|
---|
3 | prefix xsd: <http://www.w3.org/2001/XMLSchema#>
|
---|
4 |
|
---|
5 | PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
---|
6 | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
---|
7 |
|
---|
8 | prefix dbc: <http://dbpedia.org/resource/Category:>
|
---|
9 | prefix dbr: <http://dbpedia.org/resource/>
|
---|
10 | prefix dbp: <http://dbpedia.org/property/>
|
---|
11 |
|
---|
12 | PREFIX dbo: <http://dbpedia.org/ontology/>
|
---|
13 |
|
---|
14 | PREFIX prov: <http://www.w3.org/ns/prov#>
|
---|
15 |
|
---|
16 |
|
---|
17 | SELECT ?countries_in_esc_by_year ?country_in_year (?year AS ?Year) (?country AS ?Country)
|
---|
18 | ?entrant (?entrant_label AS ?Creator) ?song (?song_label AS ?Title) (?was_derived_from AS ?WikipediaURL)
|
---|
19 | WHERE {
|
---|
20 | SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
|
---|
21 | ?countries_in_esc_by_year skos:broader dbc:Countries_in_the_Eurovision_Song_Contest_by_year.
|
---|
22 |
|
---|
23 | ?country_in_year dct:subject ?countries_in_esc_by_year.
|
---|
24 | bind( REPLACE(str(?country_in_year), ".*(\\d{4})", "$1") AS ?year).
|
---|
25 | FILTER ( xsd:integer(?year) < 2020).
|
---|
26 |
|
---|
27 | ?country_in_year dbp:country ?country.
|
---|
28 |
|
---|
29 | ?country_in_year dbp:entrant ?entrant.
|
---|
30 |
|
---|
31 | ?entrant rdfs:label ?entrant_label
|
---|
32 | FILTER (lang(?entrant_label) = 'en').
|
---|
33 |
|
---|
34 | ?country_in_year dbp:song ?song.
|
---|
35 |
|
---|
36 | }
|
---|
37 |
|
---|
38 | OPTIONAL {
|
---|
39 | ?song_errata_uri dct:source ?song.
|
---|
40 | }
|
---|
41 |
|
---|
42 | BIND (IF(isIRI(?song),?song,?song_errata_uri) AS ?song_robust)
|
---|
43 |
|
---|
44 | SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
|
---|
45 |
|
---|
46 | ?song_robust rdfs:label ?song_label_raw
|
---|
47 | FILTER (lang(?song_label_raw) = 'en').
|
---|
48 |
|
---|
49 | # Create more DL friendly song-title metadata from Wikipedia song-label
|
---|
50 | BIND(REPLACE(?song_label_raw, "\\s*\\(.*?song\\)$", "", "i") AS ?song_label).
|
---|
51 |
|
---|
52 | OPTIONAL {
|
---|
53 | ?song_robust prov:wasDerivedFrom ?was_derived_from
|
---|
54 | }
|
---|
55 | }
|
---|
56 | }
|
---|
57 | ORDER BY ASC(?countries_in_esc_by_year) ?country
|
---|
58 |
|
---|