-
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
Pagination count bug related to model_bool #176
Comments
A possible solution could be to generate and inject a FILTER clause based on the currently applied Mapping the |
Here is an example of a FILTER clause for the above query: select ?parent ?child ?name
where {
values (?parent ?child ?name) {
('x' 'c' 'foo')
('y' 'd' UNDEF)
('y' 'e' UNDEF)
('z' UNDEF UNDEF)
}
filter (bound(?name))
} This correctly retrieves a single result row and a count of 1 from the derived count query. It might not be entirely trivial to compute FILTER clauses based on E.g. in the above example, the clause |
Note: There are currently 2 xfails in place for
|
Ideally, the (implicit) default of
For example, the default class M(BaseModel):
x: str
y: str
z: str | None |
Problem outline
The
total count
slot of thePage
object returned bySPARQLModelAdapter.query
is computed by a generated SPARQL count query, which returns the count of all result rows.Obviously and especially in the context of
model_bool
predicates, the number of total rows of the SPARQL result set does not necessarily coincide with the number of total models that are computable for a given query/model constellation.This needs investigation. I think that this is practically mainly a problem for ungrouped models, although I think it is possible that the problem can cause faulty total counts also for grouped models.
Example
Here is a minimal example for problem reproduction:
This returns the following serialization:
The total count refers to the number of SPARQL result rows, which obviously does not align with the actual number of instantiated Pydantic objects.
I think it is safe to say, that the problem only occurs, if the top model is affected by the
model_bool
predicate; only then, the count query result does not necessarily coincide with the number computed models.The text was updated successfully, but these errors were encountered: