fix guessVocabularyFromURI when some vocabulary has no URI space #1559
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
I ran into a bug when displaying external mappings (to LCSH and Wikidata) on a YSO concept page. I've configured one unrelated vocabulary (YSO-time) without setting a URI space. That breaks the mappings display:
It turns out that if there is a vocabulary without a defined URI space, then external mappings of other vocabularies do not resolve properly because the Model.guessVocabularyFromURI method breaks. This PR fixes the problem by using an additional if check for empty URI space.
Link to relevant issue(s), if any
Description of the changes in this PR
When constructing a cache of URI space to vocabulary mappings, don't include vocabularies that don't have a URI space.
Known problems or uncertainties in this PR
Ideally there should be a unit test, but we don't have any existing tests for empty URI space either.
The same fix should be applied to Skosmos 3 as well. I will do that in a separate PR.
Checklist
.sr-only
class, color contrast)