The previous post discussed the small number of conventions already in use for about tags in FluidDB. It occurred to me that I could usefully write some code to create about tags following each of these conventions. I’ve just done this (in python) and it’s available from github.
In addition to simply producing the about tags, the package has some normalization capabilities.
I may blog about it more, but you get most of the idea from the following examples.
from abouttag.fluiddb import FluidDB from abouttag.uri import URI from abouttag.database import Database from abouttag.objects import planet, element from abouttag.location import GEOnet db = FluidDB() print db.user(u'njr') print db.namespace(u'/njr/misc') print db.tag(u'terrycojones/private/rating/') print URI(u'FluidDB.fluidinfo.com') print URI(u'FluidDB.fluidinfo.com/one/two/') print URI(u'https://FluidDB.fluidinfo.com/one/two/') print URI(u'http://fluiddb.fluidinfo.com/one/two/') print URI(u'http://test.com/one/two/?referrer=http://a.b/c') db = Database() print db.table(u'elements ') print db.field(u'Name', u'elements') print planet(u'mars') print element(u' helium') print GEOnet(-2601490, -3577649)
which produces the following:
Object for the user named njr Object for the namespace njr/misc Object for the attribute terrycojones/private/rating http://fluiddb.fluidinfo.com http://fluiddb.fluidinfo.com/one/two https://fluiddb.fluidinfo.com/one/two http://fluiddb.fluidinfo.com/one/two http://test.com/one/two/?referrer=http://a.b/c table:elements field:Name in table:elements planet:Mars element:Helium GEOnet-2601490_-3577649
These examples all have normalization turned on, though it can be turned off by adding normalization=False to any of the relevant function calls.
This will become more significant in some other cases where the key for the about tag may require more transformation from the raw input. (For example, I’ve been reading about NACO normalization, which is used by librarians to increase the probability of matching titles and authors successfully; I’m thinking of devising a schema for about tags for books based on this.)