Queries can only be executed by specialized agents called query agents. One engine (node) can have multiple query agents, or a mixture of inference agents and query agents.For instructions on how to configure a query agent, see Chapter 23, Configuring Query Agents (Cache OM) in TIBCO BusinessEvents User’s Guide.The query language enables you to query concepts and simple events in the cache, using an SQL-like language.You can’t query scorecards or time events (they don’t exist in the cache). You can’t query the objects in the Rete network itself, or those in the backing store.Query features provide view-only access into the cache. You can’t use query language to do any updates to data in the cache.Snapshot queries return data from the cache as it exists at a moment in time. A snapshot query returns a single, finite collection of entities that exist in the cache.Continuous queries collect data as objects are added, deleted, or modified in the cache. That is, continuous queries work on data streaming through the query. Continuous queries continue to gather and return data when notified of changes, until you stop the query.The text of a query uses a structure similar to the structure of a SELECT statement in SQL, and it has parallels with the structure of a BusinessEvents rule, too:Each clause in a statement is examined in detail in Chapter 6, Query Language Components. For a quick reference to the query syntax, see Chapter 9, Query Language Reference.The query text is provided as an argument to the Query.create() function. Use of functions to create and execute queries is explained next.All queries are created and executed using a set of query functions. The query functions are called from rule functions in the query agent. Three functions are mandatory, and additional functions are available for different purposes, explained later in this guide.
● Create the query First a Query.create() function creates the query definition which contains the query text and a name for the definition.
● Create the query statement Then the Query.Statement.open() function is used to create a query statement, which is a named instance of the query definition.
● Execute an instance of the query statement and obtain results Two ways to execute a query instance are provided:
− For snapshot queries, you can use either the Query.Statement.execute() function or a Query.Statement.executeWithCallback() function.
− For continuous queries you must use the Query.Statement.executeWithCallback() function, with the IsContinuous parameter set to true.
● Use results To use results returned by a query, you can create events to send information between query and inference agents. You could also send results out to some other system. The use to which results are put depends on the business need.See Lifecycle of a Query—Use of Query Functions for more details.
● Chapter 6, Query Language Components Provides a detailed reference to each clause of a query statement.
● Chapter 7, Working With the Query Language Explains how to use the query functions and how to work with results.
● Working With Continuous Queries Explains how continuous queries use different kinds of windowsChapter 9, Query Language Reference Provides a reference to the query language components, expressions, operators, wildcards, datatypes, literals, and reserved words,
Copyright © TIBCO Software Inc. All Rights Reserved.