RDF Mapping

July 10th, 2004 7:17 AM

I’ve hacked up some geo-locator code to pull locations from RDF and map the result on a world map. As an example, here’s a (partial) map of where I’ve been from 1999—2004.

Based on latitude, longitude, and date, the code currently works with the following triple patterns:

(?person foaf:name "{name}")
(?person dao:consumed ?beer)
(?beer foaf:based_near ?loc)
(?beer dc:available ?date)
(?loc geo:lat ?lat)
(?loc geo:long ?lon)

(?person foaf:name "{name}")
(?img foaf:depicts ?person)
(?img foaf:based_near ?loc)
(?img dc:date ?date)
(?loc geo:lat ?lat)
(?loc geo:long ?lon)

(?person foaf:name "{name}")
(?img foaf:depicts ?person)
(?img foaf:creationEvent ?event)
(?event ical:date ?date)
(?event contact:nearestAirport ?air)
(?air geo:lat ?lat)
(?air geo:long ?lon)

(?person foaf:name "{name}")
(?img foaf:maker ?person)
(?img foaf:based_near ?loc)
(?img dc:date ?date)
(?loc geo:lat ?lat)
(?loc geo:long ?lon)

using

album FOR <http://kasei.us/e/ns/album#>
beer FOR <http://www.csd.abdn.ac.uk/research/AgentCities/ontologies/beer#>
contact FOR <http://www.w3.org/2000/10/swap/pim/contact#>
dao FOR <http://kasei.us/ns/dao#>
dc FOR <http://purl.org/dc/elements/1.1/>
foaf FOR <http://xmlns.com/foaf/0.1/>
geo FOR <http://www.w3.org/2003/01/geo/wgs84_pos#>
ical FOR <http://www.w3.org/2002/12/cal/ical#>

I’m assuming this will work with anyone else who’s got RDF available in this form, but couldn’t readily find an RDF file to check it with. The URL for the map is http://kasei.us/e/locations/index.cgi?name={name}&url={URL}, name being the unique identifier for the person (not unique, I know, but hopefully good enough for now), and URL being a whitespace seperated list of RDF URLs. The mapping won’t take into account travel across the international dateline, so travel from, say, Los Angeles to Tokyo would take the long way around, crossing the prime meridian.

Tomorrow I hope to add a triple pattern for image creation (?img foaf:maker ?person. ?img foaf:based_near ?loc.) as well as using EXIF data for the date (instead of relying on my album data).

Enjoy.

Update: I’ve made the changes to the code; the triples above now reflect the use of EXIF-based date data (added to the RDF in gallery.xrdf), and the addition of data points based on foaf:maker for images.