@@ -58,8 +58,9 @@ discard block |
||
58 | 58 | public function getShortName() |
59 | 59 | { |
60 | 60 | $shortname = $this->getLiteral('skosmos:shortName'); |
61 | - if ($shortname) |
|
62 | - return $shortname; |
|
61 | + if ($shortname) { |
|
62 | + return $shortname; |
|
63 | + } |
|
63 | 64 | |
64 | 65 | // if no shortname exists fall back to the id |
65 | 66 | return $this->getId(); |
@@ -194,10 +195,12 @@ discard block |
||
194 | 195 | $ret = array(); |
195 | 196 | foreach ($resources as $res) { |
196 | 197 | $prop = $res->getURI(); |
197 | - if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible |
|
198 | + if (EasyRdf\RdfNamespace::shorten($prop) !== null) { |
|
199 | + // shortening property labels if possible |
|
198 | 200 | { |
199 | 201 | $prop = EasyRdf\RdfNamespace::shorten($prop); |
200 | 202 | } |
203 | + } |
|
201 | 204 | |
202 | 205 | $ret[] = $prop; |
203 | 206 | } |
@@ -214,10 +217,12 @@ discard block |
||
214 | 217 | $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty"); |
215 | 218 | foreach ($resources as $res) { |
216 | 219 | $prop = $res->getURI(); |
217 | - if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible |
|
220 | + if (EasyRdf\RdfNamespace::shorten($prop) !== null) { |
|
221 | + // shortening property labels if possible |
|
218 | 222 | { |
219 | 223 | $prop = EasyRdf\RdfNamespace::shorten($prop); |
220 | 224 | } |
225 | + } |
|
221 | 226 | |
222 | 227 | if ($prop === $property) { |
223 | 228 | return true; |
@@ -329,11 +334,12 @@ discard block |
||
329 | 334 | public function getId() |
330 | 335 | { |
331 | 336 | $uriparts = explode("#", $this->resource->getURI()); |
332 | - if (count($uriparts) != 1) |
|
333 | - // hash namespace |
|
337 | + if (count($uriparts) != 1) { |
|
338 | + // hash namespace |
|
334 | 339 | { |
335 | 340 | return $uriparts[1]; |
336 | 341 | } |
342 | + } |
|
337 | 343 | |
338 | 344 | // slash namespace |
339 | 345 | $uriparts = explode("/", $this->resource->getURI()); |
@@ -361,10 +367,12 @@ discard block |
||
361 | 367 | $ret = array(); |
362 | 368 | foreach ($resources as $res) { |
363 | 369 | $prop = $res->getURI(); |
364 | - if (EasyRdf\RdfNamespace::shorten($prop) !== null) // prefixing if possible |
|
370 | + if (EasyRdf\RdfNamespace::shorten($prop) !== null) { |
|
371 | + // prefixing if possible |
|
365 | 372 | { |
366 | 373 | $prop = EasyRdf\RdfNamespace::shorten($prop); |
367 | 374 | } |
375 | + } |
|
368 | 376 | |
369 | 377 | $ret[] = $prop; |
370 | 378 | } |
@@ -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; |
@@ -99,17 +99,14 @@ |
||
99 | 99 | return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel())); |
100 | 100 | } |
101 | 101 | return 1; |
102 | - } |
|
103 | - else if ($bnot == null) { |
|
102 | + } else if ($bnot == null) { |
|
104 | 103 | return -1; |
105 | - } |
|
106 | - else { |
|
104 | + } else { |
|
107 | 105 | // assume that notations are unique |
108 | 106 | return strnatcasecmp($anot, $bnot); |
109 | 107 | } |
110 | 108 | }); |
111 | - } |
|
112 | - else { |
|
109 | + } else { |
|
113 | 110 | uasort($this->values, function($a, $b) { |
114 | 111 | // assume that labels are unique |
115 | 112 | return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel())); |
@@ -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 | } |