src/p4l/settings.py
changeset 61 305f9fcd409b
parent 60 da37c87abbfb
child 62 8433e12362e0
equal deleted inserted replaced
60:da37c87abbfb 61:305f9fcd409b
   293 WHERE {
   293 WHERE {
   294     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
   294     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
   295     ?root skos:narrower|skos:member ?uri.
   295     ?root skos:narrower|skos:member ?uri.
   296 }
   296 }
   297 """
   297 """
   298                             }
   298 }
       
   299 SPARQL_COUNTRY_QUERIES = {
       
   300 'filter' : """
       
   301 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   302 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   303 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   304 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   305 SELECT DISTINCT ?uri ?label
       
   306 WHERE {
       
   307     ?uri a skos:Concept.
       
   308     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
       
   309     ?uri skos:prefLabel ?label.
       
   310     FILTER (lang(?label) = %s).
       
   311     ?uri skos:prefLabel ?lab.
       
   312     FILTER regex (str(?lab), ?reg, 'i').
       
   313     FILTER (lang (?lab) = %s).
       
   314     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   315     BIND (STRLEN(STR(?lab)) AS ?len)
       
   316 }
       
   317 ORDER BY ?place ?len ?lab
       
   318 """,
       
   319 'root' : """
       
   320 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   321 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   322 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   323 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   324 SELECT DISTINCT ?uri ?label
       
   325 WHERE {
       
   326     ?uri a skos:Concept ;
       
   327     skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> ;    
       
   328     skos:prefLabel ?label .
       
   329     FILTER (lang(?label) = %s). 
       
   330     FILTER NOT EXISTS { [skos:narrower ?uri] }
       
   331 }
       
   332 """,
       
   333 'childs' : """
       
   334 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   335 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   336 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   337 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   338 SELECT DISTINCT ?uri ?label
       
   339 WHERE {
       
   340   ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
       
   341   { ?uri a ?type
       
   342     FILTER (?type = skos:Collection || ?type = skos:Concept) }.
       
   343   ?root skos:narrower|skos:member ?uri.
       
   344   ?uri skos:prefLabel|rdfs:label ?label.
       
   345   FILTER (lang(?label) = %s).
       
   346 }
       
   347 """,
       
   348 'child-count' : """
       
   349 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   350 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   351 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   352 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   353 SELECT (COUNT(?uri) as ?nb)
       
   354 WHERE {
       
   355     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
       
   356     ?root skos:narrower|skos:member ?uri.
       
   357 }
       
   358 """
       
   359 }
       
   360 SPARQL_LANGUAGE_QUERIES = {
       
   361 'filter' : """
       
   362 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   363 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   364 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   365 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   366 SELECT DISTINCT ?uri ?label
       
   367 WHERE {
       
   368     ?uri a skos:Concept.
       
   369     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> .
       
   370     ?uri skos:prefLabel ?label.
       
   371     FILTER (lang(?label) = %s).
       
   372     ?uri skos:prefLabel ?lab.
       
   373     FILTER regex (str(?lab), ?reg, 'i').
       
   374     FILTER (lang (?lab) = %s).
       
   375     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   376     BIND (STRLEN(STR(?lab)) AS ?len)
       
   377 }
       
   378 ORDER BY ?place ?len ?lab
       
   379 """,
       
   380 'root' : """
       
   381 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   382 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   383 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   384 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   385 SELECT DISTINCT ?uri ?label
       
   386 WHERE {
       
   387     ?uri a skos:Concept ;
       
   388     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> ;    
       
   389     skos:prefLabel ?label .
       
   390     FILTER (lang(?label) = %s). 
       
   391     FILTER NOT EXISTS { [skos:narrower ?uri] }
       
   392 }
       
   393 """
       
   394 }
       
   395 SPARQL_PROJECT_QUERIES = {
       
   396 'filter' : """
       
   397 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   398 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   399 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   400 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   401 SELECT DISTINCT ?uri ?label
       
   402 WHERE {
       
   403     ?uri a skos:Concept.
       
   404     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> .
       
   405     ?uri skos:prefLabel ?label.
       
   406     ?uri skos:prefLabel ?lab.
       
   407     FILTER regex (str(?lab), ?reg, 'i').
       
   408     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   409     BIND (STRLEN(STR(?lab)) AS ?len)
       
   410 }
       
   411 ORDER BY ?place ?len ?lab
       
   412 """,
       
   413 'root' : """
       
   414 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   415 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   416 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   417 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   418 SELECT DISTINCT ?uri ?label
       
   419 WHERE {
       
   420     ?uri a skos:Concept ;
       
   421     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> ;    
       
   422     skos:prefLabel ?label .
       
   423 }
       
   424 """
       
   425 }
       
   426 SPARQL_ORGANIZATION_QUERIES = {
       
   427 'filter' : """
       
   428 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   429 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   430 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   431 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   432 SELECT DISTINCT ?uri ?label
       
   433 WHERE {
       
   434     ?uri a skos:Concept.
       
   435     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> .
       
   436     ?uri skos:prefLabel ?label.
       
   437     ?uri skos:prefLabel ?lab.
       
   438     FILTER regex (str(?lab), ?reg, 'i').
       
   439     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   440     BIND (STRLEN(STR(?lab)) AS ?len)
       
   441 }
       
   442 ORDER BY ?place ?len ?lab
       
   443 """,
       
   444 'root' : """
       
   445 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   446 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   447 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   448 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   449 SELECT DISTINCT ?uri ?label
       
   450 WHERE {
       
   451     ?uri a skos:Concept ;
       
   452     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> ;    
       
   453     skos:prefLabel ?label .
       
   454 }
       
   455 """
       
   456 }
   299 
   457 
   300 
   458 
   301 REST_FRAMEWORK = {
   459 REST_FRAMEWORK = {
   302     # Use hyperlinked styles by default.
   460     # Use hyperlinked styles by default.
   303     # Only used if the `serializer_class` attribute is not set on a view.
   461     # Only used if the `serializer_class` attribute is not set on a view.