[ENH] Two New Index Types: Boolean and Class Hierarchy

Brent Pinkney brent.pinkney at aircom.co.za
Wed Aug 16 22:03:09 UTC 2006


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: magmaFixes-brp.10.cs.gz
Type: application/x-gzip
Size: 2236 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/magma/attachments/20060817/9f1e0d3e/magmaFixes-brp.10.cs.bin


More information about the Magma mailing list