@@ -30,7 +30,7 @@ |
||
30 | 30 | * @param string $property the property to query |
31 | 31 | * @param string $lang preferred language for the literal, |
32 | 32 | */ |
33 | - private function getLiteral($property, $lang=null) |
|
33 | + private function getLiteral($property, $lang = null) |
|
34 | 34 | { |
35 | 35 | if (!isset($lang)) {; |
36 | 36 | $lang = $this->getEnvLang(); |
@@ -43,8 +43,9 @@ discard block |
||
43 | 43 | |
44 | 44 | // not found with selected language, try any language |
45 | 45 | $literal = $this->resource->getLiteral($property); |
46 | - if ($literal) |
|
47 | - return $literal->getValue(); |
|
46 | + if ($literal) { |
|
47 | + return $literal->getValue(); |
|
48 | + } |
|
48 | 49 | } |
49 | 50 | |
50 | 51 | /** |
@@ -85,8 +86,9 @@ discard block |
||
85 | 86 | public function getShortName() |
86 | 87 | { |
87 | 88 | $shortname = $this->getLiteral('skosmos:shortName'); |
88 | - if ($shortname) |
|
89 | - return $shortname; |
|
89 | + if ($shortname) { |
|
90 | + return $shortname; |
|
91 | + } |
|
90 | 92 | |
91 | 93 | // if no shortname exists fall back to the id |
92 | 94 | return $this->getId(); |
@@ -205,10 +207,12 @@ discard block |
||
205 | 207 | $ret = array(); |
206 | 208 | foreach ($resources as $res) { |
207 | 209 | $prop = $res->getURI(); |
208 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible |
|
210 | + if (EasyRdf_Namespace::shorten($prop) !== null) { |
|
211 | + // shortening property labels if possible |
|
209 | 212 | { |
210 | 213 | $prop = EasyRdf_Namespace::shorten($prop); |
211 | 214 | } |
215 | + } |
|
212 | 216 | |
213 | 217 | $ret[] = $prop; |
214 | 218 | } |
@@ -225,10 +229,12 @@ discard block |
||
225 | 229 | $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty"); |
226 | 230 | foreach ($resources as $res) { |
227 | 231 | $prop = $res->getURI(); |
228 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible |
|
232 | + if (EasyRdf_Namespace::shorten($prop) !== null) { |
|
233 | + // shortening property labels if possible |
|
229 | 234 | { |
230 | 235 | $prop = EasyRdf_Namespace::shorten($prop); |
231 | 236 | } |
237 | + } |
|
232 | 238 | |
233 | 239 | if ($prop === $property) { |
234 | 240 | return true; |
@@ -329,11 +335,12 @@ discard block |
||
329 | 335 | public function getId() |
330 | 336 | { |
331 | 337 | $uriparts = explode("#", $this->resource->getURI()); |
332 | - if (count($uriparts) != 1) |
|
333 | - // hash namespace |
|
338 | + if (count($uriparts) != 1) { |
|
339 | + // hash namespace |
|
334 | 340 | { |
335 | 341 | return $uriparts[1]; |
336 | 342 | } |
343 | + } |
|
337 | 344 | |
338 | 345 | // slash namespace |
339 | 346 | $uriparts = explode("/", $this->resource->getURI()); |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Copyright (c) 2012-2013 Aalto University and University of Helsinki |
|
4 | - * MIT License |
|
5 | - * see LICENSE.txt for more information |
|
6 | - */ |
|
3 | + * Copyright (c) 2012-2013 Aalto University and University of Helsinki |
|
4 | + * MIT License |
|
5 | + * see LICENSE.txt for more information |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | /* Register text: namespace needed for jena-text queries */ |
9 | 9 | EasyRdf_Namespace::set('text', 'http://jena.apache.org/text#'); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | { |
81 | 81 | if (!empty($this->values)) { |
82 | 82 | uksort($this->values, function($a, $b) { |
83 | - return strnatcasecmp($a,$b); |
|
83 | + return strnatcasecmp($a, $b); |
|
84 | 84 | }); |
85 | 85 | } |
86 | 86 | $this->is_sorted = true; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | class GlobalConfig { |
7 | 7 | private $languages; |
8 | 8 | |
9 | - public function __construct($config_name=null) |
|
9 | + public function __construct($config_name = null) |
|
10 | 10 | { |
11 | 11 | try { |
12 | 12 | $file_path = dirname(__FILE__); |
@@ -171,7 +171,7 @@ |
||
171 | 171 | // convert to vocids array to support multi-vocabulary search |
172 | 172 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : array(); |
173 | 173 | $vocabObjects = array(); |
174 | - foreach($vocids as $vocid) { |
|
174 | + foreach ($vocids as $vocid) { |
|
175 | 175 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
176 | 176 | } |
177 | 177 | $parameters->setVocabularies($vocabObjects); |
@@ -67,8 +67,9 @@ |
||
67 | 67 | public function getSearchTerm() |
68 | 68 | { |
69 | 69 | $term = $this->request->getQueryParam('q') ? $this->request->getQueryParam('q') : $this->request->getQueryParam('query'); |
70 | - if (!$term && $this->rest) |
|
71 | - $term = $this->request->getQueryParam('label'); |
|
70 | + if (!$term && $this->rest) { |
|
71 | + $term = $this->request->getQueryParam('label'); |
|
72 | + } |
|
72 | 73 | $term = trim($term); // surrounding whitespace is not considered significant |
73 | 74 | return strpos($term, "*") === false ? $term . "*" : $term; // default to prefix search |
74 | 75 | } |
@@ -22,6 +22,9 @@ discard block |
||
22 | 22 | $this->unique = $request->getQueryParamBoolean('unique', false); |
23 | 23 | } |
24 | 24 | |
25 | + /** |
|
26 | + * @return string |
|
27 | + */ |
|
25 | 28 | public function getLang() |
26 | 29 | { |
27 | 30 | if ($this->rest && $this->request->getQueryParam('labellang')) { |
@@ -91,6 +94,9 @@ discard block |
||
91 | 94 | return $this->vocab->listConceptGroups($content_lang); |
92 | 95 | } |
93 | 96 | |
97 | + /** |
|
98 | + * @return string |
|
99 | + */ |
|
94 | 100 | public function getSearchLang() |
95 | 101 | { |
96 | 102 | if ($this->rest) { |
@@ -130,11 +136,17 @@ discard block |
||
130 | 136 | return $this->request->getQueryParam('parent') !== '' ? $this->request->getQueryParam('parent') : null; |
131 | 137 | } |
132 | 138 | |
139 | + /** |
|
140 | + * @return integer |
|
141 | + */ |
|
133 | 142 | public function getOffset() |
134 | 143 | { |
135 | 144 | return ($this->request->getQueryParam('offset') && is_numeric($this->request->getQueryParam('offset')) && $this->request->getQueryParam('offset') >= 0) ? $this->request->getQueryParam('offset') : 0; |
136 | 145 | } |
137 | 146 | |
147 | + /** |
|
148 | + * @return integer|null |
|
149 | + */ |
|
138 | 150 | public function getSearchLimit() |
139 | 151 | { |
140 | 152 | return $this->config->getDefaultSearchLimit(); |
@@ -144,6 +156,9 @@ discard block |
||
144 | 156 | return $this->unique; |
145 | 157 | } |
146 | 158 | |
159 | + /** |
|
160 | + * @param boolean $unique |
|
161 | + */ |
|
147 | 162 | public function setUnique($unique) { |
148 | 163 | $this->unique = $unique; |
149 | 164 | } |
@@ -585,7 +585,7 @@ |
||
585 | 585 | |
586 | 586 | /** |
587 | 587 | * Generate a VALUES clause for limiting the targeted graphs. |
588 | - * @param array $vocabs array of Vocabulary objects to target |
|
588 | + * @param Vocabulary[] $vocabs array of Vocabulary objects to target |
|
589 | 589 | * @return string VALUES clause, or "" if not necessary to limit |
590 | 590 | */ |
591 | 591 | protected function formatValuesGraph($vocabs) { |
@@ -56,12 +56,16 @@ |
||
56 | 56 | $this->model = $model; |
57 | 57 | |
58 | 58 | // set graphClause so that it can be used by all queries |
59 | - if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable) |
|
59 | + if ($this->isDefaultEndpoint()) { |
|
60 | + // default endpoint; query any graph (and catch it in a variable) |
|
60 | 61 | { |
61 | 62 | $this->graphClause = "GRAPH $graph"; |
62 | - } elseif ($graph) // query a specific graph |
|
63 | + } |
|
64 | + } elseif ($graph) { |
|
65 | + // query a specific graph |
|
63 | 66 | { |
64 | 67 | $this->graphClause = "GRAPH <$graph>"; |
68 | + } |
|
65 | 69 | } else // query the default graph |
66 | 70 | { |
67 | 71 | $this->graphClause = ""; |
@@ -649,7 +649,7 @@ |
||
649 | 649 | } |
650 | 650 | } |
651 | 651 | |
652 | - return implode(' UNION ', $type_patterns);; |
|
652 | + return implode(' UNION ', $type_patterns); ; |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | /** |