In an earlier installment I wrote about the reasons why we started building the content management system Zotonic using the programming language Erlang. In this installment I will give a quick overview of the data model and the basic building blocks of Zotonic.
A Zotonic web site is made of different functional parts:
Modules are directories with at least one Erlang module implementing a gen_server that manages the module. Subdirectories in the module contain all the templates, Webmachine resources, dispatch rules, actions etc.
Modules communicate with each other using notifications. Modules can be activated or deactivated using the admin interface (which is implemented using multiple modules).
The data model is inspired by semantic web triple stores. But then adapted to make it work with a relational database and usual CMS interfaces and methods.
All (ok, most) data in Zotonic is a resource. Resources are connected with edges, creating a directed graph of information. Every edge has also a predicate. The predicate defines the meaning of the edge. For example author, as in the author of an article.
For example, a news article is a resource. The image of the news article is another resource, connected to the article with an edge, and so is the author of the article, the place the article is happening etc.
You could say that Zotonic has only two tables. A resource table and an edge table.
Resources are typed using a hierarchical category system. Some predefined resource categories are: text, news, image, video, sound, person, group, predicate, category and other.
A resource has some fixed fields and can have any additional fields. The fixed fields are:
All textual fields (except name and uri) can be multilingual. Any resource can have multiple extra data fields. Think of a date range, name or address.
In the next article I will show a bit of a template.