UAV database is a tuple space database that is easy to use and easy to grasp. There is also a database server that allows to query the database from multiple processus.
We will get started by using the database directly without the database server illustrated with an music album collection kind of stuff and then will open the road to use the database server.
You can fetch the lasted version of UAV database using git:
UAV Tuple Space
What is the tuple space? It's table with three columns.
In what follows we consider the following assoc:
Give me a
The first column unique identifier. it's a random string assigned the first time you add an assoc to the database. A single assoc is represented with several rows in the table but share the same identifier.stands for
Give me a
attribute name. In the above example it's and . In this case attributes are symbols but can be any scheme value that can be serialized with .stands for
Give me a
The last column is value. It can be any scheme value that can be serialized with .for
If we addto the database, and the assigned unique identifier is , the database will more or less look like the following:
Fire an REPL inside the wiredtiger directory using the following command:
Open the database
And load themodule with:
To get started you need to open database:
Add a document to the database
To add a document to the database you simply format you data into an assoc and use uav-add!:
Debug the database
There is a debug procedure that allows to have a pick at the underlying schema. Usingyou will get something like the following:
Referencing a document
Now you can useto retrieve the document using its :
Update a document
We assigned previously the identifier of La Gale album to .
We can with this information update the document with. The thing to keep in mind is that this procedure updates the whole document so you need first to retrieve the original assoc, update the assoc and commit the new version using .
For instance, let's add the genre to the assoc:
Let's check the output of:
There is a new key/value pair with aattribute associated with .
How to delete a document
To delete a document you simply useprocedure:
As you can seedisplays nothing, the database is empty!
attribute-value index reference
You can retrieve document using attribute-value association. Otherwise said, you can retrieve every document that has a given attribute/value pair in its assoc.
Let re-addto the database an try to retrieve it by year:
Let's add another album
Let's add the album of another artist:
Now it's funny enough to query the database! Let's try: