finally a bnode with a uri

SPARQLScript Teaser

Basic support for variable assignments, placeholders, IF branches
I just managed to trick my experimental SPARQLScript parser into accepting simple IF-branches and placeholders. Here is an example of what is going to be possible with ARC soon (and yes, I know this snippet most probably won't excite anyone but me ;)
BASE <http://sparqlbot.semsol.org/data/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>

# set the endpoint
ENDPOINT <endpoint.php>

# feed still fresh?
$current = ASK FROM <graph-updates> WHERE {
  <http://planetrdf.com/index.rdf> dc:date ?date .
  FILTER (?date > ${now-1h})
}

# refresh feed and update graph log
IF (!$current) {
  DELETE FROM <http://planetrdf.com/index.rdf>
  LOAD <http://planetrdf.com/index.rdf>
  INSERT INTO <graph-updates> { <http://planetrdf.com/index.rdf> dc:date "${now}" }
} 
(Parsed Structure)

The fun thing about the whole SPARQLScript experiment is that the parser (so far) is still below 200 LOC. A lot can be re-used from the official SPARQL Grammar, e.g. IF-blocks are really just:
Script ::= ( Query | PrefixDecl | EndpointDecl | Assignment | IFBlock )*
IFBlock ::= 'IF' BrackettedExpression '{' Script '}'

Implementing the actual SPARQLScript processing engine is of course more work than the parser, but I'm making progress there, too.

Comments and Trackbacks

How does sparql compare with the "toy" language in chap. 4 of sicp? see: http://mitpress.mit.edu/sicp/full-text/book/book.html .
Comment by Colm Kennedy on 2008-06-11 11:38:37 UTC
Very cool bengee!
Comment by Keith Alexander on 2008-06-11 13:26:07 UTC
Keith, Thanks :)
Colm, ugh, no idea, sorry.
Comment by Benjamin Nowack on 2008-06-11 15:07:05 UTC
0 comments are currently in the approval queue.

Comments are disabled for this post.

Later Posts

Archives/Search

YYYY or YYYY/MM
No Posts found

Feeds