@@ -167,9 +167,11 @@ |
||
167 | 167 | */ |
168 | 168 | public function setVocab($vocabid) |
169 | 169 | { |
170 | - if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string |
|
170 | + if (strpos($vocabid, ' ') !== false) { |
|
171 | + // if there are multiple vocabularies just storing the string |
|
171 | 172 | { |
172 | 173 | $this->setVocabids($vocabid); |
174 | + } |
|
173 | 175 | } else { |
174 | 176 | $this->vocab = $this->model->getVocabulary($vocabid); |
175 | 177 | } |
@@ -76,10 +76,12 @@ |
||
76 | 76 | */ |
77 | 77 | public function getUriSpace() |
78 | 78 | { |
79 | - if ($this->urispace === null) // initialize cache |
|
79 | + if ($this->urispace === null) { |
|
80 | + // initialize cache |
|
80 | 81 | { |
81 | 82 | $this->urispace = $this->resource->getLiteral('void:uriSpace')->getValue(); |
82 | 83 | } |
84 | + } |
|
83 | 85 | |
84 | 86 | return $this->urispace; |
85 | 87 | } |
@@ -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()); |
@@ -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 | } |
@@ -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 = ""; |
@@ -101,10 +101,12 @@ discard block |
||
101 | 101 | |
102 | 102 | private function initializeNamespaces() { |
103 | 103 | foreach ($this->namespaces as $prefix => $full_uri) { |
104 | - if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined |
|
104 | + if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) { |
|
105 | + // if not already defined |
|
105 | 106 | { |
106 | 107 | EasyRdf_Namespace::set($prefix, $full_uri); |
107 | 108 | } |
109 | + } |
|
108 | 110 | } |
109 | 111 | } |
110 | 112 | |
@@ -379,10 +381,12 @@ discard block |
||
379 | 381 | // register vocabulary ids as RDF namespace prefixes |
380 | 382 | $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters |
381 | 383 | try { |
382 | - if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined |
|
384 | + if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) { |
|
385 | + // if not already defined |
|
383 | 386 | { |
384 | 387 | EasyRdf_Namespace::set($prefix, $voc->getUriSpace()); |
385 | 388 | } |
389 | + } |
|
386 | 390 | |
387 | 391 | } catch (Exception $e) { |
388 | 392 | // not valid as namespace identifier, ignore |
@@ -68,10 +68,12 @@ |
||
68 | 68 | if ($sortable !== null) { |
69 | 69 | uksort($sortable, array($this, 'mycompare')); |
70 | 70 | foreach ($sortable as $prop => $vals) { |
71 | - if (is_array($prop)) // the ConceptProperty objects have their own sorting methods |
|
71 | + if (is_array($prop)) { |
|
72 | + // the ConceptProperty objects have their own sorting methods |
|
72 | 73 | { |
73 | 74 | ksort($sortable[$prop]); |
74 | 75 | } |
76 | + } |
|
75 | 77 | |
76 | 78 | } |
77 | 79 | } |