Difference between revisions of "Filters"
|Line 40:||Line 40:|
The next operation to be built into ARK will the Relative Complement of A in B. This
The next operation to be built into ARK will the Relative Complement of A in B. This us a 'subtract' operation.
Revision as of 07:56, 11 July 2008
Filters in ARK are based on Set theory. Rather than the user attempting to create SQL based statements, they create 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 little 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 thought 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:
- 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. In an intersect operation, the new set contains only the elements found in both set A and in set B. In ARK intersects 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 this can be expressed as:
ra_3 = ra_1 ∩ ra_2
The next operation to be built into ARK will the Relative Complement of A in B. This will give us a 'subtract' operation.
The relative complement of A in B is also known as the set-theoretic difference of B and A. The new set contains the elements in B, but not in A.