15 Configuring Applications With Data Cartridges

This section describes:

For more information on data cartridges, see "Introduction to Data Cartridges" in the Oracle CEP CQL Language Reference.

15.1 Understanding Data Cartridge Application Context

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

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

For more information on data cartridges, see "Introduction to Data Cartridges" in the Oracle CEP CQL Language Reference.

15.2 How to Configure Oracle Spatial Data Cartridge Application Context

You define an application context for an instance of an Oracle Spatial data cartridge using element spatial:context in your Oracle CEP application's Event Processing Network (EPN) assembly file.

All constructors and methods from com.oracle.cartridge.spatial.Geometry and Oracle Spatial data cartridge functions are aware of spatial:context. For example, the SRID is automatically set from the value in the Oracle Spatial data cartridge application context.

To configure Oracle Spatial data cartridge application context:

  1. Open the EPN editor in the Oracle CEP IDE for Eclipse.

    See Section 5.1, "Opening the EPN Editor".

  2. Right-click any component and select Go to Assembly Source.

  3. Edit the EPN file to add a spatial:context element as Example 15-1 shows.

    Example 15-1 spatial:context Element in EPN Assembly File

    <spatial:context id="SpatialGRS80" />
    
  4. Assign a value to the id attribute that is unique in this EPN.

    This is the name you will use to reference this application context in subsequent Oracle CQL queries. In Example 15-1, the id is SpatialGRS80.

    Note:

    The id value must not equal the Oracle Spatial data cartridge name spatial. For more information, see "Data Cartridge Name" in the Oracle CEP CQL Language Reference.
  5. Configure the other attributes of the spatial:context element to suit your application requirements.

    Table 15-1 lists the attributes of the spatial:context element.

    Table 15-1 spatial:context Element Attributes

    Attribute Description

    anyinteract-tolerance

    The default tolerance for contain or inside operator.

    Default: 0.0000005

    rof

    Defines the Reciprocal Of Flattening (ROF) parameter used for buffering and projection.

    Default: 298.257223563

    sma

    Defines the Semi-Major Axis (SMA) parameter used for buffering and projection.

    Default: 6378137.0

    srid

    SRID integer. Valid values are:

    • CARTESIAN: for cartesian coordinate system.

    • LAT_LNG_WGS84_SRID: for WGS84 coordinate system.

    • An integer value from the Oracle Spatial SDO_COORD_SYS table COORD_SYS_ID column.

    Default : LAT_LNG_WGS84_SRID

    For more information, see "SDO_SRID" in the Oracle Spatial Developer's Guide.

    tolerance

    The minimum distance to be ignored in geometric operations including buffering.

    Default: 0.000000001


    Example 15-2 shows how to create a spatial context named SpatialGRS80 in an EPN assembly file using the Geodetic Reference System 1980 (GRS80) coordinate system (srid="4269").

    Example 15-2 spatial:context Element in EPN Assembly File

    <spatial:context id="SpatialGRS80" srid="4269" sma="63787.0" rof="298.25722101" />
    
  6. Create Oracle CQL queries that reference this application context by name.

    Example 15-3 shows how to reference a spatial:context in an Oracle CQL query. In this case, the query uses link name SpatialGRS80 (defined in Example 15-1) to propagate this application context to the Oracle Spatial data cartridge. The spatial:context attribute settings of SpatialGRS80 are applied to the createPoint method call. Because the application context defines the SRID, you do not need to pass that argument into the createPoint method.

    Example 15-3 Referencing spatial:context in an Oracle CQL Query

    <view  id=”createPoint”>    select com.oracle.cep.cartridge.spatial.Geometry.createPoint@SpatialGRS80(
            lng, lat, 0d)    from CustomerPos[NOW]</view>
    

    For more information on creating Oracle CQL queries using the Oracle Spatial data cartridge, see "Using the Oracle Spatial Data Cartridge" in the Oracle CEP CQL Language Reference.