When somebody gave me the idea for this I was like, yeah, I’m not going to do a geeky thing like that. But I figured, by this time next year I’ll be studying English and probably quote something Shakespear said, so what the heck.

import pyrdf
from pyrdf import RdfStore, RdfResource, RdfType
from rdflib.Namespace import Namespace

NS_P = Namespace(‘http://www.zefhemel.com/ont/person#’)

store = RdfStore(NS_P)
store.prefix_mapping(‘p’, NS_P)
store.prefix_mapping(‘j’, NS_J)

Person = RdfType(NS_P[‘Person’])

today = ‘2006–06–22’

print ‘People celebrating their birthdays today:’
for p in store.findResources(rdf_type = Person, birthday = today):
 print ‘* %s (%d)’ % (p.name, int(p.age))


* Zef Hemel (23)

There are two important things to note about this. First of all it shows how easy it is to query RDF data using PyRDF. Second of all:

It’s my 23rd birthday today!

Hooray for me!