@@ -531,14 +531,14 @@ |
||
| 531 | 531 | if(!$is_well_known && !$proplabel) { |
| 532 | 532 | $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang()); |
| 533 | 533 | |
| 534 | - if($envLangLabels) { |
|
| 535 | - $proplabel = $envLangLabels[$this->getEnvLang()]; |
|
| 534 | + if($envLangLabels) { |
|
| 535 | + $proplabel = $envLangLabels[$this->getEnvLang()]; |
|
| 536 | 536 | } else { |
| 537 | 537 | $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, ''); |
| 538 | - if(isset($defaultPropLabel[''])) { |
|
| 539 | - $proplabel = $defaultPropLabel['']; |
|
| 540 | - } |
|
| 541 | - } |
|
| 538 | + if(isset($defaultPropLabel[''])) { |
|
| 539 | + $proplabel = $defaultPropLabel['']; |
|
| 540 | + } |
|
| 541 | + } |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | // look for superproperties in the current graph |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | return $this->resource->label($fallback); |
| 137 | 137 | } |
| 138 | 138 | // We need to check all the labels in case one of them matches a subtag of the current language |
| 139 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
| 139 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
| 140 | 140 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
| 141 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
| 141 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
| 142 | 142 | return EasyRdf\Literal::create($label, $fallback); |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | public function hasXlLabel($prop = 'prefLabel') |
| 161 | 161 | { |
| 162 | - if ($this->resource->hasProperty('skosxl:' . $prop)) { |
|
| 162 | + if ($this->resource->hasProperty('skosxl:'.$prop)) { |
|
| 163 | 163 | return true; |
| 164 | 164 | } |
| 165 | 165 | return false; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | public function getXlLabel() |
| 169 | 169 | { |
| 170 | 170 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
| 171 | - foreach($labels as $labres) { |
|
| 171 | + foreach ($labels as $labres) { |
|
| 172 | 172 | $label = $labres->getLiteral('skosxl:literalForm'); |
| 173 | 173 | if ($label !== null && $label->getLang() == $this->clang) { |
| 174 | 174 | return new LabelSkosXL($this->model, $labres); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | // catch external subjects that have $res as object |
| 276 | 276 | $extSubjects = $exGraph->resourcesMatching("schema:about", $res); |
| 277 | 277 | |
| 278 | - $propList = array_unique(array_merge( |
|
| 278 | + $propList = array_unique(array_merge( |
|
| 279 | 279 | $this->DEFAULT_EXT_PROPERTIES, |
| 280 | 280 | $this->getVocab()->getConfig()->getExtProperties(), |
| 281 | 281 | $this->getVocab()->getConfig()->getPlugins()->getExtProperties() |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param string[] $seen Processed resources so far |
| 301 | 301 | * @param string[] $props (optional) limit to these property URIs |
| 302 | 302 | */ |
| 303 | - private function addExternalTriplesToGraph($res, &$seen, $props=null) |
|
| 303 | + private function addExternalTriplesToGraph($res, &$seen, $props = null) |
|
| 304 | 304 | { |
| 305 | 305 | if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) { |
| 306 | 306 | return; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | private function addPropertyValues($res, $prop, &$seen) |
| 332 | 332 | { |
| 333 | - $resList = $res->allResources('<' . $prop . '>'); |
|
| 333 | + $resList = $res->allResources('<'.$prop.'>'); |
|
| 334 | 334 | |
| 335 | 335 | foreach ($resList as $res2) { |
| 336 | 336 | if ($res2->isBNode()) { |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | $this->addResourceReifications($res, $prop, $res2, $seen); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $litList = $res->allLiterals('<' . $prop . '>'); |
|
| 343 | + $litList = $res->allLiterals('<'.$prop.'>'); |
|
| 344 | 344 | |
| 345 | 345 | foreach ($litList as $lit) { |
| 346 | 346 | $this->graph->addLiteral($res, $prop, $lit); |
@@ -528,14 +528,14 @@ discard block |
||
| 528 | 528 | // if not found in current vocabulary, look up in the default graph to be able |
| 529 | 529 | // to read an ontology loaded in a separate graph |
| 530 | 530 | // note that this imply that the property has an rdf:type declared for the query to work |
| 531 | - if(!$is_well_known && !$proplabel) { |
|
| 531 | + if (!$is_well_known && !$proplabel) { |
|
| 532 | 532 | $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang()); |
| 533 | 533 | |
| 534 | - if($envLangLabels) { |
|
| 534 | + if ($envLangLabels) { |
|
| 535 | 535 | $proplabel = $envLangLabels[$this->getEnvLang()]; |
| 536 | 536 | } else { |
| 537 | 537 | $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, ''); |
| 538 | - if(isset($defaultPropLabel[''])) { |
|
| 538 | + if (isset($defaultPropLabel[''])) { |
|
| 539 | 539 | $proplabel = $defaultPropLabel['']; |
| 540 | 540 | } |
| 541 | 541 | } |
@@ -548,12 +548,12 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | // also look up superprops in the default graph if not found in current vocabulary |
| 551 | - if(!$is_well_known && (!$superprops || empty($superprops))) { |
|
| 551 | + if (!$is_well_known && (!$superprops || empty($superprops))) { |
|
| 552 | 552 | $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri); |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | // we're reading only one super property, even if there are multiple ones |
| 556 | - $superprop = ($superprops)?$superprops[0]:null; |
|
| 556 | + $superprop = ($superprops) ? $superprops[0] : null; |
|
| 557 | 557 | if ($superprop) { |
| 558 | 558 | $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop; |
| 559 | 559 | } |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | // searching for subproperties of literals too |
| 569 | - if($superprops) { |
|
| 569 | + if ($superprops) { |
|
| 570 | 570 | foreach ($superprops as $subi) { |
| 571 | 571 | $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi; |
| 572 | 572 | $duplicates[$suburi] = $prop; |
@@ -728,14 +728,14 @@ discard block |
||
| 728 | 728 | |
| 729 | 729 | // making a human readable string from the timestamps |
| 730 | 730 | if ($created != '') { |
| 731 | - $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short', $this->getEnvLang())); |
|
| 731 | + $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short', $this->getEnvLang())); |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | if ($modified != '') { |
| 735 | 735 | if ($created != '') { |
| 736 | - $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
| 736 | + $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
| 737 | 737 | } else { |
| 738 | - $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
| 738 | + $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | } |
@@ -743,12 +743,12 @@ discard block |
||
| 743 | 743 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 744 | 744 | $ret = ''; |
| 745 | 745 | if ($this->resource->get('dc:modified')) { |
| 746 | - $modified = (string) $this->resource->get('dc:modified'); |
|
| 747 | - $ret = gettext('skosmos:modified') . ' ' . $modified; |
|
| 746 | + $modified = (string)$this->resource->get('dc:modified'); |
|
| 747 | + $ret = gettext('skosmos:modified').' '.$modified; |
|
| 748 | 748 | } |
| 749 | 749 | if ($this->resource->get('dc:created')) { |
| 750 | - $created .= (string) $this->resource->get('dc:created'); |
|
| 751 | - $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
|
| 750 | + $created .= (string)$this->resource->get('dc:created'); |
|
| 751 | + $ret .= ' '.gettext('skosmos:created').' '.$created; |
|
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | 754 | return $ret; |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | $groups[$collLabel] = array($group); |
| 821 | 821 | |
| 822 | 822 | $res = $collection; |
| 823 | - while($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
| 823 | + while ($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
| 824 | 824 | foreach ($super as $res) { |
| 825 | 825 | $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang); |
| 826 | 826 | array_unshift($groups[$collLabel], $superprop); |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | |
| 866 | 866 | foreach ($labels as $lit) { |
| 867 | 867 | // filtering away subsets of the current language eg. en vs en-GB |
| 868 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
| 868 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
| 869 | 869 | $langCode = $lit->getLang() ? $lit->getLang() : ''; |
| 870 | 870 | $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop); |
| 871 | 871 | } |
@@ -956,10 +956,10 @@ discard block |
||
| 956 | 956 | } |
| 957 | 957 | else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
| 958 | 958 | $i = 2; |
| 959 | - while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) { |
|
| 959 | + while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) { |
|
| 960 | 960 | $i += 1; |
| 961 | 961 | } |
| 962 | - $context[$vocabPrefix . $i] = $vocabUriSpace; |
|
| 962 | + $context[$vocabPrefix.$i] = $vocabUriSpace; |
|
| 963 | 963 | } |
| 964 | 964 | } |
| 965 | 965 | $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context)); |