9 Data Cartridge Schema

This chapter provides the schema reference information for the Oracle Stream Analytics data cartridge schema files. You can access these files in your Oracle Stream Analytics installation at /Oracle/Middleware/my_osa/osa/xsd.

This chapter includes the following sections:

9.1 ocep_jdbc_context_config.xsd

The ocep_jdbc_context_config.xsd file defines configuration settings for a JDBC data cartridge. A JDBC cartridge configuration has the following elements and attributes.

  • data-source: The name of the database connection between the server and the database.

  • function: The JDBC function you want to call to query a database table. A JDBC Cartridge function is a TABLE function that returns a collection.

  • param: A set of required name and type pairs that define parameter values that are passed to the function for a database query. The type value is an Oracle CQL simple type.

  • return-component-type: A simple Oracle CQL data type such as INT or FLOAT, a complex type such as a POJO bean name, or an extensible type defined by a cartridge. The return-component-type represents the component type of the collection-type returned by the JDBC cartridge TABLE function.

  • sql: The SQL query that defines the function. Precede references to the parameters declared in the param element with a colon (:).

The following entries in the configuration file show how to use these elements and their attributes to create a JDBC cartridge configuration with an SQL statement.

<jc:jdbc-ctx>
    <name>JdbcCartridgeOne</name> 
    <data-source>StockDS</data-source>
    <function name="getDetailsByOrderIdName">
        <param name="inpOrderId" type="int" />
        <param name="inpName" type="char" />
        <return-component-type>
            com.oracle.cep.example.jdbc_cartridge.RetEvent
        </return-component-type>
        <sql><![CDATA[
            SELECT
                Employee.empName as employeeName,
                Employee.empEmail as employeeEmail,
                OrderDetails.description as description
            FROM
                 PlacedOrders, OrderDetails , Employee
            WHERE
                PlacedOrders.empId = Employee.empId AND
                PlacedOrders.orderId = OrderDetails.orderId AND
                Employee.empName = :inpName AND
                PlacedOrders.orderId = :inpOrderId
        ></sql>
    </function>
</jc:jdbc-ctx>

9.2 ocep-jdbc.xsd

The ocep-jdbc.xsd file defines assembly settings for a JDBC data cartridge. A JDBC cartridge assembly configuration has the has the jdbc-context element. The jdbc-context element declares the Oracle Stream Analytics JDBC cartridge context.

The following entry in the assembly file sets the JDBC cartridge context to JdbcCartridgeOne.

<jdbc:jdbc-context id="JdbcCartridgeOne"/>

9.3 ocep-spatial.xsd

The ocep-spatial.xsd file defines assembly settings for a spatial context. Use a spatial context to specify the coordinate system you want to use and the associated attributes, as follows.

A spatial context has the following attributes:

  • cartesian: Specify true to use cartesian coordinates. Default is false which defaults to Geodetic (WGS84) coordinates.

  • srid: Identifies the coordinate system. The default is LAT_LNG_WGS84_SRID for the Geodetic (WGS84) coordinate system. Specify CARTESIAN for the Cartesian coordinate system.

  • sma: Specify a double value that defines the semi-major axis parameter. The semi-major axis parameter value is used for buffering and projection. The default value is 6378137.0.

  • rof: Specify a double value that defines the flattening parameter reciprocal. The flattening parameter reciprocal is used for buffering and projection. The default value is 298.257223563.

  • tolerance: Specify a double value that defines the minimum distance to be ignored in geometric operation including buffering. The default value is 0.000000001.

  • anyinteract-tolerance: Specify a double value that defines the default tolerance for ANYINTERACT Oracle Spatial geometric relation operator. The default value is 0.0000005.

The following entry in the assembly file shows a spatial context configuration:

<spatial:context id="my-spatial-context" anyinteract-tolerance="0.0000005"
  rof="298.257223563" sma="6378137.0" srid="LAT_LNG_WGS84_SRID"
  tolerance="0.000000001"/>

9.4 ocep-hadoop.xsd

The ocep-hadoop.xsd file defines assembly settings for a file that stores event information that resides in the Hadoop file system or in a local file system. The file element has the following attributes:

  • event-type: Specify an event type that defines the schema of the data to be stored in the Hadoop HDFS or local FS.

  • path: Specify a file path in the Hadoop HDFS or local FS where you want Oracle Stream Analytics to store the event data. A path string is absolute if it begins with a slash.

  • separator: Specify the file path separator. The path separator relates to how the data is separated within the referenced file. The path points to a CSV file, for example, and the separator specifies that the fields are separated with a comma (,).

  • operation-timeout: Specify how long to wait in milliseconds for the operation to complete. If the operation does not complete within the specified amount of time, the operation returns with an empty result and then continues normally.

The following entry in the assembly file shows a Hadoop configuration:

<hadoop:file id="hadoop" event-type="OracleL2StockTick" 
  path="/my_hadoop/hadoop/hadoop_file" separator=","/>

9.5 ocep-nosql.xsd

The ocep-nosqldb.xsd file defines assembly settings for a data store that contains event information that resides in NoSQLDB. The store element has the following attributes:

  • event-type: Specify an event type that defines the schema of the data to be stored in NoSQLDB. The event-type must be a Java-based event type that implements the java.io.Serializable interface.Class-loader of application that provides this event-type is used when deserializing the Java object put in this store.

  • store-name: The name of the Oracle NoSQLDB store.

  • store-locations: A space-separated list of the locations of the NoSQLDB nodes in the form of domain:port. For example, localhost:5000. Oracle Stream Analytics uses the locations to connect to a NoSQLDB server. If a server is not available, Oracle Stream Analytics uses the next location in the list.

The following entry in the assembly file shows a NoSQLDB configuration:

<nosqldb:store id="my_nosqldb" event-type="TradeEvent2" 
  store-name="my_nosql_store" store-locations="localhost:5000"/>