@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * Get the localname of a concept in the vocabulary. If the URI is not |
132 | 132 | * in the URI space of this vocabulary, return the full URI. |
133 | 133 | * |
134 | - * @param $uri string full URI of concept |
|
134 | + * @param string $uri string full URI of concept |
|
135 | 135 | * @return string local name of concept, or original full URI if the local name cannot be determined |
136 | 136 | */ |
137 | 137 | public function getLocalName($uri) |
@@ -303,6 +303,8 @@ discard block |
||
303 | 303 | |
304 | 304 | /** |
305 | 305 | * Counts the statistics of the vocabulary. |
306 | + * @param string $array |
|
307 | + * @param string $group |
|
306 | 308 | * @return Array containing the label counts |
307 | 309 | */ |
308 | 310 | public function getStatistics($lang = '', $array=null, $group=null) |
@@ -342,6 +344,7 @@ discard block |
||
342 | 344 | /** |
343 | 345 | * Gets the child relations of a concept and whether these children have more children. |
344 | 346 | * @param string $uri |
347 | + * @param string $lang |
|
345 | 348 | */ |
346 | 349 | public function getConceptChildren($uri, $lang) |
347 | 350 | { |
@@ -450,6 +453,8 @@ discard block |
||
450 | 453 | /** |
451 | 454 | * Lists the concepts available in the concept group. |
452 | 455 | * @param $clname |
456 | + * @param string $glname |
|
457 | + * @param string $clang |
|
453 | 458 | * @return array |
454 | 459 | */ |
455 | 460 | public function listConceptGroupContents($glname, $clang) |
@@ -476,7 +481,7 @@ discard block |
||
476 | 481 | /** |
477 | 482 | * Returns the letters of the alphabet which have been used in this vocabulary. |
478 | 483 | * The returned letters may also include specials such as '0-9' (digits) and '!*' (special characters). |
479 | - * @param $clang content language |
|
484 | + * @param string $clang content language |
|
480 | 485 | * @return array array of letters |
481 | 486 | */ |
482 | 487 | public function getAlphabet($clang) |
@@ -511,6 +516,7 @@ discard block |
||
511 | 516 | * Also the special tokens '0-9' (digits), '!*' (special characters) and '*' |
512 | 517 | * (everything) are supported. |
513 | 518 | * @param $letter letter (or special token) to search for |
519 | + * @param string $clang |
|
514 | 520 | */ |
515 | 521 | public function searchConceptsAlphabetical($letter, $limit = null, $offset = null, $clang = null) |
516 | 522 | { |
@@ -627,6 +633,9 @@ discard block |
||
627 | 633 | return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit, $showDeprecated); |
628 | 634 | } |
629 | 635 | |
636 | + /** |
|
637 | + * @param string $lang |
|
638 | + */ |
|
630 | 639 | public function getTitle($lang=null) { |
631 | 640 | return $this->config->getTitle($lang); |
632 | 641 | } |
@@ -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 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | foreach ($conceptscheme->allLiterals($prop, null) as $val) { |
176 | 176 | $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop; |
177 | 177 | if ($val->getValue() instanceof DateTime) { |
178 | - $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
178 | + $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
179 | 179 | } |
180 | 180 | $ret[$prop][] = $val; |
181 | 181 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | } |
297 | 297 | // don't know how to parse |
298 | 298 | $rev = $parts[2]; |
299 | - $datestr = $parts[3] . ' ' . $parts[4]; |
|
299 | + $datestr = $parts[3].' '.$parts[4]; |
|
300 | 300 | |
301 | 301 | return "$datestr (r$rev)"; |
302 | 302 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * Counts the statistics of the vocabulary. |
306 | 306 | * @return Array containing the label counts |
307 | 307 | */ |
308 | - public function getStatistics($lang = '', $array=null, $group=null) |
|
308 | + public function getStatistics($lang = '', $array = null, $group = null) |
|
309 | 309 | { |
310 | 310 | $sparql = $this->getSparql(); |
311 | 311 | // find the number of concepts |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit, $showDeprecated); |
628 | 628 | } |
629 | 629 | |
630 | - public function getTitle($lang=null) { |
|
630 | + public function getTitle($lang = null) { |
|
631 | 631 | return $this->config->getTitle($lang); |
632 | 632 | } |
633 | 633 |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | protected function query($query) { |
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 | $clause = ''; |
113 | 113 | if (!$vocabs) { |
114 | 114 | return $this->graph !== '?graph' && $this->graph !== NULL ? "FROM <$this->graph>" : ''; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | $quote_string = function($val) { return "'$val'"; }; |
236 | 236 | $quoted_values = array_map($quote_string, $langs); |
237 | - $langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))"; |
|
237 | + $langFilter = "FILTER(?lang IN (".implode(',', $quoted_values)."))"; |
|
238 | 238 | |
239 | 239 | $values = $this->formatValues('?type', $classes, 'uri'); |
240 | 240 | $valuesProp = $this->formatValues('?prop', $props, null); |
@@ -671,9 +671,9 @@ discard block |
||
671 | 671 | $conceptscheme['title'] = $row->title->getValue(); |
672 | 672 | } |
673 | 673 | // add dct:subject and their labels in the result |
674 | - if(isset($row->domain) && isset($row->domainLabel)){ |
|
675 | - $conceptscheme['subject']['uri']=$row->domain->getURI(); |
|
676 | - $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue(); |
|
674 | + if (isset($row->domain) && isset($row->domainLabel)) { |
|
675 | + $conceptscheme['subject']['uri'] = $row->domain->getURI(); |
|
676 | + $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue(); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | $ret[$row->cs->getURI()] = $conceptscheme; |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | $values[] = "<$graph>"; |
741 | 741 | } |
742 | 742 | if (count($values)) { |
743 | - return "FILTER (?graph IN (" . implode(',', $values) . "))"; |
|
743 | + return "FILTER (?graph IN (".implode(',', $values)."))"; |
|
744 | 744 | } |
745 | 745 | } |
746 | 746 | |
@@ -751,16 +751,16 @@ discard block |
||
751 | 751 | * @return string sparql query clauses |
752 | 752 | */ |
753 | 753 | protected function formatLimitAndOffset($limit, $offset) { |
754 | - $limit = ($limit) ? 'LIMIT ' . $limit : ''; |
|
755 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
754 | + $limit = ($limit) ? 'LIMIT '.$limit : ''; |
|
755 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
756 | 756 | // eliminating whitespace and line changes when the conditions aren't needed. |
757 | 757 | $limitandoffset = ''; |
758 | 758 | if ($limit && $offset) { |
759 | - $limitandoffset = "\n" . $limit . "\n" . $offset; |
|
759 | + $limitandoffset = "\n".$limit."\n".$offset; |
|
760 | 760 | } elseif ($limit) { |
761 | - $limitandoffset = "\n" . $limit; |
|
761 | + $limitandoffset = "\n".$limit; |
|
762 | 762 | } elseif ($offset) { |
763 | - $limitandoffset = "\n" . $offset; |
|
763 | + $limitandoffset = "\n".$offset; |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | return $limitandoffset; |
@@ -912,14 +912,14 @@ discard block |
||
912 | 912 | // if search language and UI/display language differ, must also consider case where there is no prefLabel in |
913 | 913 | // the display language; in that case, should use the label with the same language as the matched label |
914 | 914 | $labelcondFallback = ($searchLang != $lang) ? |
915 | - "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" . |
|
915 | + "OPTIONAL { # in case previous OPTIONAL block gives no labels\n". |
|
916 | 916 | "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : ""; |
917 | 917 | |
918 | 918 | // Including the labels if there is no query term given. |
919 | 919 | if ($rawterm === '') { |
920 | 920 | $labelClause = "?s skos:prefLabel ?label ."; |
921 | - $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . ""; |
|
922 | - return $labelClause . " BIND(?label AS ?match)"; |
|
921 | + $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause.""; |
|
922 | + return $labelClause." BIND(?label AS ?match)"; |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | /* |
@@ -991,20 +991,20 @@ discard block |
||
991 | 991 | $schemecond = ''; |
992 | 992 | if (!empty($schemes)) { |
993 | 993 | $conditions = array(); |
994 | - foreach($schemes as $scheme) { |
|
994 | + foreach ($schemes as $scheme) { |
|
995 | 995 | $conditions[] = "{?s skos:inScheme <$scheme>}"; |
996 | 996 | } |
997 | - $schemecond = '{'.implode(" UNION ",$conditions).'}'; |
|
997 | + $schemecond = '{'.implode(" UNION ", $conditions).'}'; |
|
998 | 998 | } |
999 | - $filterDeprecated=""; |
|
999 | + $filterDeprecated = ""; |
|
1000 | 1000 | //show or hide deprecated concepts |
1001 | - if(!$showDeprecated){ |
|
1002 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1001 | + if (!$showDeprecated) { |
|
1002 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1003 | 1003 | } |
1004 | 1004 | // extra conditions for parent and group, if specified |
1005 | - $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : ""; |
|
1006 | - $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : ""; |
|
1007 | - $pgcond = $parentcond . $groupcond; |
|
1005 | + $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : ""; |
|
1006 | + $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : ""; |
|
1007 | + $pgcond = $parentcond.$groupcond; |
|
1008 | 1008 | |
1009 | 1009 | $orderextra = $this->isDefaultEndpoint() ? $this->graph : ''; |
1010 | 1010 | |
@@ -1090,9 +1090,9 @@ discard block |
||
1090 | 1090 | $hit['type'][] = $this->shortenUri($typeuri); |
1091 | 1091 | } |
1092 | 1092 | |
1093 | - if(!empty($fields)) { |
|
1093 | + if (!empty($fields)) { |
|
1094 | 1094 | foreach ($fields as $prop) { |
1095 | - $propname = $prop . 's'; |
|
1095 | + $propname = $prop.'s'; |
|
1096 | 1096 | if (isset($row->$propname)) { |
1097 | 1097 | foreach (explode("\n", $row->$propname->getValue()) as $line) { |
1098 | 1098 | $rdata = str_getcsv($line, ',', '"', '"'); |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | $propvals = $rdata[2]; |
1108 | 1108 | } |
1109 | 1109 | |
1110 | - $hit['skos:' . $prop][] = $propvals; |
|
1110 | + $hit['skos:'.$prop][] = $propvals; |
|
1111 | 1111 | } |
1112 | 1112 | } |
1113 | 1113 | } |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | * @return array query result object |
1184 | 1184 | */ |
1185 | 1185 | public function queryConcepts($vocabs, $fields = null, $unique = false, $params, $showDeprecated = false) { |
1186 | - $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated); |
|
1186 | + $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated); |
|
1187 | 1187 | $results = $this->query($query); |
1188 | 1188 | return $this->transformConceptSearchResults($results, $vocabs, $fields); |
1189 | 1189 | } |
@@ -1238,10 +1238,10 @@ discard block |
||
1238 | 1238 | $conditions = $this->formatFilterConditions($letter, $lang); |
1239 | 1239 | $filtercondLabel = $conditions['filterpref']; |
1240 | 1240 | $filtercondALabel = $conditions['filteralt']; |
1241 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
1242 | - $filterDeprecated=""; |
|
1243 | - if(!$showDeprecated){ |
|
1244 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1241 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
1242 | + $filterDeprecated = ""; |
|
1243 | + if (!$showDeprecated) { |
|
1244 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1245 | 1245 | } |
1246 | 1246 | $query = <<<EOQ |
1247 | 1247 | SELECT DISTINCT ?s ?label ?alabel ?qualifier |
@@ -1718,7 +1718,7 @@ discard block |
||
1718 | 1718 | if (!isset($row->label) || $row->label->getLang() === $lang) { |
1719 | 1719 | $ret[$row->object->getUri()] = $val; |
1720 | 1720 | } elseif ($row->label->getLang() === $fallbacklang) { |
1721 | - $val['label'] .= ' (' . $row->label->getLang() . ')'; |
|
1721 | + $val['label'] .= ' ('.$row->label->getLang().')'; |
|
1722 | 1722 | $ret[$row->object->getUri()] = $val; |
1723 | 1723 | } |
1724 | 1724 | } |
@@ -1814,10 +1814,10 @@ discard block |
||
1814 | 1814 | |
1815 | 1815 | $label = null; |
1816 | 1816 | if (isset($row->label)) { |
1817 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
1817 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
1818 | 1818 | $label = $row->label->getValue(); |
1819 | 1819 | } else { |
1820 | - $label = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
1820 | + $label = $row->label->getValue()." (".$row->label->getLang().")"; |
|
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | } |
@@ -1893,8 +1893,8 @@ discard block |
||
1893 | 1893 | foreach ($result as $row) { |
1894 | 1894 | if (isset($row->top) && isset($row->label)) { |
1895 | 1895 | $label = $row->label->getValue(); |
1896 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
1897 | - $label .= ' (' . $row->label->getLang() . ')'; |
|
1896 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
1897 | + $label .= ' ('.$row->label->getLang().')'; |
|
1898 | 1898 | } |
1899 | 1899 | $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN)); |
1900 | 1900 | if (isset($row->notation)) { |
@@ -1987,7 +1987,7 @@ discard block |
||
1987 | 1987 | $ret[$uri]['exact'] = $row->exact->getUri(); |
1988 | 1988 | } |
1989 | 1989 | if (isset($row->tops)) { |
1990 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
1990 | + $topConceptsList = explode(" ", $row->tops->getValue()); |
|
1991 | 1991 | // sort to guarantee an alphabetical ordering of the URI |
1992 | 1992 | sort($topConceptsList); |
1993 | 1993 | $ret[$uri]['tops'] = $topConceptsList; |
@@ -2000,8 +2000,8 @@ discard block |
||
2000 | 2000 | $label = null; |
2001 | 2001 | if (isset($row->childlabel)) { |
2002 | 2002 | $label = $row->childlabel->getValue(); |
2003 | - if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) { |
|
2004 | - $label .= " (" . $row->childlabel->getLang() . ")"; |
|
2003 | + if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) { |
|
2004 | + $label .= " (".$row->childlabel->getLang().")"; |
|
2005 | 2005 | } |
2006 | 2006 | |
2007 | 2007 | } |
@@ -2022,8 +2022,8 @@ discard block |
||
2022 | 2022 | } |
2023 | 2023 | if (isset($row->label)) { |
2024 | 2024 | $preflabel = $row->label->getValue(); |
2025 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
2026 | - $preflabel .= ' (' . $row->label->getLang() . ')'; |
|
2025 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
2026 | + $preflabel .= ' ('.$row->label->getLang().')'; |
|
2027 | 2027 | } |
2028 | 2028 | |
2029 | 2029 | $ret[$uri]['prefLabel'] = $preflabel; |
@@ -2144,9 +2144,9 @@ discard block |
||
2144 | 2144 | */ |
2145 | 2145 | private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) { |
2146 | 2146 | $fcl = $this->generateFromClause(); |
2147 | - $filterDeprecated=""; |
|
2148 | - if(!$showDeprecated){ |
|
2149 | - $filterDeprecated=" FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2147 | + $filterDeprecated = ""; |
|
2148 | + if (!$showDeprecated) { |
|
2149 | + $filterDeprecated = " FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2150 | 2150 | } |
2151 | 2151 | $query = <<<EOQ |
2152 | 2152 | SELECT ?conc ?super ?label ?members ?type ?notation $fcl |
@@ -2185,10 +2185,10 @@ discard block |
||
2185 | 2185 | 'type' => array($row->type->shorten()), |
2186 | 2186 | ); |
2187 | 2187 | if (isset($row->label)) { |
2188 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
2188 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
2189 | 2189 | $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue(); |
2190 | 2190 | } else { |
2191 | - $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
2191 | + $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")"; |
|
2192 | 2192 | } |
2193 | 2193 | |
2194 | 2194 | } |
@@ -2216,8 +2216,8 @@ discard block |
||
2216 | 2216 | * @param boolean $showDeprecated whether to include deprecated concepts in search results |
2217 | 2217 | * @return array Result array with concept URI as key and concept label as value |
2218 | 2218 | */ |
2219 | - public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) { |
|
2220 | - $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated); |
|
2219 | + public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) { |
|
2220 | + $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated); |
|
2221 | 2221 | $result = $this->query($query); |
2222 | 2222 | return $this->transformConceptGroupContentsResults($result, $lang); |
2223 | 2223 | } |
@@ -2231,9 +2231,9 @@ discard block |
||
2231 | 2231 | * @param boolean $showDeprecated whether to include deprecated concepts in the change list |
2232 | 2232 | * @return string sparql query |
2233 | 2233 | */ |
2234 | - private function generateChangeListQuery($prop, $lang, $offset, $limit=200, $showDeprecated) { |
|
2234 | + private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated) { |
|
2235 | 2235 | $fcl = $this->generateFromClause(); |
2236 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
2236 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
2237 | 2237 | |
2238 | 2238 | //Additional clauses when deprecated concepts need to be included in the results |
2239 | 2239 | $optionVar = ($showDeprecated) ? '?replacedBy' : ''; |
@@ -2298,7 +2298,7 @@ discard block |
||
2298 | 2298 | * @param boolean $showDeprecated whether to include deprecated concepts in the change list |
2299 | 2299 | * @return array Result array |
2300 | 2300 | */ |
2301 | - public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated=false) { |
|
2301 | + public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false) { |
|
2302 | 2302 | $query = $this->generateChangeListQuery($prop, $lang, $offset, $limit, $showDeprecated); |
2303 | 2303 | |
2304 | 2304 | $result = $this->query($query); |
@@ -575,9 +575,9 @@ discard block |
||
575 | 575 | $vocid = $request->getVocab()->getId(); |
576 | 576 | return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang"); |
577 | 577 | } |
578 | - } else { |
|
578 | + } else { |
|
579 | 579 | header("Location: " . $urls[$format]); |
580 | - } |
|
580 | + } |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | private function returnDataResults($results, $format) { |
@@ -1120,9 +1120,9 @@ discard block |
||
1120 | 1120 | } |
1121 | 1121 | return $this->returnJson(array_merge_recursive($this->context, |
1122 | 1122 | array('@context' => array( '@language' => $request->getLang(), |
1123 | - 'prefLabel' => 'skos:prefLabel', |
|
1124 | - 'xsd' => 'http://www.w3.org/2001/XMLSchema#', |
|
1125 | - 'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') ) |
|
1123 | + 'prefLabel' => 'skos:prefLabel', |
|
1124 | + 'xsd' => 'http://www.w3.org/2001/XMLSchema#', |
|
1125 | + 'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') ) |
|
1126 | 1126 | ), |
1127 | 1127 | array('changeList' => $simpleChangeList))); |
1128 | 1128 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // wrap with JSONP callback if requested |
26 | 26 | if (filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_STRING)) { |
27 | 27 | header("Content-type: application/javascript; charset=utf-8"); |
28 | - echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW) . "(" . json_encode($data) . ");"; |
|
28 | + echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW)."(".json_encode($data).");"; |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | 'vocabularies' => 'onki:hasVocabulary', |
89 | 89 | 'id' => 'onki:vocabularyIdentifier', |
90 | 90 | 'uri' => '@id', |
91 | - '@base' => $this->getBaseHref() . "rest/v1/vocabularies", |
|
91 | + '@base' => $this->getBaseHref()."rest/v1/vocabularies", |
|
92 | 92 | ), |
93 | 93 | 'uri' => '', |
94 | 94 | 'vocabularies' => $results, |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | // convert to vocids array to support multi-vocabulary search |
106 | 106 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : array(); |
107 | 107 | $vocabObjects = array(); |
108 | - foreach($vocids as $vocid) { |
|
108 | + foreach ($vocids as $vocid) { |
|
109 | 109 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
110 | 110 | } |
111 | 111 | $parameters->setVocabularies($vocabObjects); |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | foreach ($parameters->getAdditionalFields() as $field) { |
137 | 137 | |
138 | 138 | // Quick-and-dirty compactification |
139 | - $context[$field] = 'skos:' . $field; |
|
139 | + $context[$field] = 'skos:'.$field; |
|
140 | 140 | foreach ($results as &$result) { |
141 | 141 | foreach ($result as $k => $v) { |
142 | - if ($k == 'skos:' . $field) { |
|
142 | + if ($k == 'skos:'.$field) { |
|
143 | 143 | $result[$field] = $v; |
144 | - unset($result['skos:' . $field]); |
|
144 | + unset($result['skos:'.$field]); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'prefLabel' => 'skos:prefLabel', |
230 | 230 | 'title' => 'dct:title', |
231 | 231 | '@language' => $request->getLang(), |
232 | - '@base' => $this->getBaseHref() . "rest/v1/" . $vocab->getId() . "/", |
|
232 | + '@base' => $this->getBaseHref()."rest/v1/".$vocab->getId()."/", |
|
233 | 233 | ), |
234 | 234 | 'uri' => '', |
235 | 235 | 'id' => $vocab->getId(), |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | 'subTypes' => array('@id' => 'void:class', '@type' => '@id'), |
284 | 284 | 'count' => 'void:entities', |
285 | 285 | '@language' => $request->getLang(), |
286 | - '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/", |
|
286 | + '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/", |
|
287 | 287 | ), |
288 | 288 | 'uri' => '', |
289 | 289 | 'id' => $request->getVocab()->getId(), |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | 'language' => 'void-ext:language', |
361 | 361 | 'properties' => 'void:propertyPartition', |
362 | 362 | 'labels' => 'void:triples', |
363 | - '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/", |
|
363 | + '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/", |
|
364 | 364 | ), |
365 | 365 | 'uri' => '', |
366 | 366 | 'id' => $request->getVocab()->getId(), |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $types[] = $type; |
402 | 402 | } |
403 | 403 | |
404 | - $base = $request->getVocab() ? $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/" : $this->getBaseHref() . "rest/v1/"; |
|
404 | + $base = $request->getVocab() ? $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/" : $this->getBaseHref()."rest/v1/"; |
|
405 | 405 | |
406 | 406 | $ret = array_merge_recursive($this->context, array( |
407 | 407 | '@context' => array( |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | if ($lang === null) { |
443 | 443 | // case 1A: exact match on preferred label in any language |
444 | 444 | foreach ($results as $res) { |
445 | - if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel'] == $label) { |
|
445 | + if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel'] == $label) { |
|
446 | 446 | $res['prefLabel'] = $res['matchedPrefLabel']; |
447 | 447 | unset($res['matchedPrefLabel']); |
448 | 448 | $hits[] = $res; |
@@ -564,19 +564,19 @@ discard block |
||
564 | 564 | |
565 | 565 | $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format')); |
566 | 566 | if (!$format) { |
567 | - return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls))); |
|
567 | + return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls))); |
|
568 | 568 | } |
569 | 569 | if (is_array($urls[$format])) { |
570 | 570 | $arr = $urls[$format]; |
571 | 571 | $dataLang = $request->getLang(); |
572 | 572 | if (isset($arr[$dataLang])) { |
573 | - header("Location: " . $arr[$dataLang]); |
|
573 | + header("Location: ".$arr[$dataLang]); |
|
574 | 574 | } else { |
575 | 575 | $vocid = $request->getVocab()->getId(); |
576 | 576 | return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang"); |
577 | 577 | } |
578 | 578 | } else { |
579 | - header("Location: " . $urls[$format]); |
|
579 | + header("Location: ".$urls[$format]); |
|
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | |
640 | 640 | $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format')); |
641 | 641 | if (!$format) { |
642 | - return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS); |
|
642 | + return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS); |
|
643 | 643 | } |
644 | 644 | |
645 | 645 | $vocid = $vocab ? $vocab->getId() : null; |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | } |
925 | 925 | } |
926 | 926 | // if the main concept scheme was not found, set 'top' to the first 'tops' (sorted alphabetically on the URIs) |
927 | - if (! isset($results[$uri]['top'])) { |
|
927 | + if (!isset($results[$uri]['top'])) { |
|
928 | 928 | $results[$uri]['top'] = $results[$uri]['tops'][0]; |
929 | 929 | } |
930 | 930 | } else { |
@@ -1102,16 +1102,16 @@ discard block |
||
1102 | 1102 | $changeList = $request->getVocab()->getChangeList($prop, $request->getLang(), $offset, $limit); |
1103 | 1103 | |
1104 | 1104 | $simpleChangeList = array(); |
1105 | - foreach($changeList as $conceptInfo) { |
|
1105 | + foreach ($changeList as $conceptInfo) { |
|
1106 | 1106 | if (array_key_exists('date', $conceptInfo)) { |
1107 | 1107 | if (array_key_exists('replacedBy', $conceptInfo)) { |
1108 | - $simpleChangeList[] = array( |
|
1108 | + $simpleChangeList[] = array( |
|
1109 | 1109 | 'uri' => $conceptInfo['uri'], |
1110 | 1110 | 'prefLabel' => $conceptInfo['prefLabel'], |
1111 | 1111 | 'date' => $conceptInfo['date']->format("Y-m-d\TH:i:sO"), |
1112 | 1112 | 'replacedBy' => $conceptInfo['replacedBy'] ); |
1113 | 1113 | } else { |
1114 | - $simpleChangeList[] = array( |
|
1114 | + $simpleChangeList[] = array( |
|
1115 | 1115 | 'uri' => $conceptInfo['uri'], |
1116 | 1116 | 'prefLabel' => $conceptInfo['prefLabel'], |
1117 | 1117 | 'date' => $conceptInfo['date']->format("Y-m-d\TH:i:sO") ); |
@@ -1119,10 +1119,10 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | } |
1121 | 1121 | return $this->returnJson(array_merge_recursive($this->context, |
1122 | - array('@context' => array( '@language' => $request->getLang(), |
|
1122 | + array('@context' => array('@language' => $request->getLang(), |
|
1123 | 1123 | 'prefLabel' => 'skos:prefLabel', |
1124 | 1124 | 'xsd' => 'http://www.w3.org/2001/XMLSchema#', |
1125 | - 'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') ) |
|
1125 | + 'date' => array('@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime')) |
|
1126 | 1126 | ), |
1127 | 1127 | array('changeList' => $simpleChangeList))); |
1128 | 1128 |