Helma Logo
main list history
previous version  overview  next version

Version 24 by hannes on 01. September 2009, 18:05

=== Current efforts
* *Berkeley storable|http://github.com/hns/berkeleystore/tree/master* backend for the Helma NG Storable interface based on the Berkeley DB
* *Hibernate wrapper for Helma NG|http://github.com/robi42/dbstore/tree/master* and *demo app|http://github.com/robi42/blog-ng/tree/master* by Robert Thurnher
* Helma NG *filestore module|helma.filestore* and *demo app|http://github.com/hns/helma-ng/tree/2ee6966a4ca6f27437c197cf769bf926a528eafc/apps/storage*
* Google App Engine *datastore module|http://github.com/hns/helma-ng/blob/e102a1982e25069489c5efcd14fb829fb66fa0c9/modules/helma/googlestore.js* and *demo app|http://github.com/hns/helma-ng/tree/35d42b5ca2f008fc00e2529d7fedea286acb1323/apps/googlestore* (*running on App Engine|http://helma-storage.appspot.com/*)
* *padded-ng|http://github.com/leobm/padded-ng/tree/master* is a CouchDB client by Jan-Felix Wittmann.
* Liam Staskawicz is working on a *Helma NG module|http://bitbucket.org/liamstask/mongolovehelma/* for *MongoDB|http://www.mongodb.org/*.

=== Query API design

==== Preliminary Design

The current Git snapshot implements preliminary query functionality for the googlestore, berkeleystore, filestore, memstore backends. Note that while googlestore and berkeleystore use indxing and query functionality provided by the underlying libraries and APIs, filestore and memstore use unindexed, brute force query implementations that require a full read of the queried objects. Berkeleystore

* <b>Type.query()</b> Returns a query object for the Storable type represented by the given constructor.

* <b>query.equals('propertyName', propertyValue)</b> Returns a subquery with the added equality filter.

* <b>query.less('propertyName', propertyValue)</b> Returns a subquery with the added less-than filter.

* <b>query.lessEquals('propertyName', propertyValue)</b> Returns a subquery with the added less-than-or-equals filter.

* <b>query.greater('propertyName', propertyValue)</b> Returns a subquery with the added greater-than filter.

* <b>query.greaterEquals('propertyName', propertyValue)</b> Returns a subquery with the added greater-than-or-equals filter.

* <b>query.select('propertyName')</b> Returns an array containing the result of the query. If propertyName argument is defined, the result array only contains the given property of the selected objects. Otherwise, it contains the whole objects.

==== Prior Art

Collecting links of prior art and to collect more ideas on this.

* MongoDB
** *A Developer's Tour - Advanced Queries |http://www.mongodb.org/display/DOCS/Advanced+Queries*
** *Developers' Guide - Searching and Retrieving |http://www.mongodb.org/display/DOCS/Searching+and+Retrieving*
* App Engine Datastore *Low-level API - Query |http://code.google.com/intl/en/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Query.html*
* DataMapper - http://datamapper.org/doku.php?id=docs
** Ruby-based ORM that provides nice modules that a variety of backends (rdbms and others) can mix in to provide common features like validation, lazy/eager loading, in addition to a nice query api
* Mozilla ServerJS *Relational Database Interface |https://wiki.mozilla.org/ServerJS/RDBMS*
* Persevere *JSONQuery |http://docs.persvr.org/documentation/jsonquery*
* Django's query interface http://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-specific-objects-with-filters (replaced named parameters with a JS object)
** only django's ORM part could be packaged as jar (jython2.5)
** enhanced googlestore query interface nearly identical to djangos
* *LINQ |http://msdn.microsoft.com/de-at/library/bb308959(en-us).aspx* ("language-integrated query" developed by MS for .NET), JS impl. available:
** *jLinq |http://www.hugoware.net*
** *JSLINQ |http://www.codeplex.com/JSLINQ*

=== Store interface

A persistent class is created by calling the Storable.defineClass() method with a store implementation and a class name.

  // define Storable base class
  defineClass(org.helma.wrappers.Storable);
  // create a new store
  var store = new MyStore('/db');
  // create a persistent Book object
  var Book = Storable.defineClass(store, "Book");
  
  // Book objects can now be accessed via the
  // Storable data access methods and scripted
  // via Book.prototype
  Book.prototype.toString = function() this.title;
  
  var b = new Book({title: 'JS for dummies'});
  b.save();

A store implementation can be any JavaScript object that implements the folloing functions:

* all(type) - get all objects of one type
* get(type, id) - get a single object for its id
* query() - get a query object
* getEntity(key|properties) - get an entity object
* getKey(entity) - get the key object
* getProps(entitiy) - get the properties object
* equalKeys(key1, key2) - check if keys are equal
* save(props, entitiy, tx) - save object to db
* remove(key, tx) - remove object from db
* getId(key) - get the object id

     removed
     added