Skosmos icon indicating copy to clipboard operation
Skosmos copied to clipboard

Ability to display custom properties on Vocabulary page (similar to Concept page)

Open tfrancart opened this issue 7 years ago • 3 comments

Custom properties can be displayed on Concept pages, because Concept::getProperties() reads the property labels (from the current resource description or by default by doin an extra SPARQL query) See https://github.com/NatLibFi/Skosmos/blob/master/model/Concept.php#L354

However, the display of the Vocabulary page does not work the same : instead of using ConceptProperty data structure, the (shortened) URI is used as key (https://github.com/NatLibFi/Skosmos/blob/master/model/Vocabulary.php#L147), and then translated in the Twig template to display DC labels (https://github.com/NatLibFi/Skosmos/blob/master/view/vocab-shared.twig#L12).

This has the following consequences :

  • since $conceptscheme->properties() returns only shortened URIs, URIS that cannot be shortened are not in the returned array, and cannot be displayed by the Twig template;
  • since we rely on translations to display the property labels, custom properties not in the translation file would be displayed with their URIs, and not their labels.

I suggest refactoring Vocabulary::getInfo() to use a similar approach than Concept:getProperties() , which also imply a refactoring of the vocad-shared template.

The use-case : we have a custom property on ConceptScheme that point to the open-data portal where vocabularies are described, and we would like this link to be displayed on the vocabulary page, so that user can navigate to the open data portal.

tfrancart avatar Jan 29 '18 10:01 tfrancart

Makes sense. It's an accident of history that the vocabulary page has a different mechanism than the concept page.

osma avatar Mar 12 '18 08:03 osma

Hi, Is this issue a WIP? if so is there a workaround I can use in the meantime?

scuffster avatar Aug 22 '23 09:08 scuffster

@scuffster We are currently working on Skosmos 3 which will be a major overhaul of the frontend. We intend to implement the vocabulary page in a different way, so that it supports custom properties like the current concept page does. But it will take a while, the release could happen sometime in 2024.

In the meantime, if you have a custom property you want to display on the vocabulary page, I think you need to ensure that its URI can be shortened (you may need to add a prefix declaration using EasyRdf\RdfNamespace::set in GlobalConfig.php) and also add a translation for that property into the .po files and then recompile to .mo.

osma avatar Aug 22 '23 10:08 osma