Previous | Next

TMRAP support in the blog

Posted in Personal, Technology on 2008-01-10 18:09

Farm near Ordrup, Denmark

I've been thinking for a while that it's a pity that many of the stories in the blog which are about the same things as the photos in the tmphoto application don't show up in that application. I could of course solve that by allowing myself to add occurrences to some topic types, and then adding references to the relevant blog entries from the photo topic map.

However, that seems awkward. What I really want to do is to write each blog entry, and then say what the blog entry is about (that is, tag it) in the blog entry itself. Figuring out what blog entries go with what events and places in the photo application can then be left for the two applications to figure out between them.

This still leaves one question, though. How is the tmphoto application to know which blog entries are relevant? tmphoto is written in Java using the OKS, whereas this blog engine is written in Python. I left the issue hanging here for a long time before the obvious answer struck me: TMRAP, of course. tmphoto can send a TMRAP get-topic-page request to the blog, and the blog can reply with links to all the blog entries for that topic.

90 lines of Python later I had the TMRAP server ready. Then I had to add PSIs to places and events in the photo topic map. Adding support for this in the desktop application required just a couple of lines, thanks to the nice almost-declarative UI framework it uses. Finally, I had to write the Java component that sends TMRAP queries and extracts the pages into nice beans that the JSP pages can display. This was a bit more work, but also quickly done.

So if you visit the photo page for TMRA 2006 you'll see on the right-hand side a link to the relevant blog entries. This is dynamically produced by sending a TMRAP request to the blog with the PSI for TMRA, and the blog responding with the pages it has for this topic.

Thus, accessing produces the following TM/XML response:

<?xml version="1.0" encoding="iso-8859-1"?>        
<topic-pages xmlns=""
  <server id="larsblog"> 

  <topicmap id="blogtm"> 
    <handle datatype="" 
    <contained-in role="tmrap:containee" otherrole="tmrap:container" 

  <tm:subject id="the-topic-itself">
    <!-- don't have names for these topics, sorry -->

  <view-page id="page1">
      <tm:value>ISO meeting in Leipzig</tm:value> 
    <contained-in role="tmrap:containee" otherrole="tmrap:container" 

  <view-page id="page2">
      <tm:value>TMRA 2006 &mdash; day 2</tm:value> 
    <contained-in role="tmrap:containee" otherrole="tmrap:container" 

  <view-page id="page3">
      <tm:value>TMRA 2006 &mdash; day 1</tm:value> 
    <contained-in role="tmrap:containee" otherrole="tmrap:container" 

So that was that. Next steps:

Maybe some more as well, once I've had some time to think about it.

Similar posts

The get-illustration web service

I'm working on a site that lists the various Topic Maps-related software that's out there, in an effort to make all the tools that have been released more visible

Read | 2008-10-28 15:20

Blog metadata in Topic Maps

I've been thinking for a while of representing metadata about the blog in Topic Maps, and Robert Cerny brought this up again with his request for a way to get metadata about the entries through a web service

Read | 2008-01-19 12:47

Extracting fragments with TM-Views

Last time I wrote about how I used OSL to extract a fragment from a topic map

Read | 2005-11-30 23:49


Stefan Lischke - 2008-01-11 10:23:16

Where do i find more information about TMRAP (wsdl and such stuff)

Lars Marius - 2008-01-11 10:50:37

Stefan: I created a home page for TMRAP on now that gathers what information there is on it:

heimo - 2008-01-15 02:09:51

Hi, snappy idea! sometimes answer is too obvious we start looking for them too far :)

Robert Cerny - 2008-01-17 04:23:11

Would it be possible to create a topic map for each blog entry, accessible by sending a GET request to the URL of the entry requesting the mime-type "application/xtm+xml;2.0" or even better for my use case "application/jtm+json", which responds with a topic map, containing the simple facts, that there exists a blog entry written by lmg and it is about this and this. It would be great if all items would have item identifiers, so that changes could be tracked and statement duplication could be avoided. With a little PSI magic my manual task of adding your weblog entries to the Topic Maps Wiki at could be automated. I think this would be great :-)

Lars Marius - 2008-01-19 06:48:45

Robert, I did a separate blog entry on this, in order to treat it in greater depth:

Add a comment

Name required
Email optional, not published
URL optional, published
Spam don't check this if you want to be posted
Not spam do check this if you want to be posted
> Home
> Technology
> Beer
> Personal

> The author .
> On Twitter


follow us in feedly

Subscribe by email:

My new book

det norske ølet

My other book

Guidebook to Lithuanian beer
Rough guide to
Lithuanian beer

Various blogs

Paul Krugman
James Fallows
The Loom
Digital Photography School
Democracy in America

Technology blogs

Robert Barta
Sveins blogg
Stephen Fry
Messages in a bottle
Alex Brown
Planet Topic Maps

Last comments

Lars Marius Garshol on A sudoku solver in P...

Heinz-GŁnter on A sudoku solver in P...

martin gottlieb cohen on The narrow road to t...

alex bloom on Active learning, alm...

alex bloom on Experiments in genet...

Shasta on Into the tsunami zone

kenneth mwelwa on 10 tips on presentin...

fadirra on 7 tips on writing cl...

tor henrik hodnefjell on Beer-hunting in Lviv

Tim on 7 tips on writing cl...