Skip to content

Commit

Permalink
Merge branch 'v1.8-maintenance' of https://github.com/NatLibFi/Skosmos
Browse files Browse the repository at this point in the history
…into v1.8-maintenance
  • Loading branch information
henriyli committed Sep 29, 2016
2 parents 8a78848 + c3c8d16 commit 1ebca2a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
5 changes: 2 additions & 3 deletions model/sparql/GenericSparql.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function countConcepts($lang = null, $array = null, $group = null) {
* @return string sparql query
*/
private function generateCountLangConceptsQuery($langs, $classes, $props) {
$fcl = $this->generateFromClause();
$gcl = $this->graphClause;
$classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');

$values = $this->formatValues('?type', $classes, 'uri');
Expand All @@ -203,9 +203,8 @@ private function generateCountLangConceptsQuery($langs, $classes, $props) {
$query = <<<EOQ
SELECT ?lang ?prop
(COUNT(?label) as ?count)
$fcl
WHERE {
{
$gcl {
?conc a ?type .
?conc ?prop ?label .
FILTER (langMatches(lang(?label), ?lang))
Expand Down
41 changes: 21 additions & 20 deletions model/sparql/JenaTextSparql.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function generateAlphabeticalListQuery($letter, $lang, $limit = null, $of
return parent::generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes);
}

$fcl = $this->generateFromClause();
$gc = $this->graphClause;
$classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
$values = $this->formatValues('?type', $classes, 'uri');
$limitandoffset = $this->formatLimitAndOffset($limit, $offset);
Expand All @@ -101,28 +101,29 @@ public function generateAlphabeticalListQuery($letter, $lang, $limit = null, $of
$textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $lang);

$query = <<<EOQ
SELECT DISTINCT ?s ?label ?alabel $fcl
SELECT DISTINCT ?s ?label ?alabel
WHERE {
{
$textcondPref
FILTER(STRSTARTS(LCASE(STR(?match)), '$lcletter'))
FILTER EXISTS { ?s skos:prefLabel ?match }
BIND(?match as ?label)
}
UNION
{
$textcondAlt
FILTER(STRSTARTS(LCASE(STR(?match)), '$lcletter'))
FILTER EXISTS { ?s skos:altLabel ?match }
BIND(?match as ?alabel)
$gc {
{
?s skos:prefLabel ?label .
FILTER (langMatches(LANG(?label), '$lang'))
$textcondPref
FILTER(STRSTARTS(LCASE(STR(?match)), '$lcletter'))
FILTER EXISTS { ?s skos:prefLabel ?match }
BIND(?match as ?label)
}
}
?s a ?type .
FILTER NOT EXISTS { ?s owl:deprecated true }
$values
UNION
{
$textcondAlt
FILTER(STRSTARTS(LCASE(STR(?match)), '$lcletter'))
FILTER EXISTS { ?s skos:altLabel ?match }
BIND(?match as ?alabel)
{
?s skos:prefLabel ?label .
FILTER (langMatches(LANG(?label), '$lang'))
}
}
?s a ?type .
FILTER NOT EXISTS { ?s owl:deprecated true }
} $values
}
ORDER BY LCASE(?match) $limitandoffset
EOQ;
Expand Down

0 comments on commit 1ebca2a

Please sign in to comment.