Database Management for Smalltalk

VirtualDictionarySet Query Tip

Current User: Guest
  • This forum allows Guest Users to post
  • Guests may not subscribe to email notifications
  • Posts by Guest Users will be moderated prior to publishing
Search Forums:

Current Forum
All Forums
Match Any Word
Match All Words
Match Phrase

VirtualDictionarySet Query Tip
Read original blog post

Reply to Post

12:50 pm
Thursday, 19 March 2009

John Clapperton


posts 13

VirtualDictionarySet (a virtualized subclass of DictionarySet) is the workhorse collection class to use for aggregation of objects in a VOSS database. Typically, all the objects in a DictionarySet will be of the same class (e.g. Employee, Department, Project, Order, Invoice etc), but not necessarily.

DictionarySet allows its elements to be indexed by any number of single-valued and/or multi-valued key-selector unary messages (e.g. #employeeNumber (single-valued), #lastName (multi-valued), #deptNumber (a foreign key in Employees), #deptNumber (primary key in Departments) etc), as required by the application.

Complex queries are built by sending messages such as <#for: #lastName equals: ‘Smith’>  to the DictionarySet, to which the DictionarySet returns a set of its elements meeting that criterion. There is an example of a complex query here.

The tip here, in the interests of efficiency,  is not to “change the class” of the returned partial query sets (e.g. #asOrderedCollection) until after all the intersections and/or unions of partial query sets have been done to build the complex query - and even then there is rarely any need to do this.

VirtualDictionarySet>>for:equals: returns a VOLogicalOrderedIdentitySet of virtual objects, which compares logical identity of the virtual objects it contains (and is adding) by comparing the object’s #voManager identity and its integer object #id, both of which are in the in the object’s proxy VORef (which is what is actually in the set), and therefore no #= message need be expensively forwarded to the instantiated object in the cache in the voManager. 
Moreover, VOLogicalOrderedIdentitySet is hashed (on #id in the VORef), and needs to compare identity only when probing hash collisions. Therefore it executes #includes: much faster than OrderedCollection or other non-hashed collections, which must compare equality for each of the entire collection when looking for an absent object, and, on average, half the collection for each present object, forwarding #= to the instantiated object each time.

It is therefore very much faster when constructing complex queries to do all union and intersection of the partial query sets using the VOLogicalOrderedIdentitySets as returned by the partial query components.
Read original blog post

Reply to Post

Reply to Topic: VirtualDictionarySet Query Tip

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 10 + 7        (Required)

Topic Reply:


About the VOSS 3.1 forum

Currently Online:

1 Guest

Maximum Online: 56


Groups: 2

Forums: 8

Topics: 19

Posts: 21


There are 2 members

There are 1 guests

John Clapperton has made 13 posts

Top Posters:

Thomas Holzer - 1

Simple Forum - Version 2.1 (Build 237)

Simple Forum WordPress Plugin created by Andy Staines: Yellow Swordfish

Forum Skin/Icons: theme229compatible / default

Default 'Silk' Icon Set created by Mark James: fam fam fam

Math Spam Protection based on code by Michael Woehrer: Software Guide

Tabbed Admin uses Tabifier by Patrick Fitzgerald: BarelyFitz Designs

My thanks to all the people who have aided, abetted, suggested and helped test this plugin


Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /vhost/vhost6/l/o/g/ : runtime-created function(61) : eval()'d code on line 215

Warning: file_get_contents( failed to open stream: Success in /vhost/vhost6/l/o/g/ : runtime-created function(61) : eval()'d code on line 215