What is Fluidinfo?
Fluidinfo is a shared online datastore based on tags with values. It allows anyone to store, organize, query and share data about anything.
Users add information to Fluidinfo by associating data to things via named tags. It’s easy to extract information and there’s a simple query language to search the datastore.
Five core concepts cover how Fluidinfo works:
- Objects represent things (real or imaginary).
- Tags attach information to objects.
- Users use their own tags to to attach data to shared objects.
- The permission system controls who can read and write each tag. (Objects do not have owners, so anyone can tag any object.)
- Queries select objects by specifying properties of their tags and values. The selected objects can be read or tagged.
Objects representing “things” are identified by a globally unique “about” value string. There is a (lazily instantiated) object in Fluidinfo for every possible unicode string—”paris”, “☾♠♣♥♦☽”, “book:getting started with fluidinfo (nicholas j radcliffe; nicholas h tollervey)”, “http://oreilly.com”, “3.14159265” and so on.
Each user attaches arbitrary named tags to any of these objects. The tags can have typed values; for example, I might tag the object about “paris” with a numeric rating (ntoll/rating=10), a string description (ntoll/description=”Belle”) and a JPEG image (ntoll/photo=<a jpeg blob>).
The permissions system lets users to control who can read and write each of their tags, and a simple yet powerful query language allows them to select objects and read data based on their own tags and those of other people (subject to the permissions). For example the following query matches objects that I (ntoll) have added a comment to, that both the user njr and I have added a rating greater than 6 to and whose about values contain the string “book:”:
has ntoll/comment and (ntoll/rating > 6 and njr/rating > 6) and fluiddb/about matches "book:"
Notice how tag names are scoped by a username (for example ntoll and njr in the example above) so the provenance of the data is apparent.
A RESTful API
At the lowest level, interaction with Fluidinfo is via a pure HTTP, RESTful API. Being HTTP-based, the API can be queried directly from a web browser. For example, you can directly read my rating of Paris by visiting: http://fluiddb.fluidinfo.com/about/paris/ntoll/rating (the result will probably be downloaded as a file containing the value 5) or (better) by using cUrl or wget from the command line:
Similarly, you can find all the objects I have rated greater than three and retrieve the “about” value and my rating by navigating to:
The response will be JSON. If you have any familiarity with URL semantics, you’ll be able to see that this URL goes to the /values endpoint of Fluidinfo, passing the query parameter “ntoll/rating>3” and two tag parameters “fluiddb/about”, which is the name of the object identifier (Fluidinfo’s so-called “about” tag), and “ntoll/rating”, the tag I’m using to rate things in Fluidinfo. This is the Fluidinfo equivalent of the following faux-sql:
SELECT ntoll/rating, fluiddb/about WHERE ntoll/rating>3;
Writing data is only marginally more complicated than this, requiring authentication and sending the appropriate data in JSON.
While it’s entirely possible to work with Fluidinfo via curl, it’s probably a better idea to use a client library. For example, the following Python session illustrates the simple fluidinfo.py module which forms a thin layer on top of the HTTP API (there are more abstract libraries such as FOM [the Fluid Object Mapper] and the event-driven fluidinfo.js).
Use the pip tool to install the fluidinfo.py module:
$ pip install -U fluidinfo.py
... lots of downloading/unpacking messages...
Import the required modules (we use pprint to make the output more readable):
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fluidinfo
>>> from pprint import pprint as pp
Ensure we’re logged in:
>>> fluidinfo.login('ntoll', 'secret_password')
The library returns the HTTP headers and the data from Fluidinfo as Pythonic data structures you can use immediately:
>>> headers, result = fluidinfo.get('/about/paris')
'date': 'Mon, 16 Apr 2012 13:41:25 GMT',
Adding a new value to the object about “paris” is simple:
>>> headers, result = fluidinfo.put('/about/paris/ntoll/comment',
... 'I prefer the tower in Blackpool. :-)')
'date': 'Mon, 16 Apr 2012 13:42:34 GMT',
The 204 status code shows it was a success. The same applies for deleting the value:
>>> headers, result = fluidinfo.delete('/about/paris/ntoll/comment')
It’s possible to sign up for an account via Twitter at the http://fluidinfo.com website. You must ensure you set your password for API access (click on your user profile to do so).
Flying Spaghetti Monster
If Fluidinfo sounds interesting, give it a spin. And if you have any interest in the back end, you could do worse than to check out the new O’Reilly book “Getting Started with Fluidinfo” with a magnificent jellyfish on the cover. Alternatively, if you’d like to find out more about the story behind Fluidinfo then check out Fluidinfo – An Unfundable World-Changing Start-Up.
(About the author: Nicholas H.Tollervey works for Fluidinfo and co-authored the O’Reilly Fluidinfo book. He’s a classically trained musician, philosophy graduate, teacher, writer and software developer. He’s just like this biography: concise, honest and full of useful information.)
Leave a Reply