Think of a input URI that has some RDF syntax content, or some
can understand via GRDDL. Remove
http:// from the start.
Think of the output format you want from this list:
rdf(this is also the default)
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
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.
OK, I lied. There are also some optional parameters you can give
right after the output format. You start them with a
and separate them with a
; too. They either have no
param or are like
callback=name : generates a JSON function name wrapper around the data
triples: return Triples style JSON output - verbose and regular rather than the default compact RDF/JSON
Example just for Rev Dan:
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:
The list of input formats are: atom, grddl, n3, ntriples, rdf, rdfa, rss, trig, turtle
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
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
Expires: in the response based on either the original
document, or set last modification date to now, expiry time 1 hour
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