Hi all,

I am not an expert of the semantics of how OPTIONAL works in SPARQL but I am a 
little surprised at some results I am getting. I am executing the following 
queries on a copy of the database which is normally at 
http://go.bio2rdf.org/sparql although it is down at the moment.

No results query:

SELECT * WHERE {  GRAPH <http://bio2rdf.org/go> { OPTIONAL { 
<http://go.bio2rdf.org/go:0032283> <http://www.w3.org/2000/01/rdf-schema#label> 
?label . } OPTIONAL { <http://go.bio2rdf.org/go:0032283> 
<http://purl.org/dc/elements/1.1/title> ?title . }  OPTIONAL { 
<http://go.bio2rdf.org/go:0032283> <http://owl.bio2rdf.org/go#name> ?goName }  
}  }

Results query:

SELECT * WHERE {  GRAPH <http://bio2rdf.org/go> { OPTIONAL { 
<http://go.bio2rdf.org/go:0032283> <http://owl.bio2rdf.org/go#name> ?goName }  
}  }

The only difference between the queries is that I take out two of the optional 
statements and it returns the result which should have matched in the first 
one... Or am I doing something wrong? 

For reference, I am trying to efficiently seek a label for a given item without 
knowing beforehand which predicate will be there, as the subject URI is 
generated from a query on the bio2rdf software which in turn generates the 
SPARQL query (I am actually using a CONSTRUCT internally but the behaviour is 
the same as the SELECT)

Cheers,

Peter



      Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now 
http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline

Reply via email to