How Open Source King.Oracle FDO provider uses KingFdoClass Table ( BETA Release )

This document describe how King.Oracle provider uses additional Oracle Table to describe FDO classes. In this document table will be called "KingFdoClass" for convenience. Note that actual table name in Oracle is defined by user.

 

Introduction

KingFdoClass table is used to describe FDO classes that will be used by King.Oracle provider.

Examples of use cases are:

  • Use of Oracle Views as FDO Classes
  • Overriding FDO class Attributes like: Identity, Layer Geometry Type, Name, Extent
  • Use of Tables/Views without geometry column
  • Creating FDO Class with points defined in columns with numbers X,Y and/or Z

If you are not using KingFdoclass table King.Oracle provider will create FDO classes from Geometry Tables found in Oracle Database (look How FDO King.Oracle provider uses Oracle Spatial).

With KingFdoClass table you can influence which and how FDO classes will be created.

Setup KingFdoClass Table

You need to do two things

1. Create actual table in Oracle
You can create table with SQL statement:
CREATE TABLE MYFDOCLASS ( FDO_UNIQUE_ID NUMBER(*,0),FDO_ORA_OWNER VARCHAR2(64 BYTE), FDO_ORA_NAME VARCHAR2(64 BYTE), FDO_ORA_GEOMCOLUMN VARCHAR2(1024 BYTE), FDO_SPATIALTABLE_OWNER VARCHAR2(64 BYTE), FDO_SPATIALTABLE_NAME VARCHAR2(64 BYTE), FDO_SPATIALTABLE_GEOMCOLUMN VARCHAR2(1024 BYTE), FDO_CLASS_NAME VARCHAR2(256 BYTE), FDO_SRID NUMBER, FDO_DIMINFO MDSYS.SDO_DIM_ARRAY , FDO_CS_NAME VARCHAR2(256 BYTE), FDO_WKTEXT VARCHAR2(2046 BYTE), FDO_LAYER_GTYPE VARCHAR2(64 BYTE), FDO_SEQUENCE_NAME VARCHAR2(64 BYTE), FDO_IDENTITY VARCHAR2(1024 BYTE), FDO_SDO_ROOT_MBR MDSYS.SDO_GEOMETRY , FDO_POINT_X_COLUMN VARCHAR2(128 BYTE), FDO_POINT_Y_COLUMN VARCHAR2(128 BYTE), FDO_POINT_Z_COLUMN VARCHAR2(128 BYTE), FDO_SPATIAL_CONTEXT VARCHAR2(128 BYTE))

2. Define table name in connection property KingFdoClass
When creating connection to Oracle in connection property "KingFdoClass" you need to enter name of table you have created ( ex. MYFDOCLASS )

Note: You can leave KingFdoClass connection property empty if you are not using this procedure for defining FDO classes.

If there are any kind of errors in reading and applying KingFdoClass table it will be ignored and King.Oracle provider will continue to run without error message.

After adding some new row in the table you need to restart MapGuide in order to King.Oracle "pickup" new FDO class. This is because of caching FDO schema in MG and provider.

Note:
This is beta version and table will probably change.

Using KingFdoClass Table

When connecting to Oracle King.Oracle will take KingFdoClass connection property and if it is not empty it will query against table defined in the property. For every row in KingfdoClass table it will create new FDO Class. FDO Classes will be created in FDO schema named KingFdoClass.

Note: After adding some new row in the table you need to restart MapGuide in order to King.Oracle "pickup" new FDO class. This is because of caching FDO schema in MG and provider.

Adding FDO Class in KingFdoClass Table

Adding a new row in KingFdoClass Table means adding a new FDO Class. Just few fields are obligatory:
FDO_CLASS_NAME - name of new FDO class
FDO_ORA_OWNER - Oracle Schema of Table/View which is queried
FDO_ORA_NAME - Oracle Name of Table/View which is queried

Other fields you fill in if you want to override particular class attribute.

Best would be to describe trough examples:

Example 1: New class name for existing geometry table

insert into myfdoclass ( fdo_class_name, fdo_ora_owner, fdo_ora_name, fdo_ora_geomcolumn ) values ( 'MyClassName', 'UNITTEST', 'CURVEPOLYGON', 'GEOM')

Example 2: Define identity for existing geometry table

insert into myfdoclass ( fdo_class_name, fdo_ora_owner, fdo_ora_name, fdo_ora_geomcolumn, fdo_identity ) values ( 'MyClassName', 'UNITTEST', 'CURVEPOLYGON', 'GEOM', 'ID' )

In this two cases existing geometry table is used CURVEPOLYGON which has all SDO_GEOM_METADATA, spatial index defined and all data is read as usual, we have just changed name or identity column.

Example 3: Non-Spatial Table as FDO Class

insert into myfdoclass ( fdo_class_name, fdo_ora_owner, fdo_ora_name, fdo_identity ) values ( 'NoSpatialClass', 'UNITTEST', 'NOGEOM', 'ID' )

This will create FDO class from table NOGEOM and use column ID for identity.

Example 4: Define FDO Class with point geometry from X,Y,Z number columns

create table pointdata ( id integer, x NUMBER, y NUMBER, z NUMBER)
insert into pointdata ( id,x,y) values (1,5,5);
insert into pointdata ( id,x,y) values (2,10,10);
insert into myfdoclass ( fdo_class_name, fdo_ora_owner, fdo_ora_name, fdo_point_x_column, fdo_point_y_column ) values ( 'POINTCLASS', 'UNITTEST', 'POINTDATA', 'X' ,'Y' );

In this example I have created an table POINTDATA and added two points with coordinates in x,y columns.
I defined a new FDO class 'POINTCLASS' and defined which column will be used for x and y coordinates.
When you look in MG you will see POINTDATA class with "KING_FDO_POINT" geometry property.
"KING_FDO_POINT" geometry property is created by King.Oracle provider (name is fixed).
You can use this class to view points in MapGuide.