Dead Reckoning - the new album, out 23 March 2007. Click to learn more!

Exporting Miranda's contacts as FOAF

Storing all the contacts in my various address books and networks in one address book file in the FOAF format is part of my vision for organising my digital life better with Semantic Web technologies. I haven't tried Beatnik yet but it might help with that. This is also part of a plan to integrate semantic stuff a bit deeper into my Web site, ultimately showing that we don't need the walled gardens and data silos that are social network platforms today but more on that as soon as I've made some progress with my ideas.

For now we will just try to convert some contact data. I'm not member of many social network sites because I don't like them. I don't like giving them my data. So if I want to manage my social network myself using FOAF, where could I start getting my contacts from? Most of my friends use ICQ and so IM contacts would make for a good start. Fortunately the messenger I use, Miranda IM, can export all my contacts into an easy-to-handle .ini file. To do that you click on its menu, go to "contact list import/export", then "export contact list", confirm the warning, choose where to store the file and say you don't want to export your history.

This file is kept quite simple: for each contact you have a section with a number. In each section you have several attributes. The ones we will use are "ID", "CListNick", "CListGroup", "Proto" and "Hidden". Now we need something to parse the .ini file. I work with Java and used the ini4j library for that. With it we will read in the file and then have access to the sections and the attributes of a section as Java Maps. From there on we just open another file and write the RDF/XML we want to generate as plain text into it (note that we need our URI to relate other people to ourselves).

So, we go through the sections (contacts) and whenever we see one with the attribute "Hidden" we skip it (this is people who wanted to reach you or people you ignored I assume). We use the attribute "CListGroup" to create memberships to foaf:Groups. "CListNick" servers as the foaf:nick of a person. To be able to use "ID" as an identifier we first have to determine the appropriate property to put it into. Therefore we map the value in "Proto" (protocol) to the name of a FOAF attribute: "JABBER" to foaf:jabberID, "ICQ" to foaf:icqChatID and so on. After we finished writing out all the contacts we write the groups and then finish the file. That's it.

Now you have a valid FOAF file with your IM contact list data. This is not perfect yet - the people in it are uniquely identified by their IM IDs but they don't have URIs, neither have the groups we created. Also when you want to map those entries to people from other sources you probably have to do it manually. LiveJournal has IM IDs in their FOAF data but I don't think you can search for them so you could only do it if you already know the people's handles there you want to integrate into your address book.

Take a look at the Java file for more detail.

Blogging, the Semantic Web, languages and the garbasail

I don't really blog much which has a reason: I have planned a lot of blog entries about many different things and they all build on top of each other: I want to explain the things I do to my readers. But I never get to finish any of the entries and so I figure blogging doesn't work this way. I just have to write. Whenever I feel the need to explain something I can still do it later on. And there are other people to explain things anyway.

Well so I have read up on a lot of Semantic Web stuff over the last year and it has given me a vision of what I want to do with computers. I will explain this step by step. But first some random posts about parts of the technology around it which you probably might not understand immediately if you don't know what it's all about.

By the way: as you can see I actually have two blogs, one in English and one in German. Normally I will try to write posts in both languages and then interlink them. But sometimes there are topics which are specific for one language audience (e.g. German politics and press) and sometimes I'm just lazy. :-)

Oh and: the garbasail project hasn't died! We had some bad luck with finding dates for trying it out last year and every time we wanted to there was rain announced (just like right now, it's raining cats and dogs). I hope we'll have more luck this year.

Take care!