-
Notifications
You must be signed in to change notification settings - Fork 3
Clarify that unagreggated variables in SELECT raise an error #327
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
base: main
Are you sure you want to change the base?
Conversation
Makes it clear that inserting SAMPLE is something the user can do, not something SPARQL implementation should do automatically Close #165
Co-authored-by: Olaf Hartig <[email protected]>
|
Is this section even true? I'm trying to square the language in this note (which exists in similar form in the 1.1 spec) with the translation in I read that as supporting I think the language in this section is probably true of the algebra, but I understood that to be the entire point of the translation logic that wraps un-grouped and un-aggregated variables in I also think this note is a bit confusing, because it's not clear if it is describing a restriction on the example just presented (in which the presence of grouping on |
|
@kasei This is a great point! Thank you! I overlooked it even if it was in the issue motivating the MR (#165). I think the SPARQL 1.1 specification is inconsistent and Current quick survey:
|
I don't think agg08 shows this. It has grouping on the expression
That's interesting. Ignoring current implementations, my feeling here is the insertion case makes the most intuitive sense. Both aggregated values and grouped values should be available for use in any (non-aggregation) select expressions. |
Yes, it's not about single variable indeed. My bad.
It seems to me we are not focusing on the same cases. I am focusing on "simple expressions consisting of just a variable" in the projection. I still think SELECT ?P (COUNT(?O) AS ?C)
WHERE { ?S ?P ?O } GROUP BY ?SThere are two possible outcomes:
In a query level which uses aggregates, only expressions consisting of aggregates and constants may be projected, with one exception. When
Then this query is invalid because `?P` in the `SELECT` is not a grouped value.
Replace V with SAMPLE(V)Then the query become equivalent to SELECT (SAMPLE(?P) AS ?P) (COUNT(?O) AS ?C)
WHERE { ?S ?P ?O } GROUP BY ?Sand we get results. Hence my impression that the spec is inconsistent. My MR is taking the first approach and changing algorithm but I don't feel strongly on it. I just think we should be consistent and make a choice here. |
|
In light of the discussion, looking again at the following sentence from 11.4 Aggregate Projection Restrictions [SPARQL 1.1] ..
(which was the sentence that you wanted to improve with this PR), may be this sentence was indeed meant to say that
of the translation algorithm in 18.2.4.1 Grouping and Aggregation [SPARQL 1.1]. However, I would still consider this inconsistent with the following first paragraph of 11.4 Aggregate Projection Restrictions [SPARQL 1.1]:
This one says, indirectly but clearly, that it is not allowed to project a variable unless the variable is a GROUP BY variable. So, in any case, there is an inconsistency in the spec. Regarding the two possible outcomes, I would find the first one (throwing an error, as done by Jena, Blazegraph, Oxigraph, QLever and Communica) to be more intuitive. The PR in its current form (with commit 3f3e302 included) captures this option. Yet, I agree that this is something to be discussed, at least in the TF if not the whole WG, because no matter which of the two options we pick, it is a change for some implementations. |
|
Not completely sure but I think SAMPLE is inserted to put in an aggregate.
agg08/agg09/agg10 are negative syntax tests so, yes, they don't get to the algebra. Does anyone have an example query where it would hit that SAMPLE injection clause? |
Makes it clear that inserting SAMPLE is something the user can do, not something SPARQL implementation should do automatically
Close #165
Preview | Diff