1 Introduction to Data Cartridges

Oracle Stream Explorer data cartridges extend Oracle Continuous Query Language (Oracle CQL) to support domain-specific abstract data types of the following forms: simple types, complex types, array types, and domain-specific functions.

This chapter includes the following sections:

1.1 Oracle CQL Data Cartridge Framework

The Oracle CQL data cartridge framework enables you to tightly integrate arbitrary domain data types and functions with the Oracle CQL language. The tight integration means that you can use the data cartridge extensions within Oracle CQL queries in the same way that you use Oracle CQL native types and built-in functions. The framework supports both simple and complex data types. Complex data types allow you to use object-oriented programming.

Currently, Oracle Stream Explorer provides the following data cartridges:

  • Oracle JDBC data cartridge: This data cartridge allows you to incorporate arbitrary SQL functions against multiple tables and data sources in Oracle CQL queries and views as you would Oracle CQL native types.

  • Oracle Spatial: This data cartridge exposes Oracle Spatial types, methods, fields, and constructors that you can use in Oracle CQL queries and views as you would Oracle CQL native types.

  • Hadoop Big Data cartridge: This data cartridge extends an Oracle CQL processor to access large quantities of data in a Hadoop distributed file system (HDFS).

  • NoSQLDB Big Data cartridge: This data cartridge extends an Oracle CQL processor to access large quantities of data in an Oracle NoSQL Database

  • Oracle Java data cartridge: This data cartridge exposes Java types, methods, fields, and constructors that you can use in Oracle CQL queries and views as you would Oracle CQL native types.

1.2 Names

Each data cartridge is identified by a unique data cartridge name that defines a name space for the data cartridge implementation. Use the data cartridge name to disambiguate references to types, methods, fields, and constructors.

How you access data cartridge types, methods, fields, and constructors using Oracle CQL is the same for all data cartridge implementations. For example, you can reference a data-cartridge function with func_expr, which optionally takes a link name. What you access in each data cartridge is unique to each data cartridge implementation. For more information, see:

Note:

To simplify Oracle data cartridge type names, you can use aliases as described in Oracle Fusion Middleware Oracle CQL Language Reference for Oracle Stream Analytics.

1.3 Application Context

Depending on the data cartridge implementation, you might be able to define an application context that the Oracle Stream Analytics server propagates to the functions and types that an instance of the data cartridge provides. For example, you might be able to configure an Oracle Stream Analytics server resource or a default data cartridge option and associate this application context information with a particular data cartridge instance.

Depending on the data cartridge implementation, you might be able to define an application context that the Oracle Stream Analytics server propagates to an instance of the data cartridge and the complex objects it provides.

The following figure illustrates this application context.

Figure 1-1 Data Cartridge Application Context

Description of Figure 1-1 follows
Description of "Figure 1-1 Data Cartridge Application Context"

For example, you might be able to configure an Oracle Stream Analytics server resource or a default data cartridge option and associate this application context information with a particular data cartridge instance.

You define an application context for an instance of an Oracle Spatial data cartridge using a data cartridge implementation-provided element (call it DATA_CARTRIDGE_CONTEXT) in your Oracle Stream Analytics application's Event Processing Network (EPN) assembly file as the following example shows.

<DATA_CARTRIDGE_CONTEXT id="MyContext" ATTRIBUTE="" ... />

Where DATA_CARTRIDGE_CONTEXT is the name of the data cartridge implementation-provided element and ATTRIBUTE is one of one or more attributes that the data cartridge exposes for configuration.

In your Oracle CQL query, you use the id of the DATA_CARTRIDGE_CONTEXT (MyContext in the following example) in links instead of the DATA_CARTRIDGE_NAME alone. The Oracle Stream Analytics server will set the context object into the data cartridge instance before locating the data cartridge complex object.

Note:

The id value must not equal the DATA_CARTRIDGE_NAME.

In the following example, the default link (@DATA_CARTRIDGE_NAME) propagates the default application context to the myMethod call.

<view  id="view1">    
  select com.mypackage.MyType.myMethod@DATA_CARTRIDGE_NAME( ... )    
  from S[NOW]
</view>

In the following example, the link (@MyContext) propagates the user-defined application context to the myMethod call.

<view  id="view1">
  select com.mypackage.MyType.myMethod@MyContext(...)    
  from S[NOW]
</view>

You can configure an application context for the following data cartridges:

  • Oracle Spatial data cartridge

  • Oracle JDBC data cartridge