FOAFverse Coming Along

The latest on the FOAFverse:

I've refactored the downloading of the FOAF file to use HttpClient from Jakarta Commons. This gives me much more exact control over the HTTP connections (setting Accept header correctly, setting User-Agent for LiveJournal doesn't get pissed) and I can easily add caching (thanks EHCache).

I've created a HttpClientTemplate to get all the boiler plate code out, like handling exceptions and setting common headers.

My queue is in place to fetch new FOAF files as I discover them. Which leads me to my next favorite refactoring: abstracting out the Strategies for finding the Friends of a Person. There are many ways to link to the FOAF file of a Friend. A common way is rdfs:seeAlso. Others might use the foaf:PersonalProfileDocument or its inverse foaf:hasPersonalProfileDocument. Each method of finding the FOAF file of a friend is a Strategy. As we run each one against a FOAF file, we find Friends' FOAF files, and put them in the queue to be downloaded and searched.

We're getting there. Luckily this is all code that is separate from the webapp I created the other day. It just displays the FOAF in human readable ways.
Post a Comment

Popular posts from this blog

Converting Array to List in Scala

I ported a JavaScript app to Dart. Here's what I learned.

Minification is not enough, you need tree shaking