--- a/src/p4l/settings.py Thu Sep 05 15:05:47 2013 +0200
+++ b/src/p4l/settings.py Thu Sep 05 15:47:30 2013 +0200
@@ -173,6 +173,67 @@
NB_RECORDS_BY_PAGE = 20
SPARQL_QUERY_ENDPOINT = "http://localhost:8080/openrdf-sesame/repositories/plan4learning"
+SPARQL_SUBJECT_QUERIES = {
+"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) = ?language).
+ ?uri skos:prefLabel ?lab.
+ FILTER regex (str(?lab), ?reg, 'i').
+ FILTER (lang (?lab) = ?language).
+ 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:Collection ;
+ skos:inScheme <http://skos.um.es/unescothes/CS000> ;
+ skos:prefLabel|rdfs:label ?label .
+ FILTER (lang(?label) = ?language).
+ FILTER NOT EXISTS { [skos:member ?uri] }
+}
+""",
+"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> .
+ { ?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) = ?language).
+}
+""",
+"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.
+}
+"""
+}
REST_FRAMEWORK = {
# Use hyperlinked styles by default.