15.159 SEM_APIS.VALIDATE_GEOMETRIES

Format

SEM_APIS.VALIDATE_GEOMETRIES(
     model_name      IN VARCHAR2, 
     SRID            IN NUMBER, 
     tolerance       IN NUMBER,
     parallel        IN PLS_INTEGER DEFAULT NULL, 
     tablespace_name IN VARCHAR2 DEFAULT NULL,
     options         IN VARCHAR2 DEFAULT NULL,
     network_owner  IN VARCHAR2 DEFAULT NULL,
     network_name   IN VARCHAR2 DEFAULT NULL);

Description

Determines if all geometry literals in the specified model are valid for the provided SRID and tolerance values.

Parameters

model_name

Name of the model containing geometry literals to validate. Only native models can be specified.

SRID

SRID for the spatial reference system.

tolerance

Tolerance value that should be used for validation.

parallel

Degree of parallelism to be associated with the operation. For more information about parallel execution, see Oracle Database VLDB and Partitioning Guide.

tablespace_name

Destination tablespace for the tables {model_name}_IVG$, {model_name}_FXT$, and {model_name}_NFT$.

options

String specifying options for validation. Supported options are:

  • RECTIFY=T. Staging tables {model_name}_FXT$ and {model_name}_NFT$ are created, containing rectifiable and non-rectifiable triples, respectively. You can use these tables to correct the model.

  • AUTOCORRECT=T. Triples containing invalid but rectifiable geometries are corrected. Also, table {model_name}_NFT$ containing triples with non-rectifiable geometries is created so that you can correct such triples manually.

  • STANDARD_CRS_URI=T. Use standard CRS (coordinate reference systems) URIs.

  • GML_LIT_SRL=T. Use ogc:gmlLiteral serialization for corrected geometry literals. ogc:wktLiteral serialization is the default.

  • GEOJSON_LIT_SRL=T. Use ogc:geoJSONLiteral serialization for corrected geometry literals. ogc:wktLiteral serialization is the default.
  • KML_LIT_SRL=T. Use ogc:kmlLiteral serialization for corrected geometry literals. ogc:wktLiteral serialization is the default.
network_owner

Owner of the semantic network. (See Table 1-2.)

network_name

Name of the semantic network. (See Table 1-2.)

Usage Notes

This procedure is a wrapper for SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT function.

A table {model_name}_IVG$ containing invalid geometry literals is created. Optionally, staging tables {model_name}_FXT$ and {model_name}_NFT$ can be created, containing rectifiable and non-rectifiable triples, respectively. Staging tables allow the user to correct invalid geometries. Invalid but rectifiable geometry literals in a model can also be rectified automatically if specified.

After correction of invalid geometries in a model, it is recommended that you execute SEM_APIS.PURGE_UNUSED_VALUES to purge invalid geometry literal values from the semantic network.

For an explanation of models, see Semantic Data Modeling and Semantic Data in the Database.

For information about semantic network types and options, see RDF Networks.

Examples

The following example creates a model with some invalid geometry literals and then validates the model using the RECTIFY=T and STANDARD_CRS_URI=T options.

-- Create model
EXEC sem_apis.create_sem_model('m', NULL, NULL, network_owner=>'RDFUSER', network_name=>'NET1');

-- Insert invalid geometries
-- Duplicated coordinates - rectifiable
insert into RDFUSER.NET1#RDFT_M(triple) values (sdo_rdf_triple_s('m','<http://my.org/geom1>', '<http://www.opengis.net/rdf#asWKT>', '"POLYGON((1.0 2.0, 3.0 2.0, 1.0 4.0, 1.0 2.0, 1.0 2.0))"^^<http://xmlns.oracle.com/rdf/geo/WKTLiteral>'), network_owner=>'RDFUSER', network_name=>'NET1');
-- Boundary is not closed – rectifiable
insert into RDFUSER.NET1#RDFT_M(triple) values (sdo_rdf_triple_s('m','<http://my.org/geom2>', '<http://www.opengis.net/rdf#asWKT>', '"POLYGON((1.0 2.0, 3.0 2.0, 3.0 4.0, 1.0 4.0))"^^<http://xmlns.oracle.com/rdf/geo/WKTLiteral>'), network_owner=>'RDFUSER', network_name=>'NET1');
-- Less than 4 points – non rectifiable
insert into RDFUSER.NET1#RDFT_M(triple) values (sdo_rdf_triple_s('m:<http://my.org/g2>','<http://my.org/geom3>', '<http://www.opengis.net/rdf#asWKT>', '"POLYGON((1.0 2.0, 3.0 2.0, 1.0 4.0))"^^<http://xmlns.oracle.com/rdf/geo/WKTLiteral>'), network_owner=>'RDFUSER', network_name=>'NET1');
commit;

-- Validate
EXEC sem_apis.validate_geometries(model_name=>'m',SRID=>8307,tolerance=>0.1, options=>'STANDARD_CRS_URI=T RECTIFY=T', network_owner=>'RDFUSER', network_name=>'NET1');
 
-- Check invalid geometries
SELECT original_vid, error_msg, corrected_geom_literal FROM M_IVG$;

-- Check rectified triples
select RDF$STC_GRAPH, RDF$STC_SUB, RDF$STC_PRED, RDF$STC_OBJ from M_FXT$;

-- Check non-rectified triples
select RDF$STC_GRAPH, RDF$STC_SUB, RDF$STC_PRED, RDF$STC_OBJ, ERROR_MSG from M_NFT$;