Hi all,
The recent release of Magma with complex query capacity has made it opportune to extend the list of index types which can be added to a MagmaCollection.
1. MaBooleanIndex ------------------------- This is a very simple index which indexes a Boolean attribute. e.g. people where: [ :p | (p isMale = true) & (p age > 30) ]. This index is NOT recommended for heavy production use as it can only hash the objects into one of two values - harldy good key dispersal.
Nevertheless, it has proved quite useful in prototyping and is a simple example.
2. MaClassHierarchyIndex --------------------------------- A SIGNIFICANT benefit of an object database over a relation database is the ability to store heterogenous instances in the same collection. The instances may be of different classes and have a different number of instance variables.
Often the object model has a deep class hierarchy but all the instances inheriting from some base class are maintained in a common MagmaCollection.
A canonical example is the Lava test case which maintains a list of *people* but the elements of the collection are instances of one of the concrete subclasses: viz. Person( familyName firstName ) OccidentalPerson OrientalPerson AfricanPerson
In this case it may be convenient to find all the Oriental teenagers:
people where: [ :p | (p isKindOf: OrientalPerson) & (p age between: 13 and: 20) ].
#isMemberOf: is also supported.
This index will also suffer from relatively poor key dispersal; however its implementation and usage will mitigate the effects.
The implementation of this index uses some nice arbitrary base arithmetic and some extensive use of Smalltalk reflection.
Please find attached, comments and questions are welcomed.
Brent
magma@lists.squeakfoundation.org