To help develop and test my new Sparqlette service, I hacked a couple of XSLTs that might come in handy here and there…
- SPARQL to RSS (lastest version: 0.3)
- As its name implies, this XSLT turns a SPARQL Query Results XML Format document (Variable Binding Results) into an RSS channel, making it possible to subscribe to the results of an (almost) standard SPARQL query without using
CONSTRUCT
. As can be expected, not all query results work, as the RSS specification mandates certain elements. Thus, the value of the channel’s rss:link property is taken from an XSLT parameter named_uri
, the variable bindings to use for rss:link and rss:title in each item is determined via some crude heuristics, and only items that have a URI for the chosen rss:link binding are created.Variable selection heuristics for rss:link / rss:title:
- If there’s a variable named
rsslink
orrsstitle
respectively, the bindings for that variable is used for all items. - Otherwise, the first variable that has a binding to a URI is used for rss:link, and the first variable that has a binding to a literal is used for rss:title
For rss:link I wanted to add another option between the two, that would locate a variable that only has bindings to URIs, but I couldn’t get it working with a single XPath expression, so I gave up.
Example RSS (view Sparqlette input parameters). - If there’s a variable named
- SPARQL to SPARQL (latest version: 0.1)
- This XSLT simply converts documents in the syntax of any of the currently two SPARQL Query Results XML Format draft specifications, W3C Working Draft 21 December 2004 and $Revision: 1.29 $ of $Date: 2005/05/03 09:58:04 $, into the syntax of the latest version, currently the latter. I promise to do my best to stay up to date…
Note: This entry — as all entries in the Release category — will serve as a changelog (you can subscribe to its RSS feed if you want to make sure you don’t miss out on any updates).
Leigh Dodds has created an updated version of the sparql2rss XSLT:
http://xmlarmyknife.org/xslt/sparql-rss.xsl
Write-up: Applying XSLT to SPARQL Results