All for a question mark

November 11th, 2009

Hey, did you know that the “where” keyword in the “where” clause in SPARQL is optional? Yep, you can check it here!

What does this mean? Well, instead of writing something like

select ?s ?p ?o where{
  ?s ?p ?o
}

you can write

select ?s ?p ?o {
  ?s ?p ?o
}

So, what’s the problem? Well, there is no problem… But what if you forget a space and write the following?

select ?s ?p ?owhere {
  ?s ?p ?o
}

I guess you can understand what this means :) Of course it is very easy to spot this error, but what if you are building the query string like the following one?

$query  = "select ?s ?p ?o";
$query .= "where {\n";
$query .= "  ?s ?p ?o\n";
$query .= "}";

I know, I know, that is a quick and dirty way of doing it, and anyone who does this should pay the fee. But what if a poor student forgets a \n in the concatenation, the system does not return any error, and all the objects you were asking for are not returned? Be aware, friends, and don’t repeat his mistake… ;-)

[thanks Sarp for providing me the chance to spot this error - it was a funny reversing exercise!]

Entry Filed under: research

Leave a Comment

You must be logged in to post a comment.

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

September 2010
M T W T F S S
« Dec    
 12345
6789101112
13141516171819
20212223242526
27282930  

Most Recent Posts