Triplr: Stuff in, triples out

How

How... can I use it?

Think of a input URI that has some RDF syntax content, or some microformat that Raptor can understand via GRDDL. Remove http:// from the start.

Think of the output format you want from this list:

free verizon ringtones

If the format you are thinking of is not on this list, sorry but Triplr won't work for you yet :(

Form a URI in your head that is http://triplr.org/output format/input URI

If you forgot to take out the http:// from the start of the input URI, Triplr will redirect it for you.

Give that to a web browser or other application.

Done!

OK, I lied. There are also some optional parameters you can give as a Matrix URI right after the output format. You start them with a ; and separate them with a ; too. They either have no value like param or are like param=value

Example just for Rev Dan:
http://triplr.org/json;callback=foo/sws.geonames.org/5352844/nearby.rdf

You can also specify the input format if Triplr guesses wrongly. It's not that smart, it's not AI. If you want to specify the input parser, use this format: http://triplr.org/input format-output format/input URI

The list of input formats are: atom, grddl, n3, ntriples, rdf, rdfa, rss, trig, turtle

How... does it work?

Take the request and decode it, do some parameter checking. If the data URI looks ok, use perl LWP to read it, constructing a request for the data URI with an Accept: based on the parsers that Raptor supports.

If the original request had an If-Modified-Since: header, send that when fetching the data URI and return not modified if the data URI did. This makes Triplr cache friendly and saves doing extra work that is thrown away.

Start to figure out from the mime type and sniffing at the content what it content type it is likely to be. Use that to pick an appropriate Raptor parser.

Start the parser running. At this stage the result might be nothing if the content is not well formed XML or the HTML does not contain any GRDDL hints. If triples were returned, store them in a temporary Redland RDF graph in memory.

Serialize the graph to the requested syntax output using a Raptor serializer or using the Perl CPAN JSON module or by-hand if HTML is requested.

Make the response cache friendly by sending an appropriate Last-Modified: and Expires: in the response based on either the original document, or set last modification date to now, expiry time 1 hour from now.

How... was it built?

Triplr was made with Redland (Raptor), Perl (CGI, JSON, LWP, HTML::Template*) and vi on the console.

* Probably not for long, it's too crude.

what, why, when, how, todo