There are several approaches to implementing LinkedBrainz in software. Broadly, these fall into two categories - modifying the MusicBrainz server code directly or using/modifying off-the-shelf software that translates the Postgres DB into RDF. The approach now favored is to do a little bit of both. First implement RDFa in the MusicBrainz code base and then find some RDB to RDF solution that is not too hard on the DB server.
Modify MusicBrainz to include RDFa
We would modify the views (and perhaps controllers) in the codebase to serve RDF or RDFa. This would allow/force us to adopt the same pagination scheme used for the HTML and ensure no heavy load on the DB server.
Fitting RDFa into the model-view-controller architecture is a bit awkward since you're essentially jamming the model into the view. The mb_server code uses the Catalyst MVC framework and the Template Toolkit for views part. Our strategy to minimize the mess is:
- maintain one file that will deal with all the RDFa modeling issues (root/components/rdfa-macros.tt)
- this file will be full of template toolkit macros that are prefixed with "rdfa_"
- these macros will be called from existing templates where appropriate
- tests will be written to makes sure RDFa is valid and correct
In this way, it is easy to spot where rdfa is being added to the templates and it is easy to see/change the modeling decisions. We hope to increase the HTML file size by less than 30% and we hope these RDFa templates will find their way into the first major NGS release.
RDB to RDF (aka RDF Views)
RDF Views allow the translation of an RDBMS into RDF. The main advantage is that this approach could side-step all pagination. However, this is also the major disadvantage as we must find some alternative method to limit the load on the DB server.
See the W3C WG on RDB2RDF, their wiki, and this nice blog post about existing RDB2RDF tech.
Virtuoso Open Source was used in the Zitgist mappings. See this mapping file.
D2RQ and the D2R server were used in the DBTune mappings. See this mapping file.