src/p4l/settings.py
changeset 102 53c9233a7684
parent 99 0d54489e8b26
child 113 c05567404888
equal deleted inserted replaced
101:71532a54d1c4 102:53c9233a7684
   198 "root" : """
   198 "root" : """
   199 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   199 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   200 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   200 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   201 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   201 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   202 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   202 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   203 SELECT DISTINCT ?uri ?label
   203 SELECT DISTINCT ?uri ?label ?type
   204 WHERE {
   204 WHERE {
   205     ?uri a skos:Collection ;
   205     ?uri a skos:Collection ;
   206     skos:inScheme <http://skos.um.es/unescothes/CS000> ;    
   206     skos:inScheme <http://skos.um.es/unescothes/CS000> ;
   207     skos:prefLabel|rdfs:label ?label .
   207     skos:prefLabel|rdfs:label ?label ;
       
   208     rdf:type ?type ;
   208     FILTER (lang(?label) = %s). 
   209     FILTER (lang(?label) = %s). 
   209     FILTER NOT EXISTS { [skos:member ?uri] }
   210     FILTER NOT EXISTS { [skos:member ?uri] }.
   210 }
   211 }
   211 ORDER BY ?label
   212 ORDER BY ?label
   212 """,
   213 """,
   213 "childs" : """
   214 "childs" : """
   214 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   215 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   215 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   216 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   216 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   217 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   217 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   218 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   218 SELECT DISTINCT ?uri ?label
   219 SELECT DISTINCT ?uri ?label ?type
   219 WHERE {
   220 WHERE {
   220   ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
   221   ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
   221   { ?uri a ?type
   222   { ?uri a ?type
   222     FILTER (?type = skos:Collection || ?type = skos:Concept) }.
   223     FILTER (?type = skos:Collection || ?type = skos:Concept) }.
   223   ?root skos:narrower|skos:member ?uri.
   224   ?root skos:narrower|skos:member ?uri.
   261 'root' : """
   262 'root' : """
   262 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   263 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   263 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   264 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   264 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   265 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   265 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   266 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   266 SELECT DISTINCT ?uri ?label
   267 SELECT DISTINCT ?uri ?label ?type
   267 WHERE {
   268 WHERE {
   268     ?uri a skos:Collection ;
   269     ?uri a skos:Collection ;
   269     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> ;    
   270     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> ;    
   270     skos:prefLabel|rdfs:label ?label .
   271     skos:prefLabel|rdfs:label ?label ;
       
   272     rdf:type ?type ;
   271     FILTER (lang(?label) = %s). 
   273     FILTER (lang(?label) = %s). 
   272     FILTER NOT EXISTS { [skos:member ?uri] }
   274     FILTER NOT EXISTS { [skos:member ?uri] }
   273 }
   275 }
   274 ORDER BY ?label
   276 ORDER BY ?label
   275 """,
   277 """,
   276 'childs' : """
   278 'childs' : """
   277 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   279 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   278 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   280 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   279 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   281 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   280 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   282 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   281 SELECT DISTINCT ?uri ?label
   283 SELECT DISTINCT ?uri ?label ?type
   282 WHERE {
   284 WHERE {
   283   ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
   285   ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
   284   { ?uri a ?type
   286   { ?uri a ?type
   285     FILTER (?type = skos:Collection || ?type = skos:Concept) }.
   287     FILTER (?type = skos:Collection || ?type = skos:Concept) }.
   286   ?root skos:narrower|skos:member ?uri.
   288   ?root skos:narrower|skos:member ?uri.
   404 'filter' : """
   406 'filter' : """
   405 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   407 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   406 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   408 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   407 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   409 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   408 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   410 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   409 SELECT DISTINCT ?uri ?label
   411 SELECT DISTINCT ?uri ?label ?acro
   410 WHERE {
   412 WHERE {
   411     ?uri a skos:Concept.
   413     ?uri a skos:Concept.
   412     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> .
   414     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> .
   413     ?uri skos:prefLabel ?label.
   415     ?uri skos:prefLabel ?label.
   414     ?uri skos:prefLabel ?lab.
   416     ?uri skos:prefLabel ?lab.
       
   417     OPTIONAL { ?uri skos:altLabel ?acro }.
   415     FILTER regex (str(?lab), ?reg, 'i').
   418     FILTER regex (str(?lab), ?reg, 'i').
   416     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
   419     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
   417     BIND (STRLEN(STR(?lab)) AS ?len)
   420     BIND (STRLEN(STR(?lab)) AS ?len)
   418 }
   421 }
   419 ORDER BY ?place ?len ?lab
   422 ORDER BY ?place ?len ?lab
   421 'root' : """
   424 'root' : """
   422 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   425 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   423 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   426 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   424 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   427 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   425 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   428 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   426 SELECT DISTINCT ?uri ?label
   429 SELECT DISTINCT ?uri ?label ?acro
   427 WHERE {
   430 WHERE {
   428     ?uri a skos:Concept ;
   431     ?uri a skos:Concept ;
   429     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> ;    
   432     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> ;    
   430     skos:prefLabel ?label .
   433     skos:prefLabel ?label .
       
   434     OPTIONAL { ?uri skos:altLabel ?acro }
   431 }
   435 }
   432 ORDER BY ?label
   436 ORDER BY ?label
   433 """
   437 """
   434 }
   438 }
   435 SPARQL_ORGANIZATION_QUERIES = {
   439 SPARQL_ORGANIZATION_QUERIES = {
   436 'filter' : """
   440 'filter' : """
   437 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   441 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   438 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   442 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   439 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   443 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   440 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   444 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   441 SELECT DISTINCT ?uri ?label
   445 SELECT DISTINCT ?uri ?label ?acro
   442 WHERE {
   446 WHERE {
   443     ?uri a skos:Concept.
   447     ?uri a skos:Concept.
   444     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> .
   448     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> .
   445     ?uri skos:prefLabel ?label.
   449     ?uri skos:prefLabel ?label.
   446     ?uri skos:prefLabel ?lab.
   450     ?uri skos:prefLabel ?lab.
       
   451     OPTIONAL { ?uri skos:altLabel ?acro }.
   447     FILTER regex (str(?lab), ?reg, 'i').
   452     FILTER regex (str(?lab), ?reg, 'i').
   448     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
   453     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
   449     BIND (STRLEN(STR(?lab)) AS ?len)
   454     BIND (STRLEN(STR(?lab)) AS ?len)
   450 }
   455 }
   451 ORDER BY ?place ?len ?lab
   456 ORDER BY ?place ?len ?lab
   453 'root' : """
   458 'root' : """
   454 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   459 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   455 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   460 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   456 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   461 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   457 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   462 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   458 SELECT DISTINCT ?uri ?label
   463 SELECT DISTINCT ?uri ?label ?acro
   459 WHERE {
   464 WHERE {
   460     ?uri a skos:Concept ;
   465     ?uri a skos:Concept ;
   461     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> ;    
   466     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> ;    
   462     skos:prefLabel ?label .
   467     skos:prefLabel ?label .
       
   468     OPTIONAL { ?uri skos:altLabel ?acro }
   463 }
   469 }
   464 ORDER BY ?label
   470 ORDER BY ?label
   465 """
   471 """
   466 }
   472 }
   467 SPARQL_TYPE_QUERIES = {
   473 SPARQL_TYPE_QUERIES = {
   498     FILTER NOT EXISTS { [skos:narrower ?uri] }
   504     FILTER NOT EXISTS { [skos:narrower ?uri] }
   499 }
   505 }
   500 ORDER BY ?label
   506 ORDER BY ?label
   501 """
   507 """
   502 }
   508 }
   503 
   509 SPARQL_AUDIENCE_QUERIES = {
       
   510 "filter" : "",
       
   511 "root" : "",
       
   512 "childs" : "",
       
   513 "child-count" : ""
       
   514 }
   504 
   515 
   505 REST_FRAMEWORK = {
   516 REST_FRAMEWORK = {
   506     # Use hyperlinked styles by default.
   517     # Use hyperlinked styles by default.
   507     # Only used if the `serializer_class` attribute is not set on a view.
   518     # Only used if the `serializer_class` attribute is not set on a view.
   508     'DEFAULT_MODEL_SERIALIZER_CLASS':
   519     'DEFAULT_MODEL_SERIALIZER_CLASS':