Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve guessVocabularyFromURI #870

Merged
merged 2 commits into from
Apr 24, 2019
Merged

Improve guessVocabularyFromURI #870

merged 2 commits into from
Apr 24, 2019

Conversation

osma
Copy link
Member

@osma osma commented Apr 24, 2019

This is a fix for #868. I had to do a bit of work to fix the problem without introducing additional overhead, so the solution is divided into several parts:

  1. Make disambiguateVocabulary (called from within guessVocabularyFromURI) double-check that a URI exists in a vocabulary, even though it is the "preferred" one. This is necessary in some edge cases, e.g. to distinguish between YSO and YSO Places concepts, because the vocabularies have the same URI namespace, but it does introduce an additional SPARQL query to check for a label.
  2. To avoid triggering the overhead, in Concept.getProperties(), we first check whether a label for a URI already exists within the graph (the CONSTRUCT query response), and if a label is found, avoid calling guessVocabularyFromURI.
  3. Similarly in Model.searchConcepts, when examining the search results, check first if their URIs are within the URI namespace of the current vocabulary (this requires a new method Vocabulary.containsURI) and if it is, skip calling guessVocabularyFromURI.

All in all this PR seems to fix the problem on the concept page while avoiding additional overhead.

While crafting this I also found a way to speed up the search result page a little bit (~10%) by using a whitelist parameter for Concept.getProperties (similar to the one in Concept.getMappingProperties introduced in PR #849), but I'll leave that for another PR.

@osma osma added the bug label Apr 24, 2019
@osma osma added this to the 2.2 milestone Apr 24, 2019
@osma osma merged commit 28b3c26 into master Apr 24, 2019
@osma
Copy link
Member Author

osma commented Apr 24, 2019

While crafting this I also found a way to speed up the search result page a little bit (~10%) by using a whitelist parameter for Concept.getProperties (similar to the one in Concept.getMappingProperties introduced in PR #849), but I'll leave that for another PR.

This turned out to be problematic, so I won't do a PR now.

@osma osma deleted the issue868-fix-guessvocabulary branch February 11, 2020 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant