Introduction
Ontopia is an Open Source application that lets you create, manipulate and navigate information represented in topic maps. It’s also a toolbox for building all sorts of applications. Among the advantages of topic maps driven applications are enhanced navigation and search capabilities.
Ever since Ontopia went Open Source earlier this year, I’ve wanted to give an example of how easy it is to build a web application on top of it.
Through the next couple of blog posts, I’ll try to show exactly how easy this is – and I promise to leave out the unnecessary talk (wont discuss Topic Maps, for instance).
First I’ll “reveal” how to set up and start Ontopia. As this requires very little typing on my part, I’ll quickly move on to discuss what our goal is. Then we’ll have a look at the required data model, before pointing out the kinds of views that our application needs to support — and how to lay this out. Afterwards, we create the limited amount of code needed to get everything up and running. Last, we deploy.
All code will be available for download ![]()
Setting up Ontopia
Setting up Ontopia requires no magic. Since it comes bundled with Apache Tomcat you don’t even have to download and configure lots of other stuff (something I often find quite annoying with Java based applications).
The few steps needed to set up and start Ontopia are as follows:
- If you do not already have Java Runtime Environment (JRE) installed, now is the time to do so.
- Download the latest Ontopia release.
- Extract the downloaded archive somewhere on your hard drive — e.g. c:\dev\ontopia (<install-dir>).
- Start Ontopia by executing <install-dir>\apache-tomcat\bin\startup.bat (or startup.sh).
If this doesn’t work, have a look at the installation docs that are part of the Ontopia distribution (<install-dir>/doc/install.html)
Note that we’ll put our custom code into <install-dir>\apache-tomcat\webapps. Alternatively, you can use the Ontopia maven repository to set up a maven2 project.
Identifying the Requirements
Since this is a blog let’s have a look at how to quickly set up a blog or simple CMS on top of Ontopia.
Because Ontopia’s built-in editor (Ontopoly) already supports our limited editing needs, all we need to figure out is what a blog looks like and what kind of views – i.e. pages – our application should contain.
Luckily, that is fairly easy.
A blog consists of blog posts, individual posts are written by an author, a blog post can belong to categories – which may be related to each other (e.g. form a hierarchy), and, finally, a blog post may be tagged.
What we need to store information about is therefore:
- Blog; which have a title and description and is related to blog posts.
- Blog Posts; consisting of title, excerpt and text body, publish status (draft/published) and publish date.
- Categories; with name and description.
- Tags; just the name.
- Authors; just the name (for simplicity).
It might help to draw it up:
This is our data model and what our database (topic map) eventually will store information about.
The Custom View
We also need pages displaying the information sketched out above.
Typically, the different pages of a blog are:
- Blog Index (front page)
- Individual Post Entry
- Category Index
- Category Page
- Tag Index
- Tag Page
Next: Creating the Database
Building our application on top of Ontopia we naturally use a topic map as our database. The topic map is populated using Ontopoly; Ontopia’s built-in topic map editor.
My next post will be about using Ontopoly to create our “schema” and add some data to it. The types of data that will be discussed are described in detail in The TAO of Topic Maps — which you might want to have a look at…

Lars Marius Garshol
/ 22/11/2009Good stuff, Trond! Looking forward to seeing the next parts.
Robert Strind
/ 25/11/2009Nice blog! Just the thing I needed to finally get started
Ibrahim
/ 12/12/2010it is reallllly great, I have just understooood how can we use Ontopia,
anyway thank u very much,
C. Brayton
/ 01/02/2011“If this doesn’t work, have a look at the installation docs that are part of the Ontopia distribution (/doc/install.html)” That’s like saying that if the rabbi slips up at the bris, he’ll spend 10 years at seminar studying Greek. For me, webappas/ontopoly threw a 404 error, fast and right over the plate. Deployment procedures seem to be hanging me up. Well, it just goes to show you — most things sold to you ask working right out of the box, don’t work right out of the box,