@@ -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 | } |
@@ -10,6 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | class VocabularyCategory extends DataObject |
12 | 12 | { |
13 | + /** |
|
14 | + * @param Model $model |
|
15 | + */ |
|
13 | 16 | public function __construct($model, $resource) |
14 | 17 | { |
15 | 18 | if (!($model instanceof Model)) { |
@@ -23,6 +23,9 @@ |
||
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | + /** |
|
27 | + * @param string $name |
|
28 | + */ |
|
26 | 29 | private function getConstant($name, $default) |
27 | 30 | { |
28 | 31 | if (defined($name) && constant($name)) { |
@@ -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 | } |
@@ -55,6 +55,7 @@ discard block |
||
55 | 55 | * @param Vocabulary $vocab |
56 | 56 | * @param EasyRdf_Resource $resource |
57 | 57 | * @param EasyRdf_Graph $graph |
58 | + * @param string|null $clang |
|
58 | 59 | */ |
59 | 60 | public function __construct($model, $vocab, $resource, $graph, $clang) |
60 | 61 | { |
@@ -512,6 +513,7 @@ discard block |
||
512 | 513 | |
513 | 514 | /** |
514 | 515 | * Gets the groups/arrays the concept belongs to. |
516 | + * @param boolean $includeArrays |
|
515 | 517 | */ |
516 | 518 | public function getReverseResources($includeArrays) { |
517 | 519 | $groups = array(); |
@@ -53,8 +53,9 @@ discard block |
||
53 | 53 | |
54 | 54 | // not found with selected language, try any language |
55 | 55 | $literal = $this->resource->getLiteral($property); |
56 | - if ($literal) |
|
57 | - return $literal->getValue(); |
|
56 | + if ($literal) { |
|
57 | + return $literal->getValue(); |
|
58 | + } |
|
58 | 59 | } |
59 | 60 | |
60 | 61 | /** |
@@ -95,8 +96,9 @@ discard block |
||
95 | 96 | public function getShortName() |
96 | 97 | { |
97 | 98 | $shortname = $this->getLiteral('skosmos:shortName'); |
98 | - if ($shortname) |
|
99 | - return $shortname; |
|
99 | + if ($shortname) { |
|
100 | + return $shortname; |
|
101 | + } |
|
100 | 102 | |
101 | 103 | // if no shortname exists fall back to the id |
102 | 104 | return $this->getId(); |
@@ -215,10 +217,12 @@ discard block |
||
215 | 217 | $ret = array(); |
216 | 218 | foreach ($resources as $res) { |
217 | 219 | $prop = $res->getURI(); |
218 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible |
|
220 | + if (EasyRdf_Namespace::shorten($prop) !== null) { |
|
221 | + // shortening property labels if possible |
|
219 | 222 | { |
220 | 223 | $prop = EasyRdf_Namespace::shorten($prop); |
221 | 224 | } |
225 | + } |
|
222 | 226 | |
223 | 227 | $ret[] = $prop; |
224 | 228 | } |
@@ -235,10 +239,12 @@ discard block |
||
235 | 239 | $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty"); |
236 | 240 | foreach ($resources as $res) { |
237 | 241 | $prop = $res->getURI(); |
238 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible |
|
242 | + if (EasyRdf_Namespace::shorten($prop) !== null) { |
|
243 | + // shortening property labels if possible |
|
239 | 244 | { |
240 | 245 | $prop = EasyRdf_Namespace::shorten($prop); |
241 | 246 | } |
247 | + } |
|
242 | 248 | |
243 | 249 | if ($prop === $property) { |
244 | 250 | return true; |
@@ -339,11 +345,12 @@ discard block |
||
339 | 345 | public function getId() |
340 | 346 | { |
341 | 347 | $uriparts = explode("#", $this->resource->getURI()); |
342 | - if (count($uriparts) != 1) |
|
343 | - // hash namespace |
|
348 | + if (count($uriparts) != 1) { |
|
349 | + // hash namespace |
|
344 | 350 | { |
345 | 351 | return $uriparts[1]; |
346 | 352 | } |
353 | + } |
|
347 | 354 | |
348 | 355 | // slash namespace |
349 | 356 | $uriparts = explode("/", $this->resource->getURI()); |
@@ -371,10 +378,12 @@ discard block |
||
371 | 378 | $ret = array(); |
372 | 379 | foreach ($resources as $res) { |
373 | 380 | $prop = $res->getURI(); |
374 | - if (EasyRdf_Namespace::shorten($prop) !== null) // prefixing if possible |
|
381 | + if (EasyRdf_Namespace::shorten($prop) !== null) { |
|
382 | + // prefixing if possible |
|
375 | 383 | { |
376 | 384 | $prop = EasyRdf_Namespace::shorten($prop); |
377 | 385 | } |
386 | + } |
|
378 | 387 | |
379 | 388 | $ret[] = $prop; |
380 | 389 | } |
@@ -109,10 +109,12 @@ discard block |
||
109 | 109 | |
110 | 110 | private function initializeNamespaces() { |
111 | 111 | foreach ($this->namespaces as $prefix => $fullUri) { |
112 | - if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined |
|
112 | + if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) { |
|
113 | + // if not already defined |
|
113 | 114 | { |
114 | 115 | EasyRdf_Namespace::set($prefix, $fullUri); |
115 | 116 | } |
117 | + } |
|
116 | 118 | } |
117 | 119 | } |
118 | 120 | |
@@ -391,10 +393,12 @@ discard block |
||
391 | 393 | // register vocabulary ids as RDF namespace prefixes |
392 | 394 | $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters |
393 | 395 | try { |
394 | - if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined |
|
396 | + if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) { |
|
397 | + // if not already defined |
|
395 | 398 | { |
396 | 399 | EasyRdf_Namespace::set($prefix, $voc->getUriSpace()); |
397 | 400 | } |
401 | + } |
|
398 | 402 | |
399 | 403 | } catch (Exception $e) { |
400 | 404 | // not valid as namespace identifier, ignore |
@@ -506,8 +510,9 @@ discard block |
||
506 | 510 | } |
507 | 511 | |
508 | 512 | foreach ($vocabs as $vocab) { |
509 | - if ($vocab->getConceptLabel($uri, null) !== null) |
|
510 | - return $vocab; |
|
513 | + if ($vocab->getConceptLabel($uri, null) !== null) { |
|
514 | + return $vocab; |
|
515 | + } |
|
511 | 516 | } |
512 | 517 | |
513 | 518 | // if the URI couldn't be found, fall back to the first vocabulary |
@@ -387,7 +387,9 @@ discard block |
||
387 | 387 | $hits[] = $res; |
388 | 388 | } |
389 | 389 | } |
390 | - if (sizeof($hits) > 0) return $hits; |
|
390 | + if (sizeof($hits) > 0) { |
|
391 | + return $hits; |
|
392 | + } |
|
391 | 393 | |
392 | 394 | // case 2: case-insensitive match on preferred label |
393 | 395 | foreach ($results as $res) { |
@@ -395,7 +397,9 @@ discard block |
||
395 | 397 | $hits[] = $res; |
396 | 398 | } |
397 | 399 | } |
398 | - if (sizeof($hits) > 0) return $hits; |
|
400 | + if (sizeof($hits) > 0) { |
|
401 | + return $hits; |
|
402 | + } |
|
399 | 403 | |
400 | 404 | if ($lang === null) { |
401 | 405 | // case 1A: exact match on preferred label in any language |
@@ -406,7 +410,9 @@ discard block |
||
406 | 410 | $hits[] = $res; |
407 | 411 | } |
408 | 412 | } |
409 | - if (sizeof($hits) > 0) return $hits; |
|
413 | + if (sizeof($hits) > 0) { |
|
414 | + return $hits; |
|
415 | + } |
|
410 | 416 | |
411 | 417 | // case 2A: case-insensitive match on preferred label in any language |
412 | 418 | foreach ($results as $res) { |
@@ -416,7 +422,9 @@ discard block |
||
416 | 422 | $hits[] = $res; |
417 | 423 | } |
418 | 424 | } |
419 | - if (sizeof($hits) > 0) return $hits; |
|
425 | + if (sizeof($hits) > 0) { |
|
426 | + return $hits; |
|
427 | + } |
|
420 | 428 | } |
421 | 429 | |
422 | 430 | // case 3: exact match on alternate label |
@@ -425,7 +433,9 @@ discard block |
||
425 | 433 | $hits[] = $res; |
426 | 434 | } |
427 | 435 | } |
428 | - if (sizeof($hits) > 0) return $hits; |
|
436 | + if (sizeof($hits) > 0) { |
|
437 | + return $hits; |
|
438 | + } |
|
429 | 439 | |
430 | 440 | |
431 | 441 | // case 4: case-insensitive match on alternate label |
@@ -434,7 +444,9 @@ discard block |
||
434 | 444 | $hits[] = $res; |
435 | 445 | } |
436 | 446 | } |
437 | - if (sizeof($hits) > 0) return $hits; |
|
447 | + if (sizeof($hits) > 0) { |
|
448 | + return $hits; |
|
449 | + } |
|
438 | 450 | |
439 | 451 | return $hits; |
440 | 452 | } |