Refiner is a Transformer Service blade that you can use to filter and sort large lists of data. It enables you to set the filtering and sorting criteria that are relevant to you.
For example, you could filter a container so that only the following results are returned:
All the bonds that mature in the forthcoming 2 year period.
All the bonds with a coupon greater than a particular value.
All the bonds with a rating greater than a particular value.
As well as filtering the results, you can also sort them into the most convenient order - in descending order of the bonds' coupon, for example. Filtering and sorting can be done in the same request. In Refiner 7.0.0 and later, you can sort on multiple fields.
To find out more about how to deploy Refiner and use it to filter and sort requests, see How can I… Deploy the Refiner Service Module.
Refiner Service Architecture
Refiner sits within Transformer in the Caplin Platform.
A basic Refiner setup involves a client application, which connects to Liberator using RTTP, a Transformer, which is connected to Liberator, and an Integration Adapter, which is connected to Transformer.
In Transformer, data transformation services are implemented in Transformer Modules. The Transformer provides an interface for Transformer Modules to register as providers for objects in a specific namespace. When client applications request an object whose subject matches the namespace for a particular Module, the Transformer requests that object from the Module, which then returns the object.
Transformer Modules can be written in Java, Lua or C. Refiner is a Java Transformer Module; it’s supplied as a Service blade that’s deployed in the Caplin Platform Deployment Framework. When Refiner receives a request for a filtered or sorted container, it requests the base container (sometimes referred to as the "underlying container") from the relevant Integration Adapter. When the base container and constituent records arrive from the Adapter, Refiner applies the filter and/or sort criteria specified by the client and sends back the results.
How container filtering works
The following diagram illustrates how container filtering works. It shows the Caplin Platform components involved in filtering the contents of a container, and the flow of subscriptions and data through the system. The actual filtering and sorting of the container is performed by the Transformer’s Caplin Refiner module, which is deployed as a Transformer Service blade.
In this example, the client application has already subscribed to the container
/CTR/FI/ALL, and the instruments referred to in the container are displayed to the end-user in a grid (see the beige-coloured box at the top left of the diagram). Subsequently the end-user sets up a filter that restricts the instruments displayed in the container to those where the Coupon (
CpnRate field) is greater than
6. For simplicity, the container is not windowed.
Caplin Trader calls the StreamLink Container Filtering API to add the filter (CpnRate>6) to the subscription for the container
/CTR/FI/ALL. Liberator receives the filter as a request for the subject
Liberator passes the container filter subscription request on to Transformer, where it is retained by Caplin Refiner, which sets up the filter. (If the base container – in this case
/CTR/FI/ALL– is not in the Transformer’s cache, Transformer requests it from the relevant Integration Adapter.)
At the same time, the Integration Adapter that handles the subscriptions to the instruments in the container passes back to Transformer a new container element, referring to a new instrument
In Transformer, Caplin Refiner applies the filter to the container according to the latest set of instruments. In this example, the value of the CpnRate field for
/FI/EU/C is less than
6, so these instruments no longer meet the filter criteria, and must be removed from the filtered container. The new instrument
10.62, matches the filter, so it is retained in the filtered container. Transformer sends a container structure change message to Liberator, specifying that the subject names
/FI/EU/Cbe removed from the container, and the subject name
/FI/US/Cbe added to the container.
Liberator makes the changes to the container and passes the corresponding container structure change messages on to StreamLink. StreamLink then informs the client about the change to the filtered container so that it can remove the instruments
/FI/EU/Cfrom the filtered grid on the display, and add
/FI/US/C.Any updates to the instruments
/FI/EU/B, and the image for the new instrument
/FI/US/C, are also fed back to the client via Liberator and StreamLink. The client updates the instruments in the filtered grid – see the grey box at the top right of the diagram.
To use Caplin Refiner from a client application, the application subscribes to (requests) a subject, where the subject name indicates to the Transformer that a container is to be filtered and/or sorted. The Transformer passes the subscription request to its Caplin Refiner module, which then parses information from the subject in order to perform its functions.
The client doesn’t create such subscription requests directly, but instead calls dedicated API methods to construct filter and sort directives, which are then passed on to Caplin Refiner.
To use Caplin Refiner from a client that isn’t a Caplin Trader application, call the API methods provided in the StreamLink library that your application uses. These methods allow you to build up the request in an object oriented way, and the request string itself is then generated by the StreamLink library. For a detailed example of how to do this, see How can I… Access Refiner through StreamLink.
If you want to use Caplin Refiner from another DataSource application, you create a subscription request that contains the filter and/or sort parameters and then send the request to the appropriate Transformer to be processed by its Refiner module. For example, the request could be:
For more about this, see How Can I… Filter and Sort in Refiner.
I18n support is built into Refiner and includes the following:
International characters in Filtering.
Locale-Independent Comparisons. There’s more information about this on the Oracle Performing Locale-Independent Comparisons page.
How can I… Deploy the Refiner Service Module
How can I… Filter and Sort in Refiner
How can I… Access Refiner through StreamLink
How can I… Configure Refiner
How can I… Configure sorting and filtering (in Caplin Trader 4 grids).
Reference: Refiner configuration properties