16.15.1. Programmatic Manipulation of Geometries in RDF

The ttlp function is the preferred way of inserting geometries. The more are inserted at one time, the more efficient the operation is. This loader function will also deal with cluster message optimization.

For deleting quads with geometries, normal SPARUL operations apply.

A geometry occurring in an RDF quad object is a member of the RDF box data type. This data type stands for a typed RDF literal. The type of all geometries is 256. This is mapped to a URI in the RDF_DATATYPE system table.

A geometry does not occur directly in the object position of a quad. It is referenced by an id that is stored in the RDF typed literal box and references RO_ID of the RDF_OBJ system table. To translate a geometry into a RDF box that can be stored, do as in the example below:

         iri_to_id ('http://www.w3.org/2003/01/geo/wgs84_pos#geometry'),
         DB.DBA.rdf_geo_add (rdf_box (st_point (lng, lat), 256, 257, 0, 1)));

The DB.DBA.RDF_GEO_ADD function looks if an identical geometry already exists and if so assigns the existing id to it. If the geometry is new, it gets a new ID and is stored in the RDF literals table RDF_OBJ. At this time it is also automatically inserted into the RDF geometry index.

In a cluster situation one should use the dpipe mechanism for inserting into RDF quad so as to get large numbers of inserts into a single message. This is essential for performance.