Category Archives: FOAF FOAF Project

Authorization by Codepiction

Over the last fours years and counting, I have been providing access to a triplestore with description of my photos through a facetted interface. Through those years I have received several requests for excluding people from the searchable interface, as they showed up quite prominently on Google.

It turned out to make the interface much less useful for me — and possibly for others as well — so not too long ago I ended up simply excluding photos depicting people — using SPARQL, of course:

PREFIX foaf: <>
SELECT ?Photo 
WHERE { ?Photo foaf:depicts ?Person .
        ?Person a foaf:Person }

That, of course, didn’t really improve things from my personal perspective, so watching others experiment with OpenID and social networking, I decided to take the same route — with a twist.

I didn’t really want to maintain or discover a social network for this use, but then it dawned on me: My photos actually represent a social network, as codepiction describes relations between people even better than explicitly stated ones.

With that in mind, I got the most recent version of the PHP OpenID Library up and running, and now use SPARQL to extend the non-person subset created above with photos of codepictees for users logged in with their OpenID — assuming they match with the descriptions in the store:

PREFIX foaf: <>
SELECT ?Photo 
WHERE { ?Photo foaf:depicts ?Friend .
        ?OtherPhoto foaf:depicts ?Friend .
        ?OtherPhoto foaf:depicts ?User .
        ?User ?ifp ?OpenID .
        ?ifp a owl:InverseFunctionalProperty }

Note that since I don’t restrict ?User to be distinct from ?Friend (and ?Photo from ?OtherPhoto), the query also returns photos depicting the user. The query also doesn’t explicitly look for foaf:openid, but rather any inverse functional property, and since I’ve used foaf:mbox/foaf:mbox_sha1sum quite a lot in the descriptions of the photos’ depictees, I have added the option to verify your e-mail address — it is not enough to trust what’s returned from an OpenID provider, as there is no validation, and I wouldn’t want everyone to create OpenID identities with my e-mail address.

All in all, you can now use OpenID to log into my facetted interface and — if you are recognized — get access to additional photos. Try it!

Quite slick use of codepiction, if I may say so myself…

NB: I cheated. Parts of the backend still use an old RDQL engine, so some of this was actually not done in SPARQL. Also, I supplemented the above codepiction query with queries regarding albums with codepiction and photographer information (mostly useful for myself, of course), meaning you will actually see more photos than you might expect.

(Almost) No More Comments

I haven’t been writing much here lately, but others have.

Or rather: They’ve tried.

Some time ago I turned off trackbacks and pingbacks completely, and changed the options for comments to require moderation before anything went online.

That hasn’t stopped the spammers though — I get at least ten mails about spam comments each day, and frankly that’s just not fun.

I should be upgrading to the lastest version of WordPress, as that includes the clever Akismet plugin for catching spam, which seems to work quite well on the other blogs I run. Also, I really should finish the plugin that leverages my social network through FOAF, that’d make for a really great combination, methinks.

Instead I’ve activated a plugin that turns off comments and pings within 30 days of the posting date.

I’m sorry for the inconvience for those who wish to comment on older posts — for now it has to be like that (but do send me a mail if you’d like to comment anyway).

Uncle Squared

Things haven’t been less hectic since my last progress report — I’m now officially entitled to the title “Uncle”, as my sister yesterday finally gave birth to Silke, her lovely daughter and my wonderful niece:

Silke, Gry og Hans

To top it off, (Aunt) Katrine’s brother and his wife came home from China tonight, bringing with them their new daughter Isabel, just as lovely and wonderful:


In other news, Katrine and I entered the bubbly housing market — we bought a house on Lellinge Allé, just outside central Copenhagen. We will be moving after October 1st, after which you’ll all be more than welcome to stop by! :-)

Elsewhere, Katrina is in the news and photo streams, and Tim Bray’s retrospect about Nawlins reminded me of when I was there, specifically of when I was walking down Basin Street and got “hustled” by a guy who claimed to be able to tell “where I got my shoes” for $10. Since I brought them from Denmark, I figured I’d be safe accepting the challenge, but he simply replied “On your feet”. Laughing hard, I just had to fork it over.

ObSemWeb: Prompted by Danny Ayers, I finally got around to releasing a new version of the FOAF Output plugin. It’s now at 1.17, with a few fixes and tweaks added since the last release (but still not tested with WP 1.5 and later).

Friendly Reviews

Things have been a bit hectic lately, but I have actually managed to make something that might be worth going public with. (Actually, I’ve already pointed it out on #swig, but that’s another matter.)

Over at FilmTrust they let you not only rate and review movies, but also connect with your friends to see what kind of movies they like. Of course, this being a service from the first site on the Semantic Web, it offers a nice FOAF document, like mine.

As you can see, it contains information about the reviews I’ve written and a list of my friends, with rdfs:seeAlso‘s provided for the latter, which makes it possible to create an RSS feed with some XSLT and use of the document() function, like this: FilmTrust reviews by mortenf and friends. The output is generated via W3C’s XSLT Service — note how at least three URIs are involved in this, that’s (minimal) REST for you. Oh, let’s add another one: Via the Syndication Subscription Service.

A nice addition to the original source FOAF would be dates on the reviews — that’d make it possible to limit the size of the resulting RSS file. As it is, there’s no way to know which are “new”. Also, there are some escaping issues on FilmTrust, I had to remove golbeck and sbp from my friend list to get a running example…

Note that the XSLT takes an optional parameter, user-only. That’s provided in case you’re only interested in your own reviews — I use this to drop them into my personal planet feed.

Try subscribing to reviews from your own social network!