@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } elseif ($parts[1] == 'data') { |
38 | 38 | $controller->data($request); |
39 | 39 | } elseif (sizeof($parts) == 2) { |
40 | - header("Location: " . $parts[1] . "/"); |
|
40 | + header("Location: ".$parts[1]."/"); |
|
41 | 41 | } else { |
42 | 42 | $vocab = $parts[1]; |
43 | 43 | try { |
@@ -93,5 +93,5 @@ discard block |
||
93 | 93 | } |
94 | 94 | } catch (Exception $e) { |
95 | 95 | header("HTTP/1.0 500 Internal Server Error"); |
96 | - echo('ERROR: ' . $e->getMessage()); |
|
96 | + echo('ERROR: '.$e->getMessage()); |
|
97 | 97 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->translator = new Translator($langcode); |
41 | 41 | } |
42 | 42 | $this->translator->addLoader('po', new PoFileLoader()); |
43 | - $this->translator->addResource('po', __DIR__.'/../../resource/translations/skosmos_' . $langcode . '.po', $langcode); |
|
43 | + $this->translator->addResource('po', __DIR__.'/../../resource/translations/skosmos_'.$langcode.'.po', $langcode); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | $vocabs = $params->getVocabs(); |
276 | - $showDeprecated=false; |
|
276 | + $showDeprecated = false; |
|
277 | 277 | if (sizeof($vocabs) === 1) { // search within vocabulary |
278 | 278 | $voc = $vocabs[0]; |
279 | 279 | $sparql = $voc->getSparql(); |
280 | - $showDeprecated=$voc->getConfig()->getShowDeprecated(); |
|
280 | + $showDeprecated = $voc->getConfig()->getShowDeprecated(); |
|
281 | 281 | } else { // multi-vocabulary or global search |
282 | 282 | $voc = null; |
283 | 283 | $sparql = $this->getDefaultSparql(); |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | public function getVocabularyCategories() |
439 | 439 | { |
440 | 440 | $cats = $this->globalConfig->getGraph()->allOfType('skos:Concept'); |
441 | - if(empty($cats)) { |
|
441 | + if (empty($cats)) { |
|
442 | 442 | return array(new VocabularyCategory($this, null)); |
443 | 443 | } |
444 | 444 | |
@@ -519,9 +519,9 @@ discard block |
||
519 | 519 | } |
520 | 520 | |
521 | 521 | // if there are multiple vocabularies and one is the preferred vocabulary, return it |
522 | - if($preferredVocabId != null) { |
|
522 | + if ($preferredVocabId != null) { |
|
523 | 523 | foreach ($vocabs as $vocab) { |
524 | - if($vocab->getId() == $preferredVocabId) { |
|
524 | + if ($vocab->getId() == $preferredVocabId) { |
|
525 | 525 | try { |
526 | 526 | // double check that a label exists in the preferred vocabulary |
527 | 527 | if ($vocab->getConceptLabel($uri, null) !== null) { |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | } |
533 | 533 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
534 | 534 | if ($this->getConfig()->getLogCaughtExceptions()) { |
535 | - error_log('Caught exception: ' . $e->getMessage()); |
|
535 | + error_log('Caught exception: '.$e->getMessage()); |
|
536 | 536 | } |
537 | 537 | break; |
538 | 538 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | } |
549 | 549 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
550 | 550 | if ($this->getConfig()->getLogCaughtExceptions()) { |
551 | - error_log('Caught exception: ' . $e->getMessage()); |
|
551 | + error_log('Caught exception: '.$e->getMessage()); |
|
552 | 552 | } |
553 | 553 | break; |
554 | 554 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | // using apc cache for the resource if available |
622 | 622 | if ($this->globalConfig->getCache()->isAvailable()) { |
623 | 623 | // @codeCoverageIgnoreStart |
624 | - $key = 'fetch: ' . $uri; |
|
624 | + $key = 'fetch: '.$uri; |
|
625 | 625 | $resource = $this->globalConfig->getCache()->fetch($key); |
626 | 626 | if ($resource === null || $resource === false) { // was not found in cache, or previous request failed |
627 | 627 | $resource = $this->resolver->resolve($uri, $this->getConfig()->getHttpTimeout()); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | */ |
643 | 643 | public function getSparqlImplementation($dialect, $endpoint, $graph) |
644 | 644 | { |
645 | - $classname = $dialect . "Sparql"; |
|
645 | + $classname = $dialect."Sparql"; |
|
646 | 646 | |
647 | 647 | return new $classname($endpoint, $graph, $this); |
648 | 648 | } |
@@ -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 |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | return $query; |
1017 | 1017 | } |
1018 | 1018 | /** |
1019 | - * This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses |
|
1019 | + * This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses |
|
1020 | 1020 | * @param string $lang |
1021 | 1021 | * @return string formatted language clause |
1022 | 1022 | */ |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | { |
89 | 89 | $queryId = sprintf("%05d", rand(0, 99999)); |
90 | 90 | $logger = $this->model->getLogger(); |
91 | - $logger->info("[qid $queryId] SPARQL query:\n" . $this->generateQueryPrefixes($query) . "\n$query\n"); |
|
91 | + $logger->info("[qid $queryId] SPARQL query:\n".$this->generateQueryPrefixes($query)."\n$query\n"); |
|
92 | 92 | $starttime = microtime(true); |
93 | 93 | $result = $this->client->query($query); |
94 | 94 | $elapsed = intval(round((microtime(true) - $starttime) * 1000)); |
95 | - if(method_exists($result, 'numRows')) { |
|
95 | + if (method_exists($result, 'numRows')) { |
|
96 | 96 | $numRows = $result->numRows(); |
97 | 97 | $logger->info("[qid $queryId] result: $numRows rows returned in $elapsed ms"); |
98 | 98 | } else { // graph result |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param Vocabulary[]|null $vocabs |
109 | 109 | * @return string |
110 | 110 | */ |
111 | - protected function generateFromClause($vocabs=null) |
|
111 | + protected function generateFromClause($vocabs = null) |
|
112 | 112 | { |
113 | 113 | $clause = ''; |
114 | 114 | if (!$vocabs) { |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | $gcl = $this->graphClause; |
258 | 258 | $classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept'); |
259 | 259 | |
260 | - $quote_string = function ($val) { return "'$val'"; }; |
|
260 | + $quote_string = function($val) { return "'$val'"; }; |
|
261 | 261 | $quoted_values = array_map($quote_string, $langs); |
262 | - $langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))"; |
|
262 | + $langFilter = "FILTER(?lang IN (".implode(',', $quoted_values)."))"; |
|
263 | 263 | |
264 | 264 | $values = $this->formatValues('?type', $classes, 'uri'); |
265 | 265 | $valuesProp = $this->formatValues('?prop', $props, null); |
@@ -718,9 +718,9 @@ discard block |
||
718 | 718 | $conceptscheme['title'] = $row->title->getValue(); |
719 | 719 | } |
720 | 720 | // add dct:subject and their labels in the result |
721 | - if(isset($row->domain) && isset($row->domainLabel)) { |
|
722 | - $conceptscheme['subject']['uri']=$row->domain->getURI(); |
|
723 | - $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue(); |
|
721 | + if (isset($row->domain) && isset($row->domainLabel)) { |
|
722 | + $conceptscheme['subject']['uri'] = $row->domain->getURI(); |
|
723 | + $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue(); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | $ret[$row->cs->getURI()] = $conceptscheme; |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | $values[] = "<$graph>"; |
792 | 792 | } |
793 | 793 | if (count($values)) { |
794 | - return "FILTER (?graph IN (" . implode(',', $values) . "))"; |
|
794 | + return "FILTER (?graph IN (".implode(',', $values)."))"; |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | |
@@ -803,16 +803,16 @@ discard block |
||
803 | 803 | */ |
804 | 804 | protected function formatLimitAndOffset($limit, $offset) |
805 | 805 | { |
806 | - $limit = ($limit) ? 'LIMIT ' . $limit : ''; |
|
807 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
806 | + $limit = ($limit) ? 'LIMIT '.$limit : ''; |
|
807 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
808 | 808 | // eliminating whitespace and line changes when the conditions aren't needed. |
809 | 809 | $limitandoffset = ''; |
810 | 810 | if ($limit && $offset) { |
811 | - $limitandoffset = "\n" . $limit . "\n" . $offset; |
|
811 | + $limitandoffset = "\n".$limit."\n".$offset; |
|
812 | 812 | } elseif ($limit) { |
813 | - $limitandoffset = "\n" . $limit; |
|
813 | + $limitandoffset = "\n".$limit; |
|
814 | 814 | } elseif ($offset) { |
815 | - $limitandoffset = "\n" . $offset; |
|
815 | + $limitandoffset = "\n".$offset; |
|
816 | 816 | } |
817 | 817 | |
818 | 818 | return $limitandoffset; |
@@ -968,14 +968,14 @@ discard block |
||
968 | 968 | // if search language and UI/display language differ, must also consider case where there is no prefLabel in |
969 | 969 | // the display language; in that case, should use the label with the same language as the matched label |
970 | 970 | $labelcondFallback = ($searchLang != $lang) ? |
971 | - "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" . |
|
971 | + "OPTIONAL { # in case previous OPTIONAL block gives no labels\n". |
|
972 | 972 | "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : ""; |
973 | 973 | |
974 | 974 | // Including the labels if there is no query term given. |
975 | 975 | if ($rawterm === '') { |
976 | 976 | $labelClause = "?s skos:prefLabel ?label ."; |
977 | - $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . ""; |
|
978 | - return $labelClause . " BIND(?label AS ?match)"; |
|
977 | + $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause.""; |
|
978 | + return $labelClause." BIND(?label AS ?match)"; |
|
979 | 979 | } |
980 | 980 | |
981 | 981 | /* |
@@ -1048,20 +1048,20 @@ discard block |
||
1048 | 1048 | $schemecond = ''; |
1049 | 1049 | if (!empty($schemes)) { |
1050 | 1050 | $conditions = array(); |
1051 | - foreach($schemes as $scheme) { |
|
1051 | + foreach ($schemes as $scheme) { |
|
1052 | 1052 | $conditions[] = "{?s skos:inScheme <$scheme>}"; |
1053 | 1053 | } |
1054 | 1054 | $schemecond = '{'.implode(" UNION ", $conditions).'}'; |
1055 | 1055 | } |
1056 | - $filterDeprecated=""; |
|
1056 | + $filterDeprecated = ""; |
|
1057 | 1057 | //show or hide deprecated concepts |
1058 | - if(!$showDeprecated) { |
|
1059 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1058 | + if (!$showDeprecated) { |
|
1059 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1060 | 1060 | } |
1061 | 1061 | // extra conditions for parent and group, if specified |
1062 | - $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : ""; |
|
1063 | - $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : ""; |
|
1064 | - $pgcond = $parentcond . $groupcond; |
|
1062 | + $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : ""; |
|
1063 | + $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : ""; |
|
1064 | + $pgcond = $parentcond.$groupcond; |
|
1065 | 1065 | |
1066 | 1066 | $orderextra = $this->isDefaultEndpoint() ? $this->graph : ''; |
1067 | 1067 | |
@@ -1147,9 +1147,9 @@ discard block |
||
1147 | 1147 | $hit['type'][] = $this->shortenUri($typeuri); |
1148 | 1148 | } |
1149 | 1149 | |
1150 | - if(!empty($fields)) { |
|
1150 | + if (!empty($fields)) { |
|
1151 | 1151 | foreach ($fields as $prop) { |
1152 | - $propname = $prop . 's'; |
|
1152 | + $propname = $prop.'s'; |
|
1153 | 1153 | if (isset($row->$propname)) { |
1154 | 1154 | foreach (explode("\n", $row->$propname->getValue()) as $line) { |
1155 | 1155 | $rdata = str_getcsv($line, ',', '"', '"'); |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | $propvals = $rdata[2]; |
1165 | 1165 | } |
1166 | 1166 | |
1167 | - $hit['skos:' . $prop][] = $propvals; |
|
1167 | + $hit['skos:'.$prop][] = $propvals; |
|
1168 | 1168 | } |
1169 | 1169 | } |
1170 | 1170 | } |
@@ -1299,10 +1299,10 @@ discard block |
||
1299 | 1299 | $conditions = $this->formatFilterConditions($letter, $lang); |
1300 | 1300 | $filtercondLabel = $conditions['filterpref']; |
1301 | 1301 | $filtercondALabel = $conditions['filteralt']; |
1302 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
1303 | - $filterDeprecated=""; |
|
1304 | - if(!$showDeprecated) { |
|
1305 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1302 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
1303 | + $filterDeprecated = ""; |
|
1304 | + if (!$showDeprecated) { |
|
1305 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1306 | 1306 | } |
1307 | 1307 | $query = <<<EOQ |
1308 | 1308 | SELECT DISTINCT ?s ?label ?alabel ?qualifier |
@@ -1796,7 +1796,7 @@ discard block |
||
1796 | 1796 | if (!isset($row->label) || $row->label->getLang() === $lang) { |
1797 | 1797 | $ret[$row->object->getUri()] = $val; |
1798 | 1798 | } elseif ($row->label->getLang() === $fallbacklang) { |
1799 | - $val['label'] .= ' (' . $row->label->getLang() . ')'; |
|
1799 | + $val['label'] .= ' ('.$row->label->getLang().')'; |
|
1800 | 1800 | $ret[$row->object->getUri()] = $val; |
1801 | 1801 | } |
1802 | 1802 | } |
@@ -1895,10 +1895,10 @@ discard block |
||
1895 | 1895 | |
1896 | 1896 | $label = null; |
1897 | 1897 | if (isset($row->label)) { |
1898 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
1898 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
1899 | 1899 | $label = $row->label->getValue(); |
1900 | 1900 | } else { |
1901 | - $label = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
1901 | + $label = $row->label->getValue()." (".$row->label->getLang().")"; |
|
1902 | 1902 | } |
1903 | 1903 | |
1904 | 1904 | } |
@@ -1976,8 +1976,8 @@ discard block |
||
1976 | 1976 | foreach ($result as $row) { |
1977 | 1977 | if (isset($row->top) && isset($row->label)) { |
1978 | 1978 | $label = $row->label->getValue(); |
1979 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
1980 | - $label .= ' (' . $row->label->getLang() . ')'; |
|
1979 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
1980 | + $label .= ' ('.$row->label->getLang().')'; |
|
1981 | 1981 | } |
1982 | 1982 | $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN)); |
1983 | 1983 | if (isset($row->notation)) { |
@@ -2071,7 +2071,7 @@ discard block |
||
2071 | 2071 | $ret[$uri]['exact'] = $row->exact->getUri(); |
2072 | 2072 | } |
2073 | 2073 | if (isset($row->tops)) { |
2074 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
2074 | + $topConceptsList = explode(" ", $row->tops->getValue()); |
|
2075 | 2075 | // sort to guarantee an alphabetical ordering of the URI |
2076 | 2076 | sort($topConceptsList); |
2077 | 2077 | $ret[$uri]['tops'] = $topConceptsList; |
@@ -2084,8 +2084,8 @@ discard block |
||
2084 | 2084 | $label = null; |
2085 | 2085 | if (isset($row->childlabel)) { |
2086 | 2086 | $label = $row->childlabel->getValue(); |
2087 | - if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) { |
|
2088 | - $label .= " (" . $row->childlabel->getLang() . ")"; |
|
2087 | + if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) { |
|
2088 | + $label .= " (".$row->childlabel->getLang().")"; |
|
2089 | 2089 | } |
2090 | 2090 | |
2091 | 2091 | } |
@@ -2106,8 +2106,8 @@ discard block |
||
2106 | 2106 | } |
2107 | 2107 | if (isset($row->label)) { |
2108 | 2108 | $preflabel = $row->label->getValue(); |
2109 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
2110 | - $preflabel .= ' (' . $row->label->getLang() . ')'; |
|
2109 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
2110 | + $preflabel .= ' ('.$row->label->getLang().')'; |
|
2111 | 2111 | } |
2112 | 2112 | |
2113 | 2113 | $ret[$uri]['prefLabel'] = $preflabel; |
@@ -2232,9 +2232,9 @@ discard block |
||
2232 | 2232 | private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) |
2233 | 2233 | { |
2234 | 2234 | $fcl = $this->generateFromClause(); |
2235 | - $filterDeprecated=""; |
|
2236 | - if(!$showDeprecated) { |
|
2237 | - $filterDeprecated=" FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2235 | + $filterDeprecated = ""; |
|
2236 | + if (!$showDeprecated) { |
|
2237 | + $filterDeprecated = " FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2238 | 2238 | } |
2239 | 2239 | $query = <<<EOQ |
2240 | 2240 | SELECT ?conc ?super ?label ?members ?type ?notation $fcl |
@@ -2274,10 +2274,10 @@ discard block |
||
2274 | 2274 | 'type' => array($row->type->shorten()), |
2275 | 2275 | ); |
2276 | 2276 | if (isset($row->label)) { |
2277 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
2277 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
2278 | 2278 | $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue(); |
2279 | 2279 | } else { |
2280 | - $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
2280 | + $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")"; |
|
2281 | 2281 | } |
2282 | 2282 | |
2283 | 2283 | } |
@@ -2321,10 +2321,10 @@ discard block |
||
2321 | 2321 | * @param boolean $showDeprecated whether to include deprecated concepts in the change list |
2322 | 2322 | * @return string sparql query |
2323 | 2323 | */ |
2324 | - private function generateChangeListQuery($prop, $lang, $offset, $limit=200, $showDeprecated=false) |
|
2324 | + private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false) |
|
2325 | 2325 | { |
2326 | 2326 | $fcl = $this->generateFromClause(); |
2327 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
2327 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
2328 | 2328 | |
2329 | 2329 | //Additional clauses when deprecated concepts need to be included in the results |
2330 | 2330 | $deprecatedOptions = ''; |
@@ -2415,7 +2415,7 @@ discard block |
||
2415 | 2415 | * @param boolean $showDeprecated whether to include deprecated concepts in the change list |
2416 | 2416 | * @return array Result array |
2417 | 2417 | */ |
2418 | - public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated=false) |
|
2418 | + public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false) |
|
2419 | 2419 | { |
2420 | 2420 | $query = $this->generateChangeListQuery($prop, $lang, $offset, $limit, $showDeprecated); |
2421 | 2421 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | // 1. Ensure characters with special meaning in Lucene are escaped |
42 | 42 | $lucenemap = array(); |
43 | 43 | foreach (str_split(self::LUCENE_ESCAPE_CHARS) as $char) { |
44 | - $lucenemap[$char] = '\\' . $char; // escape with a backslash |
|
44 | + $lucenemap[$char] = '\\'.$char; // escape with a backslash |
|
45 | 45 | } |
46 | 46 | $term = strtr($term, $lucenemap); |
47 | 47 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | private function formatOrderBy($expression, $lang) |
96 | 96 | { |
97 | - if(!$this->model->getConfig()->getCollationEnabled()) { |
|
97 | + if (!$this->model->getConfig()->getCollationEnabled()) { |
|
98 | 98 | return $expression; |
99 | 99 | } |
100 | 100 | $orderby = sprintf('arq:collation(\'%2$s\', %1$s)', $expression, $lang); |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | # make text query clause |
129 | 129 | $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe |
130 | 130 | $langClause = $this->generateLangClause($lang); |
131 | - $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $langClause); |
|
132 | - $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $langClause); |
|
133 | - $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang) . " STR(?s) LCASE(STR(?qualifier))"; |
|
131 | + $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $langClause); |
|
132 | + $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $langClause); |
|
133 | + $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang)." STR(?s) LCASE(STR(?qualifier))"; |
|
134 | 134 | |
135 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
135 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
136 | 136 | |
137 | - $filterDeprecated=""; |
|
138 | - if(!$showDeprecated) { |
|
139 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
137 | + $filterDeprecated = ""; |
|
138 | + if (!$showDeprecated) { |
|
139 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $query = <<<EOQ |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | return $lname; |
105 | 105 | } |
106 | 106 | // already a full URI |
107 | - return $this->getUriSpace() . $lname; |
|
107 | + return $this->getUriSpace().$lname; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $result = $sparql->queryConceptScheme($defaultcs); |
167 | 167 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
168 | 168 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
169 | - error_log('Caught exception: ' . $e->getMessage()); |
|
169 | + error_log('Caught exception: '.$e->getMessage()); |
|
170 | 170 | } |
171 | 171 | return null; |
172 | 172 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | foreach ($conceptscheme->allLiterals($prop, null) as $val) { |
200 | 200 | $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop; |
201 | 201 | if ($val->getValue() instanceof DateTime) { |
202 | - $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
202 | + $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
203 | 203 | } |
204 | 204 | $ret[$prop][] = $val; |
205 | 205 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang); |
257 | 257 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
258 | 258 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
259 | - error_log('Caught exception: ' . $e->getMessage()); |
|
259 | + error_log('Caught exception: '.$e->getMessage()); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | return $conceptSchemes; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | } |
328 | 328 | // don't know how to parse |
329 | 329 | $rev = $parts[2]; |
330 | - $datestr = $parts[3] . ' ' . $parts[4]; |
|
330 | + $datestr = $parts[3].' '.$parts[4]; |
|
331 | 331 | |
332 | 332 | return "$datestr (r$rev)"; |
333 | 333 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @param string $array the uri of the concept array class, eg. isothes:ThesaurusArray |
339 | 339 | * @param string $group the uri of the concept group class, eg. isothes:ConceptGroup |
340 | 340 | */ |
341 | - public function getStatistics($lang = '', $array=null, $group=null) |
|
341 | + public function getStatistics($lang = '', $array = null, $group = null) |
|
342 | 342 | { |
343 | 343 | $sparql = $this->getSparql(); |
344 | 344 | // find the number of concepts |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $conceptInfo = $sparql->queryConceptInfo([$uri], $this->config->getArrayClassURI(), array($this), $clang); |
458 | 458 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
459 | 459 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
460 | - error_log('Caught exception: ' . $e->getMessage()); |
|
460 | + error_log('Caught exception: '.$e->getMessage()); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | return $conceptInfo[0]; |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit, $showDeprecated); |
669 | 669 | } |
670 | 670 | |
671 | - public function getTitle($lang=null) |
|
671 | + public function getTitle($lang = null) |
|
672 | 672 | { |
673 | 673 | return $this->config->getTitle($lang); |
674 | 674 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * @param string $lang preferred language for the literal |
44 | 44 | * @return string string value for the given property, or the default value if not found |
45 | 45 | */ |
46 | - protected function getLiteral($property, $default=null, $lang=null) |
|
46 | + protected function getLiteral($property, $default = null, $lang = null) |
|
47 | 47 | { |
48 | 48 | if (!isset($lang)) { |
49 | 49 | $lang = $this->getLang(); |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | } |
54 | 54 | // We need to check all the labels in case one of them matches a subtag of the current language |
55 | 55 | if ($this->resource->allLiterals('skos:prefLabel')) { |
56 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
56 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
57 | 57 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
58 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
58 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
59 | 59 | return EasyRdf\Literal::create($label, $fallback); |
60 | 60 | } |
61 | 61 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | $ret = array(); |
161 | 161 | $props = $this->resource->propertyUris(); |
162 | - foreach($props as $prop) { |
|
162 | + foreach ($props as $prop) { |
|
163 | 163 | $prop = (EasyRdf\RdfNamespace::shorten($prop) !== null) ? EasyRdf\RdfNamespace::shorten($prop) : $prop; |
164 | 164 | $propkey = str_starts_with($prop, 'dc11:') ? |
165 | 165 | str_replace('dc11:', 'dc:', $prop) : $prop; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return isset($results[$lang]) ? $results[$lang] : null; |
53 | 53 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
54 | 54 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
55 | - error_log('Caught exception: ' . $e->getMessage()); |
|
55 | + error_log('Caught exception: '.$e->getMessage()); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return isset($results) ? $results : null; |
75 | 75 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
76 | 76 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
77 | - error_log('Caught exception: ' . $e->getMessage()); |
|
77 | + error_log('Caught exception: '.$e->getMessage()); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | "skos:related", "skos:historyNote", "skosmos:memberOf", |
30 | 30 | "skosmos:memberOfArray"); |
31 | 31 | |
32 | - public function __construct($resource, $globalPlugins=array()) |
|
32 | + public function __construct($resource, $globalPlugins = array()) |
|
33 | 33 | { |
34 | 34 | $this->resource = $resource; |
35 | 35 | $this->globalPlugins = $globalPlugins; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $paramValue = $paramLiteral->getValue(); |
119 | 119 | $paramLang = $paramLiteral->getLang(); |
120 | 120 | if ($paramLang) { |
121 | - $paramName .= '_' . $paramLang; |
|
121 | + $paramName .= '_'.$paramLang; |
|
122 | 122 | } |
123 | 123 | $this->pluginParameters[$pluginName][$paramName] = $paramValue; |
124 | 124 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $labelProperty = $override->getResource('skosmos:property'); |
151 | 151 | $labelPropUri = $labelProperty->shorten(); |
152 | 152 | if (empty($this->labelOverrides[$labelPropUri])) { |
153 | - $this->labelOverrides[$labelPropUri] = array(); |
|
153 | + $this->labelOverrides[$labelPropUri] = array(); |
|
154 | 154 | } |
155 | 155 | $newOverrides = array(); |
156 | 156 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $langs = $this->getLanguages(); |
225 | 225 | $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric |
226 | 226 | if (sizeof($langs) > 1) { |
227 | - trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
227 | + trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | return $deflang; |