Enumerating RDF::Format

Hello,

I have been using RDF.rb gem as part of dbpedialite.org for a couple of
years now. I opened an issue about enumerating the registered list of
RDF::Formats:

https://github.com/bendiken/rdf/issues/16

Time has passed and this still isn't possible, so I thought I would try and
come up with a patch. Specifically, I want iterate through the registered
list of formats and get:

* The format name (eg 'RDF/XML' or 'N-Triples')
* The default (most official) content type (eg 'text/turtle')
* The default file suffix (eg .rdf or .trix)

This is used to generate a <link rel="alternate"> and hyperlinks to other
formats in the HTML page.

Unfortunately the internal data structures currently make this difficult and
there is no name for a format stored (other than deriving it from the class
name). For the time being I have decided to resort to storing it in my own
data structure:
http://github.com/njh/dbpedialite/blob/master/lib/formats.rb


Is this a problem for anybody else?


nick.


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					

Received on Sunday, 13 May 2012 11:34:02 UTC