The About Tag Python Library

Location

The About Tag python library is available from Github at http://github.com/njr0/abouttag.

This page includes its README file and code examples.

README

This package provides functions for generating about tags for
FluidDB following various conventions.

FluidDB is a hosted, online database based on the notion of tagging.
For more information on FluidDB, visit http://fluiddb.fluidinfo.com.

For more information on the ideas that motivated this module,
see posts at http://abouttag.blogspot.com.   A good place to
start is

http://abouttag.blogspot.com/2010/03/about-tag-conventions-in-fluiddb.html

Nicholas J. Radcliffe
12th March 2010

examples.py

# -*- coding: utf-8 -*-

"""
    abouttag.examples

    abouttag: Example usage.

    Copyright 2010 AUTHORS (see AUTHORS file)
    License: MIT, see LICENSE for more information
"""

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
from abouttag.books import book, ubook, author


db = FluidDB()
print '\nFluidDB OBJECTS:'
print db.user(u'njr')
print db.namespace(u'njr/misc')
print db.tag(u'terrycojones/private/rating')

print '\nURIs:'
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 '\nDATABASE ITEMS:'
print db.table(u'elements')
print db.field(u'Name', u'elements')

print '\nPLANETS, ELEMENTS:'
print planet(u'Mars')
print element(u'Helium')

print'\nLOCATIONS:'
print GEOnet(-2601490, -3577649)

print '\nBOOKS (book-1 and book-u conventions):\n'

print book(u"Gödel, Escher, Bach: An Eternal Golden Braid",
           u'Douglas R. Hofstader')
print ubook(u"Gödel, Escher, Bach: An Eternal Golden Braid",
            u'Douglas R. Hofstader')
print
print book(u"One Hundred Years of Solitude", u'Gabriel García Márquez')
print ubook(u"One Hundred Years of Solitude", u'Gabriel García Márquez')
print
print book(u'The Feynman Lectures on Physics',
           u'Richard P. Feynman', u'Robert B. Leighton',
           u'Matthew Sands')
print ubook(u'The Feynman Lectures on Physics',
            u'Richard P. Feynman', u'Robert B. Leighton',
            u'Matthew Sands')
print
print book(u'The Oxford English Dictionary: second edition, volume 3',
           u'John Simpson', u'Edmund Weiner')
print ubook(u'The Oxford English Dictionary: second edition, volume 3',
            u'John Simpson', u'Edmund Weiner')
print

print '\nAUTHORS:'

print author(u'Gabriel García Márquez', 1927, 3, 6)
print author(u"Douglas R. Hofstadter", 1945, 2, 15)

Output from examples.py

$ python examples.py

FluidDB OBJECTS:
Object for the user named njr
Object for the namespace njr/misc
Object for the attribute terrycojones/private/rating

URIs:
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

DATABASE ITEMS:
table:elements
field:Name in table:elements

PLANETS, ELEMENTS:
planet:Mars
element:Helium

LOCATIONS:
GEOnet-2601490_-3577649

BOOKS (book-1 and book-u conventions):

book:godel escher bach an eternal golden braid (douglas r hofstader)
book:gödel escher bach an eternal golden braid (douglas r hofstader)

book:one hundred years of solitude (gabriel garcia marquez)
book:one hundred years of solitude (gabriel garcía márquez)

book:the feynman lectures on physics (richard p feynman; robert b leighton; matthew sands)
book:the feynman lectures on physics (richard p feynman; robert b leighton; matthew sands)

book:the oxford english dictionary second edition volume 3 (john simpson; edmund weiner)
book:the oxford english dictionary second edition volume 3 (john simpson; edmund weiner)


AUTHORS:
author:gabriel garcia marquez (1927-03-06)
author:douglas r hofstadter (1945-02-15)

Labels