@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // specify where to look for templates and cache |
38 | 38 | $loader = new Twig_Loader_Filesystem('view'); |
39 | 39 | // initialize Twig environment |
40 | - $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true)); |
|
40 | + $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true)); |
|
41 | 41 | $this->twig->addExtension(new Twig_Extensions_Extension_I18n()); |
42 | 42 | // used for setting the base href for the relative urls |
43 | 43 | $this->twig->addGlobal("BaseHref", $this->getBaseHref()); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter'))); |
53 | 53 | |
54 | 54 | // register a Twig filter for generating strings from language codes with CLDR |
55 | - $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) { |
|
55 | + $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) { |
|
56 | 56 | return Language::getName($langcode, $lang); |
57 | 57 | }); |
58 | 58 | $this->twig->addFilter($langFilter); |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | |
233 | 233 | private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender) |
234 | 234 | { |
235 | - $headers = "MIME-Version: 1.0" . "\r\n"; |
|
236 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
235 | + $headers = "MIME-Version: 1.0"."\r\n"; |
|
236 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
237 | 237 | if (!empty($toMail)) { |
238 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
238 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
239 | 239 | } |
240 | 240 | if (!empty($fromEmail)) { |
241 | 241 | $headers .= "Reply-To: $fromName <$fromEmail>\r\n"; |
242 | 242 | } |
243 | 243 | $service = $this->model->getConfig()->getServiceName(); |
244 | - return $headers . "From: $fromName via $service <$sender>"; |
|
244 | + return $headers."From: $fromName via $service <$sender>"; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null) |
256 | 256 | { |
257 | 257 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
258 | - $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject; |
|
258 | + $messageSubject = "[".$this->model->getConfig()->getServiceName()."] ".$messageSubject; |
|
259 | 259 | if ($fromVocab !== null && $fromVocab !== '') { |
260 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
260 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
261 | 261 | } |
262 | 262 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
263 | 263 | // determine the sender address of the message |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender); |
271 | 271 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
272 | 272 | // adding some information about the user for debugging purposes. |
273 | - $message = $message . "<br /><br /> Debugging information:" |
|
274 | - . "<br />Timestamp: " . date(DATE_RFC2822) |
|
275 | - . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT') |
|
276 | - . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER'); |
|
273 | + $message = $message."<br /><br /> Debugging information:" |
|
274 | + . "<br />Timestamp: ".date(DATE_RFC2822) |
|
275 | + . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT') |
|
276 | + . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER'); |
|
277 | 277 | |
278 | 278 | try { |
279 | 279 | mail($toAddress, $messageSubject, $message, $headers, $params); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | header("HTTP/1.0 404 Not Found"); |
282 | 282 | $template = $this->twig->loadTemplate('error-page.twig'); |
283 | 283 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
284 | - error_log('Caught exception: ' . $e->getMessage()); |
|
284 | + error_log('Caught exception: '.$e->getMessage()); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | echo $template->render( |
@@ -326,13 +326,13 @@ discard block |
||
326 | 326 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
327 | 327 | $vocabObjects = array(); |
328 | 328 | if ($vocids) { |
329 | - foreach($vocids as $vocid) { |
|
329 | + foreach ($vocids as $vocid) { |
|
330 | 330 | try { |
331 | 331 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
332 | 332 | } catch (ValueError $e) { |
333 | 333 | // fail fast with an error page if the vocabulary cannot be found |
334 | 334 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
335 | - error_log('Caught exception: ' . $e->getMessage()); |
|
335 | + error_log('Caught exception: '.$e->getMessage()); |
|
336 | 336 | } |
337 | 337 | header("HTTP/1.0 400 Bad Request"); |
338 | 338 | $this->invokeGenericErrorPage($request, $e->getMessage()); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $errored = true; |
355 | 355 | header("HTTP/1.0 500 Internal Server Error"); |
356 | 356 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
357 | - error_log('Caught exception: ' . $e->getMessage()); |
|
357 | + error_log('Caught exception: '.$e->getMessage()); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | $vocabList = $this->model->getVocabularyList(); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | 'search_count' => $counts, |
367 | 367 | 'languages' => $this->languages, |
368 | 368 | 'search_results' => $searchResults, |
369 | - 'rest' => $parameters->getOffset()>0, |
|
369 | + 'rest' => $parameters->getOffset() > 0, |
|
370 | 370 | 'global_search' => true, |
371 | 371 | 'search_failed' => $errored, |
372 | 372 | 'term' => $request->getQueryParamRaw('q'), |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | } catch (Exception $e) { |
394 | 394 | header("HTTP/1.0 500 Internal Server Error"); |
395 | 395 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
396 | - error_log('Caught exception: ' . $e->getMessage()); |
|
396 | + error_log('Caught exception: '.$e->getMessage()); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | echo $template->render( |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | } catch (Exception $e) { |
418 | 418 | header("HTTP/1.0 404 Not Found"); |
419 | 419 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
420 | - error_log('Caught exception: ' . $e->getMessage()); |
|
420 | + error_log('Caught exception: '.$e->getMessage()); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | echo $template->render( |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | 'vocab' => $vocab, |
436 | 436 | 'search_results' => $searchResults, |
437 | 437 | 'search_count' => $counts, |
438 | - 'rest' => $parameters->getOffset()>0, |
|
438 | + 'rest' => $parameters->getOffset() > 0, |
|
439 | 439 | 'limit_parent' => $parameters->getParentLimit(), |
440 | 440 | 'limit_type' => $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null, |
441 | 441 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
570 | 570 | * @param Request $request |
571 | 571 | */ |
572 | - public function invokeChangeList($request, $prop='dc:created') |
|
572 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
573 | 573 | { |
574 | 574 | $offset = ($request->getQueryParam('offset') && is_numeric($request->getQueryParam('offset')) && $request->getQueryParam('offset') >= 0) ? $request->getQueryParam('offset') : 0; |
575 | 575 | $limit = ($request->getQueryParam('limit') && is_numeric($request->getQueryParam('limit')) && $request->getQueryParam('limit') >= 0) ? $request->getQueryParam('limit') : 200; |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * @param int $cutoffYears amount of years to consider past current date |
599 | 599 | * @return Array list of concepts |
600 | 600 | */ |
601 | - public function getChangeList($request, $prop, $offset=0, $limit=200, $cutoffYears=1) |
|
601 | + public function getChangeList($request, $prop, $offset = 0, $limit = 200, $cutoffYears = 1) |
|
602 | 602 | { |
603 | 603 | // set language parameters for gettext |
604 | 604 | $this->setLanguageProperties($request->getLang()); |
@@ -615,9 +615,9 @@ discard block |
||
615 | 615 | public function formatChangeList($changeList, $lang) |
616 | 616 | { |
617 | 617 | $formatByDate = array(); |
618 | - foreach($changeList as $concept) { |
|
618 | + foreach ($changeList as $concept) { |
|
619 | 619 | $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang); |
620 | - $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept; |
|
620 | + $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept; |
|
621 | 621 | } |
622 | 622 | return $formatByDate; |
623 | 623 | } |
@@ -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>" : ''; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | $quote_string = function($val) { return "'$val'"; }; |
252 | 252 | $quoted_values = array_map($quote_string, $langs); |
253 | - $langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))"; |
|
253 | + $langFilter = "FILTER(?lang IN (".implode(',', $quoted_values)."))"; |
|
254 | 254 | |
255 | 255 | $values = $this->formatValues('?type', $classes, 'uri'); |
256 | 256 | $valuesProp = $this->formatValues('?prop', $props, null); |
@@ -694,9 +694,9 @@ discard block |
||
694 | 694 | $conceptscheme['title'] = $row->title->getValue(); |
695 | 695 | } |
696 | 696 | // add dct:subject and their labels in the result |
697 | - if(isset($row->domain) && isset($row->domainLabel)){ |
|
698 | - $conceptscheme['subject']['uri']=$row->domain->getURI(); |
|
699 | - $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue(); |
|
697 | + if (isset($row->domain) && isset($row->domainLabel)) { |
|
698 | + $conceptscheme['subject']['uri'] = $row->domain->getURI(); |
|
699 | + $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue(); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | $ret[$row->cs->getURI()] = $conceptscheme; |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | $values[] = "<$graph>"; |
764 | 764 | } |
765 | 765 | if (count($values)) { |
766 | - return "FILTER (?graph IN (" . implode(',', $values) . "))"; |
|
766 | + return "FILTER (?graph IN (".implode(',', $values)."))"; |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | |
@@ -774,16 +774,16 @@ discard block |
||
774 | 774 | * @return string sparql query clauses |
775 | 775 | */ |
776 | 776 | protected function formatLimitAndOffset($limit, $offset) { |
777 | - $limit = ($limit) ? 'LIMIT ' . $limit : ''; |
|
778 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
777 | + $limit = ($limit) ? 'LIMIT '.$limit : ''; |
|
778 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
779 | 779 | // eliminating whitespace and line changes when the conditions aren't needed. |
780 | 780 | $limitandoffset = ''; |
781 | 781 | if ($limit && $offset) { |
782 | - $limitandoffset = "\n" . $limit . "\n" . $offset; |
|
782 | + $limitandoffset = "\n".$limit."\n".$offset; |
|
783 | 783 | } elseif ($limit) { |
784 | - $limitandoffset = "\n" . $limit; |
|
784 | + $limitandoffset = "\n".$limit; |
|
785 | 785 | } elseif ($offset) { |
786 | - $limitandoffset = "\n" . $offset; |
|
786 | + $limitandoffset = "\n".$offset; |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | return $limitandoffset; |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * @param string|null $distinguisher SPARQL property path from concept to distinguisher object in case of shared prefLabels |
923 | 923 | * @return string sparql query |
924 | 924 | */ |
925 | - protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph, $distinguisher=null) |
|
925 | + protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph, $distinguisher = null) |
|
926 | 926 | { |
927 | 927 | $valuesProp = $this->formatValues('?prop', $props); |
928 | 928 | $textcond = $this->generateConceptSearchQueryCondition($term, $searchLang); |
@@ -936,31 +936,31 @@ discard block |
||
936 | 936 | // if search language and UI/display language differ, must also consider case where there is no prefLabel in |
937 | 937 | // the display language; in that case, should use the label with the same language as the matched label |
938 | 938 | $labelcondFallback = ($searchLang != $lang) ? |
939 | - "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" . |
|
939 | + "OPTIONAL { # in case previous OPTIONAL block gives no labels\n". |
|
940 | 940 | "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : ""; |
941 | 941 | |
942 | 942 | // Including the labels if there is no query term given. |
943 | 943 | if ($rawterm === '') { |
944 | 944 | $labelClause = "?s skos:prefLabel ?label ."; |
945 | - $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . ""; |
|
946 | - return $labelClause . " BIND(?label AS ?match)"; |
|
945 | + $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause.""; |
|
946 | + return $labelClause." BIND(?label AS ?match)"; |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | $distinguishercondLabel = "FILTER (LANG(?distLabel) = LANG(?label))"; |
950 | 950 | // Only include distinguisher labels in case of a shared prefLabel |
951 | 951 | $distinguisherClause = $distinguisher ? |
952 | - "OPTIONAL {\n" . |
|
953 | - " ?s skos:prefLabel ?label . ?s2 skos:prefLabel ?label . FILTER(?s2 != ?s)\n" . |
|
954 | - " ?s $distinguisher ?distinguisher.\n" . |
|
955 | - " FILTER (!isLiteral(?distinguisher) || (LANG(?distinguisher) = LANG(?label)))" . |
|
956 | - " OPTIONAL {\n" . |
|
957 | - " ?distinguisher skos:prefLabel ?distLabel .\n" . |
|
958 | - " $distinguishercondLabel\n" . |
|
959 | - " }\n" . |
|
960 | - " OPTIONAL {\n" . |
|
961 | - " ?distinguisher rdfs:label ?distLabel .\n" . |
|
962 | - " $distinguishercondLabel\n" . |
|
963 | - " }\n" . |
|
952 | + "OPTIONAL {\n". |
|
953 | + " ?s skos:prefLabel ?label . ?s2 skos:prefLabel ?label . FILTER(?s2 != ?s)\n". |
|
954 | + " ?s $distinguisher ?distinguisher.\n". |
|
955 | + " FILTER (!isLiteral(?distinguisher) || (LANG(?distinguisher) = LANG(?label)))". |
|
956 | + " OPTIONAL {\n". |
|
957 | + " ?distinguisher skos:prefLabel ?distLabel .\n". |
|
958 | + " $distinguishercondLabel\n". |
|
959 | + " }\n". |
|
960 | + " OPTIONAL {\n". |
|
961 | + " ?distinguisher rdfs:label ?distLabel .\n". |
|
962 | + " $distinguishercondLabel\n". |
|
963 | + " }\n". |
|
964 | 964 | "} BIND(COALESCE(?distLabel,STR(?distinguisher)) AS ?distcoal) " : ""; |
965 | 965 | |
966 | 966 | /* |
@@ -1033,20 +1033,20 @@ discard block |
||
1033 | 1033 | $schemecond = ''; |
1034 | 1034 | if (!empty($schemes)) { |
1035 | 1035 | $conditions = array(); |
1036 | - foreach($schemes as $scheme) { |
|
1036 | + foreach ($schemes as $scheme) { |
|
1037 | 1037 | $conditions[] = "{?s skos:inScheme <$scheme>}"; |
1038 | 1038 | } |
1039 | - $schemecond = '{'.implode(" UNION ",$conditions).'}'; |
|
1039 | + $schemecond = '{'.implode(" UNION ", $conditions).'}'; |
|
1040 | 1040 | } |
1041 | - $filterDeprecated=""; |
|
1041 | + $filterDeprecated = ""; |
|
1042 | 1042 | //show or hide deprecated concepts |
1043 | - if(!$showDeprecated){ |
|
1044 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1043 | + if (!$showDeprecated) { |
|
1044 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1045 | 1045 | } |
1046 | 1046 | // extra conditions for parent and group, if specified |
1047 | - $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : ""; |
|
1048 | - $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : ""; |
|
1049 | - $pgcond = $parentcond . $groupcond; |
|
1047 | + $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : ""; |
|
1048 | + $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : ""; |
|
1049 | + $pgcond = $parentcond.$groupcond; |
|
1050 | 1050 | |
1051 | 1051 | $orderextra = $this->isDefaultEndpoint() ? $this->graph : ''; |
1052 | 1052 | |
@@ -1135,9 +1135,9 @@ discard block |
||
1135 | 1135 | $hit['type'][] = $this->shortenUri($typeuri); |
1136 | 1136 | } |
1137 | 1137 | |
1138 | - if(!empty($fields)) { |
|
1138 | + if (!empty($fields)) { |
|
1139 | 1139 | foreach ($fields as $prop) { |
1140 | - $propname = $prop . 's'; |
|
1140 | + $propname = $prop.'s'; |
|
1141 | 1141 | if (isset($row->$propname)) { |
1142 | 1142 | foreach (explode("\n", $row->$propname->getValue()) as $line) { |
1143 | 1143 | $rdata = str_getcsv($line, ',', '"', '"'); |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | $propvals = $rdata[2]; |
1153 | 1153 | } |
1154 | 1154 | |
1155 | - $hit['skos:' . $prop][] = $propvals; |
|
1155 | + $hit['skos:'.$prop][] = $propvals; |
|
1156 | 1156 | } |
1157 | 1157 | } |
1158 | 1158 | } |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | * @return array query result object |
1233 | 1233 | */ |
1234 | 1234 | public function queryConcepts($vocabs, $fields, $unique, $params, $showDeprecated = false) { |
1235 | - $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated); |
|
1235 | + $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated); |
|
1236 | 1236 | $results = $this->query($query); |
1237 | 1237 | return $this->transformConceptSearchResults($results, $vocabs, $fields); |
1238 | 1238 | } |
@@ -1287,10 +1287,10 @@ discard block |
||
1287 | 1287 | $conditions = $this->formatFilterConditions($letter, $lang); |
1288 | 1288 | $filtercondLabel = $conditions['filterpref']; |
1289 | 1289 | $filtercondALabel = $conditions['filteralt']; |
1290 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
1291 | - $filterDeprecated=""; |
|
1292 | - if(!$showDeprecated){ |
|
1293 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1290 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
1291 | + $filterDeprecated = ""; |
|
1292 | + if (!$showDeprecated) { |
|
1293 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1294 | 1294 | } |
1295 | 1295 | $query = <<<EOQ |
1296 | 1296 | SELECT DISTINCT ?s ?label ?alabel ?qualifier |
@@ -1767,7 +1767,7 @@ discard block |
||
1767 | 1767 | if (!isset($row->label) || $row->label->getLang() === $lang) { |
1768 | 1768 | $ret[$row->object->getUri()] = $val; |
1769 | 1769 | } elseif ($row->label->getLang() === $fallbacklang) { |
1770 | - $val['label'] .= ' (' . $row->label->getLang() . ')'; |
|
1770 | + $val['label'] .= ' ('.$row->label->getLang().')'; |
|
1771 | 1771 | $ret[$row->object->getUri()] = $val; |
1772 | 1772 | } |
1773 | 1773 | } |
@@ -1863,10 +1863,10 @@ discard block |
||
1863 | 1863 | |
1864 | 1864 | $label = null; |
1865 | 1865 | if (isset($row->label)) { |
1866 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
1866 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
1867 | 1867 | $label = $row->label->getValue(); |
1868 | 1868 | } else { |
1869 | - $label = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
1869 | + $label = $row->label->getValue()." (".$row->label->getLang().")"; |
|
1870 | 1870 | } |
1871 | 1871 | |
1872 | 1872 | } |
@@ -1942,8 +1942,8 @@ discard block |
||
1942 | 1942 | foreach ($result as $row) { |
1943 | 1943 | if (isset($row->top) && isset($row->label)) { |
1944 | 1944 | $label = $row->label->getValue(); |
1945 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
1946 | - $label .= ' (' . $row->label->getLang() . ')'; |
|
1945 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
1946 | + $label .= ' ('.$row->label->getLang().')'; |
|
1947 | 1947 | } |
1948 | 1948 | $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN)); |
1949 | 1949 | if (isset($row->notation)) { |
@@ -2036,7 +2036,7 @@ discard block |
||
2036 | 2036 | $ret[$uri]['exact'] = $row->exact->getUri(); |
2037 | 2037 | } |
2038 | 2038 | if (isset($row->tops)) { |
2039 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
2039 | + $topConceptsList = explode(" ", $row->tops->getValue()); |
|
2040 | 2040 | // sort to guarantee an alphabetical ordering of the URI |
2041 | 2041 | sort($topConceptsList); |
2042 | 2042 | $ret[$uri]['tops'] = $topConceptsList; |
@@ -2049,8 +2049,8 @@ discard block |
||
2049 | 2049 | $label = null; |
2050 | 2050 | if (isset($row->childlabel)) { |
2051 | 2051 | $label = $row->childlabel->getValue(); |
2052 | - if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) { |
|
2053 | - $label .= " (" . $row->childlabel->getLang() . ")"; |
|
2052 | + if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) { |
|
2053 | + $label .= " (".$row->childlabel->getLang().")"; |
|
2054 | 2054 | } |
2055 | 2055 | |
2056 | 2056 | } |
@@ -2071,8 +2071,8 @@ discard block |
||
2071 | 2071 | } |
2072 | 2072 | if (isset($row->label)) { |
2073 | 2073 | $preflabel = $row->label->getValue(); |
2074 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
2075 | - $preflabel .= ' (' . $row->label->getLang() . ')'; |
|
2074 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
2075 | + $preflabel .= ' ('.$row->label->getLang().')'; |
|
2076 | 2076 | } |
2077 | 2077 | |
2078 | 2078 | $ret[$uri]['prefLabel'] = $preflabel; |
@@ -2193,9 +2193,9 @@ discard block |
||
2193 | 2193 | */ |
2194 | 2194 | private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) { |
2195 | 2195 | $fcl = $this->generateFromClause(); |
2196 | - $filterDeprecated=""; |
|
2197 | - if(!$showDeprecated){ |
|
2198 | - $filterDeprecated=" FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2196 | + $filterDeprecated = ""; |
|
2197 | + if (!$showDeprecated) { |
|
2198 | + $filterDeprecated = " FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2199 | 2199 | } |
2200 | 2200 | $query = <<<EOQ |
2201 | 2201 | SELECT ?conc ?super ?label ?members ?type ?notation $fcl |
@@ -2234,10 +2234,10 @@ discard block |
||
2234 | 2234 | 'type' => array($row->type->shorten()), |
2235 | 2235 | ); |
2236 | 2236 | if (isset($row->label)) { |
2237 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
2237 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
2238 | 2238 | $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue(); |
2239 | 2239 | } else { |
2240 | - $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
2240 | + $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")"; |
|
2241 | 2241 | } |
2242 | 2242 | |
2243 | 2243 | } |
@@ -2265,8 +2265,8 @@ discard block |
||
2265 | 2265 | * @param boolean $showDeprecated whether to include deprecated concepts in search results |
2266 | 2266 | * @return array Result array with concept URI as key and concept label as value |
2267 | 2267 | */ |
2268 | - public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) { |
|
2269 | - $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated); |
|
2268 | + public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) { |
|
2269 | + $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated); |
|
2270 | 2270 | $result = $this->query($query); |
2271 | 2271 | return $this->transformConceptGroupContentsResults($result, $lang); |
2272 | 2272 | } |
@@ -2281,9 +2281,9 @@ discard block |
||
2281 | 2281 | * @param int $cutoffYears amount of years to consider past current date |
2282 | 2282 | * @return string sparql query |
2283 | 2283 | */ |
2284 | - private function generateChangeListQuery($prop, $lang, $offset, $limit=200, $showDeprecated=false, $cutoffYears=1) { |
|
2284 | + private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false, $cutoffYears = 1) { |
|
2285 | 2285 | $fcl = $this->generateFromClause(); |
2286 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
2286 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
2287 | 2287 | |
2288 | 2288 | // only consider concepts changed within 1 year from today |
2289 | 2289 | $date = new DateTime(); |
@@ -2386,7 +2386,7 @@ discard block |
||
2386 | 2386 | * @param int $cutoffYears amount of years to consider past current date |
2387 | 2387 | * @return array Result array |
2388 | 2388 | */ |
2389 | - public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated=false, $cutoffYears=1) { |
|
2389 | + public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false, $cutoffYears = 1) { |
|
2390 | 2390 | $query = $this->generateChangeListQuery($prop, $lang, $offset, $limit, $showDeprecated, $cutoffYears); |
2391 | 2391 | |
2392 | 2392 | $result = $this->query($query); |