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

w3c benchmark: incomplete query: bindings/values07 #4

Open
Rintarou opened this issue Jul 17, 2018 · 0 comments
Open

w3c benchmark: incomplete query: bindings/values07 #4

Rintarou opened this issue Jul 17, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@Rintarou
Copy link
Collaborator

Rintarou commented Jul 17, 2018

When running the query
bindings/values07
from the w3c SPARQL 1.1 compliance benchmark

which has this exact form:

PREFIX : <http://example.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?s ?o1 ?o2
{
  ?s ?p1 ?o1
  OPTIONAL { ?s foaf:knows ?o2 }
} VALUES (?o2) {
 (:b)
}

we get incomplete results:

<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
  <head>
    <variable name="s"/>
    <variable name="o1"/>
    <variable name="o2"/>
  </head>
  <results>
    <result>
      <binding name="s">
        <uri>http://example.org/a</uri>
      </binding>
      <binding name="o1">
        <uri>http://example.org/b</uri>
      </binding>
      <binding name="o2">
        <uri>http://example.org/b</uri>
      </binding>
    </result>
    <result>
      <binding name="s">
        <uri>http://example.org/a</uri>
      </binding>
      <binding name="o1">
        <literal>alan@example.org</literal>
      </binding>
      <binding name="o2">
        <uri>http://example.org/b</uri>
      </binding>
    </result>
    <result>
      <binding name="s">
        <uri>http://example.org/a</uri>
      </binding>
      <binding name="o1">
        <literal>Alan</literal>
      </binding>
      <binding name="o2">
        <uri>http://example.org/b</uri>
      </binding>
    </result>
  </results>
</sparql>

these are sound, but we expect two additionnal bindings:

    <result>
      <binding name="s">
        <uri>http://example.org/c</uri>
      </binding>
      <binding name="o1">
        <literal>alice@example.org</literal>
      </binding>
      <binding name="o2">
        <uri>http://example.org/b</uri>
      </binding>
    </result>
    <result>
      <binding name="s">
        <uri>http://example.org/c</uri>
      </binding>
      <binding name="o1">
        <literal>Alice</literal>
      </binding>
      <binding name="o2">
        <uri>http://example.org/b</uri>
      </binding>
    </result>

The query executes over this dataset:

@prefix : <http://example.org/> .
@prefix foaf:       <http://xmlns.com/foaf/0.1/> .

:a foaf:name "Alan" .
:a foaf:mbox "alan@example.org" .
:b foaf:name "Bob" .
:b foaf:mbox "bob@example.org" .
:c foaf:name "Alice" .
:c foaf:mbox "alice@example.org" .
:a foaf:knows :b .
:b foaf:knows :c .

The expected results does not seem to make sense. Yet they are correct, and we can reproduce them with Jena.
What is confusing is that it feels like bindings are made up.
The one we obtain do make sense. :a is linked to his inbox, his label and :b.
but then there is :c that, while being linked to her inbox and label as well, should not foaf:knows :b.
Please note that there is no inference at play here.

Moreover, if we have those :c related bindings appear, why don't we have other :b related ones in the same fashion?
Like so:

    <result>
      <binding name="s">
        <uri>http://example.org/b</uri>
      </binding>
      <binding name="o1">
        <literal>bob@example.org</literal>
      </binding>
      <binding name="o2">
        <uri>http://example.org/b</uri>
      </binding>
    </result>
    <result>
      <binding name="s">
        <uri>http://example.org/b</uri>
      </binding>
      <binding name="o1">
        <literal>Bob</literal>
      </binding>
      <binding name="o2">
        <uri>http://example.org/b</uri>
      </binding>
    </result>

A hypothesis would be that the VALUES declaration assigns the :b to ?o2 if there is no validfoaf:knows statement for ?o1 to be the object of.
It would behave accordingly:
*. :a gets included: there is an explicit :a foaf:knows :b, so it would match
*. :b gets rejected: there is an explicit :b foaf:knows :c, so :b is the subject of a foaf:knows statement. Therefore, it cannot match :b foaf:knows [:b]
*. :c gets included, as it is the subject of no foaf:knows statement, it gets handed the :b value.
The more I think about it the less it makes sense. Why on earth would that be standard behavior?

attached is the Query, Results, and Expected files.
QRE.zip

@Rintarou Rintarou added the bug Something isn't working label Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant