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

fix(api-v1): Optimise link value queries for Fuseki (DSP-1243) #1791

Merged
merged 5 commits into from Jan 22, 2021

Conversation

@benjamingeer
Copy link
Collaborator

@benjamingeer benjamingeer commented Jan 21, 2021

This PR improves the performance of the API v1 SPARQL queries that find link values when using Fuseki.

  • Use IRI literals instead of BIND.
  • Use FILTER NOT EXISTS to check knora-base:isDeleted (as in #1739).
  • Remove unnecessary graph patterns.

resolves DSP-1243

@benjamingeer benjamingeer added the API/V1 label Jan 21, 2021
@benjamingeer benjamingeer self-assigned this Jan 21, 2021
@benjamingeer benjamingeer requested a review from SepidehAlassi Jan 21, 2021
Copy link
Contributor

@SepidehAlassi SepidehAlassi left a comment

This looks great, I just have one point, please see the comment.

case Some(objectIri) => {

BIND(IRI("@objectIri") AS ?object)
BIND(IRI("@linkValueIri") AS ?linkValue)

This comment has been minimized.

@SepidehAlassi

SepidehAlassi Jan 22, 2021
Contributor

In line 50 and 72 below, you are using <@linkValueIri> not the ?linkValue, is the bind here really necessary?
I see that ?linkValue is used in Select, so if for that purpose BIND is necessary, why not use ?linkValue in the other statements?

This comment has been minimized.

@benjamingeer

benjamingeer Jan 22, 2021
Author Collaborator

The bind is there only so we can return ?linkValue in SELECT. Using an IRI literal instead of a variable improves performance, so I changed all the variables to literals wherever possible in these queries.

@SepidehAlassi SepidehAlassi self-requested a review Jan 22, 2021
Copy link
Contributor

@SepidehAlassi SepidehAlassi left a comment

Thanks for this optimization!

@benjamingeer
Copy link
Collaborator Author

@benjamingeer benjamingeer commented Jan 22, 2021

Thanks for reviewing!

@benjamingeer benjamingeer merged commit b1e1b9e into main Jan 22, 2021
10 checks passed
10 checks passed
Build Everything
Details
Prepare next release
Details
API Unit Tests
Details
API E2E Tests
Details
API Integration Tests
Details
Upgrade Integration Tests
Details
Docs Build Test
Details
Publish (on release only)
Details
Deploy docs (on release only)
Details
Google chat notification about release and published version
Details
@benjamingeer benjamingeer deleted the fix/DSP-1243-api-v1-link-query branch Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants