Geonames machine tags, Triplr.org and JSON, oh my!

[Update: I've got a slightly more updated version over here, well at least it has pictures anyway]

Harry Chen over at the Geospatial Semantic Web Blog has posted up a nice spring board called Geonames machine tags. In which he suggest tagging flickr photos using the format geonames:feature=5352844 to point to features over at geonames.org. In this case feature 5352844 is of the Golden Gate Bridge. It’s worth reading the whole article, which while short is interesting and it seems like a good jumping off point for doing stuff … example…

“If flikr’s [sic] service is implemented to recognize geonames’s machine tag, then it can pull this semantic description from geonames.org, which is the RDF description about the Golden Gate Bridge”

Now while only a handful of us have the ability to make an implementation of that from the flickr side (upon which I can’t comment, other that to say it sounds like a good idea), it’s pretty open for greasemonkeying.

But wait, there’s more …

Introducing Triplr.org, a very new and very importantly useful site.

This is where things get a little groovy. This by the sall Aaron’s hacking.

Let’s take the geonames.org url for Golden Gate Bridge…

http://www.geonames.org/5352844/

… and throw about.rdf onto the end to get us some RDF goodness (if there is such a thing) …

http://sws.geonames.org/5352844/about.rdf

… (you may need to do a view source to see the actual RDF for that).

Which is great, but you know, still a bit of pain to parse, what we need is some good old fashion JSON.

First lets throw the geonames.org rdf file at triplr, as it says “Stuff in, triples out” and we all love triples!

http://triplr.org/html/http://sws.geonames.org/5352844/about.rdf

That looks kinda neat, Golden Gate Bridge, in all sorts of languages (even if it’s not translated into all of them yet), the location and nearby stuff, that we’ll come back to in a tick.

Now the magic, JSONifyed …

http://triplr.org/json/http://sws.geonames.org/5352844/about.rdf

Here’s a snippet of what you get:

{
“triples” : [
{
"subject" : { "value" : "http://sws.geonames.org/5352844/" , "type" : "uri" } ,
"predicate" : { "value" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" , "type" : "uri" } ,
"object" : { "value" : "http://www.geonames.org/ontology#Feature" , "type" : "uri" }
},

... snip ...

{
"subject" : { "value" : "http://sws.geonames.org/5352844/" , "type" : "uri" } ,
"predicate" : { "value" : "http://www.w3.org/2003/01/geo/wgs84_pos#lat" , "type" : "uri" } ,
"object" : { "value" : "37.8196506" , "type" : "literal" }
},
{
"subject" : { "value" : "http://sws.geonames.org/5352844/" , "type" : "uri" } ,
"predicate" : { "value" : "http://www.w3.org/2003/01/geo/wgs84_pos#long" , "type" : "uri" } ,
"object" : { "value" : "-122.4788612" , "type" : "literal" }
},
],

“count” : “48″,
}

So by using triplr.org, we can convert the lovely information from geonames.org into JSON. Apparently, the JSON parsing part of triplr.org maybe a little shaky while Dave works out the encoding issues. Also, Dave doesn’t know I’m about to blog this, so services may be up, down, speedy, slow.

And Speaking of sometimes shaky, I may just throw some of this stuff at Yahoo! Pipes and see how far I can get.

3 Responses to “Geonames machine tags, Triplr.org and JSON, oh my!”

  1. [...] Flickr’s Dan Catt on the geobloggers blog takes up the idea : Now while only a handful of us have the ability to make an implementation of that from the flickr side (upon which I can’t comment, other that to say it sounds like a good idea) … He then continues describing how the geonames rdf format can easily be transformed into JSON using triplr.org. Read the full posting on Geoblogger.com … Posted by marc Filed in Uncategorized [...]

  2. ???

  3. Very good site! I like it! Thanks!

Leave a Reply