Index: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/GET-ESC-LOD.sh
===================================================================
--- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/GET-ESC-LOD.sh	(revision 34735)
+++ main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/GET-ESC-LOD.sh	(revision 34736)
@@ -21,37 +21,5 @@
 
 
-
-# How to deal with 2 entrants specifying 2 songs ???
-# Could be an issue with SPARQL: e.g., see discussion
-
-# "Constructing containers and collections"
-#   https://www.w3.org/2009/sparql/wiki/Feature:Constructing_containers_and_collections
-
-
-# Adapted from:
-#  https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command
-
-rawurlencode() {
-    local string="${1}"
-    local strlen=${#string}
-    local encoded=""
-    local pos c o
-
-    for (( pos=0 ; pos<strlen ; pos++ )); do
-	c=${string:$pos:1}
-	case "$c" in
-	    [-_.~a-zA-Z0-9\(\)] ) o="${c}"
-	    ;;
-
-	    " " ) o="+"
-	    ;;
-	    
-	    * )   printf -v o '%%%02X' "'$c"
-	esac
-	encoded+="${o}"
-    done
-    echo "${encoded}"
-}
-
+source ./_lod_utils.bash
 
 sparql_url="https://dbpedia.demo.openlinksw.com/sparql/"
Index: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/LOCAL-LOD-QUERY--ERRATA-ALL.sh
===================================================================
--- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/LOCAL-LOD-QUERY--ERRATA-ALL.sh	(revision 34736)
+++ main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/LOCAL-LOD-QUERY--ERRATA-ALL.sh	(revision 34736)
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+
+s-query --service http://localhost:3030/greenstone/query \
+ "SELECT * WHERE { \
+    GRAPH <http://localhost:3030/greenstone/data/eurovision-errata>  { ?s ?p ?o } \
+  } $*"
Index: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/LOCAL-LOD-QUERY.sh
===================================================================
--- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/LOCAL-LOD-QUERY.sh	(revision 34735)
+++ main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/LOCAL-LOD-QUERY.sh	(revision 34736)
@@ -1,4 +1,9 @@
 #!/bin/bash
 
+input_sparql_query_file=${1:-problem-songs--using-errata.sparql}
 
-s-query --service http://localhost:3030/greenstone/query "SELECT * WHERE {?s ?p ?o} $*"
+sparql_query=`cat "$input_sparql_query_file"`
+
+
+s-query --service http://localhost:3030/greenstone/query \
+	"$sparql_query $*"
Index: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/problem-songs--using-errata.sparql
===================================================================
--- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/problem-songs--using-errata.sparql	(revision 34736)
+++ main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/problem-songs--using-errata.sparql	(revision 34736)
@@ -0,0 +1,50 @@
+prefix skos:   <http://www.w3.org/2004/02/skos/core#>
+prefix dct:    <http://purl.org/dc/terms/>
+prefix xsd:    <http://www.w3.org/2001/XMLSchema#>
+
+PREFIX rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
+
+prefix dbc:    <http://dbpedia.org/resource/Category:>
+prefix dbr:    <http://dbpedia.org/resource/>
+prefix dbp:    <http://dbpedia.org/property/>
+
+PREFIX dbo:    <http://dbpedia.org/ontology/>
+
+PREFIX prov:   <http://www.w3.org/ns/prov#>
+
+SELECT ?country_in_year (?year AS ?Year) (?country AS ?Country) ?entrant ?song
+
+WHERE {
+  SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
+    ?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) < 2020).
+
+    ?country_in_year dbp:country ?country.
+
+    ?country_in_year dbp:entrant ?entrant.
+    ?entrant rdfs:label ?entrant_label
+      FILTER (lang(?entrant_label) = 'en').
+
+    ?country_in_year dbp:song ?song_errata
+       FILTER (isLITERAL(?song_errata)).
+  }
+
+  ?country_in_year dbp:song ?song.
+  ?country_in_year dct:source ?song_errata.
+
+  SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
+    ?song dbp:artist ?entrant. 
+  }
+  ?song dct:source ?song_errata.
+
+}
+ORDER BY DESC(?countries_in_esc_by_year)
+
+
+
+
+
