TMRAP support in the blog
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 http://www.garshol.priv.no/blog/tmrap.py/get-topic-page?identifier=http://psi.garshol.priv.no/lmg/events/2006/tmra produces the following TM/XML response:
<?xml version="1.0" encoding="iso-8859-1"?> <topic-pages xmlns="http://psi.ontopia.net/tmrap/" xmlns:tmrap="http://psi.ontopia.net/tmrap/" xmlns:tm="http://psi.ontopia.net/xml/tm-xml/" xmlns:iso="http://psi.topicmaps.org/iso13250/model/"> <server id="larsblog"> <iso:topic-name> <tm:value>Larsblog</tm:value> </iso:topic-name> </server> <topicmap id="blogtm"> <iso:topic-name> <tm:value>Larsblog</tm:value> </iso:topic-name> <handle datatype="http://www.w3.org/2001/XMLSchema#anyURI" >http://psi.garshol.priv.no/junk/blogtm</handle> <contained-in role="tmrap:containee" otherrole="tmrap:container" topicref="larsblog"/> </topicmap> <tm:subject id="the-topic-itself"> <tm:identifier>http://psi.garshol.priv.no/lmg/events/2006/tmra</tm:identifier> <!-- don't have names for these topics, sorry --> </tm:subject> <view-page id="page1"> <tm:locator>http://www.garshol.priv.no/blog/75.html</tm:locator> <iso:topic-name> <tm:value>ISO meeting in Leipzig</tm:value> </iso:topic-name> <contained-in role="tmrap:containee" otherrole="tmrap:container" topicref="blogtm"/> </view-page> <view-page id="page2"> <tm:locator>http://www.garshol.priv.no/blog/74.html</tm:locator> <iso:topic-name> <tm:value>TMRA 2006 — day 2</tm:value> </iso:topic-name> <contained-in role="tmrap:containee" otherrole="tmrap:container" topicref="blogtm"/> </view-page> <view-page id="page3"> <tm:locator>http://www.garshol.priv.no/blog/73.html</tm:locator> <iso:topic-name> <tm:value>TMRA 2006 — day 1</tm:value> </iso:topic-name> <contained-in role="tmrap:containee" otherrole="tmrap:container" topicref="blogtm"/> </view-page> </topic-pages>
So that was that. Next steps:
- Actually publish the PSIs so other people can use them,
- Make the TMRAP server available so others can query it,
- Make it support RSS as one of the alternatives,
- Start using the Mappa Topic Maps engine to add some Topic Maps support to this blog, and
- Release the TMRAP component as part of the OKS.
Maybe some more as well, once I've had some time to think about it.
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
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
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 ontopia.net now that gathers what information there is on it: http://www.ontopia.net/topicmaps/tmrap.html
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 http://www.topincs.com/topicmaps/wiki/ 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: http://www.garshol.priv.no/blog/148.html