Wed 29 Jun 2005

Approaching release

twinql is getting there… the parser now generates correct expressions for even complex queries (nonsense though they may be):
* (parse-sparql 
"PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?mbox WHERE {
?x foaf:name ?name .
?x foaf:mbox ?mbox .
?y foaf:knows ?knows .
foaf:knows rdfs:label ?label .
OPTIONAL {
?x a ?what .
?y a ?something .
{} .
{ ?y a ?nested . } .
OPTIONAL {
?x ?something ?z .
FILTER ( ?z < 5) .
} .
} .
{ ?something a ?flarp . }}")

(SPARQL
:SELECT
:VARS (|name| |mbox|)
:WHERE
'(GRAPH-PATTERN
(TRIPLE |x| !foaf:name |name|)
(TRIPLE |x| !foaf:mbox |mbox|)
(TRIPLE |y| !foaf:knows |knows|)
(TRIPLE "foaf:knows" !"rdfs:label" |label|)
(OPTIONAL
(GRAPH-PATTERN
(TRIPLE |x| !rdf:type |what|)
(TRIPLE |y| !rdf:type |something|)
(GRAPH-PATTERN)
(GRAPH-PATTERN
(TRIPLE |y| !rdf:type |nested|))
(OPTIONAL
(GRAPH-PATTERN
(TRIPLE |x| |something| |y|)
(FILTER (< |x| 5))))))
(GRAPH-PATTERN
(TRIPLE |something| !rdf:type |flarp|))))
It also runs nested graph patterns, optionals, unions (not thoroughly tested), and so on, and I'm part-way through implementing filters. Ah yes, filters — complex buggers to do right.

I'm very pleased that this works:
(run-sparql 
"PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?mbox WHERE {
?x foaf:name ?name .
OPTIONAL {
?x foaf:mbox ?mbox .
} .
}" :stream *standard-output*
:result-format :sparql-xml)
To parse, compile, and run that query on my FOAF file (780-odd statements) takes about 110ms. Not bad.

Release date… soon.

Posted at 2005-06-29 09:43:09 by RichardLink to Approaching releas…
Comments, trackbacks.

Google
Web holygoat.co.uk
  • richard is: