Generic data model for GObject: libmodel “Is this going to be forever?” 0.1

I present you libmodel 0.1.

We’ve been busy at Codethink lately, one of the projects we came up with is a long overdue generic data model library for GObject.

Let me give you a bit of background. As Martyn mentioned already, Tracker 0.7 is out, and with it there’s a new lot of possibilities than just storing metadata from your filesystem. Thanks to our GSoC, Adrien Bustany, we’ve got flickr, facebook and twitter miners, that allows us to store feed streams from these social networks locally. Also, more and more data providers are showing up in the GNOME stack, like Google Data and CouchDB libraries.

Building applications on top of Tracker using the D-Bus/SPARQL interfaces directly seemed a bit of an overhead for us and as stated by many people already, the current situation in GObject about abstract data models was not any good, until now.

Datamodel

So we decided to take this bullet and see what can we came up with, Ryan Lortie did some research on the existing solutions within other popular frameworks (.NET, CoreData, Java, Qt) and came up with this first approach, that has already served us quite well.

Some of the design goals are: high bindability for other platforms to be able to implement the data model abstract classes/interfaces, lazy loading of data within a collection, atomic signals for notifications of multiple changes in a collection, simplicity and more importantly, it should be FUN to implement a model and use it.

libmodel is implemented in Vala to allow us to move quickly to an API that we are happy with, as for now is a collection of abstract classes for Lists, Dictionaries, References and Objects. check the documentation and the source code for more info. Note that this work has to mature and that we already have some changes in the current API planned.

Have fun with it, and let us know what you think about it! Oh, and stay tuned as more tasty bits are yet to come.

Advertisements

10 thoughts on “Generic data model for GObject: libmodel “Is this going to be forever?” 0.1

  1. ‘n_children()’ returns the number of references currently in the list.
    Why didn’t you name it number_of_references() or reference_no() or reference_size() or something more in-line with what the description of the method says?
    Why are Model.String, Model.List, … abstract classes and not interfaces?
    Is there a plan to merge with LibGee interfaces?

    Like

  2. Sounds like a good thing to have. Is the COPYING file meant to be GPL? LGPL would be more normal if the intent is to eventually get it into glib.

    Like

  3. @qnull: Looks like piotra is using a very very old version of vala there, and suffering from issues in the bindings. Shame his blog lacka comments, but do tell him to get a copy of vala 0.7.7. There’s a PPA available here:
    https://launchpad.net/~vala-team/+archive/ppa
    @anonymous: thanks for your constructive and enlightening comment. I do wish you’d left your name so we could carry on this informative conversation.

    Like

  4. @Jan:
    Oops, I’ll fix that straight away. This is meant to be LGPLv2.
    @Philipp @Frade:
    Thank you for the positive feedback!
    @Giles:
    We’ve looked at it, but we wanted something small to do fast prototyping.

    Like

  5. @qnull, I just mentioned issues which raised with first attempt to write simple things in vala.
    @Rob Taylor, I used latest available version in latest Ubuntu 9.04. I think it’s important rule to depend on code/lib/whatever which is available out of the box on most distros. So blame Ubuntu they provide old vala in latest release.
    I do not like comments on my blog. Is it a shame?
    Last but not least. Few issues mentioned in my blog has been fixed in vala 0.7.7…

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s