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/"><http://xmlns.com/foaf/0.1/></a> <br>
INSERT INTO <urn:identity> {<br>
<a class="moz-txt-link-rfc2396E" href="http://www.example.com"><http://www.example.com></a> rdf:type foaf:Person .<br>
<a class="moz-txt-link-rfc2396E" href="http://www.example.com"><http://www.example.com></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/"><http://xmlns.com/foaf/0.1/></a> <br>
INSERT INTO <urn:identy> {<br>
<a class="moz-txt-link-rfc2396E" href="http://www.example.com"><http://www.example.com></a> foaf:givenname "Max" .<br>
}<br>
<br>
<br>
PREFIX foaf: <a class="moz-txt-link-rfc2396E" href="http://xmlns.com/foaf/0.1/"><http://xmlns.com/foaf/0.1/></a> <br>
SELECT ?s ?name WHERE {<br>
GRAPH <urn:identity> {<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
<urn:identity>!!!<br>
<br>
</body>
</html>