-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add tests to document current definition of EXISTS #43
Conversation
See issue #42 for discussion. |
The :existsScope02 test is defined as a QueryEvaluationTest, but does not define an |
i was wondering about this, but did not find a clear indication of how to classify negative evaluation tests of this sort, just negative syntax tests or evaluation test, such as type promotion tests, which did not produce some other specific result. |
nb. the pfps corrections, above, should now be in the pfps-sparql-exists branch, which has been created for this issue. |
That is because I don't believe there are any other cases where SPARQL is defined in such a way that you would expect an error that isn't a syntax error. Run-time errors are generally caught and end up producing a false effective boolean value or result in a variable not being bound. My opinion on this is that while these tests are useful to identify places where the spec is undefined or poorly specified, it would be a mistake to have them as part of the official test suite because they don't capture the intended semantics. |
recording limits to the language definition can be useful, in itself. the other alternative is to define the results which they should produce. |
This is a syntactically-valid piece of SPARQL code, but its evaluation does Definition: Extend Let μ be a solution mapping, Ω a multiset of solution mappings, var a variable So what is the test supposed to look like? One option would be to say that some sort of run-time exception is supposed to Another option would be to say that implementations are free to do whatever A third option would be to say that trying to evaluate Extend when its second What I did was to try to push through all the tests to some sort of result peter On 06/20/2016 08:53 AM, Gregory Todd Williams wrote:
|
I believe this would be the first test case to indicate an expected runtime exception, so we'd have to create new manifest terms to describe that. If implementations are free to do whatever they want, I don't think it belongs in the test suite (what would the test definition say is the expected result?). My understanding is that the test suite helps validate the language features that have expected behavior. For example, we can test that a RAND() returns a number in the range [0,1), but can't test that it returns a specific value. Similarly, you could have a test that asserts that an Extend() as described above is syntactically valid (positive syntax test) or syntactically invalid (negative syntax test). But if evaluation might return results or raise an error, depending on the implementation, I don't think that's appropriate to try to encode in a test (nor do I think that would be a good definition for the spec to adopt). I would think that your third option could be considered a negative syntax test, as variable scoping rules should allow syntactic determination that at the point of filter evaluation, and Extend within an Exists may be subject to substitution. I think leaving that as a runtime exception and having the error be data-dependent could be overly confusing. Of the three cases, I think I'd be most happy trying to find a definition that produces expected results without runtime errors. That might include syntactic restrictions within an EXISTS pattern, and almost certainly involves revising the definition of substitute(). |
On 06/20/2016 09:10 AM, Gregory Todd Williams wrote:
What is the intended semantics of SPARQL 1.1 Query? There isn't an The problem is that the SPARQL 1.1 Query specification So what to do? The approach up to now has been to add errata suggestions to Indeed there is an errata suggestion "errata-query-8" about one aspect of There is also "errata-query-10" which talks about how substitute handles My suggestion is that these tests be approved, as documenting the defined If I'm being even more hopeful, I would also hope that this method of fixing Peter F. Patel-Schneider |
we have already had to work around this limitation for tests in which, for instance, the suite permits undefined variables, but we do not.
or, perhaps, to define a single result.
i changed our harness implementation to interpret that no result indicates a 400. |
Agreed. As I said, this is only my opinion. However, I can at least tell you that as former member of the SPARQL WG (and a proponent of the EXISTS feature, though not the eventual editor of the text), your proposed tests and the spec text as written certainly aren't the semantics I had intended. |
On 06/20/2016 09:41 AM, Gregory Todd Williams wrote:
Right now this test is valid syntax, so a negative syntax test is not It is actually quite easy to come up with a definition of EXISTS that doesn't peter |
On 06/20/2016 09:50 AM, Gregory Todd Williams wrote:
As a user of SPARQL, that doesn't give me much comfort. The problems with EXISTS have been known for at least two years. SPARQL There is a new W3C recommendation in development (SHACL) that has a large peter |
Your injection proposal is to inject the solution sequence at the top-level of the exists pattern? If so, I believe there would be a class of queries made impossible that EXISTS was meant to allow. |
How might we get it fixed now without a newly-chartered WG? |
On 06/20/2016 09:57 AM, Gregory Todd Williams wrote:
What would these be? peter |
On 06/20/2016 09:58 AM, Gregory Todd Williams wrote:
That's a good question. I tried to outline how it might happen in a previous peter |
Cases where a top-level join isn't going to give you the same semantics as having the variable bound to a term lower-down the query tree. I don't have specific uses cases at hand, but off the top of my head:
|
On 06/20/2016 10:04 AM, Gregory Todd Williams wrote:
I was trying to craft examples that would show this off. I can come up with examples that use disconnected variables, like SELECT ?x WHERE { This is precisely where different implementations diverge on behaviour. My However, I can't come up with examples for connected variables. peter |
By "disconnected variables" do you mean the hiding of the inner No projection within the EXISTS. I believe the results are different between injection and substitution. Generated on the fly, though, so please let me know if I've gotten it wrong. |
On 06/20/2016 10:44 AM, Gregory Todd Williams wrote:
I think that this has the same result. PREFIX : http://example/ With injection, there is a solution mapping ?g to <not_a_graph_name.ttl> With substitution, GRAPH just ends up with an empty solution mapping. peter |
|
Hmm... yeah, I think that example isn't right. I think I made a mistake in evaluating the proposed injection semantics. I've got to get back to work, so will try to circle back to this as soon as I can allocate more time. |
The manifest seems to have some case issues. For example, the manifest list using :existsSubquery01 but the test definition using :existsSubQuery01. |
[off-list] It appears that your message was somehow mangled. peter On 06/20/2016 12:21 PM, Gregory Todd Williams wrote:
|
On 06/20/2016 11:18 AM, Gregory Todd Williams wrote:
Injection is different from substitution, but I think only in cases where Consider I would argue that the correct answer is the injection one even though that Peter F. Patel-Schneider |
I've fixed the manifest case typos in kasei/rdf-tests@4fc5080 (not sure how I can submit a PR to an already in-flight PR). |
I did it on my copy (existsSubQuery -> existsSubquery) and also put all the peter On 06/20/2016 06:43 PM, Gregory Todd Williams wrote:
|
i transcribed them to the pfps-... branch and pushed them. |
thank you for analysis.text as noted elsewhere, the argument behind the current issue follows from a definition of "substitute" which requires that the implementation conflate lexical terms, abstract syntax and run-time state. as a thought experiment, reconsider the tests with a notion of "substitute" which is consistent with that which is required in order that the paragraph which leads section two make any sense at all. |
On 06/21/2016 04:15 PM, james anderson wrote:
Well, we disagree. I see a formal definition of EXISTS and substitute that has no wiggle room for Broken. I see a formal definition of EXISTS and substitute that has no wiggle room for Broken. I see a formal definition of EXISTS and substitute that has no wiggle room for Broken. And then there are all the cases where semantic anomalies happen. Broken. Just because the formal definition may not match some of the introductory, Fixing EXISTS is going to require changing the behaviour of queries that are In fact this fixing has already been suggested in errata-query-8 peter |
that is because you assert a particular implementation for substitute which is not specified by the recommendation.
by misinterpretation.
i find no text in the recommendation which prescribes how the substitution is to be effected. |
@pfps, do you agree that we should close this PR pending the outcome of the CG? |
On 07/04/2016 06:37 PM, Gregg Kellogg wrote:
That's a good question. Eventually this could be closed because the CG peter |
No harm in leaving it open, but it will eventually be closed without merge in favor of a new PR based on the CG's recommendations. |
This has been languishing, and no indication that a CG has taken this up. Closing as indicated some time ago. |
I believe that it is inappropriate to close this MR. The tests are correct tests of the spec. They really should be added to the test suite. If that is not possible the only other appropriate thing to do is to keep the MR open to document this continuing problem with the spec. |
The way this was left in July of 2016 was that it would be closed in favor of something coming out of a CG; nothing's happened since then. Feel free to reopen this, if you think something has changed, or create a new PR, but there was not consensus in the group to merge, based on my reading of the comments. |
Indeed, which is why it should not have been closed. |
This was discussed during the rdf-star meeting on 26 September 2024. View the transcriptAddressing SPARQL EXISTS errata 4ora: Are there people fine with the current syntax? ora: In any case, chairs will discuss this, let's move on AndyS: [about SPARQL EXISTS] There are two proposals AndyS: 1. substitution based on various existing errata AndyS: 2. an other one based on ANTIJOIN. We already have MINUS. Except the behavior with disjoin domain. But outside of it it's ANTIJOIN AndyS: On an other note, there are other things that might go to SPARQL like LATERAL that can be based on substitution. And pure form of anti join and semi join AndyS: It's a possibility to move these additions (LATERAL, anti join...) to sparql dev pchampin: we would add more subtly differences between operators like FILTER NOT EXISTS vs MINUS pchampin: Your point of having multiple ways might create problems ora: SPARQL spec spends a bit of time presenting this difference AndyS: It was quite contentious in SPARQL 1.1 <pchampin> I'm more than happy to let the editors decide on that AndyS: I am not aware of any outgoing opinion, I think it ends up to a choice on which way to go tl: is it related to triple terms in any way of is it a SPARQL errata AndyS: it has nothing to do with triple terms tl: what is the criteria of SPARQL errata to discuss now? tl: it's a central issue, is that the argument? pfps: There are a bunch of problems with SPARQL, the ones with EXIST are the biggies pfps: They end up splitting the SPARQL implementation space pfps: The decision that has to be made is to move SPARQL EXIST toward a more database-like implementation and keep it more consistent with the existing AndyS: The current implementation is present in SQL with correlated subqueries pfps: if you use the semi/anti join interepretation of EXISTS you change SPARQL more than the other option pfps: In the end people who will see and understand the differences are very few ora: I would like to know preferences AndyS: My preference is for substitution and applying errata (option 1) pfps: I don't have much of a horse in this race pfps: Idealy I would love to get more SPARQL developers on board ora: we could talk outside of the group ktk: I reached out to stardog but not got an input gtw: I am not sure much value to reach out to more developers. sparql-dev has been opened for a long time <pchampin> Tpt: I have a signicant preference for option 1; option 2 is basically equivalent to MINUS pfps: One way to check the issue would be to pull some tests <pfps> which PR? <gkellogg> w3c/rdf-tests#42 <gb> Issue 42 tests to document current definition of EXISTS in SPARQL (by pfps) [SPARQL] <gkellogg> w3c/rdf-tests#43 <gb> CLOSED Pull Request 43 Add tests to document current definition of EXISTS (by pfps) ora: Whatever solutions we pick, someone will ask why we pick it AndyS: picking sustitution breaks the least queries ora: That seems to me a as good reason as any, let's make a decision tl: I would like to ask james about it ora: Let's vote on it next Thursday ora: Let's do it |
Pull request to add these tests to the SPARQL test repository in the EXISTS section