[Haskell] ANN: hsparql, a SPARQL query generator/DSL and client

Jeff Wheeler jeff at nokrev.com
Wed Jul 8 18:27:51 EDT 2009

I'm excited to announce the first version of hsparql. HSparql makes it
easy to query SPARQL-compliant servers using a relatively intuitive DSL
and very simple client.

SPARQL is a SQL-ish query language for stores of RDF data. So, SPARQL
lets you search the structured data in several big databases. I wrote it
so that I could search DBpedia [1], a neat site that pulls structured
data from Wikipedia's infoboxes, and also ties it to remote data
services like MusicBrainz and US Census information. HSparql isn't tied
to DBpedia in any way, though, and can search any server.

The DSL looks something like this:

> simple :: Query [Variable]
> simple = do
>     resource <- prefix (iriRef "http://dbpedia.org/resource/")
>     dbpprop  <- prefix (iriRef "http://dbpedia.org/property/")
>     foaf     <- prefix (iriRef "http://xmlns.com/foaf/0.1/")
>     x    <- var
>     name <- var
>     page <- var
>     triple x (dbpprop .:. "genre") (resource .:. "Web_browser")
>     triple x (foaf .:. "name") name
>     triple x (foaf .:. "page") page
>     return [name, page]

It's currently available on Hackage [2], and at the moment the source
is only available from the tarball hosted there.

I'd greatly appreciate any feedback on this package.

Jeff Wheeler

[1] http://dbpedia.org/
[2] http://hackage.haskell.org/package/hsparql

More information about the Haskell mailing list