src/p4l/settings.py
changeset 118 d33a072d974b
parent 117 0a4e7d6ebe80
child 119 ece69ca3ac24
--- a/src/p4l/settings.py	Wed Sep 25 22:14:51 2013 +0200
+++ b/src/p4l/settings.py	Wed Sep 25 23:22:29 2013 +0200
@@ -439,341 +439,341 @@
     SPARQL_REF_QUERIES = {
         'subjects': {
             'url' : SPARQL_QUERY_ENDPOINT,
-            'filter' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label
-                WHERE {{
-                    ?uri a skos:Concept.
-                    ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
-                    ?uri skos:prefLabel ?label.
-                    FILTER (lang(?label) = {lang}).
-                    ?uri skos:prefLabel ?lab.
-                    FILTER regex (str(?lab), ?reg, 'i').
-                    FILTER (lang (?lab) = {lang}).
-                    BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
-                    BIND (STRLEN(STR(?lab)) AS ?len)
-                }}
-                ORDER BY ?place ?len ?lab
-            """,
-            "root" : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label ?type
-                WHERE {{
-                    ?uri a skos:Collection ;
-                         skos:inScheme <http://skos.um.es/unescothes/CS000> ;
-                         skos:prefLabel|rdfs:label ?label ;
-                         rdf:type ?type .
-                    FILTER (lang(?label) = {lang}). 
-                    FILTER NOT EXISTS {{ [skos:member ?uri] }}.
-                }}
-                ORDER BY ?label
-            """,
-            "childs" : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label ?type
-                WHERE {{
-                  ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
-                  {{ ?uri a ?type
-                    FILTER (?type = skos:Collection || ?type = skos:Concept) }}.
-                  ?root skos:narrower|skos:member ?uri.
-                  ?uri skos:prefLabel|rdfs:label ?label.
-                  FILTER (lang(?label) = {lang}).
-                }}
-                ORDER BY ?label
-            """,
-            "child-count" : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT (COUNT(?uri) as ?nb)
-                WHERE {{
-                    ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
-                    ?root skos:narrower|skos:member ?uri.
-                }}
-            """
+            'filter' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label "
+                "WHERE {{ "
+                    "?uri a skos:Concept. "
+                    "?uri skos:inScheme <http://skos.um.es/unescothes/CS000> . "
+                    "?uri skos:prefLabel ?label. "
+                    "FILTER (lang(?label) = {lang}). "
+                    "?uri skos:prefLabel ?lab. "
+                    "FILTER regex (str(?lab), ?reg, 'i'). "
+                    "FILTER (lang (?lab) = {lang}). "
+                    "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
+                    "BIND (STRLEN(STR(?lab)) AS ?len) "
+                "}} "
+                "ORDER BY ?place ?len ?lab"
+            ),
+            "root" : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label ?type "
+                "WHERE {{ "
+                    "?uri a skos:Collection ; "
+                         "skos:inScheme <http://skos.um.es/unescothes/CS000> ; "
+                         "skos:prefLabel|rdfs:label ?label ; "
+                         "rdf:type ?type . "
+                    "FILTER (lang(?label) = {lang}). " 
+                    "FILTER NOT EXISTS {{ [skos:member ?uri] }}. "
+                "}} "
+                "ORDER BY ?label"
+            ),
+            "childs" : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label ?type "
+                "WHERE {{ "
+                  "?uri skos:inScheme <http://skos.um.es/unescothes/CS000> . "
+                  "{{ ?uri a ?type "
+                    "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
+                  "?root skos:narrower|skos:member ?uri. "
+                  "?uri skos:prefLabel|rdfs:label ?label. "
+                  "FILTER (lang(?label) = {lang}). "
+                "}} "
+                "ORDER BY ?label"
+            ),
+            "child-count" : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT (COUNT(?uri) as ?nb) "
+                "WHERE {{ "
+                    "?uri skos:inScheme <http://skos.um.es/unescothes/CS000> . "
+                    "?root skos:narrower|skos:member ?uri. "
+                "}}"
+            )
         },
         'themes': {
             'url' : SPARQL_QUERY_ENDPOINT,
-            'filter' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label
-                WHERE {{
-                    ?uri a skos:Concept.
-                    ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
-                    ?uri skos:prefLabel ?label.
-                    FILTER (lang(?label) = {lang}).
-                    ?uri skos:prefLabel ?lab.
-                    FILTER regex (str(?lab), ?reg, 'i').
-                    FILTER (lang (?lab) = {lang}).
-                    BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
-                    BIND (STRLEN(STR(?lab)) AS ?len)
-                }}
-                ORDER BY ?place ?len ?lab
-            """,
-            'root' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label ?type
-                WHERE {{
-                    ?uri a skos:Collection ;
-                         skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> ;    
-                         skos:prefLabel|rdfs:label ?label ;
-                         rdf:type ?type .
-                    FILTER (lang(?label) = {lang}). 
-                    FILTER NOT EXISTS {{ [skos:member ?uri] }}
-                }}
-                ORDER BY ?label
-            """,
-            'childs' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label ?type
-                WHERE {{
-                  ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
-                  {{ ?uri a ?type
-                    FILTER (?type = skos:Collection || ?type = skos:Concept) }}.
-                  ?root skos:narrower|skos:member ?uri.
-                  ?uri skos:prefLabel|rdfs:label ?label.
-                  FILTER (lang(?label) = {lang}).
-                }}
-                ORDER BY ?label
-            """,
-            'child-count' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT (COUNT(?uri) as ?nb)
-                WHERE {{
-                    ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
-                    ?root skos:narrower|skos:member ?uri.
-                }}
-            """
+            'filter' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label "
+                "WHERE {{ "
+                    "?uri a skos:Concept. "
+                    "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> . "
+                    "?uri skos:prefLabel ?label. "
+                    "FILTER (lang(?label) = {lang}). "
+                    "?uri skos:prefLabel ?lab. "
+                    "FILTER regex (str(?lab), ?reg, 'i'). "
+                    "FILTER (lang (?lab) = {lang}). "
+                    "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
+                    "BIND (STRLEN(STR(?lab)) AS ?len) "
+                "}} "
+                "ORDER BY ?place ?len ?lab"
+            ),
+            'root' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label ?type "
+                "WHERE {{ "
+                    "?uri a skos:Collection ; "
+                         "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> ; "    
+                         "skos:prefLabel|rdfs:label ?label ; "
+                         "rdf:type ?type . "
+                    "FILTER (lang(?label) = {lang}). " 
+                    "FILTER NOT EXISTS {{ [skos:member ?uri] }} "
+                "}} "
+                "ORDER BY ?label"
+            ),
+            'childs' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label ?type "
+                "WHERE {{ "
+                  "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> . "
+                  "{{ ?uri a ?type "
+                    "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
+                  "?root skos:narrower|skos:member ?uri. "
+                  "?uri skos:prefLabel|rdfs:label ?label. "
+                  "FILTER (lang(?label) = {lang}). "
+                "}} "
+                "ORDER BY ?label "
+            ),
+            'child-count' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT (COUNT(?uri) as ?nb) "
+                "WHERE {{ "
+                    "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> . "
+                    "?root skos:narrower|skos:member ?uri. "
+                "}} "
+            )
         },
         'countries': {
             'url' : SPARQL_QUERY_ENDPOINT,
-            'filter' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label
-                WHERE {{
-                    ?uri a skos:Concept.
-                    ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
-                    ?uri skos:prefLabel ?label.
-                    FILTER (lang(?label) = {lang}).
-                    ?uri skos:prefLabel ?lab.
-                    FILTER regex (str(?lab), ?reg, 'i').
-                    FILTER (lang (?lab) = {lang}).
-                    BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
-                    BIND (STRLEN(STR(?lab)) AS ?len)
-                }}
-                ORDER BY ?place ?len ?lab
-            """,
-            'root' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label
-                WHERE {{
-                    ?uri a skos:Concept ;
-                         skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> ;    
-                         skos:prefLabel ?label .
-                    FILTER (lang(?label) = {lang}). 
-                    FILTER NOT EXISTS {{ [skos:narrower ?uri] }}
-                }}
-                ORDER BY ?label
-            """,
-            'childs' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label
-                WHERE {{
-                  ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
-                  {{ ?uri a ?type
-                    FILTER (?type = skos:Collection || ?type = skos:Concept) }}.
-                  ?root skos:narrower|skos:member ?uri.
-                  ?uri skos:prefLabel|rdfs:label ?label.
-                  FILTER (lang(?label) = {lang}).
-                }}
-                ORDER BY ?label
-            """,
-            'child-count' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT (COUNT(?uri) as ?nb)
-                WHERE {{
-                    ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
-                    ?root skos:narrower|skos:member ?uri.
-                }}
-            """
+            'filter' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label "
+                "WHERE {{ "
+                    "?uri a skos:Concept. "
+                    "?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> . "
+                    "?uri skos:prefLabel ?label. "
+                    "FILTER (lang(?label) = {lang}). "
+                    "?uri skos:prefLabel ?lab. "
+                    "FILTER regex (str(?lab), ?reg, 'i'). "
+                    "FILTER (lang (?lab) = {lang}). "
+                    "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
+                    "BIND (STRLEN(STR(?lab)) AS ?len) "
+                "}} "
+                "ORDER BY ?place ?len ?lab"
+            ),
+            'root' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label "
+                "WHERE {{ "
+                    "?uri a skos:Concept ; "
+                         "skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> ; "    
+                         "skos:prefLabel ?label . "
+                    "FILTER (lang(?label) = {lang}). " 
+                    "FILTER NOT EXISTS {{ [skos:narrower ?uri] }} "
+                "}} "
+                "ORDER BY ?label "
+            ),
+            'childs' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label "
+                "WHERE {{ "
+                  "?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> . "
+                  "{{ ?uri a ?type "
+                    "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
+                  "?root skos:narrower|skos:member ?uri. "
+                  "?uri skos:prefLabel|rdfs:label ?label. "
+                  "FILTER (lang(?label) = {lang}). "
+                "}} "
+                "ORDER BY ?label"
+            ),
+            'child-count' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT (COUNT(?uri) as ?nb) "
+                "WHERE {{ "
+                    "?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> . "
+                    "?root skos:narrower|skos:member ?uri. "
+                "}}"
+            )
         },
         'languages': {
             'url' : SPARQL_QUERY_ENDPOINT,
-            'filter' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label
-                WHERE {{
-                    ?uri a skos:Concept.
-                    ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> .
-                    ?uri skos:prefLabel ?label.
-                    FILTER (lang(?label) = {lang}).
-                    ?uri skos:prefLabel ?lab.
-                    FILTER regex (str(?lab), ?reg, 'i').
-                    FILTER (lang (?lab) = {lang}).
-                    BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
-                    BIND (STRLEN(STR(?lab)) AS ?len)
-                }}
-                ORDER BY ?place ?len ?lab
-            """,
-            'root' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label
-                WHERE {{
-                    ?uri a skos:Concept ;
-                         skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> ;    
-                         skos:prefLabel ?label .
-                    FILTER (lang(?label) = {lang}). 
-                    FILTER NOT EXISTS {{ [skos:narrower ?uri] }}
-                }}
-                ORDER BY ?label
-            """
+            'filter' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label "
+                "WHERE {{ "
+                    "?uri a skos:Concept. "
+                    "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> . "
+                    "?uri skos:prefLabel ?label. "
+                    "FILTER (lang(?label) = {lang}). "
+                    "?uri skos:prefLabel ?lab. "
+                    "FILTER regex (str(?lab), ?reg, 'i'). "
+                    "FILTER (lang (?lab) = {lang}). "
+                    "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
+                    "BIND (STRLEN(STR(?lab)) AS ?len) "
+                "}} "
+                "ORDER BY ?place ?len ?lab"
+            ),
+            'root' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label "
+                "WHERE {{ "
+                    "?uri a skos:Concept ; "
+                         "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> ;     "
+                         "skos:prefLabel ?label . "
+                    "FILTER (lang(?label) = {lang}).  "
+                    "FILTER NOT EXISTS {{ [skos:narrower ?uri] }} "
+                "}} "
+                "ORDER BY ?label"
+            )
         },
         'projects': {
             'url' : SPARQL_QUERY_ENDPOINT,
-            'filter' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label ?acro
-                WHERE {{
-                    ?uri a skos:Concept.
-                    ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> .
-                    ?uri skos:prefLabel ?label.
-                    ?uri skos:prefLabel ?lab.
-                    OPTIONAL {{ ?uri skos:altLabel ?acro }}.
-                    FILTER regex (str(?lab), ?reg, 'i').
-                    BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
-                    BIND (STRLEN(STR(?lab)) AS ?len)
-                }}
-                ORDER BY ?place ?len ?lab
-            """,
-            'root' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label ?acro
-                WHERE {{
-                    ?uri a skos:Concept ;
-                    skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> ;    
-                    skos:prefLabel ?label .
-                    OPTIONAL {{ ?uri skos:altLabel ?acro }}
-                }}
-                ORDER BY ?label
-            """
+            'filter' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label ?acro "
+                "WHERE {{ "
+                    "?uri a skos:Concept. "
+                    "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> . "
+                    "?uri skos:prefLabel ?label. "
+                    "?uri skos:prefLabel ?lab. "
+                    "OPTIONAL {{ ?uri skos:altLabel ?acro }}. "
+                    "FILTER regex (str(?lab), ?reg, 'i'). "
+                    "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
+                    "BIND (STRLEN(STR(?lab)) AS ?len) "
+                "}} "
+                "ORDER BY ?place ?len ?lab"
+            ),
+            'root' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label ?acro "
+                "WHERE {{ "
+                    "?uri a skos:Concept ; "
+                    "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> ;     "
+                    "skos:prefLabel ?label . "
+                    "OPTIONAL {{ ?uri skos:altLabel ?acro }} "
+                "}} "
+                "ORDER BY ?label"
+            )
         },
         'organizations': {
             'url' : SPARQL_QUERY_ENDPOINT,
-            'filter' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label ?acro
-                WHERE {{
-                    ?uri a skos:Concept.
-                    ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> .
-                    ?uri skos:prefLabel ?label.
-                    ?uri skos:prefLabel ?lab.
-                    OPTIONAL {{ ?uri skos:altLabel ?acro }}.
-                    FILTER regex (str(?lab), ?reg, 'i').
-                    BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
-                    BIND (STRLEN(STR(?lab)) AS ?len)
-                }}
-                ORDER BY ?place ?len ?lab
-            """,
-            'root' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label ?acro
-                WHERE {{
-                    ?uri a skos:Concept ;
-                         skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> ;    
-                         skos:prefLabel ?label .
-                    OPTIONAL {{ ?uri skos:altLabel ?acro }}
-                }}
-                ORDER BY ?label
-            """
+            'filter' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label ?acro "
+                "WHERE {{ "
+                    "?uri a skos:Concept. "
+                    "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> . "
+                    "?uri skos:prefLabel ?label. "
+                    "?uri skos:prefLabel ?lab. "
+                    "OPTIONAL {{ ?uri skos:altLabel ?acro }}. "
+                    "FILTER regex (str(?lab), ?reg, 'i'). "
+                    "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
+                    "BIND (STRLEN(STR(?lab)) AS ?len) "
+                "}} "
+                "ORDER BY ?place ?len ?lab"
+            ),
+            'root' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label ?acro "
+                "WHERE {{ "
+                    "?uri a skos:Concept ; "
+                         "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> ;     "
+                         "skos:prefLabel ?label . "
+                    "OPTIONAL {{ ?uri skos:altLabel ?acro }} "
+                "}} "
+                "ORDER BY ?label"
+            )
         },
         'types': {
             'url' : SPARQL_QUERY_ENDPOINT,
-            'filter' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label
-                WHERE {{
-                    ?uri a skos:Concept.
-                    ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> .
-                    ?uri skos:prefLabel ?label.
-                    FILTER (lang(?label) = {lang}).
-                    ?uri skos:prefLabel ?lab.
-                    FILTER regex (str(?lab), ?reg, 'i').
-                    FILTER (lang (?lab) = {lang}).
-                    BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
-                    BIND (STRLEN(STR(?lab)) AS ?len)
-                }}
-                ORDER BY ?place ?len ?lab
-            """,
-            'root' : """
-                PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
-                PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-                PREFIX owl:<http://www.w3.org/2002/07/owl#>
-                PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-                SELECT DISTINCT ?uri ?label
-                WHERE {{
-                    ?uri a skos:Concept ;
-                         skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> ;    
-                         skos:prefLabel ?label .
-                    FILTER (lang(?label) = {lang}). 
-                    FILTER NOT EXISTS {{ [skos:narrower ?uri] }}
-                }}
-                ORDER BY ?label
-            """
+            'filter' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label "
+                "WHERE {{ "
+                    "?uri a skos:Concept. "
+                    "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> . "
+                    "?uri skos:prefLabel ?label. "
+                    "FILTER (lang(?label) = {lang}). "
+                    "?uri skos:prefLabel ?lab. "
+                    "FILTER regex (str(?lab), ?reg, 'i'). "
+                    "FILTER (lang (?lab) = {lang}). "
+                    "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
+                    "BIND (STRLEN(STR(?lab)) AS ?len) "
+                "}} "
+                "ORDER BY ?place ?len ?lab"
+            ),
+            'root' : (
+                "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
+                "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+                "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
+                "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
+                "SELECT DISTINCT ?uri ?label "
+                "WHERE {{ "
+                    "?uri a skos:Concept ; "
+                         "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> ;     "
+                         "skos:prefLabel ?label . "
+                    "FILTER (lang(?label) = {lang}).  "
+                    "FILTER NOT EXISTS {{ [skos:narrower ?uri] }} "
+                "}} "
+                "ORDER BY ?label "
+            )
         },
         'audiences': {
             'url' : SPARQL_QUERY_ENDPOINT,