@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | |
263 | 263 | /** |
264 | 264 | * Used to generate the BIND + FILTER part related to the languages |
265 | - * @param $varnameInput the name of the variable from which to extract the language |
|
266 | - * @param $varnameOutput the name of the variable that will contain the language tag |
|
265 | + * @param string $varnameInput the name of the variable from which to extract the language |
|
266 | + * @param string $varnameOutput the name of the variable that will contain the language tag |
|
267 | 267 | * @param array $values languages to use in the FILTER |
268 | 268 | * @return string part of the sparql query dealing wit the languages |
269 | 269 | */ |
@@ -312,6 +312,7 @@ discard block |
||
312 | 312 | /** |
313 | 313 | * Counts the number of concepts in a easyRDF graph with a specific language. |
314 | 314 | * @param array $langs Languages to query for |
315 | + * @param string[] $classes |
|
315 | 316 | * @return Array containing count of concepts for each language and property. |
316 | 317 | */ |
317 | 318 | public function countLangConcepts($langs, $classes = null) { |
@@ -496,7 +497,7 @@ discard block |
||
496 | 497 | * Returns information (as a graph) for one or more concept URIs |
497 | 498 | * @param mixed $uris concept URI (string) or array of URIs |
498 | 499 | * @param string|null $arrayClass the URI for thesaurus array class, or null if not used |
499 | - * @param \Vocabulary[]|null $vocabs vocabularies to target |
|
500 | + * @param Vocabulary[] $vocabs vocabularies to target |
|
500 | 501 | * @return \EasyRdf\Graph |
501 | 502 | */ |
502 | 503 | public function queryConceptInfoGraph($uris, $arrayClass = null, $vocabs = array()) { |
@@ -512,7 +513,7 @@ discard block |
||
512 | 513 | |
513 | 514 | /** |
514 | 515 | * Returns information (as an array of Concept objects) for one or more concept URIs |
515 | - * @param mixed $uris concept URI (string) or array of URIs |
|
516 | + * @param string $uris concept URI (string) or array of URIs |
|
516 | 517 | * @param string|null $arrayClass the URI for thesaurus array class, or null if not used |
517 | 518 | * @param \Vocabulary[] $vocabs vocabularies to target |
518 | 519 | * @param string|null $clang content language |
@@ -727,7 +728,7 @@ discard block |
||
727 | 728 | |
728 | 729 | /** |
729 | 730 | * Generate a VALUES clause for limiting the targeted graphs. |
730 | - * @param Vocabulary[]|null $vocabs array of Vocabulary objects to target |
|
731 | + * @param Vocabulary[] $vocabs array of Vocabulary objects to target |
|
731 | 732 | * @return string VALUES clause, or "" if not necessary to limit |
732 | 733 | */ |
733 | 734 | protected function formatValuesGraph($vocabs) { |
@@ -907,6 +908,7 @@ discard block |
||
907 | 908 | * @param string $searchLang language code used for matching labels (null means any language) |
908 | 909 | * @param string[] $props properties to target e.g. array('skos:prefLabel','skos:altLabel') |
909 | 910 | * @param boolean $unique restrict results to unique concepts (default: false) |
911 | + * @param string $filterGraph |
|
910 | 912 | * @return string sparql query |
911 | 913 | */ |
912 | 914 | protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph) |
@@ -1181,6 +1183,7 @@ discard block |
||
1181 | 1183 | /** |
1182 | 1184 | * Generates sparql query clauses used for creating the alphabetical index. |
1183 | 1185 | * @param string $letter the letter (or special class) to search for |
1186 | + * @param string $lang |
|
1184 | 1187 | * @return array of sparql query clause strings |
1185 | 1188 | */ |
1186 | 1189 | private function formatFilterConditions($letter, $lang) { |
@@ -1348,6 +1351,7 @@ discard block |
||
1348 | 1351 | /** |
1349 | 1352 | * Query for the first characters (letter or otherwise) of the labels in the particular language. |
1350 | 1353 | * @param string $lang language |
1354 | + * @param string[] $classes |
|
1351 | 1355 | * @return array array of characters |
1352 | 1356 | */ |
1353 | 1357 | public function queryFirstCharacters($lang, $classes = null) { |
@@ -1670,7 +1674,7 @@ discard block |
||
1670 | 1674 | /** |
1671 | 1675 | * Query a single transitive property of a concept. |
1672 | 1676 | * @param string $uri |
1673 | - * @param array $props the property/properties. |
|
1677 | + * @param string[] $props the property/properties. |
|
1674 | 1678 | * @param string $lang |
1675 | 1679 | * @param string $fallbacklang language to use if label is not available in the preferred language |
1676 | 1680 | * @param integer $limit |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @param string $query |
66 | 66 | * @return string |
67 | - */ |
|
67 | + */ |
|
68 | 68 | protected function generateQueryPrefixes($query) |
69 | 69 | { |
70 | 70 | // Check for undefined prefixes |
@@ -261,25 +261,25 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
264 | - * Used to generate the BIND + FILTER part related to the languages |
|
265 | - * @param $varnameInput the name of the variable from which to extract the language |
|
266 | - * @param $varnameOutput the name of the variable that will contain the language tag |
|
267 | - * @param array $values languages to use in the FILTER |
|
268 | - * @return string part of the sparql query dealing wit the languages |
|
269 | - */ |
|
264 | + * Used to generate the BIND + FILTER part related to the languages |
|
265 | + * @param $varnameInput the name of the variable from which to extract the language |
|
266 | + * @param $varnameOutput the name of the variable that will contain the language tag |
|
267 | + * @param array $values languages to use in the FILTER |
|
268 | + * @return string part of the sparql query dealing wit the languages |
|
269 | + */ |
|
270 | 270 | protected function formatValuesFilterAndBind($varnameInput, $varnameOutput, $values) { |
271 | - $queryPart = "BIND(lang($varnameInput) AS $varnameOutput)"; |
|
272 | - $first = true; |
|
271 | + $queryPart = "BIND(lang($varnameInput) AS $varnameOutput)"; |
|
272 | + $first = true; |
|
273 | 273 | |
274 | - $queryPart .= "FILTER(" ; |
|
274 | + $queryPart .= "FILTER(" ; |
|
275 | 275 | foreach ($values as $val) { |
276 | 276 | if($first != true){ |
277 | 277 | $queryPart .= ' || '; |
278 | 278 | } |
279 | - $first = false; |
|
279 | + $first = false; |
|
280 | 280 | $queryPart .= "$varnameOutput = '$val'"; |
281 | 281 | } |
282 | - $queryPart .= ")"; |
|
282 | + $queryPart .= ")"; |
|
283 | 283 | |
284 | 284 | return $queryPart; |
285 | 285 | } |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | |
1833 | 1833 | /** |
1834 | 1834 | * Generates a sparql query for finding the hierarchy for a concept. |
1835 | - * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal. |
|
1835 | + * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal. |
|
1836 | 1836 | * @param string $uri concept uri. |
1837 | 1837 | * @param string $lang |
1838 | 1838 | * @param string $fallback language to use if label is not available in the preferred language |
@@ -1909,10 +1909,10 @@ discard block |
||
1909 | 1909 | $ret[$uri]['exact'] = $row->exact->getUri(); |
1910 | 1910 | } |
1911 | 1911 | if (isset($row->tops)) { |
1912 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
1913 | - // sort to garantee an alphabetical ordering of the URI |
|
1914 | - sort($topConceptsList); |
|
1915 | - $ret[$uri]['tops'] = $topConceptsList; |
|
1912 | + $topConceptsList=explode(" ", $row->tops->getValue()); |
|
1913 | + // sort to garantee an alphabetical ordering of the URI |
|
1914 | + sort($topConceptsList); |
|
1915 | + $ret[$uri]['tops'] = $topConceptsList; |
|
1916 | 1916 | } |
1917 | 1917 | if (isset($row->children)) { |
1918 | 1918 | if (!isset($ret[$uri]['narrower'])) { |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | protected function query($query) { |
88 | 88 | $queryId = sprintf("%05d", rand(0, 99999)); |
89 | 89 | $logger = $this->model->getLogger(); |
90 | - $logger->info("[qid $queryId] SPARQL query:\n" . $this->generateQueryPrefixes($query) . "\n$query\n"); |
|
90 | + $logger->info("[qid $queryId] SPARQL query:\n".$this->generateQueryPrefixes($query)."\n$query\n"); |
|
91 | 91 | $starttime = microtime(true); |
92 | 92 | $result = $this->client->query($query); |
93 | 93 | $elapsed = intval(round((microtime(true) - $starttime) * 1000)); |
94 | - if(method_exists($result, 'numRows')) { |
|
94 | + if (method_exists($result, 'numRows')) { |
|
95 | 95 | $numRows = $result->numRows(); |
96 | 96 | $logger->info("[qid $queryId] result: $numRows rows returned in $elapsed ms"); |
97 | 97 | } else { // graph result |
@@ -107,20 +107,20 @@ discard block |
||
107 | 107 | * @param Vocabulary[]|null $vocabs |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - protected function generateFromClause($vocabs=null) { |
|
110 | + protected function generateFromClause($vocabs = null) { |
|
111 | 111 | $graphs = array(); |
112 | 112 | $clause = ''; |
113 | 113 | if (!$vocabs) { |
114 | 114 | return $this->graph !== '?graph' && $this->graph !== NULL ? "FROM <$this->graph>" : ''; |
115 | 115 | } |
116 | - foreach($vocabs as $vocab) { |
|
116 | + foreach ($vocabs as $vocab) { |
|
117 | 117 | $graph = $vocab->getGraph(); |
118 | 118 | if (!in_array($graph, $graphs)) { |
119 | 119 | array_push($graphs, $graph); |
120 | 120 | } |
121 | 121 | } |
122 | 122 | foreach ($graphs as $graph) { |
123 | - if($graph !== NULL) |
|
123 | + if ($graph !== NULL) |
|
124 | 124 | $clause .= "FROM NAMED <$graph> "; |
125 | 125 | } |
126 | 126 | return $clause; |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | $queryPart = "BIND(lang($varnameInput) AS $varnameOutput)"; |
272 | 272 | $first = true; |
273 | 273 | |
274 | - $queryPart .= "FILTER(" ; |
|
274 | + $queryPart .= "FILTER("; |
|
275 | 275 | foreach ($values as $val) { |
276 | - if($first != true){ |
|
276 | + if ($first != true) { |
|
277 | 277 | $queryPart .= ' || '; |
278 | 278 | } |
279 | 279 | $first = false; |
@@ -687,9 +687,9 @@ discard block |
||
687 | 687 | $conceptscheme['title'] = $row->title->getValue(); |
688 | 688 | } |
689 | 689 | // add dct:subject and their labels in the result |
690 | - if(isset($row->domain) && isset($row->domainLabel)){ |
|
691 | - $conceptscheme['subject']['uri']=$row->domain->getURI(); |
|
692 | - $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue(); |
|
690 | + if (isset($row->domain) && isset($row->domainLabel)) { |
|
691 | + $conceptscheme['subject']['uri'] = $row->domain->getURI(); |
|
692 | + $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue(); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | $ret[$row->cs->getURI()] = $conceptscheme; |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | foreach ($graphs as $graph) { |
753 | 753 | $values[] = "<$graph>"; |
754 | 754 | } |
755 | - return "FILTER (?graph IN (" . implode(',', $values) . "))"; |
|
755 | + return "FILTER (?graph IN (".implode(',', $values)."))"; |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | /** |
@@ -762,16 +762,16 @@ discard block |
||
762 | 762 | * @return string sparql query clauses |
763 | 763 | */ |
764 | 764 | protected function formatLimitAndOffset($limit, $offset) { |
765 | - $limit = ($limit) ? 'LIMIT ' . $limit : ''; |
|
766 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
765 | + $limit = ($limit) ? 'LIMIT '.$limit : ''; |
|
766 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
767 | 767 | // eliminating whitespace and line changes when the conditions aren't needed. |
768 | 768 | $limitandoffset = ''; |
769 | 769 | if ($limit && $offset) { |
770 | - $limitandoffset = "\n" . $limit . "\n" . $offset; |
|
770 | + $limitandoffset = "\n".$limit."\n".$offset; |
|
771 | 771 | } elseif ($limit) { |
772 | - $limitandoffset = "\n" . $limit; |
|
772 | + $limitandoffset = "\n".$limit; |
|
773 | 773 | } elseif ($offset) { |
774 | - $limitandoffset = "\n" . $offset; |
|
774 | + $limitandoffset = "\n".$offset; |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | return $limitandoffset; |
@@ -923,14 +923,14 @@ discard block |
||
923 | 923 | // if search language and UI/display language differ, must also consider case where there is no prefLabel in |
924 | 924 | // the display language; in that case, should use the label with the same language as the matched label |
925 | 925 | $labelcondFallback = ($searchLang != $lang) ? |
926 | - "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" . |
|
926 | + "OPTIONAL { # in case previous OPTIONAL block gives no labels\n". |
|
927 | 927 | "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : ""; |
928 | 928 | |
929 | 929 | // Including the labels if there is no query term given. |
930 | 930 | if ($rawterm === '') { |
931 | 931 | $labelClause = "?s skos:prefLabel ?label ."; |
932 | - $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . ""; |
|
933 | - return $labelClause . " BIND(?label AS ?match)"; |
|
932 | + $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause.""; |
|
933 | + return $labelClause." BIND(?label AS ?match)"; |
|
934 | 934 | } |
935 | 935 | |
936 | 936 | /* |
@@ -994,20 +994,20 @@ discard block |
||
994 | 994 | $schemecond = ''; |
995 | 995 | if (!empty($schemes)) { |
996 | 996 | $conditions = array(); |
997 | - foreach($schemes as $scheme) { |
|
997 | + foreach ($schemes as $scheme) { |
|
998 | 998 | $conditions[] = "{?s skos:inScheme <$scheme>}"; |
999 | 999 | } |
1000 | - $schemecond = '{'.implode(" UNION ",$conditions).'}'; |
|
1000 | + $schemecond = '{'.implode(" UNION ", $conditions).'}'; |
|
1001 | 1001 | } |
1002 | - $filterDeprecated=""; |
|
1002 | + $filterDeprecated = ""; |
|
1003 | 1003 | //show or hide deprecated concepts |
1004 | - if(!$showDeprecated){ |
|
1005 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1004 | + if (!$showDeprecated) { |
|
1005 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1006 | 1006 | } |
1007 | 1007 | // extra conditions for parent and group, if specified |
1008 | - $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : ""; |
|
1009 | - $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : ""; |
|
1010 | - $pgcond = $parentcond . $groupcond; |
|
1008 | + $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : ""; |
|
1009 | + $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : ""; |
|
1010 | + $pgcond = $parentcond.$groupcond; |
|
1011 | 1011 | |
1012 | 1012 | $orderextra = $this->isDefaultEndpoint() ? $this->graph : ''; |
1013 | 1013 | |
@@ -1080,9 +1080,9 @@ discard block |
||
1080 | 1080 | $hit['type'][] = $this->shortenUri($typeuri); |
1081 | 1081 | } |
1082 | 1082 | |
1083 | - if(!empty($fields)) { |
|
1083 | + if (!empty($fields)) { |
|
1084 | 1084 | foreach ($fields as $prop) { |
1085 | - $propname = $prop . 's'; |
|
1085 | + $propname = $prop.'s'; |
|
1086 | 1086 | if (isset($row->$propname)) { |
1087 | 1087 | foreach (explode("\n", $row->$propname->getValue()) as $line) { |
1088 | 1088 | $rdata = str_getcsv($line, ',', '"', '"'); |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | $propvals = $rdata[2]; |
1098 | 1098 | } |
1099 | 1099 | |
1100 | - $hit['skos:' . $prop][] = $propvals; |
|
1100 | + $hit['skos:'.$prop][] = $propvals; |
|
1101 | 1101 | } |
1102 | 1102 | } |
1103 | 1103 | } |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | * @return array query result object |
1174 | 1174 | */ |
1175 | 1175 | public function queryConcepts($vocabs, $fields = null, $unique = false, $params, $showDeprecated = false) { |
1176 | - $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated); |
|
1176 | + $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated); |
|
1177 | 1177 | $results = $this->query($query); |
1178 | 1178 | return $this->transformConceptSearchResults($results, $vocabs, $fields); |
1179 | 1179 | } |
@@ -1227,9 +1227,9 @@ discard block |
||
1227 | 1227 | $conditions = $this->formatFilterConditions($letter, $lang); |
1228 | 1228 | $filtercondLabel = $conditions['filterpref']; |
1229 | 1229 | $filtercondALabel = $conditions['filteralt']; |
1230 | - $filterDeprecated=""; |
|
1231 | - if(!$showDeprecated){ |
|
1232 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1230 | + $filterDeprecated = ""; |
|
1231 | + if (!$showDeprecated) { |
|
1232 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1233 | 1233 | } |
1234 | 1234 | $query = <<<EOQ |
1235 | 1235 | SELECT DISTINCT ?s ?label ?alabel $fcl |
@@ -1305,8 +1305,8 @@ discard block |
||
1305 | 1305 | * @param array $classes |
1306 | 1306 | * @param boolean $showDeprecated whether to include deprecated concepts in the result (default: false) |
1307 | 1307 | */ |
1308 | - public function queryConceptsAlphabetical($letter, $lang, $limit = null, $offset = null, $classes = null,$showDeprecated = false) { |
|
1309 | - $query = $this->generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes,$showDeprecated); |
|
1308 | + public function queryConceptsAlphabetical($letter, $lang, $limit = null, $offset = null, $classes = null, $showDeprecated = false) { |
|
1309 | + $query = $this->generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes, $showDeprecated); |
|
1310 | 1310 | $results = $this->query($query); |
1311 | 1311 | return $this->transformAlphabeticalListResults($results); |
1312 | 1312 | } |
@@ -1640,7 +1640,7 @@ discard block |
||
1640 | 1640 | if (!isset($row->label) || $row->label->getLang() === $lang) { |
1641 | 1641 | $ret[$row->object->getUri()] = $val; |
1642 | 1642 | } elseif ($row->label->getLang() === $fallbacklang) { |
1643 | - $val['label'] .= ' (' . $row->label->getLang() . ')'; |
|
1643 | + $val['label'] .= ' ('.$row->label->getLang().')'; |
|
1644 | 1644 | $ret[$row->object->getUri()] = $val; |
1645 | 1645 | } |
1646 | 1646 | } |
@@ -1736,10 +1736,10 @@ discard block |
||
1736 | 1736 | |
1737 | 1737 | $label = null; |
1738 | 1738 | if (isset($row->label)) { |
1739 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
1739 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
1740 | 1740 | $label = $row->label->getValue(); |
1741 | 1741 | } else { |
1742 | - $label = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
1742 | + $label = $row->label->getValue()." (".$row->label->getLang().")"; |
|
1743 | 1743 | } |
1744 | 1744 | |
1745 | 1745 | } |
@@ -1815,8 +1815,8 @@ discard block |
||
1815 | 1815 | foreach ($result as $row) { |
1816 | 1816 | if (isset($row->top) && isset($row->label)) { |
1817 | 1817 | $label = $row->label->getValue(); |
1818 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
1819 | - $label .= ' (' . $row->label->getLang() . ')'; |
|
1818 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
1819 | + $label .= ' ('.$row->label->getLang().')'; |
|
1820 | 1820 | } |
1821 | 1821 | $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN)); |
1822 | 1822 | if (isset($row->notation)) { |
@@ -1909,7 +1909,7 @@ discard block |
||
1909 | 1909 | $ret[$uri]['exact'] = $row->exact->getUri(); |
1910 | 1910 | } |
1911 | 1911 | if (isset($row->tops)) { |
1912 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
1912 | + $topConceptsList = explode(" ", $row->tops->getValue()); |
|
1913 | 1913 | // sort to garantee an alphabetical ordering of the URI |
1914 | 1914 | sort($topConceptsList); |
1915 | 1915 | $ret[$uri]['tops'] = $topConceptsList; |
@@ -1922,8 +1922,8 @@ discard block |
||
1922 | 1922 | $label = null; |
1923 | 1923 | if (isset($row->childlabel)) { |
1924 | 1924 | $label = $row->childlabel->getValue(); |
1925 | - if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) { |
|
1926 | - $label .= " (" . $row->childlabel->getLang() . ")"; |
|
1925 | + if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) { |
|
1926 | + $label .= " (".$row->childlabel->getLang().")"; |
|
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | } |
@@ -1944,8 +1944,8 @@ discard block |
||
1944 | 1944 | } |
1945 | 1945 | if (isset($row->label)) { |
1946 | 1946 | $preflabel = $row->label->getValue(); |
1947 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
1948 | - $preflabel .= ' (' . $row->label->getLang() . ')'; |
|
1947 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
1948 | + $preflabel .= ' ('.$row->label->getLang().')'; |
|
1949 | 1949 | } |
1950 | 1950 | |
1951 | 1951 | $ret[$uri]['prefLabel'] = $preflabel; |
@@ -2066,9 +2066,9 @@ discard block |
||
2066 | 2066 | */ |
2067 | 2067 | private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) { |
2068 | 2068 | $fcl = $this->generateFromClause(); |
2069 | - $filterDeprecated=""; |
|
2070 | - if(!$showDeprecated){ |
|
2071 | - $filterDeprecated=" FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2069 | + $filterDeprecated = ""; |
|
2070 | + if (!$showDeprecated) { |
|
2071 | + $filterDeprecated = " FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2072 | 2072 | } |
2073 | 2073 | $query = <<<EOQ |
2074 | 2074 | SELECT ?conc ?super ?label ?members ?type ?notation $fcl |
@@ -2107,10 +2107,10 @@ discard block |
||
2107 | 2107 | 'type' => array($row->type->shorten()), |
2108 | 2108 | ); |
2109 | 2109 | if (isset($row->label)) { |
2110 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
2110 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
2111 | 2111 | $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue(); |
2112 | 2112 | } else { |
2113 | - $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
2113 | + $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")"; |
|
2114 | 2114 | } |
2115 | 2115 | |
2116 | 2116 | } |
@@ -2138,8 +2138,8 @@ discard block |
||
2138 | 2138 | * @param boolean $showDeprecated whether to include deprecated concepts in search results |
2139 | 2139 | * @return array Result array with concept URI as key and concept label as value |
2140 | 2140 | */ |
2141 | - public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) { |
|
2142 | - $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated); |
|
2141 | + public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) { |
|
2142 | + $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated); |
|
2143 | 2143 | $result = $this->query($query); |
2144 | 2144 | return $this->transformConceptGroupContentsResults($result, $lang); |
2145 | 2145 | } |
@@ -2152,7 +2152,7 @@ discard block |
||
2152 | 2152 | */ |
2153 | 2153 | private function generateChangeListQuery($lang, $offset, $prop) { |
2154 | 2154 | $fcl = $this->generateFromClause(); |
2155 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
2155 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
2156 | 2156 | |
2157 | 2157 | $query = <<<EOQ |
2158 | 2158 | SELECT DISTINCT ?concept ?date ?label $fcl |