Mailing list ARC-DEV: Archives

Bug with GRAPH and OPTIONAL

From: Mario Volke 
Subject: Bug with GRAPH and OPTIONAL
Date: Wed, 17 Dec 2008 10:13:51 +0100


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I think I've found a critical bug in the sparql implementation of ARC2.<br>
<br>
I've done the following queries:<br>
<br>
PREFIX foaf: <a class="moz-txt-link-rfc2396E" href="http://xmlns.com/foaf/0.1/">&lt;http://xmlns.com/foaf/0.1/&gt;</a> <br>
INSERT INTO &lt;urn:identity&gt; {<br>
<a class="moz-txt-link-rfc2396E" href="http://www.example.com">&lt;http://www.example.com&gt;</a> rdf:type foaf:Person .<br>
<a class="moz-txt-link-rfc2396E" href="http://www.example.com">&lt;http://www.example.com&gt;</a> foaf:givenname "Anna" .<br>
}<br>
<br>
<b>consider the graph uri in the following statement!!!</b><br>
<br>
PREFIX foaf: <a class="moz-txt-link-rfc2396E" href="http://xmlns.com/foaf/0.1/">&lt;http://xmlns.com/foaf/0.1/&gt;</a> <br>
INSERT INTO &lt;urn:identy&gt; {<br>
<a class="moz-txt-link-rfc2396E" href="http://www.example.com">&lt;http://www.example.com&gt;</a> foaf:givenname "Max" .<br>
}<br>
<br>
<br>
PREFIX foaf: <a class="moz-txt-link-rfc2396E" href="http://xmlns.com/foaf/0.1/">&lt;http://xmlns.com/foaf/0.1/&gt;</a> <br>
SELECT ?s ?name WHERE {<br>
GRAPH &lt;urn:identity&gt; {<br>
?s rdf:type foaf:Person .<br>
OPTIONAL { ?s foaf:givenname ?name }<br>
}<br>
}<br>
<br>
the last select query gives me the following result:<br>
<br>
<table>
  <tbody>
    <tr>
      <th>s</th>
      <th>name</th>
    </tr>
    <tr>
      <td><a class="moz-txt-link-freetext" href="http://www.example.com">http://www.example.com</a></td>
      <td>Max</td>
    </tr>
    <tr>
      <td><a class="moz-txt-link-freetext" href="http://www.example.com">http://www.example.com</a></td>
      <td>Anna</td>
    </tr>
  </tbody>
</table>
<br>
<br>
This is obviously wrong because Max is not in the graph
&lt;urn:identity&gt;!!!<br>
<br>
</body>
</html>