-
Notifications
You must be signed in to change notification settings - Fork 0
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
Page total count does not work for grouped models #98
Comments
Now, how to test the fix implemented in #99? Imo ideally this should have end2end testing for Testing against a remote endpoint is not an option for me. |
mock urllib. |
Yes, but this is easier said than done, simply mocking The mocking solution I was trying to implement would allow to generically mock graph = Graph().parse("some_actual_rdf.ttl")
def code_under_test():
s = SPARQLWrapper("https://some.inexistent.endpoint")
s.setQuery("select * where {?s ?p ?o .}")
result = s.query()
return result
# target rdflib.Graph instead of remote endpoint for code under test
with SPARQLWrapperLocalTarget(graph) as graph:
result = code_under_test() See https://github.com/lu-pl/sparqwrapper_mock_draft. |
I can implement very basic tests for |
Something like this might not even be wildly insufficient for properly testing the behavior implemented in #99. Opinions? |
NOTE: SPARQL counting and thus the implemented The problem might be caused by how the label service binds label variables, it seems like those variables are not processed by the SPARQL engine directly but bolted on to the query result set as part of a post-processing step, which could explain why the COUNT is not behaving as expected. This post serves the purpose of recording this issue. Nothing more. This is clearly a Wikidata specific problem, all COUNTs of label service bindings are affected. |
Given the following query/model constellation
the total count in a
Page
object will be 3, which is correct:If the model uses grouping however, the count will still be 3, which is NOT correct:
Result:
Obviously this happens because the count query constructor is too dumb to recognize grouping and simply counts all the SPARQL result rows.
A remedy for the problem is ergo to have an alternative code path in the count query constructor in case the outermost model defines a
group_by
config.The text was updated successfully, but these errors were encountered: