Category Archives: Release

WordPress Plugin: Semantic Visits

When I came back from Madrid, after the Image Decription workshop, a few days in the city, and a hefty party in Getafe, I realised I could add another country to my list of visits.

The nice folks at World66 have created a nice interface for generating an image with visited countries highlighted, but while it would be easy to check a few boxes and copy the code to somewhere on my blog pages, that wouldn’t make it possible for the semantic web to figure out where I’ve been. For that reason, I decided to mint a set of vocabulary terms for visits according to Norm Walsh’s country counting rules, collected in the visit vocabulary, and have WordPress output the information in my FOAF profile – thanks to the extensibility of my FOAF Output Plugin. Of course, the FOAF Explorer now also understands these terms, displaying maps of the world, Canada and USA when appropriate — see for yourself!

Thus, here is a new plugin, the Semantic Visits Plugin (view source).

The current version is 1.1.

Changes since 1.0:
  • Added visits to Canadian regions.
  • Fixed “wrong” code/name/etc. properties.
  • The URIs for US states are now correct, pointing at the http://www.daml.ri.cmu.edu/ont/USRegionState.daml ontology containing state definitions instead of http://www.daml.ri.cmu.edu/ont/State.daml which only contains classes and properties.

Continue reading WordPress Plugin: Semantic Visits

WordPress Plugin: FOAF Output

A while ago I hacked WordPres into emitting FOAF, but even though it worked fine, the amount of WordPress-tweaking wasn’t for the faint of heart.

Since then, I have looked a little deeper into WordPress, and now it’s finally ready: The FOAF Output Plugin (view source).

Note: If you want to try running this with WordPress > 1.2, please fix the .htaccess rewrite rule for the author pages like this, otherwise the FOAF file will result in a 404:

RewriteRule ^author/([^/].+)/?$ /<SITEHOME>/index.php?author_name=$1 [QSA,L]

The current version is 1.17 (released 2005-08-31).

Changes since 1.16:
  • Fixed errant line breaks in links.
  • Added generator comment to RSS output.
Changes since 1.15:
  • Added oneline bio on profile page, not HTML-escaped.
  • Added link to RSS channel from author list.
  • Tweaked prefix usage for namespaces.
Changes since 1.14:
  • Added check for array being returned from get_the_category().
  • Added check for get_Lat and get_Long for > 1.2 compatibility.
Changes since 1.13:
  • Fixed category/interest when no categories were found.
  • Changed skos:externalID to dc:identifier.
  • Updated SKOS generation with SKOS extensions vocabulary.
  • Fixed generation of author list URI.
Changes since 1.12:
  • Changed a wrong foaf:made to foaf:page, caught by Ian Davis.
  • Fixed erroneous output of homepage URI on profile page.
  • Fixed a problem with statements being added to Atom feeds, thanks Danny/Sam.
Changes since 1.11:
  • Added blog-wide FOAF output (blogroll) with seeAlso’s to authors’ individual files (example).
Changes since 1.10:
  • Added SKOS output (example) and enhanced RSS output.
  • Added document level RDF/XML API hook, foaf_output_profile_rdf_document, to allow for additional properties by add-ons, e.g. generator information.
  • Fixed possible missing namespace declarations for dcterms in RSS/Atom.
  • Tweaked initialisation code to increase reusability.
Changes since 1.9:
  • Fixed limited interest generation for HTML profile page.
  • Multiple URIs per interest is now handled correctly (if separated by whitespace).
  • Only categories with posts by author are deemed “interesting”.
  • Added bio:olb per B.K. DeLong’s suggestion.
  • Added trust ratings for friends.
Changes since 1.8:
  • Renamed foaf_output_the_date to get_foaf_output_profile_page to better reflect the functionality.
Changes since 1.7:
  • Improved identification of “active” author / user.
  • Now really only shows profile on first archive page, even in paged mode.

Continue reading WordPress Plugin: FOAF Output

Garmin Geko 201 and RDF

Note: This post originated outside of the weblog, but I figured it really belongs here, and it makes it easier to find.

Following in the footsteps of Matt Biddulph, I acquired a Garmin Geko 201 GPS unit, wanting to annotate my digital photographs with location information.

Matt also wrote a Python script to extract the tracklogs and waypoints from the unit and turn them into RDF statements.

I tried it out, and found I had to overcome some dependency problems, as well as do a little tweaking to get all the information I wanted.

Dependencies

The following dependencies applied to the script on my almost clean Redhat 9 laptop installation with Python 2.2.2:

  1. PyGarmin, which itself doesn’t have any dependencies. It did however need a little patching (diff for garmin.py) to keep Python from complaining.
  2. Redland, with Python interface.

The libraries should be installed in reverse order…

Waypoints tweaking

To keep my version of Python (2.2.2) from crashing, I had to fix some import statements in the original version of Matt’s garmin2rdf.py. Also, a variable name clash was resolved.

Now being able to output an RDF model, I noticed the waypoints only had a property (dc:title) for the name given to it in the unit, but no indication of the symbol used (such as a house, an airport or a building icon). I figured it would be nice to be able to use that information as well, and decided to map each symbol to a Wordnet term, through the use of the Wordnet 1.6 vocabulary namespace.

The Garmin Protocol Specification defines a number of symbols, but the Geko 201 only has a subset of these (and two additional symbols not defined in the specification).

Each numeric symbol ID is mapped to a string identifier such as sym_airport, which in turn (for the Geko 201 symbols only, it’s not easy to create a sensible mapping) is mapped to a Wordnet noun, indicating which type of place is marked. This also fits in nicely with the spacenamespace effort.

When outputting the RDF model, each waypoint is assigned an rdf:type of the wordnet term if found. If no term is found, the string identifier is output as the literal object of a http://hackdiary.com/ns/gps#symbol property, and if no string identifer is found, the symbol ID is output as a literal object of a http://hackdiary.com/ns/gps#symbolid property.

Waypoint symbol mapping

Some of the symbols used relates to verbs, but places need to be identified by nouns. The mapping below doesn’t seem perfect, comments and suggestions are welcomed, especially regarding what to call a place with information (as well as the two special Geko 201 symbols, 8255 and 8256, a closed and an open box)…

Symbol ID String identifier Wordnet term
0 sym_anchor Harbour-1
6 sym_dollar Bank-4
7 sym_fish Fishery-1
8 sym_fuel Gas_station-1
10 sym_house Home-1
11 sym_knife Restaurant-1
14 sym_skull Danger_zone-1
18 sym_wpt_dot Train_station-1
19 sym_wreck Wreck-4
150 sym_boat_ramp Lake-1
151 sym_camp Campground-1
152 sym_restrooms Restroom-1
155 sym_phone Telephone-1
156 sym_1st_aid Hospital-1
157 sym_info Information-2
159 sym_park Park-1
160 sym_picnic Park-2
161 sym_scenic Sight-2
162 sym_skiing Mountain-1
163 sym_swimming Beach-1
170 sym_car Parking_lot-1
171 sym_deer Zoo-1
173 sym_lodging Lodging-1
175 sym_trail_head Spot-1
178 sym_flag Place-1
8197 sym_golf Golf_course-1
8234 sym_building Building-1
8255 sym_8255 Place-1
8256 sym_8256 Place-1
16384 sym_airport Airport-1
16395 sym_parachute Amusement_park-1

Files

Thanks

… to mattb and danbri for making this possible.