Only shorten URIs of types in the SKOS namespace in the search results#1284
Merged
Only shorten URIs of types in the SKOS namespace in the search results#1284
Conversation
|
Kudos, SonarCloud Quality Gate passed!
|
Codecov Report
@@ Coverage Diff @@
## master #1284 +/- ##
=========================================
Coverage 69.36% 69.36%
- Complexity 1649 1650 +1
=========================================
Files 32 32
Lines 4047 4047
=========================================
Hits 2807 2807
Misses 1240 1240
Continue to review full report at Codecov.
|
joelit
approved these changes
Mar 2, 2022
Contributor
joelit
left a comment
There was a problem hiding this comment.
Looks fine now. Strange that the prefixing only had an effect for the property objects but not for the URI of the search results.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Reasons for creating this PR
See #1254 - some types are not shown correctly in the autocomplete popup for the search box.
The underlying problem is/was that the REST
searchmethod can return types either in shortened format (e.g.skos:Concept) or as full URIs (e.g.http://www.yso.fi/onto/yso/yso-meta/Concept). Those type URIs that can be shortened are, based on the URI namespace prefixes registered to EasyRdf. This includes vocabulary-specific prefixes from the Skosmos configuration file. In the case of Lajisto vocabulary where the problem was first discovered, EasyRdf knows the namespace prefixlajisto:(which is used for both regular concepts and types) and is able to shorten type URIs into qnames such aslajisto:MX.species. For most other vocabularies with custom types, the types are in a different namespace, e.g.yso-meta:for YSO andrdac:for KANTO/finaf, and EasyRdf doesn't know about these namespaces so cannot shorten these URIs.The JS code that populates the autocomplete box attempts to resolve the shortened URIs and expand them back to full URIs. But the expansion is based on the JSON-LD context of the response of the
searchmethod. The context doesn't include custom prefixes such aslajisto:, so expansion will fail and the shortened type URI ends up being displayed in the UI, instead of a human-readable label.There are at least two approaches to fixing this:
searchmethod returns.I chose the 2nd approach, as it was easier and less disruptive. So instead of eagerly trying to shorten type URIs, the
searchmethod will now return full type URIs, except for types in the SKOS namespace (i.e.skos:Conceptandskos:Collection). The SKOS type URIs are still shortened because not doing so could be disruptive for API clients used to the old behaviour.Link to relevant issue(s), if any
Description of the changes in this PR
Known problems or uncertainties in this PR
n/a
Checklist