QMML Documentation 





QMML: An Introduction
QMML stands for Question Mark Markup Language. It is pronounced as "Quimmel".

QMML was internally created as part of a specific project for the Ubuntu Linux distribution, but we decided to release it as a standalone markup language.

QMML is somewhat like other markup languages, but it has a greater emphasis on storing very large amounts of information for other programs to use.

A QMML file looks something like the following example:

example.qmml:
?Song1?
?Title?name1?*Artist?
?Artist?artist1?*Artist?
?Album?album1 ?*Album?
?*Song1?

?Song2?
?Title?name2 ?*Artist?
?Artist?artist2?*Artist?
?Album?album2?*Album?
?Artwork?artwork.png?*Artwork?
?*Song2?

?Song3?
?Title?name3?*Artist?
?Artist?artist3?*Artist?
?Album?album3?*Album?
?*Song3?

In QMML, there are two types of tags. A QMML tag is a word surrounded in a pair of question marks.(?) Inside a QMML tag is some kind of stored information.

Currently, QMML supports 2 types of tags: Objects and properties.

An Object is a tag which contains other tags known as properties.
In the example above, each ?Song? tag was a separate object.

Objects begin with:
?ObjectName?

Have properties inside them:
?property1?text?*property1?

and always end with:
?*ObjectName?
(Note the asterisk)

Now, properties are defined inside of objects. Some of the properties defined in the example were "?Artist?" and "?Title?". Properties are defined in the following way:
?PropertyName?PropertyData?*PropertyName?

Any object can have any number of properties that can be referenced, regardless of the properties other objects have.

In this way, one can store a massively large database of objects with properties, as may be needed in several applications.


The Python Bindings

Currently, there are only python bindings for QMML.

There are two simple, easy to understand commands used to control the python bindings.

First off, you should go and download our python bindings. The file qmml.py should be put in the same directory as your project and python folder.
To use QMML in your Python application, start with the import command:
import qmml

The first command to control your qmml database is the search command. This command finds all values of a certain property in your qmml file and outputs them to a textfile.
So, you can call the search function with:
qmml.search(propertyName, filePath)

Where propertyName is the specific property you want to retrieve, and filePath is the path to your .qmml file.
 
So, to collect a list of all of the Song titles in our example above, you would run:
qmml.search(Title, example.qmml)

And, your output would be in the text file qmml automatically created called titles. The output would look like:
name1
name2
name3

The other qmml command is the give command. The give command gives back an exact property of an exact object. You call the give function with:
qmml.give(ObjectName, PropertyName,filePath)

Where ObjectName is the name of the object you wish to obtain a property from, PropertyName is the name of the property you want to obtain, and filePath is the path to your .qmml file.
So, referring to our example, to obtain the album name of Song3, you would run:
qmml.give(Song3, Album, example.qmml)
nameQMML would then send the output to the automatically created file: Song3Album.
The output would look like:
album3

Extending the Python Bindings
Although the Python Bindings currently have a limited number of commands, it is extremely easy to extend them, as the code is relatively simple, easy to understand, extremely short, and it does not need to be compiled or installed.
To add a command to the python bindings, simply create a new function in the "qmml.py" file.

Writing your own Bindings

QMML could effectively be translated to work with almost any language. We are currently adding to the Python bindings and working on Ruby bindings, but we'd love some help. Don't be afraid to comment in the forums, or contribute your own work!