src/p4l/settings.py
changeset 156 894a01c6a2b2
parent 148 a998cf036d15
child 161 216b3f9582aa
equal deleted inserted replaced
155:7e8034bec089 156:894a01c6a2b2
   336                          "skos:prefLabel|rdfs:label ?label ; "
   336                          "skos:prefLabel|rdfs:label ?label ; "
   337                          "rdf:type ?type . "
   337                          "rdf:type ?type . "
   338                     "FILTER (lang(?label) = {lang}). " 
   338                     "FILTER (lang(?label) = {lang}). " 
   339                     "FILTER NOT EXISTS {{ [skos:member ?uri] }}. "
   339                     "FILTER NOT EXISTS {{ [skos:member ?uri] }}. "
   340                 "}} "
   340                 "}} "
   341                 "ORDER BY ?label"
   341                 "ORDER BY str(?label)"
   342             ),
   342             ),
   343             "childs" : (
   343             "childs" : (
   344                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   344                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   345                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   345                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   346                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   346                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   352                     "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
   352                     "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
   353                   "?root skos:narrower|skos:member ?uri. "
   353                   "?root skos:narrower|skos:member ?uri. "
   354                   "?uri skos:prefLabel|rdfs:label ?label. "
   354                   "?uri skos:prefLabel|rdfs:label ?label. "
   355                   "FILTER (lang(?label) = {lang}). "
   355                   "FILTER (lang(?label) = {lang}). "
   356                 "}} "
   356                 "}} "
   357                 "ORDER BY ?label"
   357                 "ORDER BY str(?label)"
   358             ),
   358             ),
   359             "child-count" : (
   359             "child-count" : (
   360                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   360                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   361                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   361                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   362                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   362                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   401                          "skos:prefLabel|rdfs:label ?label ; "
   401                          "skos:prefLabel|rdfs:label ?label ; "
   402                          "rdf:type ?type . "
   402                          "rdf:type ?type . "
   403                     "FILTER (lang(?label) = {lang}). " 
   403                     "FILTER (lang(?label) = {lang}). " 
   404                     "FILTER NOT EXISTS {{ [skos:member ?uri] }} "
   404                     "FILTER NOT EXISTS {{ [skos:member ?uri] }} "
   405                 "}} "
   405                 "}} "
   406                 "ORDER BY ?label"
   406                 "ORDER BY str(?label)"
   407             ),
   407             ),
   408             'childs' : (
   408             'childs' : (
   409                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   409                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   410                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   410                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   411                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   411                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   417                     "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
   417                     "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
   418                   "?root skos:narrower|skos:member ?uri. "
   418                   "?root skos:narrower|skos:member ?uri. "
   419                   "?uri skos:prefLabel|rdfs:label ?label. "
   419                   "?uri skos:prefLabel|rdfs:label ?label. "
   420                   "FILTER (lang(?label) = {lang}). "
   420                   "FILTER (lang(?label) = {lang}). "
   421                 "}} "
   421                 "}} "
   422                 "ORDER BY ?label "
   422                 "ORDER BY str(?label)"
   423             ),
   423             ),
   424             'child-count' : (
   424             'child-count' : (
   425                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   425                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   426                 "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#> "
   427                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   427                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   465                          "skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> ; "    
   465                          "skos:inScheme <http://skos.um.es/unescothes/CS000/Countries> ; "    
   466                          "skos:prefLabel ?label . "
   466                          "skos:prefLabel ?label . "
   467                     "FILTER (lang(?label) = {lang}). " 
   467                     "FILTER (lang(?label) = {lang}). " 
   468                     "FILTER NOT EXISTS {{ [skos:narrower ?uri] }} "
   468                     "FILTER NOT EXISTS {{ [skos:narrower ?uri] }} "
   469                 "}} "
   469                 "}} "
   470                 "ORDER BY ?label "
   470                 "ORDER BY str(?label)"
   471             ),
   471             ),
   472             'childs' : (
   472             'childs' : (
   473                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   473                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   474                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   474                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   475                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   475                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   481                     "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
   481                     "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
   482                   "?root skos:narrower|skos:member ?uri. "
   482                   "?root skos:narrower|skos:member ?uri. "
   483                   "?uri skos:prefLabel|rdfs:label ?label. "
   483                   "?uri skos:prefLabel|rdfs:label ?label. "
   484                   "FILTER (lang(?label) = {lang}). "
   484                   "FILTER (lang(?label) = {lang}). "
   485                 "}} "
   485                 "}} "
   486                 "ORDER BY ?label"
   486                 "ORDER BY str(?label)"
   487             ),
   487             ),
   488             'child-count' : (
   488             'child-count' : (
   489                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   489                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   490                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   490                 "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
   491                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   491                 "PREFIX owl:<http://www.w3.org/2002/07/owl#> "
   529                          "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> ;     "
   529                          "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Languages> ;     "
   530                          "skos:prefLabel ?label . "
   530                          "skos:prefLabel ?label . "
   531                     "FILTER (lang(?label) = {lang}).  "
   531                     "FILTER (lang(?label) = {lang}).  "
   532                     "FILTER NOT EXISTS {{ [skos:narrower ?uri] }} "
   532                     "FILTER NOT EXISTS {{ [skos:narrower ?uri] }} "
   533                 "}} "
   533                 "}} "
   534                 "ORDER BY ?label"
   534                 "ORDER BY str(?label)"
   535             )
   535             )
   536         },
   536         },
   537         'projects': {
   537         'projects': {
   538             'url' : SPARQL_QUERY_ENDPOINT,
   538             'url' : SPARQL_QUERY_ENDPOINT,
   539             'filter' : (
   539             'filter' : (
   544                 "SELECT DISTINCT ?uri ?label ?acro "
   544                 "SELECT DISTINCT ?uri ?label ?acro "
   545                 "WHERE {{ "
   545                 "WHERE {{ "
   546                     "?uri a skos:Concept. "
   546                     "?uri a skos:Concept. "
   547                     "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> . "
   547                     "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> . "
   548                     "?uri skos:prefLabel ?label. "
   548                     "?uri skos:prefLabel ?label. "
   549                     "?uri skos:prefLabel ?lab. "
   549                     "?uri skos:prefLabel|skos:altLabel ?lab. "
   550                     "OPTIONAL {{ ?uri skos:altLabel ?acro }}. "
   550                     "OPTIONAL {{ ?uri skos:altLabel ?acro }}. "
   551                     "FILTER regex (str(?lab), ?reg, 'i'). "
   551                     "FILTER regex (str(?lab), ?reg, 'i'). "
   552                     "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
   552                     "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
   553                     "BIND (STRLEN(STR(?lab)) AS ?len) "
   553                     "BIND (STRLEN(STR(?lab)) AS ?len) "
   554                 "}} "
   554                 "}} "
   564                     "?uri a skos:Concept ; "
   564                     "?uri a skos:Concept ; "
   565                     "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> ;     "
   565                     "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Projects> ;     "
   566                     "skos:prefLabel ?label . "
   566                     "skos:prefLabel ?label . "
   567                     "OPTIONAL {{ ?uri skos:altLabel ?acro }} "
   567                     "OPTIONAL {{ ?uri skos:altLabel ?acro }} "
   568                 "}} "
   568                 "}} "
   569                 "ORDER BY ?label"
   569                 "ORDER BY str(?label)"
   570             )
   570             )
   571         },
   571         },
   572         'organizations': {
   572         'organizations': {
   573             'url' : SPARQL_QUERY_ENDPOINT,
   573             'url' : SPARQL_QUERY_ENDPOINT,
   574             'filter' : (
   574             'filter' : (
   579                 "SELECT DISTINCT ?uri ?label ?acro "
   579                 "SELECT DISTINCT ?uri ?label ?acro "
   580                 "WHERE {{ "
   580                 "WHERE {{ "
   581                     "?uri a skos:Concept. "
   581                     "?uri a skos:Concept. "
   582                     "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> . "
   582                     "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> . "
   583                     "?uri skos:prefLabel ?label. "
   583                     "?uri skos:prefLabel ?label. "
   584                     "?uri skos:prefLabel ?lab. "
   584                     "?uri skos:prefLabel|skos:altLabel ?lab. "
   585                     "OPTIONAL {{ ?uri skos:altLabel ?acro }}. "
   585                     "OPTIONAL {{ ?uri skos:altLabel ?acro }}. "
   586                     "FILTER regex (str(?lab), ?reg, 'i'). "
   586                     "FILTER regex (str(?lab), ?reg, 'i'). "
   587                     "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
   587                     "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
   588                     "BIND (STRLEN(STR(?lab)) AS ?len) "
   588                     "BIND (STRLEN(STR(?lab)) AS ?len) "
   589                 "}} "
   589                 "}} "
   599                     "?uri a skos:Concept ; "
   599                     "?uri a skos:Concept ; "
   600                          "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> ;     "
   600                          "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Organizations> ;     "
   601                          "skos:prefLabel ?label . "
   601                          "skos:prefLabel ?label . "
   602                     "OPTIONAL {{ ?uri skos:altLabel ?acro }} "
   602                     "OPTIONAL {{ ?uri skos:altLabel ?acro }} "
   603                 "}} "
   603                 "}} "
   604                 "ORDER BY ?label"
   604                 "ORDER BY str(?label)"
   605             )
   605             )
   606         },
   606         },
   607         'types': {
   607         'types': {
   608             'url' : SPARQL_QUERY_ENDPOINT,
   608             'url' : SPARQL_QUERY_ENDPOINT,
   609             'filter' : (
   609             'filter' : (
   636                          "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> ;     "
   636                          "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/DocumentType> ;     "
   637                          "skos:prefLabel ?label . "
   637                          "skos:prefLabel ?label . "
   638                     "FILTER (lang(?label) = {lang}).  "
   638                     "FILTER (lang(?label) = {lang}).  "
   639                     "FILTER NOT EXISTS {{ [skos:narrower ?uri] }} "
   639                     "FILTER NOT EXISTS {{ [skos:narrower ?uri] }} "
   640                 "}} "
   640                 "}} "
   641                 "ORDER BY ?label "
   641                 "ORDER BY str(?label)"
   642             )
   642             )
   643         },
   643         },
   644         'audiences': {
   644         'audiences': {
   645             'url' : SPARQL_QUERY_ENDPOINT,
   645             'url' : SPARQL_QUERY_ENDPOINT,
   646             "filter" : "",
   646             "filter" : "",