Query as a Pre-filter

Query agents can act as pre-filters and routers. Suppose you want to check for the existence of a concept in the cache, using properties of an event. If the concept does not exist, you want to create it.

You can achieve this result as follows:

The query agent listens for messages on a destination D1.

On receiving a message (event A) at D1, the query agent executes the query statement to determine if the corresponding concept exists in cache.

  • If the query finds an existing concept, nothing happens.
  • If the query does not find an existing concept the agent sends event A to destination D2.

    The inference agent listens for events (messages) on destination D2.

    On receiving an event at D2, a rule in the inference agent creates the concept.