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) < 1969).
|
---|
26 |
|
---|
27 | ?country_in_year dbp:country ?country.
|
---|
28 |
|
---|
29 | ?country_in_year dbp:entrant ?entrant.
|
---|
30 | }
|
---|
31 |
|
---|
32 | OPTIONAL {
|
---|
33 | ?entrant_errata_uri dct:source ?entrant.
|
---|
34 | }
|
---|
35 |
|
---|
36 | BIND (IF(isIRI(?entrant),?entrant,?entrant_errata_uri) AS ?entrant_robust)
|
---|
37 |
|
---|
38 | SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
|
---|
39 |
|
---|
40 | ?country_in_year dbp:song ?song.
|
---|
41 |
|
---|
42 | }
|
---|
43 |
|
---|
44 | OPTIONAL {
|
---|
45 | ?song_errata_uri dct:source ?song.
|
---|
46 | }
|
---|
47 |
|
---|
48 | BIND (IF(isIRI(?song),?song,?song_errata_uri) AS ?song_robust)
|
---|
49 |
|
---|
50 | SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
|
---|
51 |
|
---|
52 | ?entrant_robust rdfs:label ?entrant_label
|
---|
53 | FILTER (lang(?entrant_label) = 'en').
|
---|
54 |
|
---|
55 |
|
---|
56 | ?song_robust rdfs:label ?song_label_raw
|
---|
57 | FILTER (lang(?song_label_raw) = 'en').
|
---|
58 |
|
---|
59 | # Create more DL friendly song-title metadata from Wikipedia song-label
|
---|
60 | BIND(REPLACE(?song_label_raw, "\\s*\\(.*?song\\)$", "", "i") AS ?song_label).
|
---|
61 |
|
---|
62 | OPTIONAL {
|
---|
63 | ?song_robust prov:wasDerivedFrom ?was_derived_from
|
---|
64 | }
|
---|
65 | }
|
---|
66 | }
|
---|
67 | ORDER BY DESC(?countries_in_esc_by_year)
|
---|