Skip to content
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

Question about sparql-star-pattern-9 eval test #278

Closed
rubensworks opened this issue Jun 21, 2023 · 2 comments
Closed

Question about sparql-star-pattern-9 eval test #278

rubensworks opened this issue Jun 21, 2023 · 2 comments

Comments

@rubensworks
Copy link
Member

I'm looking at the SPARQL eval test sparql-star-pattern-9,
and I'm confused as to why the expected results are defined in the way they are.

The query is as follows:

PREFIX :       <http://example/>

SELECT * {
    { <<?s ?p :o>> ?p ?z }
    UNION
    { ?z ?p  <<?s ?p :o>> }
}

Dataset:

PREFIX :       <http://example/>

<<:s1 :p :o>> :q :z .
<<:s2 :p :o>> :p "same-p" .
<<:s3 :p :o>> : "same-p" .


:z1 :q << :s1 :p :o >> .
:z2 :p << :s2 :p :o >> .

The expected results are:

{ "head": {
    "vars": [ "s" , "p" , "z" ]
  } ,
  "results": {
    "bindings": [
      { 
        "s": { "type": "uri" , "value": "http://example/s2" } ,
        "p": { "type": "uri" , "value": "http://example/p" } ,
        "z": { "type": "literal" , "value": "same-p" }
      } ,
      { 
        "s": { "type": "uri" , "value": "http://example/s2" } ,
        "p": { "type": "uri" , "value": "http://example/p" } ,
        "z": { "type": "uri" , "value": "http://example/z2" }
      }
    ]
  }
}

From the expected results, it looks like implementations are expected to perform an inner join between the ?s and ?p within the quoted triple patterns. However, since we're performing a UNION, I would expect such an inner join not to be required. Instead, I would expect 5 results for this query, instead of only 2.

Am I missing something here, and does the UNION operation introduce some special semantics wrt. quoted triple patterns?
Or is the test incorrect?

@Tpt
Copy link
Contributor

Tpt commented Jun 21, 2023

Just to be sure: have you seen that the ?p variable is present both inside of the quoted triples and in the root pattern, leading to a join of the predicate of the quoted triple with the predicate of the root triple?

This leads the first pattern <<?s ?p :o>> ?p ?z to only matches the second triple of the dataset (<<:s2 :p :o>> :p "same-p") and the second pattern ?z ?p <<?s ?p :o>> to only matches the fifth triple of the dataset (:z2 :p << :s2 :p :o >>).

I hope I am not missing something.

@rubensworks
Copy link
Member Author

Just to be sure: have you seen that the ?p variable is present both inside of the quoted triples and in the root pattern, leading to a join of the predicate of the quoted triple with the predicate of the root triple?

Ah indeed, that's what I was missing. Thanks for clearing that up :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants