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.damlontology containing state definitions instead ofhttp://www.daml.ri.cmu.edu/ont/State.damlwhich only contains classes and properties.
- Features:
- Requirements:
-
- WordPress 1.2 (later versions not tested but might work).
- A working installation of the FOAF Output Plugin version 1.7 or later.
- Installation:
-
- Download the Semantic Visits Plugin, rename to
semantic-visits.phpand place it in the plugins directory. - Activate it in the administration interface under Plugins.
- Create three link categories in the administration interface under Links > Link Categories, one named “Countries", one named “CA Regions", and one named “US States” (case matters). Remember to enter “0″ in the Limit field unless you also want the list of countries and regions/states to be displayed alongside the other links in the side bar. Once created, the list of link categories should look something like this (larger version):

- Download the Semantic Visits Plugin, rename to
- Managing visits:
-
The lists of visits are managed as links (possibly without a link!) in categories named “Countries", “CA Regions", and “US States", created as described above. The fields in the link manager must be used as follows for the plugin to work correctly:
- The URI field can be empty, but if you do enter a URI, make sure it’s for a page about the country or US state, e.g. “
http://www.denmark.dk/“. - The Link Name field must contain the ISO3166 code for the country — or the two-letter state code for the Canadian region or US state, e.g. “DK", “AL” or “CA” (case matters). The list of ISO3166 Country Codes is available elsewhere, as is a list of US State Codes.
- The Short description field can be empty, but must contain the name of the country, region, or state if not left blank, e.g. “Denmark".
- The URI field can be empty, but if you do enter a URI, make sure it’s for a page about the country or US state, e.g. “
- API extensions, functions:
-
get_semantic_visits_countries_image():- This function returns, if on a page with with one post/author, a string with an
imgelement pointing to a map with visited countries highlighted. get_semantic_visits_usstates_image():- This function returns, if on a page with with one post/author, a string with an
imgelement pointing to a map with visited US states highlighted. get_semantic_visits_caregions_image():- This function returns, if on a page with with one post/author, a string with an
imgelement pointing to a map with visited Canadian regions highlighted. get_semantic_visits_countries():- This function returns, if on a page with with one post/author, an array with each element being an associative array, representing a country, with the fields code, name, uri and country, where the first three correspond to the fields in the link administration interface and the last is the URI identifying the country, e.g.
http://www.daml.org/2001/09/countries/iso#DK. get_semantic_visits_usstates():- This function returns, if on a page with with one post/author, an array with each element being an associative array, representing a state, with the fields code, name, uri and usstate, where the first three correspond to the fields in the link administration interface and the last is the URI identifying the state, e.g.
http://www.daml.ri.cmu.edu/ont/USRegionState.daml#DC. get_semantic_visits_caregions():- This function returns, if on a page with with one post/author, an array with each element being an associative array, representing a region, with the fields code, name, uri and caregion, where the first three correspond to the fields in the link administration interface and the last is the URI identifying the region, e.g.
http://www.daml.ri.cmu.edu/ont/CanadianState.daml#AL.
Of course, all of this hacking wouldn’t be necessary if we had the right inference rules in place and tools to handle them with. With images depicting me, taken at various points around the globe, it seems like it should be possible at some point to automatically infer which countries I have visited, much like Dan Connolly has done with his Travel Tools.
With existing data we could get close by using information on the nearest airport, but it might be prone to errors for small and closeby countries where the nearest airport is actually located in another country.
Hey morten, do any ideas exist to relate visited countries to time of visit. From my point of view there is a huge difference in visiting a country as a child or as a business traveller
Comment by Christoph Görn — 2004-07-06 @ 10:42:48
Grafik besuchter Länder…
Heute nehm ich mal Bezug auf einen eigenen Eintrag… Es gibt ein Update zu diesem: Im Zuge der Semanticwebbisierung hat mortenf ein
Trackback by erdGeschoss — 2004-07-06 @ 12:31:15
[…] 1) FOAF output (im wesentlichen ein update der Version die bereits installiert war) und 2) Semantic Visits. Beide habe ich auf mortenf’s blog gef […]
Pingback by C:\datenbrei » Neue Plugins für Wordpress 1.2 — 2004-07-06 @ 17:32:44
Christoph,
No, I’m not aware of any specific efforts to model visits and age, but there might be something in kanzaki’s whois vocabulary and what Dan Connolly has done with cyc, using
subAbstracandtemporallySubsumes.Comment by Morten Frederiksen — 2004-07-06 @ 22:42:35
Me again,
I have looked at kanzaki’s whois vocabulary, and I think that using this is the right way of expressing “I have been to this and that country and did things like…". Travelling to a country is never without any purpose, so I think the whois:stage must contain a visit:country. Some example is at http://B4mad.Net/FOAF/goern-visits.rdf. Actually FoaF Explorer is not capable of rendering this.
PS: Is defining the way I use a vocabulary by making such a statement acceptable or is there a more general way defining the coexistence of whois: and visit: ?
Comment by Christoph Görn — 2004-07-07 @ 09:17:44
Hey,
I think your example looks fine, but the
visit:countryshould not be placed in thewhois:Stage, asvisit:countryhas a domain offoaf:Person, and places and people are almost certainly disjoint.Aside from that it seems the FOAF Explorer renders it fine? It doesn’t include the Germany visit, but that is due to the reason mentioned above, the
visit:countryisn’t a property of the person.Regarding interoperability of
whoisandvisit, I’m not sure how it should be done. It seems like it won’t be possible without rules, e.g. one that says that if a person has a stage with awhois:where, with some sort of location, and covering a time span of at least to days, it can be infered that the person has visited the country that the location is located in…Comment by Morten Frederiksen — 2004-07-07 @ 10:24:07
[…] , ancient) but this release has workarounds. What’s more he’s come up with a Semantic Visits plugin. Both are dead straightforwa […]
Pingback by Danny Ayers, Raw Blog — 2004-07-08 @ 12:15:53
Absolutely marvellous!
Both this and your updated FOAF Output worked perfectly.
One little question - is there an easy way of including/seeAlso’ing my handwritten FOAF? I presume there’s a PHP [include this.file] but maybe there’s a less in-the-engine way?
Comment by Danny — 2004-07-08 @ 14:21:37
PS. Is there an easy way of hidding selected categories from the front page? WP’s link hiding seems to hide it from the FOAF too.
I guess adding something like [div style="display: none;"] to the markup associated with each link should do it - but any easier way?
Comment by Danny — 2004-07-08 @ 14:27:58
Danny,
Regarding the hiding of categories (I’m assuming you mean link categories), make sure you put “0″ in the Limit field for the category (see instructions above), that’ll stop them from showing on the HTML pages, and will still keep them in the FOAF file for the countries/states.
As for the other-foaf-file inclusion, it’d have to be by
seeAlso— I think it’d be impossible to keep it well-formed otherwise. Watch this space or beat me to it by coding up the plugin. :)Comment by Morten Frederiksen — 2004-07-09 @ 00:58:58
Thanks.
btw, while you’re on this roll, have you thought about any WP coolness relating to topics/subjects (and maybe foaf:project)? I just came across MS’s OPML stuff, it could surely be a lot more fun in RDF…
Comment by Danny — 2004-07-09 @ 22:53:04
[…] および拡張されたRSS(1.0)出力を持った個人のプロフィールページ。Semantic VisitsseeAlso’sもあります。 も参照 […]
Pingback by Standing Tall » WordPress プラグイン一覧追加情報(2) — 2004-08-11 @ 12:58:27
[…] ritten by Morten Frederiksen: The FOAF output plugin, FOAF’ed weighted interests and semantic visits. Click on the author link of this post too s […]
Pingback by UIML Ramblings » Semantic-me — 2005-01-02 @ 23:47:48
Hey morten, I just played arround with your set of plugins on WordPress 1.5. Seems to work ok, only the URI field of the country links seems to be handled differently by wp1.5: it always contains a http:// when left blank.
Comment by Christoph Görn — 2005-02-17 @ 17:41:34
[…] gin is WORKING FOAF Output 1.16RC is WORKING FOAF Output seeAlso’s 1.1 is WORKING FOAF Output Semantic Visits 1.2 is WORKING Kitten’s S […]
Pingback by Preparing the Move towards WordPress 1.5 » B:\datenbrei — 2005-02-18 @ 10:05:44
Hello,
Thank you for your articles which help me in my work
Bye
Andy
Comment by andy — 2005-08-19 @ 15:37:16
Hey Morten!
Thx for all the plugins, I’ll try them as soon as I can. :)
Comment by mp3-man — 2006-03-21 @ 03:42:28