@@ -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); |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | |
| 870 | 870 | foreach ($labels as $lit) { |
| 871 | 871 | // filtering away subsets of the current language eg. en vs en-GB |
| 872 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
| 872 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
| 873 | 873 | $langCode = $lit->getLang() ? $lit->getLang() : ''; |
| 874 | 874 | $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop); |
| 875 | 875 | } |
@@ -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)); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | public function getPrefLabel() { |
| 12 | 12 | $label = null; |
| 13 | 13 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
| 14 | - foreach($labels as $labres) { |
|
| 14 | + foreach ($labels as $labres) { |
|
| 15 | 15 | $label = $labres->getLiteral('skosxl:literalForm'); |
| 16 | 16 | if ($label->getLang() == $this->clang) { |
| 17 | 17 | return $label; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function getProperties() { |
| 24 | 24 | $ret = array(); |
| 25 | 25 | $props = $this->resource->properties(); |
| 26 | - foreach($props as $prop) { |
|
| 26 | + foreach ($props as $prop) { |
|
| 27 | 27 | if ($prop !== 'rdf:type' && $prop !== 'skosxl:literalForm') { |
| 28 | 28 | // make sure to use the correct gettext keys for DC namespace |
| 29 | 29 | $propkey = str_starts_with($prop, 'dc11:') ? |