src/p4l/settings.py
changeset 163 c875b5418740
parent 161 216b3f9582aa
--- a/src/p4l/settings.py	Wed Dec 04 10:41:38 2013 +0100
+++ b/src/p4l/settings.py	Mon Dec 16 12:39:52 2013 +0100
@@ -384,11 +384,13 @@
                 "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. "
+                    "?uri skos:prefLabel ?prefLabel. "
+                    "?uri skos:notation ?notation. "
+                    "FILTER (lang(?prefLabel) = {lang}). "
+                    "BIND(CONCAT(?notation, ' - ', ?prefLabel) AS ?label). "
+                    "?uri skos:prefLabel|skos:altLabel ?lab. "
                     "FILTER regex (str(?lab), ?reg, 'i'). "
-                    "FILTER (lang (?lab) = {lang}). "
+                    "FILTER (lang (?lab) = {lang} || lang(?lab) = ''). "
                     "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
                     "BIND (STRLEN(STR(?lab)) AS ?len) "
                 "}} "
@@ -403,10 +405,12 @@
                 "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] }} "
+                         "skos:prefLabel ?prefLabel ; "
+                         "skos:notation ?notation ; "
+                         "rdf:type ?type . "                       
+                    "FILTER (lang(?prefLabel) = {lang}). " 
+                    "FILTER NOT EXISTS {{ [skos:member ?uri] }}. "
+                    "BIND(CONCAT(?notation, ' - ', ?prefLabel) AS ?label)"
                 "}} "
                 "ORDER BY str(?label)"
             ),
@@ -421,8 +425,10 @@
                   "{{ ?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}). "
+                  "?uri skos:prefLabel ?prefLabel. "
+                  "?uri skos:notation ?notation ; "
+                      "FILTER (lang(?prefLabel) = {lang}). "
+                  "BIND(CONCAT(?notation, ' - ', ?prefLabel) AS ?label)"
                 "}} "
                 "ORDER BY str(?label)"
             ),