Skip to content

Commit

Permalink
Merge pull request #1012 from NatLibFi/issue990-fix-labelless-uris
Browse files Browse the repository at this point in the history
mappings: fix issue with explicitLanguageTags set to true and label i…
  • Loading branch information
kouralex authored Jun 23, 2020
2 parents 258c04a + e0d4737 commit 653ad5e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions model/ConceptMappingPropertyValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,19 @@ public function asJskos($queryExVocabs = true, $lang = null, $hrefLink = null)
]
],
// EXTRA
'description' => gettext($this->type . "_help"), // pop-up text
'hrefLink' => $hrefLink, // link to resource as displayed in the UI
'lang' => $propertyLang, // TBD: could it be part of the prefLabel?
'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI
'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch
];

$helpprop = $this->type . "_help";
// see if we have a translation for the property help text
$help = gettext($helpprop);
if ($help != $helpprop) {
$ret['description'] = $help;
}

$fromScheme = $this->vocab->getDefaultConceptScheme();
if (isset($fromScheme)) {
$ret['fromScheme'] = [
Expand All @@ -221,10 +227,13 @@ public function asJskos($queryExVocabs = true, $lang = null, $hrefLink = null)
$label = $this->getLabel($lang, $queryExVocabs);
if (isset($label)) {
if (is_string($label)) {
list($labelLang, $labelValue) = ['-', $label];
list($labelLang, $labelValue) = ['', $label];
} else {
list($labelLang, $labelValue) = [$label->getLang(), $label->getValue()];
}
// set the language of the preferred label to be whatever returned
$ret['lang'] = $labelLang;

if ($labelValue != $this->getUri()) {
// The `queryLabel()` method above will fallback to returning the URI
// if no label was found. We don't want that here.
Expand Down

0 comments on commit 653ad5e

Please sign in to comment.