Hi all,
If you’re not already familiar with machine tags the easiest way to
think of them is being like a plain old tag but with a special syntax
that allows users to define additional structured data about that tag.
If you'd like to know more, the best place to start is the official
announcement we made about machine tags in the Flickr API group:
http://www.flickr.com/groups/api/discuss/72157594497877875
If you want to know even more, take a look at:
http://code.flickr.com/blog/2008/07/18/wildcard-machine-tag-urls/
http://code.flickr.com/blog/2008/08/28/machine-tags-lastfm-and-rocknroll/
http://blech.vox.com/library/post/flickr-exif-machine-tags.html
--
Okay! Now that everyone is feeling warm and fuzzy about machine tags:
We enabled (4) new experimental API methods for browsing the hierarchies
of machine tags on the site.
They are aggregate rollups of all the unique namespaces, predicates,
values and pairs for public photos with machine tags.
For example, lots of people have added "exif:" related machine tags to
their photos but there hasn't been a way to know what kind of EXIF data
has been added. exif:camera? exif:focus? exif:tunablaster?
Those are the sorts of things these methods are designed to help you
find. Sort of like wildcard URIs but for the API. Like this:
--
* flickr.machinetags.getNamespaces
This returns a list of all the unique namespaces, optionally bracketed
by a specific predicate. For example:
<namespaces predicate="airport" page="1" total="2" perpage="500" pages="1">
<namespace usage="1931" predicates="1">aero</namespace>
<namespace usage="3" predicates="1">geo</namespace>
</namespaces>
http://www.flickr.com/services/api/flickr.machinetags.getPredicates.html
* flickr.machinetags.getPredicates
Like "getNamespaces", returns a list of all the unique namespaces,
optionally bracketed by a specific namespace. For example:
<predicates namespace="aero" page="1" total="17" perpage="500" pages="1">
<predicate usage="1" namespaces="1">aiirport</predicate>
<predicate usage="1" namespaces="1">aiport</predicate>
<predicate usage="2568" namespaces="1">airline</predicate>
<predicate usage="1" namespaces="1">airlines</predicate>
<predicate usage="1" namespaces="1">airpor</predicate>
<predicate usage="1" namespaces="1">airporrt</predicate>
<predicate usage="1944" namespaces="1">airport</predicate>
<predicate usage="10" namespaces="1">icao</predicate>
<predicate usage="328" namespaces="1">ln</predicate>
<predicate usage="1972" namespaces="1">man</predicate>
<predicate usage="1926" namespaces="1">model</predicate>
<predicate usage="517" namespaces="1">msn</predicate>
<predicate usage="1" namespaces="1">seires</predicate>
<predicate usage="1894" namespaces="1">series</predicate>
<predicate usage="338" namespaces="1">special</predicate>
<predicate usage="1908" namespaces="1">tail</predicate>
<predicate usage="5" namespaces="1">type</predicate>
</predicates>
http://www.flickr.com/services/api/flickr.machinetags.getPredicates.html
* flickr.machinetags.getValues
At this point, the pattern should be pretty straightforward. All the
unique values for a specific namespace/predicate pair. For example:
<values namespace="aero" predicate="tail" page="1" total="1159"
perpage="500" pages="3">
<value usage="1">01-0041</value>
<value usage="1">164993</value>
<value usage="2">26000</value>
<value usage="1">4k-az01</value>
<value usage="1">4l-tgl</value>
<value usage="1">4r-ade</value>
<!-- and so on... -->
</values>
http://www.flickr.com/services/api/flickr.machinetags.getValues.html
* flickr.machinetags.getPairs
Finally, get pairs returns the list of unique namespace/predicate pairs
optionally filtered by namespace or predicate.
<-- please, not another blob of XML... -->
http://www.flickr.com/services/api/flickr.machinetags.getPairs.html
--
A couple things to note:
Certain namespace/predicate pairs have been special cased to return a
single value. As of this writing they are:
* geo:lat (and variations)
* geo:lon (and variations)
* file:name
* file:path
* (anything):md5
If people have a particular reason for needing or wanting these please
let us know. Otherwise the cost of storing all the variations and the
dubious use of returning them made us decide to exclude them.
Also, as of this writing some of the earliest machine tags may not have
been indexed yet. Once the indexing is complete we'll do a proper blog
post (on code.flickr.com) and probably add some machine tags specific
documentation to the API section on the site.
--
Finally, until further notice please keep in mind that these methods are
still considered experimental and write your code accordingly.
Enjoy!