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: <http://xmlns.com/foaf/0.1/> 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: <http://xmlns.com/foaf/0.1/> 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.