src/p4l/settings.py
changeset 117 0a4e7d6ebe80
parent 114 93b45b4f423c
child 118 d33a072d974b
equal deleted inserted replaced
116:0a6c7c8f8490 117:0a4e7d6ebe80
   197         'TIMEOUT': 300,
   197         'TIMEOUT': 300,
   198     }
   198     }
   199 }
   199 }
   200 
   200 
   201 
   201 
   202 SPARQL_QUERY_ENDPOINT = "http://localhost:8080/openrdf-sesame/repositories/plan4learning"
   202 
   203 SPARQL_SUBJECT_QUERIES = {
   203 
   204 "filter" : """
   204 RDF_SCHEMES = { 
   205 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   205     'organizations': 'http://www.iiep.unesco.org/plan4learning/scheme/Organizations',
   206 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   206     'audiences': '',
   207 PREFIX owl:<http://www.w3.org/2002/07/owl#>
   207     'languages': 'http://www.iiep.unesco.org/plan4learning/scheme/Languages',
   208 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
   208     'types': 'http://www.iiep.unesco.org/plan4learning/scheme/DocumentType',
   209 SELECT DISTINCT ?uri ?label
   209     'subjects': 'http://skos.um.es/unescothes/CS000',
   210 WHERE {
   210     'themes': 'http://www.iiep.unesco.org/plan4learning/scheme/Themes',
   211     ?uri a skos:Concept.
   211     'countries': 'http://skos.um.es/unescothes/CS000/Countries',    
   212     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
   212     'projects': 'http://www.iiep.unesco.org/plan4learning/scheme/Projects'
   213     ?uri skos:prefLabel ?label.
       
   214     FILTER (lang(?label) = %s).
       
   215     ?uri skos:prefLabel ?lab.
       
   216     FILTER regex (str(?lab), ?reg, 'i').
       
   217     FILTER (lang (?lab) = %s).
       
   218     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   219     BIND (STRLEN(STR(?lab)) AS ?len)
       
   220 }
       
   221 ORDER BY ?place ?len ?lab
       
   222 """,
       
   223 "root" : """
       
   224 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   225 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   226 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   227 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   228 SELECT DISTINCT ?uri ?label ?type
       
   229 WHERE {
       
   230     ?uri a skos:Collection ;
       
   231     skos:inScheme <http://skos.um.es/unescothes/CS000> ;
       
   232     skos:prefLabel|rdfs:label ?label ;
       
   233     rdf:type ?type ;
       
   234     FILTER (lang(?label) = %s). 
       
   235     FILTER NOT EXISTS { [skos:member ?uri] }.
       
   236 }
       
   237 ORDER BY ?label
       
   238 """,
       
   239 "childs" : """
       
   240 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   241 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   242 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   243 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   244 SELECT DISTINCT ?uri ?label ?type
       
   245 WHERE {
       
   246   ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
       
   247   { ?uri a ?type
       
   248     FILTER (?type = skos:Collection || ?type = skos:Concept) }.
       
   249   ?root skos:narrower|skos:member ?uri.
       
   250   ?uri skos:prefLabel|rdfs:label ?label.
       
   251   FILTER (lang(?label) = %s).
       
   252 }
       
   253 ORDER BY ?label
       
   254 """,
       
   255 "child-count" : """
       
   256 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   257 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   258 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   259 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   260 SELECT (COUNT(?uri) as ?nb)
       
   261 WHERE {
       
   262     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
       
   263     ?root skos:narrower|skos:member ?uri.
       
   264 }
       
   265 """
       
   266 }
       
   267 SPARQL_THEME_QUERIES = {
       
   268 'filter' : """
       
   269 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   270 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   271 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   272 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   273 SELECT DISTINCT ?uri ?label
       
   274 WHERE {
       
   275     ?uri a skos:Concept.
       
   276     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
       
   277     ?uri skos:prefLabel ?label.
       
   278     FILTER (lang(?label) = %s).
       
   279     ?uri skos:prefLabel ?lab.
       
   280     FILTER regex (str(?lab), ?reg, 'i').
       
   281     FILTER (lang (?lab) = %s).
       
   282     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   283     BIND (STRLEN(STR(?lab)) AS ?len)
       
   284 }
       
   285 ORDER BY ?place ?len ?lab
       
   286 """,
       
   287 'root' : """
       
   288 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   289 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   290 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   291 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   292 SELECT DISTINCT ?uri ?label ?type
       
   293 WHERE {
       
   294     ?uri a skos:Collection ;
       
   295     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> ;    
       
   296     skos:prefLabel|rdfs:label ?label ;
       
   297     rdf:type ?type ;
       
   298     FILTER (lang(?label) = %s). 
       
   299     FILTER NOT EXISTS { [skos:member ?uri] }
       
   300 }
       
   301 ORDER BY ?label
       
   302 """,
       
   303 'childs' : """
       
   304 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   305 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   306 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   307 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   308 SELECT DISTINCT ?uri ?label ?type
       
   309 WHERE {
       
   310   ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
       
   311   { ?uri a ?type
       
   312     FILTER (?type = skos:Collection || ?type = skos:Concept) }.
       
   313   ?root skos:narrower|skos:member ?uri.
       
   314   ?uri skos:prefLabel|rdfs:label ?label.
       
   315   FILTER (lang(?label) = %s).
       
   316 }
       
   317 ORDER BY ?label
       
   318 """,
       
   319 'child-count' : """
       
   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 (COUNT(?uri) as ?nb)
       
   325 WHERE {
       
   326     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
       
   327     ?root skos:narrower|skos:member ?uri.
       
   328 }
       
   329 """
       
   330 }
       
   331 SPARQL_COUNTRY_QUERIES = {
       
   332 'filter' : """
       
   333 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   334 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   335 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   336 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   337 SELECT DISTINCT ?uri ?label
       
   338 WHERE {
       
   339     ?uri a skos:Concept.
       
   340     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
       
   341     ?uri skos:prefLabel ?label.
       
   342     FILTER (lang(?label) = %s).
       
   343     ?uri skos:prefLabel ?lab.
       
   344     FILTER regex (str(?lab), ?reg, 'i').
       
   345     FILTER (lang (?lab) = %s).
       
   346     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   347     BIND (STRLEN(STR(?lab)) AS ?len)
       
   348 }
       
   349 ORDER BY ?place ?len ?lab
       
   350 """,
       
   351 'root' : """
       
   352 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   353 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   354 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   355 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   356 SELECT DISTINCT ?uri ?label
       
   357 WHERE {
       
   358     ?uri a skos:Concept ;
       
   359     skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> ;    
       
   360     skos:prefLabel ?label .
       
   361     FILTER (lang(?label) = %s). 
       
   362     FILTER NOT EXISTS { [skos:narrower ?uri] }
       
   363 }
       
   364 ORDER BY ?label
       
   365 """,
       
   366 'childs' : """
       
   367 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   368 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   369 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   370 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   371 SELECT DISTINCT ?uri ?label
       
   372 WHERE {
       
   373   ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
       
   374   { ?uri a ?type
       
   375     FILTER (?type = skos:Collection || ?type = skos:Concept) }.
       
   376   ?root skos:narrower|skos:member ?uri.
       
   377   ?uri skos:prefLabel|rdfs:label ?label.
       
   378   FILTER (lang(?label) = %s).
       
   379 }
       
   380 ORDER BY ?label
       
   381 """,
       
   382 'child-count' : """
       
   383 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   384 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   385 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   386 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   387 SELECT (COUNT(?uri) as ?nb)
       
   388 WHERE {
       
   389     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
       
   390     ?root skos:narrower|skos:member ?uri.
       
   391 }
       
   392 """
       
   393 }
       
   394 SPARQL_LANGUAGE_QUERIES = {
       
   395 'filter' : """
       
   396 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   397 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   398 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   399 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   400 SELECT DISTINCT ?uri ?label
       
   401 WHERE {
       
   402     ?uri a skos:Concept.
       
   403     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> .
       
   404     ?uri skos:prefLabel ?label.
       
   405     FILTER (lang(?label) = %s).
       
   406     ?uri skos:prefLabel ?lab.
       
   407     FILTER regex (str(?lab), ?reg, 'i').
       
   408     FILTER (lang (?lab) = %s).
       
   409     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   410     BIND (STRLEN(STR(?lab)) AS ?len)
       
   411 }
       
   412 ORDER BY ?place ?len ?lab
       
   413 """,
       
   414 'root' : """
       
   415 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   416 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   417 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   418 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   419 SELECT DISTINCT ?uri ?label
       
   420 WHERE {
       
   421     ?uri a skos:Concept ;
       
   422     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> ;    
       
   423     skos:prefLabel ?label .
       
   424     FILTER (lang(?label) = %s). 
       
   425     FILTER NOT EXISTS { [skos:narrower ?uri] }
       
   426 }
       
   427 ORDER BY ?label
       
   428 """
       
   429 }
       
   430 SPARQL_PROJECT_QUERIES = {
       
   431 'filter' : """
       
   432 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   433 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   434 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   435 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   436 SELECT DISTINCT ?uri ?label ?acro
       
   437 WHERE {
       
   438     ?uri a skos:Concept.
       
   439     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> .
       
   440     ?uri skos:prefLabel ?label.
       
   441     ?uri skos:prefLabel ?lab.
       
   442     OPTIONAL { ?uri skos:altLabel ?acro }.
       
   443     FILTER regex (str(?lab), ?reg, 'i').
       
   444     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   445     BIND (STRLEN(STR(?lab)) AS ?len)
       
   446 }
       
   447 ORDER BY ?place ?len ?lab
       
   448 """,
       
   449 'root' : """
       
   450 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   451 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   452 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   453 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   454 SELECT DISTINCT ?uri ?label ?acro
       
   455 WHERE {
       
   456     ?uri a skos:Concept ;
       
   457     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> ;    
       
   458     skos:prefLabel ?label .
       
   459     OPTIONAL { ?uri skos:altLabel ?acro }
       
   460 }
       
   461 ORDER BY ?label
       
   462 """
       
   463 }
       
   464 SPARQL_ORGANIZATION_QUERIES = {
       
   465 'filter' : """
       
   466 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   467 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   468 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   469 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   470 SELECT DISTINCT ?uri ?label ?acro
       
   471 WHERE {
       
   472     ?uri a skos:Concept.
       
   473     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> .
       
   474     ?uri skos:prefLabel ?label.
       
   475     ?uri skos:prefLabel ?lab.
       
   476     OPTIONAL { ?uri skos:altLabel ?acro }.
       
   477     FILTER regex (str(?lab), ?reg, 'i').
       
   478     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   479     BIND (STRLEN(STR(?lab)) AS ?len)
       
   480 }
       
   481 ORDER BY ?place ?len ?lab
       
   482 """,
       
   483 'root' : """
       
   484 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   485 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   486 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   487 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   488 SELECT DISTINCT ?uri ?label ?acro
       
   489 WHERE {
       
   490     ?uri a skos:Concept ;
       
   491     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> ;    
       
   492     skos:prefLabel ?label .
       
   493     OPTIONAL { ?uri skos:altLabel ?acro }
       
   494 }
       
   495 ORDER BY ?label
       
   496 """
       
   497 }
       
   498 SPARQL_TYPE_QUERIES = {
       
   499 'filter' : """
       
   500 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   501 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   502 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   503 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   504 SELECT DISTINCT ?uri ?label
       
   505 WHERE {
       
   506     ?uri a skos:Concept.
       
   507     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> .
       
   508     ?uri skos:prefLabel ?label.
       
   509     FILTER (lang(?label) = %s).
       
   510     ?uri skos:prefLabel ?lab.
       
   511     FILTER regex (str(?lab), ?reg, 'i').
       
   512     FILTER (lang (?lab) = %s).
       
   513     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   514     BIND (STRLEN(STR(?lab)) AS ?len)
       
   515 }
       
   516 ORDER BY ?place ?len ?lab
       
   517 """,
       
   518 'root' : """
       
   519 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   520 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   521 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   522 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   523 SELECT DISTINCT ?uri ?label
       
   524 WHERE {
       
   525     ?uri a skos:Concept ;
       
   526     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> ;    
       
   527     skos:prefLabel ?label .
       
   528     FILTER (lang(?label) = %s). 
       
   529     FILTER NOT EXISTS { [skos:narrower ?uri] }
       
   530 }
       
   531 ORDER BY ?label
       
   532 """
       
   533 }
       
   534 SPARQL_AUDIENCE_QUERIES = {
       
   535 "filter" : "",
       
   536 "root" : "",
       
   537 "childs" : "",
       
   538 "child-count" : ""
       
   539 }
       
   540 
       
   541 RDF_SCHEMES = {
       
   542     'organization': 'http://www.iiep.unesco.org/plan4learning/scheme/Organizations',
       
   543     'audience': '',
       
   544     'language': 'http://www.iiep.unesco.org/plan4learning/scheme/Languages',
       
   545     'type': 'http://www.iiep.unesco.org/plan4learning/scheme/DocumentType',
       
   546     'subject': 'http://skos.um.es/unescothes/CS000',
       
   547     'theme': 'http://www.iiep.unesco.org/plan4learning/scheme/Themes',
       
   548     'country': 'http://skos.um.es/unescothes/CS000/Countries',    
       
   549     'project': 'http://www.iiep.unesco.org/plan4learning/scheme/Projects'
       
   550 }
   213 }
   551 
   214 
   552 REST_FRAMEWORK = {
   215 REST_FRAMEWORK = {
   553     # Use hyperlinked styles by default.
   216     # Use hyperlinked styles by default.
   554     # Only used if the `serializer_class` attribute is not set on a view.
   217     # Only used if the `serializer_class` attribute is not set on a view.
   564     'PAGINATE_BY': 20,
   227     'PAGINATE_BY': 20,
   565     'PAGINATE_BY_PARAM': 'page_size' 
   228     'PAGINATE_BY_PARAM': 'page_size' 
   566 }
   229 }
   567 
   230 
   568 LANGUAGES_LIST = [
   231 LANGUAGES_LIST = [
   569 (u"French","fr"),
   232 (u"French", "fr"),
   570 (u"English","en"),
   233 (u"English", "en"),
   571 (u"Spanish; Castilian","es"),
   234 (u"Spanish; Castilian", "es"),
   572 (u"",""),
   235 (u"", ""),
   573 (u"Abkhaz","ab"),
   236 (u"Abkhaz", "ab"),
   574 (u"Afar","aa"),
   237 (u"Afar", "aa"),
   575 (u"Afrikaans","af"),
   238 (u"Afrikaans", "af"),
   576 (u"Akan","ak"),
   239 (u"Akan", "ak"),
   577 (u"Albanian","sq"),
   240 (u"Albanian", "sq"),
   578 (u"Amharic","am"),
   241 (u"Amharic", "am"),
   579 (u"Arabic","ar"),
   242 (u"Arabic", "ar"),
   580 (u"Aragonese","an"),
   243 (u"Aragonese", "an"),
   581 (u"Armenian","hy"),
   244 (u"Armenian", "hy"),
   582 (u"Assamese","as"),
   245 (u"Assamese", "as"),
   583 (u"Avaric","av"),
   246 (u"Avaric", "av"),
   584 (u"Avestan","ae"),
   247 (u"Avestan", "ae"),
   585 (u"Aymara","ay"),
   248 (u"Aymara", "ay"),
   586 (u"Azerbaijani","az"),
   249 (u"Azerbaijani", "az"),
   587 (u"Bambara","bm"),
   250 (u"Bambara", "bm"),
   588 (u"Bashkir","ba"),
   251 (u"Bashkir", "ba"),
   589 (u"Basque","eu"),
   252 (u"Basque", "eu"),
   590 (u"Belarusian","be"),
   253 (u"Belarusian", "be"),
   591 (u"Bengali; Bangla","bn"),
   254 (u"Bengali; Bangla", "bn"),
   592 (u"Bihari","bh"),
   255 (u"Bihari", "bh"),
   593 (u"Bislama","bi"),
   256 (u"Bislama", "bi"),
   594 (u"Bosnian","bs"),
   257 (u"Bosnian", "bs"),
   595 (u"Breton","br"),
   258 (u"Breton", "br"),
   596 (u"Bulgarian","bg"),
   259 (u"Bulgarian", "bg"),
   597 (u"Burmese","my"),
   260 (u"Burmese", "my"),
   598 (u"Catalan","ca"),
   261 (u"Catalan", "ca"),
   599 (u"Chamorro","ch"),
   262 (u"Chamorro", "ch"),
   600 (u"Chechen","ce"),
   263 (u"Chechen", "ce"),
   601 (u"Chichewa; Chewa; Nyanja","ny"),
   264 (u"Chichewa; Chewa; Nyanja", "ny"),
   602 (u"Chinese","zh"),
   265 (u"Chinese", "zh"),
   603 (u"Chuvash","cv"),
   266 (u"Chuvash", "cv"),
   604 (u"Cornish","kw"),
   267 (u"Cornish", "kw"),
   605 (u"Corsican","co"),
   268 (u"Corsican", "co"),
   606 (u"Cree","cr"),
   269 (u"Cree", "cr"),
   607 (u"Croatian","hr"),
   270 (u"Croatian", "hr"),
   608 (u"Czech","cs"),
   271 (u"Czech", "cs"),
   609 (u"Danish","da"),
   272 (u"Danish", "da"),
   610 (u"Divehi; Dhivehi; Maldivian;","dv"),
   273 (u"Divehi; Dhivehi; Maldivian;", "dv"),
   611 (u"Dutch","nl"),
   274 (u"Dutch", "nl"),
   612 (u"Dzongkha","dz"),
   275 (u"Dzongkha", "dz"),
   613 (u"English","en"),
   276 (u"English", "en"),
   614 (u"Esperanto","eo"),
   277 (u"Esperanto", "eo"),
   615 (u"Estonian","et"),
   278 (u"Estonian", "et"),
   616 (u"Ewe","ee"),
   279 (u"Ewe", "ee"),
   617 (u"Faroese","fo"),
   280 (u"Faroese", "fo"),
   618 (u"Fijian","fj"),
   281 (u"Fijian", "fj"),
   619 (u"Finnish","fi"),
   282 (u"Finnish", "fi"),
   620 (u"French","fr"),
   283 (u"French", "fr"),
   621 (u"Fula; Fulah; Pulaar; Pular","ff"),
   284 (u"Fula; Fulah; Pulaar; Pular", "ff"),
   622 (u"Galician","gl"),
   285 (u"Galician", "gl"),
   623 (u"Ganda","lg"),
   286 (u"Ganda", "lg"),
   624 (u"Georgian","ka"),
   287 (u"Georgian", "ka"),
   625 (u"German","de"),
   288 (u"German", "de"),
   626 (u"Greek Modern","el"),
   289 (u"Greek Modern", "el"),
   627 (u"Guarani","gn"),
   290 (u"Guarani", "gn"),
   628 (u"Gujarati","gu"),
   291 (u"Gujarati", "gu"),
   629 (u"Haitian; Haitian Creole","ht"),
   292 (u"Haitian; Haitian Creole", "ht"),
   630 (u"Hausa","ha"),
   293 (u"Hausa", "ha"),
   631 (u"Hebrew","he"),
   294 (u"Hebrew", "he"),
   632 (u"Herero","hz"),
   295 (u"Herero", "hz"),
   633 (u"Hindi","hi"),
   296 (u"Hindi", "hi"),
   634 (u"Hiri Motu","ho"),
   297 (u"Hiri Motu", "ho"),
   635 (u"Hungarian","hu"),
   298 (u"Hungarian", "hu"),
   636 (u"Icelandic","is"),
   299 (u"Icelandic", "is"),
   637 (u"Ido","io"),
   300 (u"Ido", "io"),
   638 (u"Igbo","ig"),
   301 (u"Igbo", "ig"),
   639 (u"Indonesian","id"),
   302 (u"Indonesian", "id"),
   640 (u"Interlingua","ia"),
   303 (u"Interlingua", "ia"),
   641 (u"Interlingue","ie"),
   304 (u"Interlingue", "ie"),
   642 (u"Inuktitut","iu"),
   305 (u"Inuktitut", "iu"),
   643 (u"Inupiaq","ik"),
   306 (u"Inupiaq", "ik"),
   644 (u"Irish","ga"),
   307 (u"Irish", "ga"),
   645 (u"Italian","it"),
   308 (u"Italian", "it"),
   646 (u"Japanese","ja"),
   309 (u"Japanese", "ja"),
   647 (u"Javanese","jv"),
   310 (u"Javanese", "jv"),
   648 (u"Kalaallisut; Greenlandic","kl"),
   311 (u"Kalaallisut; Greenlandic", "kl"),
   649 (u"Kannada","kn"),
   312 (u"Kannada", "kn"),
   650 (u"Kanuri","kr"),
   313 (u"Kanuri", "kr"),
   651 (u"Kashmiri","ks"),
   314 (u"Kashmiri", "ks"),
   652 (u"Kazakh","kk"),
   315 (u"Kazakh", "kk"),
   653 (u"Khmer","km"),
   316 (u"Khmer", "km"),
   654 (u"Kikuyu; Gikuyu","ki"),
   317 (u"Kikuyu; Gikuyu", "ki"),
   655 (u"Kinyarwanda","rw"),
   318 (u"Kinyarwanda", "rw"),
   656 (u"Kirundi","rn"),
   319 (u"Kirundi", "rn"),
   657 (u"Komi","kv"),
   320 (u"Komi", "kv"),
   658 (u"Kongo","kg"),
   321 (u"Kongo", "kg"),
   659 (u"Korean","ko"),
   322 (u"Korean", "ko"),
   660 (u"Kurdish","ku"),
   323 (u"Kurdish", "ku"),
   661 (u"Kwanyama; Kuanyama","kj"),
   324 (u"Kwanyama; Kuanyama", "kj"),
   662 (u"Kyrgyz","ky"),
   325 (u"Kyrgyz", "ky"),
   663 (u"Lao","lo"),
   326 (u"Lao", "lo"),
   664 (u"Latin","la"),
   327 (u"Latin", "la"),
   665 (u"Latvian","lv"),
   328 (u"Latvian", "lv"),
   666 (u"Limburgish; Limburgan; Limburger","li"),
   329 (u"Limburgish; Limburgan; Limburger", "li"),
   667 (u"Lingala","ln"),
   330 (u"Lingala", "ln"),
   668 (u"Lithuanian","lt"),
   331 (u"Lithuanian", "lt"),
   669 (u"Luba-Katanga","lu"),
   332 (u"Luba-Katanga", "lu"),
   670 (u"Luxembourgish; Letzeburgesch","lb"),
   333 (u"Luxembourgish; Letzeburgesch", "lb"),
   671 (u"Macedonian","mk"),
   334 (u"Macedonian", "mk"),
   672 (u"Malagasy","mg"),
   335 (u"Malagasy", "mg"),
   673 (u"Malay","ms"),
   336 (u"Malay", "ms"),
   674 (u"Malayalam","ml"),
   337 (u"Malayalam", "ml"),
   675 (u"Maltese","mt"),
   338 (u"Maltese", "mt"),
   676 (u"Manx","gv"),
   339 (u"Manx", "gv"),
   677 (u"Marathi","mr"),
   340 (u"Marathi", "mr"),
   678 (u"Marshallese","mh"),
   341 (u"Marshallese", "mh"),
   679 (u"Mongolian","mn"),
   342 (u"Mongolian", "mn"),
   680 (u"Maori","mi"),
   343 (u"Maori", "mi"),
   681 (u"Nauru","na"),
   344 (u"Nauru", "na"),
   682 (u"Navajo; Navaho","nv"),
   345 (u"Navajo; Navaho", "nv"),
   683 (u"Ndonga","ng"),
   346 (u"Ndonga", "ng"),
   684 (u"Nepali","ne"),
   347 (u"Nepali", "ne"),
   685 (u"North Ndebele","nd"),
   348 (u"North Ndebele", "nd"),
   686 (u"Northern Sami","se"),
   349 (u"Northern Sami", "se"),
   687 (u"Norwegian","no"),
   350 (u"Norwegian", "no"),
   688 (u"Norwegian Bokmal","nb"),
   351 (u"Norwegian Bokmal", "nb"),
   689 (u"Norwegian Nynorsk","nn"),
   352 (u"Norwegian Nynorsk", "nn"),
   690 (u"Nuosu","ii"),
   353 (u"Nuosu", "ii"),
   691 (u"Occitan","oc"),
   354 (u"Occitan", "oc"),
   692 (u"Ojibwe; Ojibwa","oj"),
   355 (u"Ojibwe; Ojibwa", "oj"),
   693 (u"Church Slavic; Church Slavonic","cu"),
   356 (u"Church Slavic; Church Slavonic", "cu"),
   694 (u"Oriya","or"),
   357 (u"Oriya", "or"),
   695 (u"Oromo","om"),
   358 (u"Oromo", "om"),
   696 (u"Ossetian; Ossetic","os"),
   359 (u"Ossetian; Ossetic", "os"),
   697 (u"Panjabi; Punjabi","pa"),
   360 (u"Panjabi; Punjabi", "pa"),
   698 (u"Pashto; Pushto","ps"),
   361 (u"Pashto; Pushto", "ps"),
   699 (u"Persian","fa"),
   362 (u"Persian", "fa"),
   700 (u"Polish","pl"),
   363 (u"Polish", "pl"),
   701 (u"Portuguese","pt"),
   364 (u"Portuguese", "pt"),
   702 (u"Pali","pi"),
   365 (u"Pali", "pi"),
   703 (u"Quechua","qu"),
   366 (u"Quechua", "qu"),
   704 (u"Romanian; Moldavian","ro"),
   367 (u"Romanian; Moldavian", "ro"),
   705 (u"Romansh","rm"),
   368 (u"Romansh", "rm"),
   706 (u"Russian","ru"),
   369 (u"Russian", "ru"),
   707 (u"Samoan","sm"),
   370 (u"Samoan", "sm"),
   708 (u"Sango","sg"),
   371 (u"Sango", "sg"),
   709 (u"Sanskrit (Samskrta),sa"),
   372 (u"Sanskrit (Samskrta),sa"),
   710 (u"Sardinian","sc"),
   373 (u"Sardinian", "sc"),
   711 (u"Scottish Gaelic; Gaelic","gd"),
   374 (u"Scottish Gaelic; Gaelic", "gd"),
   712 (u"Serbian","sr"),
   375 (u"Serbian", "sr"),
   713 (u"Shona","sn"),
   376 (u"Shona", "sn"),
   714 (u"Sindhi","sd"),
   377 (u"Sindhi", "sd"),
   715 (u"Sinhala; Sinhalese","si"),
   378 (u"Sinhala; Sinhalese", "si"),
   716 (u"Slovak","sk"),
   379 (u"Slovak", "sk"),
   717 (u"Slovene","sl"),
   380 (u"Slovene", "sl"),
   718 (u"Somali","so"),
   381 (u"Somali", "so"),
   719 (u"South Azerbaijani","az"),
   382 (u"South Azerbaijani", "az"),
   720 (u"South Ndebele","nr"),
   383 (u"South Ndebele", "nr"),
   721 (u"Southern Sotho","st"),
   384 (u"Southern Sotho", "st"),
   722 (u"Spanish; Castilian","es"),
   385 (u"Spanish; Castilian", "es"),
   723 (u"Sundanese","su"),
   386 (u"Sundanese", "su"),
   724 (u"Swahili","sw"),
   387 (u"Swahili", "sw"),
   725 (u"Swati","ss"),
   388 (u"Swati", "ss"),
   726 (u"Swedish","sv"),
   389 (u"Swedish", "sv"),
   727 (u"Tagalog","tl"),
   390 (u"Tagalog", "tl"),
   728 (u"Tahitian","ty"),
   391 (u"Tahitian", "ty"),
   729 (u"Tajik","tg"),
   392 (u"Tajik", "tg"),
   730 (u"Tamil","ta"),
   393 (u"Tamil", "ta"),
   731 (u"Tatar","tt"),
   394 (u"Tatar", "tt"),
   732 (u"Telugu","te"),
   395 (u"Telugu", "te"),
   733 (u"Thai","th"),
   396 (u"Thai", "th"),
   734 (u"Tibetan","bo"),
   397 (u"Tibetan", "bo"),
   735 (u"Tigrinya","ti"),
   398 (u"Tigrinya", "ti"),
   736 (u"Tonga","to"),
   399 (u"Tonga", "to"),
   737 (u"Tsonga","ts"),
   400 (u"Tsonga", "ts"),
   738 (u"Tswana","tn"),
   401 (u"Tswana", "tn"),
   739 (u"Turkish","tr"),
   402 (u"Turkish", "tr"),
   740 (u"Turkmen","tk"),
   403 (u"Turkmen", "tk"),
   741 (u"Twi","tw"),
   404 (u"Twi", "tw"),
   742 (u"Ukrainian","uk"),
   405 (u"Ukrainian", "uk"),
   743 (u"Urdu","ur"),
   406 (u"Urdu", "ur"),
   744 (u"Uyghur; Uighur","ug"),
   407 (u"Uyghur; Uighur", "ug"),
   745 (u"Uzbek","uz"),
   408 (u"Uzbek", "uz"),
   746 (u"Venda","ve"),
   409 (u"Venda", "ve"),
   747 (u"Vietnamese","vi"),
   410 (u"Vietnamese", "vi"),
   748 (u"Volapuk","vo"),
   411 (u"Volapuk", "vo"),
   749 (u"Walloon","wa"),
   412 (u"Walloon", "wa"),
   750 (u"Welsh","cy"),
   413 (u"Welsh", "cy"),
   751 (u"Western Frisian","fy"),
   414 (u"Western Frisian", "fy"),
   752 (u"Wolof","wo"),
   415 (u"Wolof", "wo"),
   753 (u"Xhosa","xh"),
   416 (u"Xhosa", "xh"),
   754 (u"Yiddish","yi"),
   417 (u"Yiddish", "yi"),
   755 (u"Yoruba","yo"),
   418 (u"Yoruba", "yo"),
   756 (u"Zhuang; Chuang","za"),
   419 (u"Zhuang; Chuang", "za"),
   757 (u"Zulu","zu")]
   420 (u"Zulu", "zu")]
   758 
   421 
   759 from config import *  # @UnusedWildImport
   422 from config import *  # @UnusedWildImport
   760 
   423 
   761 if not "SRC_BASE_URL" in locals():
   424 if not "SRC_BASE_URL" in locals():
   762     SRC_BASE_URL = BASE_URL + __name__.split('.')[0] + '/'
   425     SRC_BASE_URL = BASE_URL + __name__.split('.')[0] + '/'
   765 if not "LOGOUT_URL" in locals():
   428 if not "LOGOUT_URL" in locals():
   766     LOGOUT_URL = SRC_BASE_URL + 'auth/disconnect/'
   429     LOGOUT_URL = SRC_BASE_URL + 'auth/disconnect/'
   767 if not "LOGIN_REDIRECT_URL" in locals():
   430 if not "LOGIN_REDIRECT_URL" in locals():
   768     LOGIN_REDIRECT_URL = SRC_BASE_URL
   431     LOGIN_REDIRECT_URL = SRC_BASE_URL
   769 if not "LOGOUT_REDIRECT_URL" in locals():
   432 if not "LOGOUT_REDIRECT_URL" in locals():
   770     LOGOUT_REDIRECT_URL = SRC_BASE_URL + 'auth/login'     
   433     LOGOUT_REDIRECT_URL = SRC_BASE_URL + 'auth/login'
       
   434 
       
   435 if not "SPARQL_QUERY_ENDPOINT" in locals():    
       
   436     SPARQL_QUERY_ENDPOINT = "http://localhost:8080/openrdf-sesame/repositories/plan4learning"
       
   437 
       
   438 if not "SPARQL_REF_QUERIES" in locals():
       
   439     SPARQL_REF_QUERIES = {
       
   440         'subjects': {
       
   441             'url' : SPARQL_QUERY_ENDPOINT,
       
   442             'filter' : """
       
   443                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   444                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   445                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   446                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   447                 SELECT DISTINCT ?uri ?label
       
   448                 WHERE {{
       
   449                     ?uri a skos:Concept.
       
   450                     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
       
   451                     ?uri skos:prefLabel ?label.
       
   452                     FILTER (lang(?label) = {lang}).
       
   453                     ?uri skos:prefLabel ?lab.
       
   454                     FILTER regex (str(?lab), ?reg, 'i').
       
   455                     FILTER (lang (?lab) = {lang}).
       
   456                     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   457                     BIND (STRLEN(STR(?lab)) AS ?len)
       
   458                 }}
       
   459                 ORDER BY ?place ?len ?lab
       
   460             """,
       
   461             "root" : """
       
   462                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   463                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   464                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   465                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   466                 SELECT DISTINCT ?uri ?label ?type
       
   467                 WHERE {{
       
   468                     ?uri a skos:Collection ;
       
   469                          skos:inScheme <http://skos.um.es/unescothes/CS000> ;
       
   470                          skos:prefLabel|rdfs:label ?label ;
       
   471                          rdf:type ?type .
       
   472                     FILTER (lang(?label) = {lang}). 
       
   473                     FILTER NOT EXISTS {{ [skos:member ?uri] }}.
       
   474                 }}
       
   475                 ORDER BY ?label
       
   476             """,
       
   477             "childs" : """
       
   478                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   479                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   480                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   481                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   482                 SELECT DISTINCT ?uri ?label ?type
       
   483                 WHERE {{
       
   484                   ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
       
   485                   {{ ?uri a ?type
       
   486                     FILTER (?type = skos:Collection || ?type = skos:Concept) }}.
       
   487                   ?root skos:narrower|skos:member ?uri.
       
   488                   ?uri skos:prefLabel|rdfs:label ?label.
       
   489                   FILTER (lang(?label) = {lang}).
       
   490                 }}
       
   491                 ORDER BY ?label
       
   492             """,
       
   493             "child-count" : """
       
   494                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   495                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   496                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   497                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   498                 SELECT (COUNT(?uri) as ?nb)
       
   499                 WHERE {{
       
   500                     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
       
   501                     ?root skos:narrower|skos:member ?uri.
       
   502                 }}
       
   503             """
       
   504         },
       
   505         'themes': {
       
   506             'url' : SPARQL_QUERY_ENDPOINT,
       
   507             'filter' : """
       
   508                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   509                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   510                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   511                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   512                 SELECT DISTINCT ?uri ?label
       
   513                 WHERE {{
       
   514                     ?uri a skos:Concept.
       
   515                     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
       
   516                     ?uri skos:prefLabel ?label.
       
   517                     FILTER (lang(?label) = {lang}).
       
   518                     ?uri skos:prefLabel ?lab.
       
   519                     FILTER regex (str(?lab), ?reg, 'i').
       
   520                     FILTER (lang (?lab) = {lang}).
       
   521                     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   522                     BIND (STRLEN(STR(?lab)) AS ?len)
       
   523                 }}
       
   524                 ORDER BY ?place ?len ?lab
       
   525             """,
       
   526             'root' : """
       
   527                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   528                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   529                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   530                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   531                 SELECT DISTINCT ?uri ?label ?type
       
   532                 WHERE {{
       
   533                     ?uri a skos:Collection ;
       
   534                          skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> ;    
       
   535                          skos:prefLabel|rdfs:label ?label ;
       
   536                          rdf:type ?type .
       
   537                     FILTER (lang(?label) = {lang}). 
       
   538                     FILTER NOT EXISTS {{ [skos:member ?uri] }}
       
   539                 }}
       
   540                 ORDER BY ?label
       
   541             """,
       
   542             'childs' : """
       
   543                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   544                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   545                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   546                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   547                 SELECT DISTINCT ?uri ?label ?type
       
   548                 WHERE {{
       
   549                   ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
       
   550                   {{ ?uri a ?type
       
   551                     FILTER (?type = skos:Collection || ?type = skos:Concept) }}.
       
   552                   ?root skos:narrower|skos:member ?uri.
       
   553                   ?uri skos:prefLabel|rdfs:label ?label.
       
   554                   FILTER (lang(?label) = {lang}).
       
   555                 }}
       
   556                 ORDER BY ?label
       
   557             """,
       
   558             'child-count' : """
       
   559                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   560                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   561                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   562                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   563                 SELECT (COUNT(?uri) as ?nb)
       
   564                 WHERE {{
       
   565                     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> .
       
   566                     ?root skos:narrower|skos:member ?uri.
       
   567                 }}
       
   568             """
       
   569         },
       
   570         'countries': {
       
   571             'url' : SPARQL_QUERY_ENDPOINT,
       
   572             'filter' : """
       
   573                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   574                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   575                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   576                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   577                 SELECT DISTINCT ?uri ?label
       
   578                 WHERE {{
       
   579                     ?uri a skos:Concept.
       
   580                     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
       
   581                     ?uri skos:prefLabel ?label.
       
   582                     FILTER (lang(?label) = {lang}).
       
   583                     ?uri skos:prefLabel ?lab.
       
   584                     FILTER regex (str(?lab), ?reg, 'i').
       
   585                     FILTER (lang (?lab) = {lang}).
       
   586                     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   587                     BIND (STRLEN(STR(?lab)) AS ?len)
       
   588                 }}
       
   589                 ORDER BY ?place ?len ?lab
       
   590             """,
       
   591             'root' : """
       
   592                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   593                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   594                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   595                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   596                 SELECT DISTINCT ?uri ?label
       
   597                 WHERE {{
       
   598                     ?uri a skos:Concept ;
       
   599                          skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> ;    
       
   600                          skos:prefLabel ?label .
       
   601                     FILTER (lang(?label) = {lang}). 
       
   602                     FILTER NOT EXISTS {{ [skos:narrower ?uri] }}
       
   603                 }}
       
   604                 ORDER BY ?label
       
   605             """,
       
   606             'childs' : """
       
   607                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   608                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   609                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   610                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   611                 SELECT DISTINCT ?uri ?label
       
   612                 WHERE {{
       
   613                   ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
       
   614                   {{ ?uri a ?type
       
   615                     FILTER (?type = skos:Collection || ?type = skos:Concept) }}.
       
   616                   ?root skos:narrower|skos:member ?uri.
       
   617                   ?uri skos:prefLabel|rdfs:label ?label.
       
   618                   FILTER (lang(?label) = {lang}).
       
   619                 }}
       
   620                 ORDER BY ?label
       
   621             """,
       
   622             'child-count' : """
       
   623                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   624                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   625                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   626                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   627                 SELECT (COUNT(?uri) as ?nb)
       
   628                 WHERE {{
       
   629                     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> .
       
   630                     ?root skos:narrower|skos:member ?uri.
       
   631                 }}
       
   632             """
       
   633         },
       
   634         'languages': {
       
   635             'url' : SPARQL_QUERY_ENDPOINT,
       
   636             'filter' : """
       
   637                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   638                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   639                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   640                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   641                 SELECT DISTINCT ?uri ?label
       
   642                 WHERE {{
       
   643                     ?uri a skos:Concept.
       
   644                     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> .
       
   645                     ?uri skos:prefLabel ?label.
       
   646                     FILTER (lang(?label) = {lang}).
       
   647                     ?uri skos:prefLabel ?lab.
       
   648                     FILTER regex (str(?lab), ?reg, 'i').
       
   649                     FILTER (lang (?lab) = {lang}).
       
   650                     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   651                     BIND (STRLEN(STR(?lab)) AS ?len)
       
   652                 }}
       
   653                 ORDER BY ?place ?len ?lab
       
   654             """,
       
   655             'root' : """
       
   656                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   657                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   658                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   659                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   660                 SELECT DISTINCT ?uri ?label
       
   661                 WHERE {{
       
   662                     ?uri a skos:Concept ;
       
   663                          skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> ;    
       
   664                          skos:prefLabel ?label .
       
   665                     FILTER (lang(?label) = {lang}). 
       
   666                     FILTER NOT EXISTS {{ [skos:narrower ?uri] }}
       
   667                 }}
       
   668                 ORDER BY ?label
       
   669             """
       
   670         },
       
   671         'projects': {
       
   672             'url' : SPARQL_QUERY_ENDPOINT,
       
   673             'filter' : """
       
   674                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   675                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   676                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   677                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   678                 SELECT DISTINCT ?uri ?label ?acro
       
   679                 WHERE {{
       
   680                     ?uri a skos:Concept.
       
   681                     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> .
       
   682                     ?uri skos:prefLabel ?label.
       
   683                     ?uri skos:prefLabel ?lab.
       
   684                     OPTIONAL {{ ?uri skos:altLabel ?acro }}.
       
   685                     FILTER regex (str(?lab), ?reg, 'i').
       
   686                     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   687                     BIND (STRLEN(STR(?lab)) AS ?len)
       
   688                 }}
       
   689                 ORDER BY ?place ?len ?lab
       
   690             """,
       
   691             'root' : """
       
   692                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   693                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   694                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   695                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   696                 SELECT DISTINCT ?uri ?label ?acro
       
   697                 WHERE {{
       
   698                     ?uri a skos:Concept ;
       
   699                     skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> ;    
       
   700                     skos:prefLabel ?label .
       
   701                     OPTIONAL {{ ?uri skos:altLabel ?acro }}
       
   702                 }}
       
   703                 ORDER BY ?label
       
   704             """
       
   705         },
       
   706         'organizations': {
       
   707             'url' : SPARQL_QUERY_ENDPOINT,
       
   708             'filter' : """
       
   709                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   710                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   711                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   712                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   713                 SELECT DISTINCT ?uri ?label ?acro
       
   714                 WHERE {{
       
   715                     ?uri a skos:Concept.
       
   716                     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> .
       
   717                     ?uri skos:prefLabel ?label.
       
   718                     ?uri skos:prefLabel ?lab.
       
   719                     OPTIONAL {{ ?uri skos:altLabel ?acro }}.
       
   720                     FILTER regex (str(?lab), ?reg, 'i').
       
   721                     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   722                     BIND (STRLEN(STR(?lab)) AS ?len)
       
   723                 }}
       
   724                 ORDER BY ?place ?len ?lab
       
   725             """,
       
   726             'root' : """
       
   727                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   728                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   729                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   730                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   731                 SELECT DISTINCT ?uri ?label ?acro
       
   732                 WHERE {{
       
   733                     ?uri a skos:Concept ;
       
   734                          skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> ;    
       
   735                          skos:prefLabel ?label .
       
   736                     OPTIONAL {{ ?uri skos:altLabel ?acro }}
       
   737                 }}
       
   738                 ORDER BY ?label
       
   739             """
       
   740         },
       
   741         'types': {
       
   742             'url' : SPARQL_QUERY_ENDPOINT,
       
   743             'filter' : """
       
   744                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   745                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   746                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   747                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   748                 SELECT DISTINCT ?uri ?label
       
   749                 WHERE {{
       
   750                     ?uri a skos:Concept.
       
   751                     ?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> .
       
   752                     ?uri skos:prefLabel ?label.
       
   753                     FILTER (lang(?label) = {lang}).
       
   754                     ?uri skos:prefLabel ?lab.
       
   755                     FILTER regex (str(?lab), ?reg, 'i').
       
   756                     FILTER (lang (?lab) = {lang}).
       
   757                     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   758                     BIND (STRLEN(STR(?lab)) AS ?len)
       
   759                 }}
       
   760                 ORDER BY ?place ?len ?lab
       
   761             """,
       
   762             'root' : """
       
   763                 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   764                 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   765                 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   766                 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   767                 SELECT DISTINCT ?uri ?label
       
   768                 WHERE {{
       
   769                     ?uri a skos:Concept ;
       
   770                          skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> ;    
       
   771                          skos:prefLabel ?label .
       
   772                     FILTER (lang(?label) = {lang}). 
       
   773                     FILTER NOT EXISTS {{ [skos:narrower ?uri] }}
       
   774                 }}
       
   775                 ORDER BY ?label
       
   776             """
       
   777         },
       
   778         'audiences': {
       
   779             'url' : SPARQL_QUERY_ENDPOINT,
       
   780             "filter" : "",
       
   781             "root" : "",
       
   782             "childs" : "",
       
   783             "child-count" : ""
       
   784         }
       
   785     }