What is the PayloadSelector?

The PayloadSelector is a mechanism to request the filtering of data. It is a simplified "Query" modeled thought a Query By Example (QBE). The sample data is given in the payload and in the selector is make explicit the conditions to be applied.

The PayloadSelector is defined as a list of selector conditions (also called filters) to be considered on the entities of the message when using a Pull Request. Each one represents a condition to be used to allow addition extra filtering on data.

The PayloadSelector contain the value type PayloadSelector, defined by an array of Selectors elements, in which each one contains:

  • a Selector element using a XPATH expression that allows the selection XML elements in the payload.
  • an Operator element, that is one of : 

    EQUAL,
    NOT_EQUAL,
    LIKE,
    NOT_LIKE,
    GREATER_THAN,
    GREATER_THAN_OR_EQUAL_TO,
    LESS_THAN,
    LESS_THAN_OR_EQUAL_TO,
    IS_NULL.


When to use the PayloadSelector?

Whenever is needed filtering of data.


Using the PayloadSelector - a practical case

To use this feature in the PullRequest, supply a Selectors array refereed to the Payload data specified in the PullRequest. In the QBE, you must supply an example of the data to be selected.


Consider that you want to select Fishing Vessels with Net Tonnage in the closed interval [10.000, 30.000]. 


In this case you must supply an example of the Payload with the particular characteristics involved for every limit of the interval (see The standard Message structure common to all communication protocols). The Payload might be:

Payload data
<Payload>

<Vessel>
<NetTonnage>10000.0</NetTonnage>
<ShipType>FishingVessel</ShipType>
</Vessel>

<Vessel>
<NetTonnage>30000.0</NetTonnage>
<ShipType>FishingVessel</ShipType>
</Vessel>


</Payload>

The invariant fixed condition for the overall query is repeated for each limit.


Once fixed the payload, you can supply a selector on this data. The PayloadSelector might be:

Payload selector
<PayloadSelector>

<Selectors>
<Selector>//Vessel[1]/NetTonnage</Selector>
<Operator>GREATER_THAN_OR_EQUAL_TO</Operator>
</Selectors>



<Selectors>
<Selector>//Vessel[2]/NetTonnage</Selector>
<Operator>LESS_THAN_OR_EQUAL_TO</Operator>
</Selectors>


</PayloadSelector>


We apply the filtering on the each interval. For the invariant condition we don't need to supply any filter. We provide instead, filters for each limit. We request all Vessels having Vessel/NetTonnage between 10.000 and 30.000. And we can apply all conditions with XPATH because we have an example of the data.

The QBE parser on the CISE node performs an analysis of these and execute a query, which in turn conducts a search for similar entities.