@@ -84,7 +84,7 @@ |
||
84 | 84 | foreach (explode(' ', GLOBAL_PLUGINS) as $pluginName) { |
85 | 85 | $globalPluginsArray[] = "\"$pluginName\""; |
86 | 86 | } |
87 | - $globalPlugins = " " . implode(', ', $globalPluginsArray) . " "; |
|
87 | + $globalPlugins = " ".implode(', ', $globalPluginsArray)." "; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | # print the prefixes |
@@ -517,13 +517,13 @@ |
||
517 | 517 | |
518 | 518 | $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, ''); |
519 | 519 | |
520 | - if($envLangLabels) { |
|
521 | - $proplabel = $envLangLabels[$this->getEnvLang()]; |
|
520 | + if($envLangLabels) { |
|
521 | + $proplabel = $envLangLabels[$this->getEnvLang()]; |
|
522 | 522 | } else { |
523 | - if($defaultPropLabel) { |
|
524 | - $proplabel = $defaultPropLabel['']; |
|
525 | - } |
|
526 | - } |
|
523 | + if($defaultPropLabel) { |
|
524 | + $proplabel = $defaultPropLabel['']; |
|
525 | + } |
|
526 | + } |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | // look for superproperties in the current graph |
@@ -312,8 +312,7 @@ discard block |
||
312 | 312 | foreach ($res->propertyUris() as $prop) { |
313 | 313 | $this->addPropertyValues($res, $prop, $seen); |
314 | 314 | } |
315 | - } |
|
316 | - else { |
|
315 | + } else { |
|
317 | 316 | foreach ($props as $prop) { |
318 | 317 | if ($res->hasProperty($prop)) { |
319 | 318 | $this->addPropertyValues($res, $prop, $seen); |
@@ -678,7 +677,9 @@ discard block |
||
678 | 677 | $subPrefLabelProps = $this->graph->resourcesMatching('rdfs:subPropertyOf', $prefLabelProp); |
679 | 678 | foreach ($subPrefLabelProps as $subPrefLabelProp) { |
680 | 679 | // return the first available translation |
681 | - if ($subPrefLabelProp->label($lang)) return $subPrefLabelProp->label($lang); |
|
680 | + if ($subPrefLabelProp->label($lang)) { |
|
681 | + return $subPrefLabelProp->label($lang); |
|
682 | + } |
|
682 | 683 | } |
683 | 684 | return null; |
684 | 685 | } |
@@ -909,8 +910,7 @@ discard block |
||
909 | 910 | if (!in_array($vocabUriSpace, $context, true)) { |
910 | 911 | if (!isset($context[$vocabPrefix])) { |
911 | 912 | $context[$vocabPrefix] = $vocabUriSpace; |
912 | - } |
|
913 | - else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
|
913 | + } else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
|
914 | 914 | $i = 2; |
915 | 915 | while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) { |
916 | 916 | $i += 1; |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | return $this->resource->label($fallback); |
143 | 143 | } |
144 | 144 | // We need to check all the labels in case one of them matches a subtag of the current language |
145 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
145 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
146 | 146 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
147 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
147 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
148 | 148 | return EasyRdf\Literal::create($label, $fallback); |
149 | 149 | } |
150 | 150 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function getXlLabel() |
173 | 173 | { |
174 | 174 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
175 | - foreach($labels as $labres) { |
|
175 | + foreach ($labels as $labres) { |
|
176 | 176 | $label = $labres->getLiteral('skosxl:literalForm'); |
177 | 177 | if ($label !== null && $label->getLang() == $this->clang) { |
178 | 178 | return new LabelSkosXL($this->model, $labres); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // catch external subjects that have $res as object |
280 | 280 | $extSubjects = $exGraph->resourcesMatching("schema:about", $res); |
281 | 281 | |
282 | - $propList = array_unique(array_merge( |
|
282 | + $propList = array_unique(array_merge( |
|
283 | 283 | $this->DEFAULT_EXT_PROPERTIES, |
284 | 284 | $this->getVocab()->getConfig()->getExtProperties(), |
285 | 285 | $this->getVocab()->getConfig()->getPluginRegister()->getExtProperties() |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param string[] $seen Processed resources so far |
305 | 305 | * @param string[] $props (optional) limit to these property URIs |
306 | 306 | */ |
307 | - private function addExternalTriplesToGraph($res, &$seen, $props=null) |
|
307 | + private function addExternalTriplesToGraph($res, &$seen, $props = null) |
|
308 | 308 | { |
309 | 309 | if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) { |
310 | 310 | return; |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | private function addPropertyValues($res, $prop, &$seen) |
336 | 336 | { |
337 | - $resList = $res->allResources('<' . $prop . '>'); |
|
337 | + $resList = $res->allResources('<'.$prop.'>'); |
|
338 | 338 | |
339 | 339 | foreach ($resList as $res2) { |
340 | 340 | if ($res2->isBNode()) { |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $this->addResourceReifications($res, $prop, $res2, $seen); |
345 | 345 | } |
346 | 346 | |
347 | - $litList = $res->allLiterals('<' . $prop . '>'); |
|
347 | + $litList = $res->allLiterals('<'.$prop.'>'); |
|
348 | 348 | |
349 | 349 | foreach ($litList as $lit) { |
350 | 350 | $this->graph->addLiteral($res, $prop, $lit); |
@@ -532,15 +532,15 @@ discard block |
||
532 | 532 | // if not found in current vocabulary, look up in the default graph to be able |
533 | 533 | // to read an ontology loaded in a separate graph |
534 | 534 | // note that this imply that the property has an rdf:type declared for the query to work |
535 | - if(!$is_well_known && !$proplabel) { |
|
535 | + if (!$is_well_known && !$proplabel) { |
|
536 | 536 | $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang()); |
537 | 537 | |
538 | 538 | $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, ''); |
539 | 539 | |
540 | - if($envLangLabels) { |
|
540 | + if ($envLangLabels) { |
|
541 | 541 | $proplabel = $envLangLabels[$this->getEnvLang()]; |
542 | 542 | } else { |
543 | - if($defaultPropLabel) { |
|
543 | + if ($defaultPropLabel) { |
|
544 | 544 | $proplabel = $defaultPropLabel['']; |
545 | 545 | } |
546 | 546 | } |
@@ -553,12 +553,12 @@ discard block |
||
553 | 553 | } |
554 | 554 | |
555 | 555 | // also look up superprops in the default graph if not found in current vocabulary |
556 | - if(!$is_well_known && (!$superprops || empty($superprops))) { |
|
556 | + if (!$is_well_known && (!$superprops || empty($superprops))) { |
|
557 | 557 | $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri); |
558 | 558 | } |
559 | 559 | |
560 | 560 | // we're reading only one super property, even if there are multiple ones |
561 | - $superprop = ($superprops)?$superprops[0]:null; |
|
561 | + $superprop = ($superprops) ? $superprops[0] : null; |
|
562 | 562 | if ($superprop) { |
563 | 563 | $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop; |
564 | 564 | } |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | } |
572 | 572 | |
573 | 573 | // searching for subproperties of literals too |
574 | - if($superprops) { |
|
574 | + if ($superprops) { |
|
575 | 575 | foreach ($superprops as $subi) { |
576 | 576 | $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi; |
577 | 577 | $duplicates[$suburi] = $prop; |
@@ -732,14 +732,14 @@ discard block |
||
732 | 732 | |
733 | 733 | // making a human readable string from the timestamps |
734 | 734 | if ($created != '') { |
735 | - $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short', $this->getEnvLang())); |
|
735 | + $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short', $this->getEnvLang())); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | if ($modified != '') { |
739 | 739 | if ($created != '') { |
740 | - $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
740 | + $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
741 | 741 | } else { |
742 | - $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
742 | + $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | } |
@@ -747,12 +747,12 @@ discard block |
||
747 | 747 | trigger_error($e->getMessage(), E_USER_WARNING); |
748 | 748 | $ret = ''; |
749 | 749 | if ($this->resource->get('dc:modified')) { |
750 | - $modified = (string) $this->resource->get('dc:modified'); |
|
751 | - $ret = gettext('skosmos:modified') . ' ' . $modified; |
|
750 | + $modified = (string)$this->resource->get('dc:modified'); |
|
751 | + $ret = gettext('skosmos:modified').' '.$modified; |
|
752 | 752 | } |
753 | 753 | if ($this->resource->get('dc:created')) { |
754 | - $created .= (string) $this->resource->get('dc:created'); |
|
755 | - $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
|
754 | + $created .= (string)$this->resource->get('dc:created'); |
|
755 | + $ret .= ' '.gettext('skosmos:created').' '.$created; |
|
756 | 756 | } |
757 | 757 | } |
758 | 758 | return $ret; |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | $groups[$collLabel] = array($group); |
825 | 825 | |
826 | 826 | $res = $collection; |
827 | - while($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
827 | + while ($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
828 | 828 | foreach ($super as $res) { |
829 | 829 | $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang); |
830 | 830 | array_unshift($groups[$collLabel], $superprop); |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | foreach ($labels as $lit) { |
871 | 871 | // filtering away subsets of the current language eg. en vs en-GB |
872 | 872 | $langCode = strval($lit->getLang()); |
873 | - if ($langCode != $this->clang && strpos($langCode, $this->getEnvLang() . '-') !== 0) { |
|
873 | + if ($langCode != $this->clang && strpos($langCode, $this->getEnvLang().'-') !== 0) { |
|
874 | 874 | $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop); |
875 | 875 | } |
876 | 876 | } |
@@ -961,10 +961,10 @@ discard block |
||
961 | 961 | } |
962 | 962 | else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
963 | 963 | $i = 2; |
964 | - while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) { |
|
964 | + while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) { |
|
965 | 965 | $i += 1; |
966 | 966 | } |
967 | - $context[$vocabPrefix . $i] = $vocabUriSpace; |
|
967 | + $context[$vocabPrefix.$i] = $vocabUriSpace; |
|
968 | 968 | } |
969 | 969 | } |
970 | 970 | $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context)); |
@@ -30,14 +30,14 @@ |
||
30 | 30 | $url = $baseurl . "$vocid/"; |
31 | 31 | } else { |
32 | 32 | |
33 | - if ($localname !== $uri && $localname === urlencode($localname)) { |
|
34 | - // the URI can be shortened |
|
33 | + if ($localname !== $uri && $localname === urlencode($localname)) { |
|
34 | + // the URI can be shortened |
|
35 | 35 | $url = $baseurl . "$vocid/page/$localname"; |
36 | 36 | } else { |
37 | 37 | // must use full URI |
38 | - $query = http_build_query(array('uri'=>$uri)); |
|
38 | + $query = http_build_query(array('uri'=>$uri)); |
|
39 | 39 | $url = $baseurl . "$vocid/page/?" . $query; |
40 | - } |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | $this->redirect303($url); |
43 | 43 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $baseurl = $this->getBaseHref(); |
17 | 17 | $vocid = $vocab->getId(); |
18 | 18 | $query = http_build_query(array('uri'=>$uri, 'format'=>$targetFormat)); |
19 | - $url = $baseurl . "rest/v1/$vocid/data?$query"; |
|
19 | + $url = $baseurl."rest/v1/$vocid/data?$query"; |
|
20 | 20 | $this->redirect303($url); |
21 | 21 | } |
22 | 22 | |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | $localname = $vocab->getLocalName($uri); |
28 | 28 | |
29 | 29 | if (!$localname) { |
30 | - $url = $baseurl . "$vocid/"; |
|
30 | + $url = $baseurl."$vocid/"; |
|
31 | 31 | } else { |
32 | 32 | |
33 | 33 | if ($localname !== $uri && $localname === urlencode($localname)) { |
34 | 34 | // the URI can be shortened |
35 | - $url = $baseurl . "$vocid/page/$localname"; |
|
35 | + $url = $baseurl."$vocid/page/$localname"; |
|
36 | 36 | } else { |
37 | 37 | // must use full URI |
38 | 38 | $query = http_build_query(array('uri'=>$uri)); |
39 | - $url = $baseurl . "$vocid/page/?" . $query; |
|
39 | + $url = $baseurl."$vocid/page/?".$query; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | $this->redirect303($url); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // guess vocabulary based on URI |
58 | 58 | $vocab = $this->model->guessVocabularyFromURI($request->getUri()); |
59 | 59 | if ($vocab === null) { |
60 | - return $this->returnError('404', 'Not Found', 'Unrecognized URI ' . $request->getUri()); |
|
60 | + return $this->returnError('404', 'Not Found', 'Unrecognized URI '.$request->getUri()); |
|
61 | 61 | } |
62 | 62 | $request->setVocab($vocab->getId()); |
63 | 63 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $opts = array('http' => array('method'=>'HEAD', |
14 | 14 | 'user_agent' => 'Skosmos', |
15 | 15 | 'timeout' => $timeout)); |
16 | - $context = stream_context_create($opts); |
|
16 | + $context = stream_context_create($opts); |
|
17 | 17 | $fd = fopen($this->uri, 'rb', false, $context); |
18 | 18 | $headers = stream_get_meta_data($fd)['wrapper_data']; |
19 | 19 | foreach ($headers as $header) { |
@@ -47,12 +47,16 @@ discard block |
||
47 | 47 | $this->client = new EasyRdf\Sparql\Client($endpoint); |
48 | 48 | |
49 | 49 | // set graphClause so that it can be used by all queries |
50 | - if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable) |
|
50 | + if ($this->isDefaultEndpoint()) { |
|
51 | + // default endpoint; query any graph (and catch it in a variable) |
|
51 | 52 | { |
52 | 53 | $this->graphClause = "GRAPH $graph"; |
53 | - } elseif ($graph !== null) // query a specific graph |
|
54 | + } |
|
55 | + } elseif ($graph !== null) { |
|
56 | + // query a specific graph |
|
54 | 57 | { |
55 | 58 | $this->graphClause = "GRAPH <$graph>"; |
59 | + } |
|
56 | 60 | } else // query the default graph |
57 | 61 | { |
58 | 62 | $this->graphClause = ""; |
@@ -1274,8 +1278,7 @@ discard block |
||
1274 | 1278 | if (isset($row->qualifier)) { |
1275 | 1279 | if ($row->qualifier instanceof EasyRdf\Literal) { |
1276 | 1280 | $hit['qualifier'] = $row->qualifier->getValue(); |
1277 | - } |
|
1278 | - else { |
|
1281 | + } else { |
|
1279 | 1282 | $hit['qualifier'] = $row->qualifier->localName(); |
1280 | 1283 | } |
1281 | 1284 | } |
@@ -1955,8 +1958,7 @@ discard block |
||
1955 | 1958 | if (sizeof($ret) > 0) { |
1956 | 1959 | // existing concept, with children |
1957 | 1960 | return $ret; |
1958 | - } |
|
1959 | - else { |
|
1961 | + } else { |
|
1960 | 1962 | // nonexistent concept |
1961 | 1963 | return null; |
1962 | 1964 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param string $query |
67 | 67 | * @return string |
68 | - */ |
|
68 | + */ |
|
69 | 69 | protected function generateQueryPrefixes($query) |
70 | 70 | { |
71 | 71 | // Check for undefined prefixes |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | $gcl = $this->graphClause; |
234 | 234 | $classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept'); |
235 | 235 | |
236 | - $quote_string = function($val) { return "'$val'"; }; |
|
237 | - $quoted_values = array_map($quote_string, $langs); |
|
238 | - $langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))"; |
|
236 | + $quote_string = function($val) { return "'$val'"; }; |
|
237 | + $quoted_values = array_map($quote_string, $langs); |
|
238 | + $langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))"; |
|
239 | 239 | |
240 | 240 | $values = $this->formatValues('?type', $classes, 'uri'); |
241 | 241 | $valuesProp = $this->formatValues('?prop', $props, null); |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | return $query; |
963 | 963 | } |
964 | 964 | /** |
965 | - * This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses |
|
965 | + * This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses |
|
966 | 966 | * @param string $lang |
967 | 967 | * @return string formatted language clause |
968 | 968 | */ |
@@ -1911,7 +1911,7 @@ discard block |
||
1911 | 1911 | |
1912 | 1912 | /** |
1913 | 1913 | * Generates a sparql query for finding the hierarchy for a concept. |
1914 | - * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal. |
|
1914 | + * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal. |
|
1915 | 1915 | * @param string $uri concept uri. |
1916 | 1916 | * @param string $lang |
1917 | 1917 | * @param string $fallback language to use if label is not available in the preferred language |
@@ -1988,10 +1988,10 @@ discard block |
||
1988 | 1988 | $ret[$uri]['exact'] = $row->exact->getUri(); |
1989 | 1989 | } |
1990 | 1990 | if (isset($row->tops)) { |
1991 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
1992 | - // sort to guarantee an alphabetical ordering of the URI |
|
1993 | - sort($topConceptsList); |
|
1994 | - $ret[$uri]['tops'] = $topConceptsList; |
|
1991 | + $topConceptsList=explode(" ", $row->tops->getValue()); |
|
1992 | + // sort to guarantee an alphabetical ordering of the URI |
|
1993 | + sort($topConceptsList); |
|
1994 | + $ret[$uri]['tops'] = $topConceptsList; |
|
1995 | 1995 | } |
1996 | 1996 | if (isset($row->children)) { |
1997 | 1997 | if (!isset($ret[$uri]['narrower'])) { |
@@ -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,30 +936,30 @@ 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 | - " OPTIONAL {\n" . |
|
956 | - " ?distinguisher skos:prefLabel ?distLabel .\n" . |
|
957 | - " $distinguishercondLabel\n" . |
|
958 | - " }\n" . |
|
959 | - " OPTIONAL {\n" . |
|
960 | - " ?distinguisher rdfs:label ?distLabel .\n" . |
|
961 | - " $distinguishercondLabel\n" . |
|
962 | - " }\n" . |
|
952 | + "OPTIONAL {\n". |
|
953 | + " ?s skos:prefLabel ?label . ?s2 skos:prefLabel ?label . FILTER(?s2 != ?s)\n". |
|
954 | + " ?s $distinguisher ?distinguisher.\n". |
|
955 | + " OPTIONAL {\n". |
|
956 | + " ?distinguisher skos:prefLabel ?distLabel .\n". |
|
957 | + " $distinguishercondLabel\n". |
|
958 | + " }\n". |
|
959 | + " OPTIONAL {\n". |
|
960 | + " ?distinguisher rdfs:label ?distLabel .\n". |
|
961 | + " $distinguishercondLabel\n". |
|
962 | + " }\n". |
|
963 | 963 | "} BIND(COALESCE(?distLabel,STR(?distinguisher)) AS ?distcoal) " : ""; |
964 | 964 | |
965 | 965 | /* |
@@ -1032,20 +1032,20 @@ discard block |
||
1032 | 1032 | $schemecond = ''; |
1033 | 1033 | if (!empty($schemes)) { |
1034 | 1034 | $conditions = array(); |
1035 | - foreach($schemes as $scheme) { |
|
1035 | + foreach ($schemes as $scheme) { |
|
1036 | 1036 | $conditions[] = "{?s skos:inScheme <$scheme>}"; |
1037 | 1037 | } |
1038 | - $schemecond = '{'.implode(" UNION ",$conditions).'}'; |
|
1038 | + $schemecond = '{'.implode(" UNION ", $conditions).'}'; |
|
1039 | 1039 | } |
1040 | - $filterDeprecated=""; |
|
1040 | + $filterDeprecated = ""; |
|
1041 | 1041 | //show or hide deprecated concepts |
1042 | - if(!$showDeprecated){ |
|
1043 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1042 | + if (!$showDeprecated) { |
|
1043 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1044 | 1044 | } |
1045 | 1045 | // extra conditions for parent and group, if specified |
1046 | - $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : ""; |
|
1047 | - $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : ""; |
|
1048 | - $pgcond = $parentcond . $groupcond; |
|
1046 | + $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : ""; |
|
1047 | + $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : ""; |
|
1048 | + $pgcond = $parentcond.$groupcond; |
|
1049 | 1049 | |
1050 | 1050 | $orderextra = $this->isDefaultEndpoint() ? $this->graph : ''; |
1051 | 1051 | |
@@ -1134,9 +1134,9 @@ discard block |
||
1134 | 1134 | $hit['type'][] = $this->shortenUri($typeuri); |
1135 | 1135 | } |
1136 | 1136 | |
1137 | - if(!empty($fields)) { |
|
1137 | + if (!empty($fields)) { |
|
1138 | 1138 | foreach ($fields as $prop) { |
1139 | - $propname = $prop . 's'; |
|
1139 | + $propname = $prop.'s'; |
|
1140 | 1140 | if (isset($row->$propname)) { |
1141 | 1141 | foreach (explode("\n", $row->$propname->getValue()) as $line) { |
1142 | 1142 | $rdata = str_getcsv($line, ',', '"', '"'); |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | $propvals = $rdata[2]; |
1152 | 1152 | } |
1153 | 1153 | |
1154 | - $hit['skos:' . $prop][] = $propvals; |
|
1154 | + $hit['skos:'.$prop][] = $propvals; |
|
1155 | 1155 | } |
1156 | 1156 | } |
1157 | 1157 | } |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | * @return array query result object |
1232 | 1232 | */ |
1233 | 1233 | public function queryConcepts($vocabs, $fields, $unique, $params, $showDeprecated = false) { |
1234 | - $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated); |
|
1234 | + $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated); |
|
1235 | 1235 | $results = $this->query($query); |
1236 | 1236 | return $this->transformConceptSearchResults($results, $vocabs, $fields); |
1237 | 1237 | } |
@@ -1286,10 +1286,10 @@ discard block |
||
1286 | 1286 | $conditions = $this->formatFilterConditions($letter, $lang); |
1287 | 1287 | $filtercondLabel = $conditions['filterpref']; |
1288 | 1288 | $filtercondALabel = $conditions['filteralt']; |
1289 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
1290 | - $filterDeprecated=""; |
|
1291 | - if(!$showDeprecated){ |
|
1292 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1289 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
1290 | + $filterDeprecated = ""; |
|
1291 | + if (!$showDeprecated) { |
|
1292 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1293 | 1293 | } |
1294 | 1294 | $query = <<<EOQ |
1295 | 1295 | SELECT DISTINCT ?s ?label ?alabel ?qualifier |
@@ -1766,7 +1766,7 @@ discard block |
||
1766 | 1766 | if (!isset($row->label) || $row->label->getLang() === $lang) { |
1767 | 1767 | $ret[$row->object->getUri()] = $val; |
1768 | 1768 | } elseif ($row->label->getLang() === $fallbacklang) { |
1769 | - $val['label'] .= ' (' . $row->label->getLang() . ')'; |
|
1769 | + $val['label'] .= ' ('.$row->label->getLang().')'; |
|
1770 | 1770 | $ret[$row->object->getUri()] = $val; |
1771 | 1771 | } |
1772 | 1772 | } |
@@ -1862,10 +1862,10 @@ discard block |
||
1862 | 1862 | |
1863 | 1863 | $label = null; |
1864 | 1864 | if (isset($row->label)) { |
1865 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
1865 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
1866 | 1866 | $label = $row->label->getValue(); |
1867 | 1867 | } else { |
1868 | - $label = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
1868 | + $label = $row->label->getValue()." (".$row->label->getLang().")"; |
|
1869 | 1869 | } |
1870 | 1870 | |
1871 | 1871 | } |
@@ -1941,8 +1941,8 @@ discard block |
||
1941 | 1941 | foreach ($result as $row) { |
1942 | 1942 | if (isset($row->top) && isset($row->label)) { |
1943 | 1943 | $label = $row->label->getValue(); |
1944 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
1945 | - $label .= ' (' . $row->label->getLang() . ')'; |
|
1944 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
1945 | + $label .= ' ('.$row->label->getLang().')'; |
|
1946 | 1946 | } |
1947 | 1947 | $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN)); |
1948 | 1948 | if (isset($row->notation)) { |
@@ -2035,7 +2035,7 @@ discard block |
||
2035 | 2035 | $ret[$uri]['exact'] = $row->exact->getUri(); |
2036 | 2036 | } |
2037 | 2037 | if (isset($row->tops)) { |
2038 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
2038 | + $topConceptsList = explode(" ", $row->tops->getValue()); |
|
2039 | 2039 | // sort to guarantee an alphabetical ordering of the URI |
2040 | 2040 | sort($topConceptsList); |
2041 | 2041 | $ret[$uri]['tops'] = $topConceptsList; |
@@ -2048,8 +2048,8 @@ discard block |
||
2048 | 2048 | $label = null; |
2049 | 2049 | if (isset($row->childlabel)) { |
2050 | 2050 | $label = $row->childlabel->getValue(); |
2051 | - if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) { |
|
2052 | - $label .= " (" . $row->childlabel->getLang() . ")"; |
|
2051 | + if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) { |
|
2052 | + $label .= " (".$row->childlabel->getLang().")"; |
|
2053 | 2053 | } |
2054 | 2054 | |
2055 | 2055 | } |
@@ -2070,8 +2070,8 @@ discard block |
||
2070 | 2070 | } |
2071 | 2071 | if (isset($row->label)) { |
2072 | 2072 | $preflabel = $row->label->getValue(); |
2073 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
2074 | - $preflabel .= ' (' . $row->label->getLang() . ')'; |
|
2073 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
2074 | + $preflabel .= ' ('.$row->label->getLang().')'; |
|
2075 | 2075 | } |
2076 | 2076 | |
2077 | 2077 | $ret[$uri]['prefLabel'] = $preflabel; |
@@ -2192,9 +2192,9 @@ discard block |
||
2192 | 2192 | */ |
2193 | 2193 | private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) { |
2194 | 2194 | $fcl = $this->generateFromClause(); |
2195 | - $filterDeprecated=""; |
|
2196 | - if(!$showDeprecated){ |
|
2197 | - $filterDeprecated=" FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2195 | + $filterDeprecated = ""; |
|
2196 | + if (!$showDeprecated) { |
|
2197 | + $filterDeprecated = " FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2198 | 2198 | } |
2199 | 2199 | $query = <<<EOQ |
2200 | 2200 | SELECT ?conc ?super ?label ?members ?type ?notation $fcl |
@@ -2233,10 +2233,10 @@ discard block |
||
2233 | 2233 | 'type' => array($row->type->shorten()), |
2234 | 2234 | ); |
2235 | 2235 | if (isset($row->label)) { |
2236 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
2236 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
2237 | 2237 | $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue(); |
2238 | 2238 | } else { |
2239 | - $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
2239 | + $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")"; |
|
2240 | 2240 | } |
2241 | 2241 | |
2242 | 2242 | } |
@@ -2264,8 +2264,8 @@ discard block |
||
2264 | 2264 | * @param boolean $showDeprecated whether to include deprecated concepts in search results |
2265 | 2265 | * @return array Result array with concept URI as key and concept label as value |
2266 | 2266 | */ |
2267 | - public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) { |
|
2268 | - $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated); |
|
2267 | + public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) { |
|
2268 | + $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated); |
|
2269 | 2269 | $result = $this->query($query); |
2270 | 2270 | return $this->transformConceptGroupContentsResults($result, $lang); |
2271 | 2271 | } |
@@ -2279,9 +2279,9 @@ discard block |
||
2279 | 2279 | * @param boolean $showDeprecated whether to include deprecated concepts in the change list |
2280 | 2280 | * @return string sparql query |
2281 | 2281 | */ |
2282 | - private function generateChangeListQuery($prop, $lang, $offset, $limit=200, $showDeprecated=false) { |
|
2282 | + private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false) { |
|
2283 | 2283 | $fcl = $this->generateFromClause(); |
2284 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
2284 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
2285 | 2285 | |
2286 | 2286 | //Additional clauses when deprecated concepts need to be included in the results |
2287 | 2287 | $deprecatedOptions = ''; |
@@ -2359,7 +2359,7 @@ discard block |
||
2359 | 2359 | * @param boolean $showDeprecated whether to include deprecated concepts in the change list |
2360 | 2360 | * @return array Result array |
2361 | 2361 | */ |
2362 | - public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated=false) { |
|
2362 | + public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false) { |
|
2363 | 2363 | $query = $this->generateChangeListQuery($prop, $lang, $offset, $limit, $showDeprecated); |
2364 | 2364 | |
2365 | 2365 | $result = $this->query($query); |
@@ -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 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @return string sparql order by clause |
93 | 93 | */ |
94 | 94 | private function formatOrderBy($expression, $lang) { |
95 | - if(!$this->model->getConfig()->getCollationEnabled()) { |
|
95 | + if (!$this->model->getConfig()->getCollationEnabled()) { |
|
96 | 96 | return $expression; |
97 | 97 | } |
98 | 98 | $orderby = sprintf('arq:collation(\'%2$s\', %1$s)', $expression, $lang); |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | # make text query clause |
127 | 127 | $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe |
128 | 128 | $langClause = $this->generateLangClause($lang); |
129 | - $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $langClause); |
|
130 | - $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $langClause); |
|
131 | - $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang) . " STR(?s) LCASE(STR(?qualifier))"; |
|
129 | + $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $langClause); |
|
130 | + $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $langClause); |
|
131 | + $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang)." STR(?s) LCASE(STR(?qualifier))"; |
|
132 | 132 | |
133 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
133 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
134 | 134 | |
135 | - $filterDeprecated=""; |
|
136 | - if(!$showDeprecated){ |
|
137 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
135 | + $filterDeprecated = ""; |
|
136 | + if (!$showDeprecated) { |
|
137 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | $query = <<<EOQ |
@@ -156,18 +156,18 @@ discard block |
||
156 | 156 | $localname = $vocab->getLocalName($uri); |
157 | 157 | if ($localname !== $uri && $localname === urlencode($localname)) { |
158 | 158 | // check that the prefix stripping worked, and there are no problematic chars in localname |
159 | - $paramstr = count($params) > 0 ? '?' . http_build_query($params) : ''; |
|
159 | + $paramstr = count($params) > 0 ? '?'.http_build_query($params) : ''; |
|
160 | 160 | if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) { |
161 | - return "$vocid/$lang/$type/$localname" . $paramstr; |
|
161 | + return "$vocid/$lang/$type/$localname".$paramstr; |
|
162 | 162 | } |
163 | 163 | |
164 | - return "$vocid/$lang/$localname" . $paramstr; |
|
164 | + return "$vocid/$lang/$localname".$paramstr; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // case 2: URI outside vocabulary namespace, or has problematic chars |
168 | 168 | // pass the full URI as parameter instead |
169 | 169 | $params['uri'] = $uri; |
170 | - return "$vocid/$lang/$type/?" . http_build_query($params); |
|
170 | + return "$vocid/$lang/$type/?".http_build_query($params); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | { |
294 | 294 | if ($modifiedDate) { |
295 | 295 | $ifModifiedSince = $this->getIfModifiedSince(); |
296 | - $this->sendHeader("Last-Modified: " . $modifiedDate->format('D, d M Y H:i:s \G\M\T')); |
|
296 | + $this->sendHeader("Last-Modified: ".$modifiedDate->format('D, d M Y H:i:s \G\M\T')); |
|
297 | 297 | if ($ifModifiedSince !== null && $ifModifiedSince >= $modifiedDate) { |
298 | 298 | $this->sendHeader("HTTP/1.0 304 Not Modified"); |
299 | 299 | return true; |
@@ -72,7 +72,7 @@ |
||
72 | 72 | return $help; |
73 | 73 | } |
74 | 74 | |
75 | - // if not, see if there was a comment/definition for the property in the graph |
|
75 | + // if not, see if there was a comment/definition for the property in the graph |
|
76 | 76 | if ($this->tooltip !== null) { |
77 | 77 | return $this->tooltip; |
78 | 78 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param string $super URI of superproperty |
28 | 28 | * @param boolean $sort_by_notation whether to sort the property values by their notation code |
29 | 29 | */ |
30 | - public function __construct($prop, $label, $tooltip=null, $super=null, $sort_by_notation=false) |
|
30 | + public function __construct($prop, $label, $tooltip = null, $super = null, $sort_by_notation = false) |
|
31 | 31 | { |
32 | 32 | $this->prop = $prop; |
33 | 33 | $this->label = $label; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getDescription() |
69 | 69 | { |
70 | - $helpprop = $this->prop . "_help"; |
|
70 | + $helpprop = $this->prop."_help"; |
|
71 | 71 | |
72 | 72 | // see if we have a translation with the help text |
73 | 73 | $help = gettext($helpprop); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | public function addValue($value) |
100 | 100 | { |
101 | - $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel() . rtrim(' ' . $value->getUri())] = $value; |
|
101 | + $this->values[ltrim($value->getNotation().' ').$value->getLabel().rtrim(' '.$value->getUri())] = $value; |
|
102 | 102 | $this->is_sorted = false; |
103 | 103 | } |
104 | 104 |
@@ -125,11 +125,9 @@ discard block |
||
125 | 125 | return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel())); |
126 | 126 | } |
127 | 127 | return 1; |
128 | - } |
|
129 | - else if ($bnot == null) { |
|
128 | + } else if ($bnot == null) { |
|
130 | 129 | return -1; |
131 | - } |
|
132 | - else { |
|
130 | + } else { |
|
133 | 131 | // assume that notations are unique, choose strategy |
134 | 132 | if ($this->sort_by_notation == "lexical") { |
135 | 133 | return strcoll($anot, $bnot); |
@@ -138,8 +136,7 @@ discard block |
||
138 | 136 | } |
139 | 137 | } |
140 | 138 | }); |
141 | - } |
|
142 | - else { |
|
139 | + } else { |
|
143 | 140 | uasort($this->values, function($a, $b) { |
144 | 141 | // assume that labels are unique |
145 | 142 | return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel())); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | $label = $this->getLabel(); |
38 | 38 | $notation = $this->getNotation(); |
39 | - return ltrim($notation . ' ') . $label; |
|
39 | + return ltrim($notation.' ').$label; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function getType() |
@@ -180,25 +180,25 @@ discard block |
||
180 | 180 | 'from' => [ |
181 | 181 | 'memberSet' => [ |
182 | 182 | [ |
183 | - 'uri' => (string) $this->source->getUri(), |
|
183 | + 'uri' => (string)$this->source->getUri(), |
|
184 | 184 | ] |
185 | 185 | ] |
186 | 186 | ], |
187 | 187 | 'to' => [ |
188 | 188 | 'memberSet' => [ |
189 | 189 | [ |
190 | - 'uri' => (string) $this->getUri() |
|
190 | + 'uri' => (string)$this->getUri() |
|
191 | 191 | ] |
192 | 192 | ] |
193 | 193 | ], |
194 | 194 | // EXTRA |
195 | 195 | 'hrefLink' => $hrefLink, // link to resource as displayed in the UI |
196 | 196 | 'lang' => $propertyLang, // TBD: could it be part of the prefLabel? |
197 | - 'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI |
|
197 | + 'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI |
|
198 | 198 | 'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch |
199 | 199 | ]; |
200 | 200 | |
201 | - $helpprop = $this->type . "_help"; |
|
201 | + $helpprop = $this->type."_help"; |
|
202 | 202 | // see if we have a translation for the property help text |
203 | 203 | $help = gettext($helpprop); |
204 | 204 | if ($help != $helpprop) { |
@@ -208,20 +208,20 @@ discard block |
||
208 | 208 | $fromScheme = $this->vocab->getDefaultConceptScheme(); |
209 | 209 | if (isset($fromScheme)) { |
210 | 210 | $ret['fromScheme'] = [ |
211 | - 'uri' => (string) $fromScheme, |
|
211 | + 'uri' => (string)$fromScheme, |
|
212 | 212 | ]; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $exvocab = $this->getExvocab(); |
216 | 216 | if (isset($exvocab)) { |
217 | 217 | $ret['toScheme'] = [ |
218 | - 'uri' => (string) $exvocab->getDefaultConceptScheme(), |
|
218 | + 'uri' => (string)$exvocab->getDefaultConceptScheme(), |
|
219 | 219 | ]; |
220 | 220 | } |
221 | 221 | |
222 | 222 | $notation = $this->getNotation(); |
223 | 223 | if (isset($notation)) { |
224 | - $ret['to']['memberSet'][0]['notation'] = (string) $notation; |
|
224 | + $ret['to']['memberSet'][0]['notation'] = (string)$notation; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | $label = $this->getLabel($lang, $queryExVocabs); |