-
Notifications
You must be signed in to change notification settings - Fork 18
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(sipi): Improve performance of file value query #1697
Changes from 3 commits
0f864d6
ad77987
4a5041c
05029e9
12f433e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,39 +36,22 @@ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
PREFIX knora-base: <http://www.knora.org/ontology/knora-base#> | ||
|
||
SELECT ?fileValue ?objPred ?objObj | ||
WHERE { | ||
|
||
CONSTRUCT { | ||
?fileValue ?objPred ?objObj . | ||
?fileValue knora-base:attachedToProject ?resourceProject . | ||
?fileValue knora-base:hasPermissions ?currentFileValuePermissions . | ||
} WHERE { | ||
?fileValue knora-base:internalFilename "@filename" . | ||
|
||
?currentFileValue knora-base:previousValue* ?fileValue ; | ||
knora-base:isDeleted false . | ||
|
||
?prop rdfs:subPropertyOf* knora-base:hasFileValue . | ||
knora-base:hasPermissions ?currentFileValuePermissions . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure I remember why this is necessary (although I seem to have worked on that query): I suppose it's necessary because permissions are only stored for the current version of a value, and if someone asks for a filename that was changed with a later version of the file value, it's the only way to get the permissions, right? So this means permissions are not versioned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
https://docs.knora.org/02-knora-ontologies/knora-base/#permissions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just realised that this means that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Values don't have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
true, good catch! |
||
|
||
?resource ?prop ?currentFileValue ; | ||
knora-base:isDeleted false . | ||
|
||
{ | ||
?fileValue ?objPred ?objObj . | ||
FILTER(?objPred != knora-base:attachedToProject && ?objPred != knora-base:hasPermissions) | ||
} | ||
UNION | ||
{ | ||
@* Return the permissions of the current version of the value. *@ | ||
|
||
?currentFileValue knora-base:hasPermissions ?currentFileValuePermissions . | ||
|
||
BIND(knora-base:hasPermissions AS ?objPred) | ||
BIND(?currentFileValuePermissions AS ?objObj) | ||
} | ||
UNION | ||
{ | ||
@* Return the project of the resource that contains the value. *@ | ||
knora-base:attachedToProject ?resourceProject . | ||
|
||
?resource knora-base:attachedToProject ?resourceProject . | ||
?fileValue ?objPred ?objObj . | ||
FILTER(?objPred != knora-base:attachedToProject && ?objPred != knora-base:hasPermissions) | ||
|
||
BIND(knora-base:attachedToProject AS ?objPred) | ||
BIND(?resourceProject AS ?objObj) | ||
} | ||
?currentFileValue knora-base:isDeleted false . | ||
?resource knora-base:isDeleted false . | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjamingeer Could you test that with GraphDB locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem possible with the current Bazel setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, there would be a config option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think our policy at the moment is that we're not officially maintaining support for GraphDB. But I'm trying to do it anyway if it's not too much effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe at some point we might have more than one free triplestore available