Skip to content

Commit

Permalink
Use GRAPH, not FROM in alphabetical letters query - much faster on Fu…
Browse files Browse the repository at this point in the history
…seki
  • Loading branch information
osma committed Dec 1, 2020
1 parent 91a30e5 commit 77f4b41
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions model/sparql/GenericSparql.php
Original file line number Diff line number Diff line change
Expand Up @@ -1337,15 +1337,17 @@ public function queryConceptsAlphabetical($letter, $lang, $limit = null, $offset
* @return string sparql query
*/
private function generateFirstCharactersQuery($lang, $classes) {
$fcl = $this->generateFromClause();
$gcl = $this->graphClause;
$classes = (isset($classes) && sizeof($classes) > 0) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
$values = $this->formatValues('?type', $classes, 'uri');
$query = <<<EOQ
SELECT DISTINCT (ucase(str(substr(?label, 1, 1))) as ?l) $fcl WHERE {
?c skos:prefLabel ?label .
?c a ?type
FILTER(langMatches(lang(?label), '$lang'))
$values
SELECT DISTINCT (ucase(str(substr(?label, 1, 1))) as ?l) WHERE {
$gcl {
?c skos:prefLabel ?label .
?c a ?type
FILTER(langMatches(lang(?label), '$lang'))
$values
}
}
EOQ;
return $query;
Expand Down

0 comments on commit 77f4b41

Please sign in to comment.