Filters in ARK are based on Set theory. Rather than the user attempting to create SQL based statements, they create simple sets of the data and then merge them or join them in simple ways to create quite complex statements using relatively simple building bricks. For users more familiar with SQL, this is likely to be a like confusing at the start, but for users with no prior database knowledge, this is hopefully a much more simple and powerful way of creating queries.
The basic operation of a filter in ARK is to query the database (using whatever SQL is appropriate for that filter type) and then produce a result_array which can be though of as a 'set'. Filters should only ever perform a single action and bring back a simple set.
The magic is in the way we operate on these sets. The results of each filter (results_array) are the elements of a 'set'. The results of two filters (sets) can then be 'operated on' to create a new set. This new set can then be combined with a third set using another operation to create a further new set.
In this way, filters are essentially considering how a whole set of different objects (in ARK lingo, results_arrays) are related to each other.
For more information on Set Theory - with extremely useful diagrams - see Wikipedia.
At present (v0.6), ARK performs an 'intersect' on results sets as default, but the aim is to support the full range of basic set operations:
* Union * Intersect * Relative complement of A in B * Complement of A in U
The aim is to have these options graphically selected by the end user.
At v0.6 ARK only supports Intersect operations which work as follows:
Following the creation of the first result_array - the user may want to refine the results further. Currently this is undertaken by running another filter, producing another separate results array and then displaying the Intersection of these two arrays.
A simple worked through example of this is:
Question: "I want to see all the of the contexts that have been verified by Stuart Eve".
* Run a 'Filter By Item' to return all of the Contexts. This produces the initial results_array (ra_1). * Run a 'Filter By Action' to return all of the Items that have been verified by Stuart Eve (ra_2). (note this filter on its own returns all of the items not just contexts). * Run an Intersect on ra_1 and ra_2 to produce a new results_array (ra_3) that only contains Contexts that have been Verified by Stuart Eve. (in Set Theory speak this is : ra_3 = ra_1 ∩ ra_2 ).