Re: Maintaining an RSS 1.0 feed with SPARQL

Karl,

   I'm not sure which operations you're inquiring about -- running  
queries against RSS 1.0 data? Generating RSS 1.0 from a relational DB  
using SPARQL? Generating RSS from differently shaped RDF?

   Anyway, here is some general waffling.

   Once you have read the feed into a store, it seems like it would be  
a trivial application of CONSTRUCT to generate a new RSS feed... with  
the exception of the rss:items construct.

   For the title, link etc., and for the items themselves, you would  
fill out the constructed part as a template, and substitute in  
accordingly.

   rss:items, though, points to a rdf:Seq of each item in the feed.  
Not easy.

   (Sidenote: You would also have to rely on the implementation  
omitting duplicate triples (the "header" appears for each result), or  
on clients processing the feed sensibly (rather than as XML).)

   I'd suggest joining together three graphs:

* The boilerplate header, which you could select from a store and  
CONSTRUCT:

CONSTRUCT {
   <http://example.com/feed> a rss:channel ;
     rss:title ?title .
} WHERE {
   ...
}

* The item subgraph, CONSTRUCTing from the items in the store:

CONSTRUCT {
   ?x a rss:item ;
      rss:title ?title ;
      rss:description ?desc .
} WHERE {
   ...
}

* The rss:items sequence, which you should probably generate outside  
of SPARQL -- CONSTRUCT won't allow you to use the same bnode in more  
than one selected row, and rdf:li is very hard to emulate.


   If you mean actually running SPARQL queries *against* data from RSS  
1.0 -- I've done it, but again, rdf:Seq means you have to be a little  
trickier, particularly when combining data from multiple sources.


   It's kinda depressing that this trivial thing isn't easy to do in  
SPARQL; the handling of sequences just isn't there. Even as a SPARQL  
implementor, without the opportunity to redesign RSS 1.0, I'd advise  
you to use XSLT or plain ol' text substitution for this kind of thing  
(particularly generation).

   I hope that offered some insight!

-R


On  30 Jun 2008, at 8:46 PM, Karl Dubost wrote:

>
> hi,
>
> Given an RSS 1.0 feed with let's say the feed item for the last 2  
> weeks. When the blog is updated, I would select the posts of the  
> last 2 weeks. (or maybe the last 30 posts). Instead of dumping a DB  
> into an RDF template, or using XSLT, or XML parser to read and  
> update the feed, I was wondering about SPARQL.
>
>
> Are there people who have used (are using) SPARQL to maintain an RSS  
> feed?
> Code examples? Tutorials? Recommendations?
>
> Thanks.
>
> -- 
> Karl Dubost - W3C
> http://www.w3.org/QA/
> Be Strict To Be Cool
>
>
>
>
>
>
>

Received on Tuesday, 1 July 2008 04:15:25 UTC