prefix skos: prefix dct: prefix xsd: PREFIX rdf: PREFIX rdfs: prefix dbc: prefix dbr: prefix dbp: PREFIX dbo: PREFIX prov: SELECT ?countries_in_esc_by_year ?country_in_year (?year AS ?Year) (?country AS ?Country) ?entrant_robust (?entrant_label AS ?Creator) ?song_robust (?song_label AS ?Title) (?was_derived_from AS ?WikipediaURL) WHERE { SERVICE { ?countries_in_esc_by_year skos:broader dbc:Countries_in_the_Eurovision_Song_Contest_by_year. ?country_in_year dct:subject ?countries_in_esc_by_year. bind( REPLACE(str(?country_in_year), ".*(\\d{4})", "$1") AS ?year). FILTER ( (xsd:integer(?year) > 1956) && (xsd:integer(?year) < 2023) && (xsd:integer(?year) != 2020) ). ?country_in_year dbp:country ?country. ?country_in_year dbp:entrant ?entrant_robust. ?country_in_year dbp:song ?song_robust. OPTIONAL { ?entrant_robust rdfs:label ?entrant_label FILTER (lang(?entrant_label) = 'en'). ?song_robust rdfs:label ?song_label_raw FILTER (lang(?song_label_raw) = 'en'). # Create more DL friendly song-title metadata from Wikipedia song-label BIND(REPLACE(?song_label_raw, "\\s*\\(.*?song\\)$", "", "i") AS ?song_label). ?song_robust prov:wasDerivedFrom ?was_derived_from } } } ORDER BY ASC(?countries_in_esc_by_year) ?country