fix(sipi): Improve performance of file value query #1697
Conversation
It's really fast now! :-) |
@@ -38,40 +35,24 @@ 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 | |||
CONSTRUCT { |
benjamingeer
Sep 2, 2020
Author
Collaborator
This doesn't seem possible with the current Bazel setup.
This doesn't seem possible with the current Bazel setup.
tobiasschweizer
Sep 2, 2020
Contributor
Ideally, there would be a config option.
Ideally, there would be a config option.
benjamingeer
Sep 2, 2020
Author
Collaborator
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.
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.
tobiasschweizer
Sep 2, 2020
Contributor
maybe at some point we might have more than one free triplestore available
maybe at some point we might have more than one free triplestore available
knora-base:isDeleted false . | ||
|
||
?prop rdfs:subPropertyOf* knora-base:hasFileValue . | ||
knora-base:hasPermissions ?currentFileValuePermissions . |
tobiasschweizer
Sep 2, 2020
Contributor
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.
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.
benjamingeer
Sep 2, 2020
Author
Collaborator
The permissions attached to the current version of a value also apply to previous versions of the value. Value versions other than the current one do not have this predicate.
https://docs.knora.org/02-knora-ontologies/knora-base/#permissions
The permissions attached to the current version of a value also apply to previous versions of the value. Value versions other than the current one do not have this predicate.
https://docs.knora.org/02-knora-ontologies/knora-base/#permissions
benjamingeer
Sep 2, 2020
Author
Collaborator
(Values don't have attachedToProject
anymore, either.)
(Values don't have attachedToProject
anymore, either.)
…ct from file values.
It's really fast now, thanks for this PR! |
Thanks for the review and for testing it! |
@@ -50,6 +50,10 @@ CONSTRUCT { | |||
knora-base:attachedToProject ?resourceProject . | |||
|
|||
?fileValue ?objPred ?objObj . | |||
|
|||
@* This FILTER is unnecessary, but it makes Jena run the query faster. *@ |
tobiasschweizer
Sep 2, 2020
Contributor
that comment means that we know how the triplestore works ;-)
that comment means that we know how the triplestore works ;-)
benjamingeer
Sep 2, 2020
Author
Collaborator
Exactly! :)
Exactly! :)
https://dasch.myjetbrains.com/youtrack/issue/DSP-582
This PR rewrites the
getFileValue
SPARQL templates to use aCONSTRUCT
query that seems to be more efficient with Jena than the currentSELECT
query is.