Question: Given the coordinates schema we used in the class examples, and the additional structures (index), write a PL/SQL procedure called knncloak which implements the two-rounds

Given the coordinates schema we used in the class examples, and the additional structures (index), write a PL/SQL procedure called knncloak which implements the two-rounds NN cloaking SKA technique. The procedure must receive as argument the ID of the querying user, and an integer K. The procedure must print on the screen the cloaking region (i.e., minimum bounding rectangle) obtained using the 2-round KNN.

-- create table coordinates CREATE TABLE coordinates ( id NUMBER PRIMARY KEY, point SDO_GEOMETRY );

--- create a spatial index on coordinates.point column --- create a 500x500 spatial grid, with x and y values ranging from 0 to 500

INSERT INTO user_sdo_geom_metadata ( TABLE_NAME , COLUMN_NAME , DIMINFO , SRID) VALUES ( 'coordinates' , 'POINT' , SDO_DIM_ARRAY(--- 500x500 grid SDO_DIM_ELEMENT('X', 0, 500, 0.005), SDO_DIM_ELEMENT('Y', 0, 500, 0.005) ) , null -- SRID ); CREATE INDEX coordinates_sidx ON coordinates(point) INDEXTYPE IS MDSYS.SPATIAL_INDEX;

--- load the coordinate points (x,y) from the 30_x_y_coordinates.txt file into the table INSERT INTO coordinates VALUES ( 1, SDO_GEOMETRY( 2001 -- 2 dimensional point , null -- SDO SRID , SDO_POINT_TYPE(460,80,null) , null , null ) );

-- create a MBR using the indexes of all the returned geometries SELECT sdo_aggr_mbr(point) FROM coordinates c WHERE c.id in ( (SELECT p.id FROM coordinates p WHERE SDO_NN(p.point, SDO_GEOMETRY(2001 , null , SDO_POINT_TYPE(240,460,null) , null , null ), 'sdo_num_res=5', 1 )='TRUE' ) );

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!