src/p4l/settings.py
changeset 163 c875b5418740
parent 161 216b3f9582aa
equal deleted inserted replaced
162:5fe64e9de88b 163:c875b5418740
   382                 "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
   382                 "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
   383                 "SELECT DISTINCT ?uri ?label "
   383                 "SELECT DISTINCT ?uri ?label "
   384                 "WHERE {{ "
   384                 "WHERE {{ "
   385                     "?uri a skos:Concept. "
   385                     "?uri a skos:Concept. "
   386                     "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> . "
   386                     "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> . "
   387                     "?uri skos:prefLabel ?label. "
   387                     "?uri skos:prefLabel ?prefLabel. "
   388                     "FILTER (lang(?label) = {lang}). "
   388                     "?uri skos:notation ?notation. "
   389                     "?uri skos:prefLabel ?lab. "
   389                     "FILTER (lang(?prefLabel) = {lang}). "
       
   390                     "BIND(CONCAT(?notation, ' - ', ?prefLabel) AS ?label). "
       
   391                     "?uri skos:prefLabel|skos:altLabel ?lab. "
   390                     "FILTER regex (str(?lab), ?reg, 'i'). "
   392                     "FILTER regex (str(?lab), ?reg, 'i'). "
   391                     "FILTER (lang (?lab) = {lang}). "
   393                     "FILTER (lang (?lab) = {lang} || lang(?lab) = ''). "
   392                     "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
   394                     "BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place). "
   393                     "BIND (STRLEN(STR(?lab)) AS ?len) "
   395                     "BIND (STRLEN(STR(?lab)) AS ?len) "
   394                 "}} "
   396                 "}} "
   395                 "ORDER BY ?place ?len ?lab"
   397                 "ORDER BY ?place ?len ?lab"
   396             ),
   398             ),
   401                 "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
   403                 "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
   402                 "SELECT DISTINCT ?uri ?label ?type "
   404                 "SELECT DISTINCT ?uri ?label ?type "
   403                 "WHERE {{ "
   405                 "WHERE {{ "
   404                     "?uri a skos:Collection ; "
   406                     "?uri a skos:Collection ; "
   405                          "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> ; "    
   407                          "skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> ; "    
   406                          "skos:prefLabel|rdfs:label ?label ; "
   408                          "skos:prefLabel ?prefLabel ; "
   407                          "rdf:type ?type . "
   409                          "skos:notation ?notation ; "
   408                     "FILTER (lang(?label) = {lang}). " 
   410                          "rdf:type ?type . "                       
   409                     "FILTER NOT EXISTS {{ [skos:member ?uri] }} "
   411                     "FILTER (lang(?prefLabel) = {lang}). " 
       
   412                     "FILTER NOT EXISTS {{ [skos:member ?uri] }}. "
       
   413                     "BIND(CONCAT(?notation, ' - ', ?prefLabel) AS ?label)"
   410                 "}} "
   414                 "}} "
   411                 "ORDER BY str(?label)"
   415                 "ORDER BY str(?label)"
   412             ),
   416             ),
   413             'childs' : (
   417             'childs' : (
   414                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   418                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   419                 "WHERE {{ "
   423                 "WHERE {{ "
   420                   "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> . "
   424                   "?uri skos:inScheme <http://www.iiep.unesco.org/plan4learning/scheme/Themes> . "
   421                   "{{ ?uri a ?type "
   425                   "{{ ?uri a ?type "
   422                     "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
   426                     "FILTER (?type = skos:Collection || ?type = skos:Concept) }}. "
   423                   "?root skos:narrower|skos:member ?uri. "
   427                   "?root skos:narrower|skos:member ?uri. "
   424                   "?uri skos:prefLabel|rdfs:label ?label. "
   428                   "?uri skos:prefLabel ?prefLabel. "
   425                   "FILTER (lang(?label) = {lang}). "
   429                   "?uri skos:notation ?notation ; "
       
   430                       "FILTER (lang(?prefLabel) = {lang}). "
       
   431                   "BIND(CONCAT(?notation, ' - ', ?prefLabel) AS ?label)"
   426                 "}} "
   432                 "}} "
   427                 "ORDER BY str(?label)"
   433                 "ORDER BY str(?label)"
   428             ),
   434             ),
   429             'child-count' : (
   435             'child-count' : (
   430                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "
   436                 "PREFIX skos:<http://www.w3.org/2004/02/skos/core#> "