So when I was accepted to #oSoc15 I was so excited to be a part of it again. The moment I got my assignment (see Chris his post), I started looking up how to develop for Drupal. I learned how to build custom modules, themes, how to install them and so on. That way, I was prepared to enter the battlefield of #oSoc15.
So the next step was to learn about all the semantic data formats, how to get the website more semantic and how to get all that into Drupal. Luckily there are a lot of Drupal modules that do all that stuff. So we didn’t need to write our own modules and extensions to get everything like we and the client wanted it.
So hence the name open Summer of configuration. Because there are a lot of modules available we just needed to find the right ones, install them and configure them to our needs. The hardest part was finding them, but thanks to the help of our client and Steven from Calibrate (see blogpost Samir for more info) we were able to speed up that process, because we didn’t need to look for all the right modules.
Warning, the following will be technical
So you’re probably wondering what modules did we use to create a semantic website? Well, here you go
Schema.org is a vocabulary to structure data on the internet. This will give a great enhancement next to the RDF tagging. And lucky for us, there is already a Drupal module for that. So again, just install it, configure it with every content type and done.
One of the advantages of Drupal is that you can create your own content types. But what if you want to link them? (e.g. a person has projects, project is done by persons …). Well, you don’t need to create your own database scheme with foreign keys. There’s a Drupal module called ‘entity reference’ where you can just make references to other content types without one line of code.
Views & Viewfield
Now that we have our entity references, we want to do some queries on that data so we can display the right data for the right content types. Again: Drupal has a solution for that. With the views module you can create queries, again without one line of code.
And last but not least, ONE (yes one) custom module written by yours truly.
Because the client wants all the data in other semantic formats (turtle, jsonld, n-triples) we needed to find a way to export that data and format it. Finally something we could do ourselves. So I started off by writing my own module that checks if someone requests a webpage in a different format (trough URL parameters or content negotiation). When the module gets one of those requests he will scrape the data from the requested page and formats it. Now you’re probably thinking: “Wow, that’s a lot of work!” But no, there’s an awesome API called EasyRDF that does a lot of work for you. But this module will only work if the correct RDF mappings are applied to the data, so a right configuration is muy importante.
As you see, we’ve spent most of our time finding, installing and configuring the right modules instead of writing code. Although I would have loved writing everything ourselves, it would be impossible to do all that in three weeks. Especially if the client wants a stable and secure solution.
So the “Drupal way” might sound boring, but you can get a lot of things done very fast. It’s just a matter of finding and configuring the right modules.
I hope you’ve enjoyed this post and might consider of using Drupal for your own website. The learning curve is steap, but when you’ve got the hang of it, nobody can stop you.