Using Triplify to expose the semantics of a site
Recently the SWC took a thorough look at Triplify, a tool for mapping the contents of a relational DB to RDF, in the course of which we could convince ourselves of Triplify’s ease of use and its potent capabilities.
We take this opportunity to given an account of the philosophy behind Triplify, how it is used and also had the chance to interview the creator Sören Auer.
A common objection from critics of the semantic web is that regular users or webmasters won’t go to the trouble of marking up their content or whole web sites with RDF.
While it is obvious that nobody is going to decorate their web pages with hand-carved RDF triples, it is also apparent that a lot of the current web’s pages are generated by transforming information from relational databases to HTML pages, which are perfectly suited for human consumption, but which suffer from a big loss of machine-readable semantics.
As the information in the relational databases is highly structured and contains rich semantics, it is only natural to also use the already existing structured data to generate RDF representations of the same information.
Triplify is all about this approach of bootstrapping data for the semantic web. It does this for web applications which are built on PHP and MySQL.
Triplify consists of a lightweight PHP script and a configuration file. The latter is used to do the mapping of the columns of an application’s relational database to appropriate RDF classes and properties.
In many cases a site administrator who wants to export her site’s content as RDF, only has to save Triplify with a premade configuration file for her site’s application into the right folder, as for many popular applications like WordPress, Joomla! or phpBB all the work has already been done.
Once installed, Triplify can be used to generate a dump of the site’s complete RDF graph, or to generate Linked Data, as each of the site’s main concepts’ RDF graph is provided under its own URL, e.g. the semantic description of a user with the ID 123 can be accessed under http://yoursite.com/triplify/user/123.
If no configuration for an application exits, it is fairly easy to create one by yourself.
All one has to do is to look at the app’s database schema, find appropriate classes and properties from well known ontologies and create MySQL queries that grab the data from the relational database and map them to RDF classes or properties.
An example for a query that takes the data from a table describing the user of a CMS:
"SELECT id, name AS 'foaf:name', url AS 'foaf:homepage', short_description AS 'dc:abstract' FROM user_table",
Triplify’s creator Sören Auer kindly gave us the opportunity for an interview:
Triplify is very easy to configure for web developers. For which scenarios would you recommend to use Triplify, and in which situations other approaches of semantifying your data might be more suitable?
As you already mentioned Triplify was primarily developed for Web applications developed in PHP. These usually have a relatively small and simple set of tables. Triplify creates complete RDF exports, Linked Data or JSON, but does not include SPARQL endpoint functionality. When SPARQL is required you are better off with D2R Server or Virtuosos RDF views.
Triplify creates semantic representations of the data in relational databases. Do you think there would also be benefit in the inverse approach i. e. creating an application that parses triples and writes it to a relational DB according to a mapping file?
In certain scenarios this might make sense, but for the most cases I think the database schema has to be developed separately. Database schemata contain more storage and retrieval oriented information, such as for example about data indexing. Vocabularies and ontologies on the other hand represent information on a conceptually higher level and are more flexible with regard to evolution of the information structures than databases.
Are there plans for further development of Triplify?
Sure. We want to add SPARQL support and possibly port Triplify to other scripting languages such as Ruby and Python.
Thank you Sören, we will stay tuned about the news from your great application and look forward to the Triplification Challenge 2009!