src/p4l/settings.py
changeset 102 53c9233a7684
parent 99 0d54489e8b26
child 113 c05567404888
--- a/src/p4l/settings.py	Fri Sep 20 00:03:31 2013 +0200
+++ b/src/p4l/settings.py	Fri Sep 20 00:14:42 2013 +0200
@@ -200,13 +200,14 @@
 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
+SELECT DISTINCT ?uri ?label ?type
 WHERE {
     ?uri a skos:Collection ;
-    skos:inScheme <http://skos.um.es/unescothes/CS000> ;    
-    skos:prefLabel|rdfs:label ?label .
+    skos:inScheme <http://skos.um.es/unescothes/CS000> ;
+    skos:prefLabel|rdfs:label ?label ;
+    rdf:type ?type ;
     FILTER (lang(?label) = %s). 
-    FILTER NOT EXISTS { [skos:member ?uri] }
+    FILTER NOT EXISTS { [skos:member ?uri] }.
 }
 ORDER BY ?label
 """,
@@ -215,7 +216,7 @@
 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
+SELECT DISTINCT ?uri ?label ?type
 WHERE {
   ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
   { ?uri a ?type
@@ -263,11 +264,12 @@
 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
+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 .
+    skos:prefLabel|rdfs:label ?label ;
+    rdf:type ?type ;
     FILTER (lang(?label) = %s). 
     FILTER NOT EXISTS { [skos:member ?uri] }
 }
@@ -278,7 +280,7 @@
 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
+SELECT DISTINCT ?uri ?label ?type
 WHERE {
   ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
   { ?uri a ?type
@@ -406,12 +408,13 @@
 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
+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)
@@ -423,11 +426,12 @@
 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
+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
 """
@@ -438,12 +442,13 @@
 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
+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)
@@ -455,11 +460,12 @@
 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
+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
 """
@@ -500,7 +506,12 @@
 ORDER BY ?label
 """
 }
-
+SPARQL_AUDIENCE_QUERIES = {
+"filter" : "",
+"root" : "",
+"childs" : "",
+"child-count" : ""
+}
 
 REST_FRAMEWORK = {
     # Use hyperlinked styles by default.