src/p4l/settings.py
changeset 43 829d9d4111da
parent 39 33a413910b75
child 45 9dd14a51a2bb
equal deleted inserted replaced
42:ad27066048ce 43:829d9d4111da
   171     }
   171     }
   172 }
   172 }
   173 
   173 
   174 NB_RECORDS_BY_PAGE = 20
   174 NB_RECORDS_BY_PAGE = 20
   175 SPARQL_QUERY_ENDPOINT = "http://localhost:8080/openrdf-sesame/repositories/plan4learning"
   175 SPARQL_QUERY_ENDPOINT = "http://localhost:8080/openrdf-sesame/repositories/plan4learning"
       
   176 SPARQL_SUBJECT_QUERIES = {
       
   177 "filter" : """
       
   178 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   179 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   180 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   181 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   182 SELECT DISTINCT ?uri ?label
       
   183 WHERE {
       
   184     ?uri a skos:Concept.
       
   185     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
       
   186     ?uri skos:prefLabel ?label.
       
   187     FILTER (lang(?label) = ?language).
       
   188     ?uri skos:prefLabel ?lab.
       
   189     FILTER regex (str(?lab), ?reg, 'i').
       
   190     FILTER (lang (?lab) = ?language).
       
   191     BIND (STRLEN(STRBEFORE (str(?lab), ?reg)) AS ?place).
       
   192     BIND (STRLEN(STR(?lab)) AS ?len)
       
   193 }
       
   194 ORDER BY ?place ?len ?lab
       
   195 """,
       
   196 "root" : """
       
   197 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   198 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   199 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   200 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   201 SELECT DISTINCT ?uri ?label
       
   202 WHERE {
       
   203     ?uri a skos:Collection ;
       
   204     skos:inScheme <http://skos.um.es/unescothes/CS000> ;    
       
   205     skos:prefLabel|rdfs:label ?label .
       
   206     FILTER (lang(?label) = ?language). 
       
   207     FILTER NOT EXISTS { [skos:member ?uri] }
       
   208 }
       
   209 """,
       
   210 "childs" : """
       
   211 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   212 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   213 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   214 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   215 SELECT DISTINCT ?uri ?label
       
   216 WHERE {
       
   217   ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
       
   218   { ?uri a ?type
       
   219     FILTER (?type = skos:Collection || ?type = skos:Concept) }.
       
   220   ?root skos:narrower|skos:member ?uri.
       
   221   ?uri skos:prefLabel|rdfs:label ?label.
       
   222   FILTER (lang(?label) = ?language).
       
   223 }
       
   224 """,
       
   225 "child-count" : """
       
   226 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
       
   227 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       
   228 PREFIX owl:<http://www.w3.org/2002/07/owl#>
       
   229 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
       
   230 SELECT (COUNT(?uri) as ?nb)
       
   231 WHERE {
       
   232     ?uri skos:inScheme <http://skos.um.es/unescothes/CS000> .
       
   233     ?root skos:narrower|skos:member ?uri.
       
   234 }
       
   235 """
       
   236 }
   176 
   237 
   177 REST_FRAMEWORK = {
   238 REST_FRAMEWORK = {
   178     # Use hyperlinked styles by default.
   239     # Use hyperlinked styles by default.
   179     # Only used if the `serializer_class` attribute is not set on a view.
   240     # Only used if the `serializer_class` attribute is not set on a view.
   180     'DEFAULT_MODEL_SERIALIZER_CLASS':
   241     'DEFAULT_MODEL_SERIALIZER_CLASS':