B.1 GeoSPARQL Functions for Spatial Support
This section provides reference information about the GeoSPARQL functions:
- ogcf:aggBoundingBox
- ogcf:aggBoundingCircle
- ogcf:aggCentroid
- ogcf:aggConcaveHull
- ogcf:aggConvexHull
- ogcf:aggUnion
- ogcf:Area
- ogcf:asGeoJSON
- ogcf:asGML
- ogcf:asKML
- ogcf:asWKT
- ogcf:boundary
- ogcf:boundingCircle
- ogcf:buffer
- ogcf:concaveHull
- ogcf:convexHull
- ogcf:coordinateDimension
- ogcf:difference
- ogcf:dimension
- ogcf:distance
- ogcf:envelope
- ogcf:geometryN
- ogcf:geometryType
- ogcf:getSRID
- ogcf:intersection
- ogcf:is3D
- ogcf:isEmpty
- ogcf:isMeasured
- ogcf:isSimple
- ogcf:length
- ogcf:maxX
- ogcf:maxY
- ogcf:maxZ
- ogcf:metricArea
- ogcf:metricBuffer
- ogcf:metricLength
- ogcf:metricPerimeter
- ogcf:minX
- ogcf:minY
- ogcf:minZ
- ogcf:numGeometries
- ogcf:perimeter
- ogcf:relate
- ogcf:sfContains
- ogcf:sfCrosses
- ogcf:sfDisjoint
- ogcf:sfEquals
- ogcf:sfIntersects
- ogcf:sfOverlaps
- ogcf:sfTouches
- ogcf:sfWithin
- ogcf:spatialDimension
- ogcf:symDifference
- ogcf:transform
- ogcf:union
Parent topic: SEM_MATCH Support for Spatial Queries
B.1.1 ogcf:aggBoundingBox
Format
ogcf:aggBoundingBox(geom : geomLiteral) : ogc:wktLiteral
Description
Aggregate that returns a single geometry object that is the minimum bounding box (rectangle) of the input set of geometries.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the aggregate bounding box of U.S. Congressional district polygons.
SELECT bb
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:aggBoundingBox(?cgeom) AS ?bb)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.2 ogcf:aggBoundingCircle
Format
ogcf:aggBoundingCircle(geom : geomLiteral) : ogc:wktLiteral
Description
Aggregate that returns a single geometry object that is the minimum bounding circle of the input set of geometries.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the aggregate bounding circle of U.S. Congressional district polygons.
SELECT bc
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:aggBoundingCircle(?cgeom) AS ?bc)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.3 ogcf:aggCentroid
Format
ogcf:aggCentroid(geom : geomLiteral) : ogc:wktLiteral
Description
Aggregate that returns a single geometry object that is the centroid (center point) of the input set of geometries.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the aggregate centroid of U.S. Congressional district polygons.
SELECT c
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:aggCentroid(?cgeom) AS ?c)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.4 ogcf:aggConcaveHull
Format
ogcf:aggConcaveHull(geom : geomLiteral) : ogc:wktLiteral
Description
Aggregate that returns a single geometry object that is the concave hull of the input set of geometries. The concave hull is a polygon that represents the area of the input geometry, such as a collection of points. With complex input geometries, the concave hull is typically significantly smaller in area than the convex hull.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the aggregate concave hull of U.S. Congressional district polygons.
SELECT ch
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:aggConcaveHull(?cgeom) AS ?ch)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.5 ogcf:aggConvexHull
Format
ogcf:aggConvexHull(geom : geomLiteral) : ogc:wktLiteral
Description
Aggregate that returns a single geometry object that is the convex hull of the input set of geometries. The convex hull is a simple convex polygon that completely encloses the geometry object, using as few straight-line sides as possible to create the smallest polygon that completely encloses the geometry object.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the aggregate convex hull of U.S. Congressional district polygons.
SELECT ch
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:aggConvexHull(?cgeom) AS ?ch)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.6 ogcf:aggUnion
Format
ogcf:aggUnion(geom : geomLiteral) : ogc:wktLiteral
Description
Aggregate that returns a single geometry object that is the topological union of the input set of geometries.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the aggregate union of U.S. Congressional district polygons.
SELECT u
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:aggUnion(?cgeom) AS ?u)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.7 ogcf:Area
Format
ogcf:area(geom : geomLiteral, units : xsd:anyURI) : ogc:wktLiteral
Description
Returns the area of a two-dimensional polygon.
Parameters
- geom
-
Geometry object. Specified as a query variable or a constant
geomLiteral
value. - units
-
Unit of measurement:
- A URI of the form
<http://xmlns.oracle.com/rdf/geo/uom/{SDO_UNIT}>
(for example,<http://xmlns.oracle.com/rdf/geo/uom/M>
). Any SDO_UNIT value from the MDSYS.SDO_AREA_UNITS table will be recognized. See the section about Unit Of Measurement Support in Oracle Spatial Developer's Guide for more information about unit of measurement specification. - A URI from the QUDT vocabulary of units that has an
equivalent unit in MDSYS.SDO_AREA_UNITS table. For example,
<http://qudt.org/vocab/unit/M2>
for square meter.
- A URI of the form
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the area in square meters of each U.S. Congressional district polygon.
SELECT name, ca
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name (ogcf:area(?cgeom, <http://qudt.org/vocab/unit/M2>) AS ?ca)
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.8 ogcf:asGeoJSON
Format
ogcf:asGeoJSON(geom : geomLiteral) : ogc:geoJSONLiteral
Description
Converts geom to an equivalent GeoJSON representation.
Usage Notes
Converting a geometry to an ogc:geoJSONLiteral
will result in a coordinate
transformation to CRS84 Longitude, Latitiude, which is the only coordinate reference system
supported by GeoJSON.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns each U.S. Congressional district polygon as an
ogc:geoJSONLiteral
.
SELECT name, gjson
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name (ogcf:asGeoJSON(?cgeom) AS ?gjson)
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.9 ogcf:asGML
Format
ogcf:asGML(geom : geomLiteral, gmlProfile : xsd:string) : ogc:gmlLiteral
Description
Converts geom
to an equivalent GML representation.
Parameters
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns each U.S. Congressional district polygon as an
ogc:GMLLiteral
.
SELECT name, gml
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name (ogcf:asGML(?cgeom, "3.11") AS ?gml)
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.10 ogcf:asKML
Format
ogcf:asKML(geom : geomLiteral) : ogc:kmlLiteral
Description
Converts geom to an equivalent KML representation.
Usage Notes
Converting a geometry to an ogc:kmlLiteral
will result in a coordinate
transformation to CRS84 Longitude, Latitiude, which is the only coordinate reference system
supported by GML.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns each U.S. Congressional district polygon as an
ogc:kmlLiteral
.
SELECT name, kml
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name (ogcf:asKML(?cgeom) AS ?kml)
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.11 ogcf:asWKT
Format
ogcf:asWKT(geom : geomLiteral) : ogc:wktLiteral
Description
Converts geom to an equivalent WKT representation.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns each U.S. Congressional district polygon as an
ogc:wktLiteral
.
SELECT name, wkt
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name (ogcf:asWKT(?cgeom) AS ?wkt)
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.12 ogcf:boundary
Format
ogcf:boundary(geom : geomLiteral) : ogc:wktLiteral
Description
Returns a geometry object that is the closure of the boundary of geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the boundaries of U.S. Congressional district polygons.
SELECT cb FROM table(sem_match( 'PREFIX ogc: <http://www.opengis.net/ont/geosparql#> PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/> PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/> PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/> PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/> SELECT (ogcf:boundary(?cgeom) AS ?cb) WHERE { ?person usgovt:name ?name . ?person pol:hasRole ?role . ?role pol:forOffice ?office . ?office pol:represents ?cdist . ?cdist orageo:hasExactGeometry ?cgeom }' ,sem_models('gov_all_vm'), null ,null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.13 ogcf:boundingCircle
Format
ogcf:boundingCircle(geom : geomLiteral) : ogc:wktLiteral
Description
Returns a geometric object that is the minimum bounding circle around
geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns the minimum bounding circle around each U.S. Congressional district polygon.
SELECT name, bc
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name (ogcf:boundingCircle(?cgeom) AS ?bc)
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.14 ogcf:buffer
Format
ogcf:buffer(geom : geomLiteral, radius : xsd:decimal, units : xsd:anyURI) : ogc:wktLiteral
Description
Returns a buffer polygon the specified radius (measured in units) around a geometry.
Parameters
- geom
-
Geometry object. Specified as a query variable or a constant
geomLiteral
value. - radius
-
Radius value used to define the buffer.
- units
-
Unit of measurement:
- A URI of the form
<http://xmlns.oracle.com/rdf/geo/uom/{SDO_UNIT}>
(for example,<http://xmlns.oracle.com/rdf/geo/uom/M>
). Any SDO_UNIT value from the MDSYS.SDO_DIST_UNITS table will be recognized. See the section about Unit Of Measurement Support in Oracle Spatial Developer's Guide for more information about unit of measurement specification. - A URI from the QUDT vocabulary of units that has an
equivalent unit in MDSYS.SDO_DIST_UNITS table. For example,
<http://qudt.org/vocab/unit/M>
for meter.
- A URI of the form
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the U.S. Congressional district polygons that are within a 100–kilometer buffer around a specified point.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (
ogcf:sfWithin(?cgeom,
ogcf:buffer("POINT(-71.46444 42.7575)"^^ogc:wktLiteral,
100,
<http://xmlns.oracle.com/rdf/geo/uom/KM>))) }'
,sem_models('gov_all_vm'), null
,null
,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.15 ogcf:concaveHull
Format
ogcf:concaveHull(geom : geomLiteral) : ogc:wktLiteral
Description
Returns a geometric object that represents the concave hull of
geom
. The convex hull is a simple convex polygon that completely encloses
the geometry object. Spatial uses as few straight-line sides as possible to create the
smallest polygon that completely encloses the specified object. A convex hull is a
convenient way to get an approximation of a complex geometry object.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns the concave hull of each U.S. Congressional district polygon.
SELECT name, ch
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name (ogcf:concaveHull(?cgeom) AS ?ch)
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.16 ogcf:convexHull
Format
ogcf:convexHull(geom : geomLiteral) : ogc:wktLiteral
Description
Returns a polygon geometry that represents the convex hull of geom. (The convex hull is a simple convex polygon that completely encloses the geometry object, using as few straight-line sides as possible to create the smallest polygon that completely encloses the geometry object.)
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the U.S. Congressional district polygons whose convex hull contains a specified point.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfContains(ogcf:convexHull(?cgeom),
"POINT(-71.46444 42.7575)"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null
,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.17 ogcf:coordinateDimension
Format
ogcf:coordinateDimension(geom : geomLiteral) : xsd:integer
Description
Returns the coordinate dimension of geom
. The coordinate
dimension is the number of measurements or axes needed to describe a position in the
coordinate reference system of geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns the coordinate dimension of each U.S. Congressional district polygon.
SELECT cdist, cd
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (ogcf:coordinateDimension(?cgeom) AS ?cd)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.18 ogcf:difference
Format
ogcf:difference(geom1 : geomLiteral, geom2 : geomLiteral) : ogc:wktLiteral
Description
Returns a geometry object that is the topological difference (MINUS operation) of geom1
and geom2
.
Parameters
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the U.S. Congressional district polygons whose centroid is within the difference of two specified polygons.
SELECT name, cdist FROM table(sem_match( 'PREFIX ogc: <http://www.opengis.net/ont/geosparql#> PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/> PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/> PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/> PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/> SELECT ?name ?cdist WHERE { ?person usgovt:name ?name . ?person pol:hasRole ?role . ?role pol:forOffice ?office . ?office pol:represents ?cdist . ?cdist orageo:hasExactGeometry ?cgeom FILTER (ogcf:sfWithin(orageo:centroid(?cgeom), ogcf:difference( "Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral, "Polygon((-83.2 34.3, -83.0 34.3, -83.0 34.5, -83.2 34.5, -83.2 34.3))"^^ogc:wktLiteral))) } ' ,sem_models('gov_all_vm'), null ,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.19 ogcf:dimension
Format
ogcf:dimension(geom : geomLiteral) : xsd:integer
Description
Returns the dimension of geom
. For example, the dimension of a
point is 0, a line is 1, and a polygon is 2.
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns the dimension of each U.S. Congressional district polygon.
SELECT cdist, cd
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (ogcf:dimension(?cgeom) AS ?cd)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.20 ogcf:distance
Format
ogcf:distance(geom1 : geomLiteral, geom2 : geomLiteral, units : xsd:anyURI) : xsd:decimal
Description
Returns the distance in units between the two closest points of geom1
and geom2
.
Parameters
- geom1
-
Geometry object. Specified as a query variable or a constant
geomLiteral
value. - geom2
-
Geometry object. Specified as a query variable or a constant
geomLiteral
value. - units
-
Unit of measurement:
- A URI of the form
<http://xmlns.oracle.com/rdf/geo/uom/{SDO_UNIT}>
(for example,<http://xmlns.oracle.com/rdf/geo/uom/KM>
). Any SDO_UNIT value from the MDSYS.SDO_DIST_UNITS table will be recognized. See the section about unit of measurement support in Oracle Spatial and Graph Developer's Guide for more information about unit of measurement specification. - A URI from the QUDT vocabulary of units that has an equivalent unit in
MDSYS.SDO_DIST_UNITS table. For example,
<http://qudt.org/vocab/unit/M>
for meter.
- A URI of the form
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example orders U.S. Congressional districts based on distance from a specified point.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
}
ORDER BY ASC(ogcf:distance(?cgeom,
"POINT(-71.46444 42.7575)"^^ogc:wktLiteral,
<http://xmlns.oracle.com/rdf/geo/uom/KM>))'
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '))
ORDER BY sem$rownum;
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.21 ogcf:envelope
Format
ogcf:envelope(geom : geomLiteral) : ogc:wktLiteral
Description
Returns the minimum bounding rectangle (MBR) of geom
, that is, the single rectangle that minimally encloses geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the U.S. Congressional district polygons whose minimum bounding rectangle contains a specified point.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfContains(ogcf:envelope(?cgeom),
"POINT(-71.46444 42.7575)"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.22 ogcf:geometryN
Format
ogcf:geometryN(geom : geomLiteral, geomindex : xsd:integer) : ogc:wktLiteral
Description
Returns the nth
geometry of geom
if geom
is a geometry collection or geom
if
geom
is a single geometry and n=1
.
Parameters
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns the second geometry in the input geometry collection.
SELECT g
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:geometryN("GEOMETRYCOLLECTION(POINT(-75 44), LINESTRING(-75 44, -75 45),
POLYGON((-75 44, -75 43, -74 43, -74 44, -75 44)))"^^ogc:wktLiteral, 2) AS ?g)
WHERE
{ }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.23 ogcf:geometryType
Format
ogcf:geometryType(geom : geomLiteral) : xsd:anyURI
Description
Returns the URI of the subtype of
<http://www.opengis.net/ont/sf#Geometry>
of which
geom
is a member. Possible return values are:
<http://www.opengis.net/ont/sf#Point>
<http://www.opengis.net/ont/sf#LineString>
<http://www.opengis.net/ont/sf#Polygon>
<http://www.opengis.net/ont/sf#GeometryCollection>
<http://www.opengis.net/ont/sf#MultiPoint>
<http://www.opengis.net/ont/sf#MultiLineString>
<http://www.opengis.net/ont/sf#MultiPolygon>
<http://www.opengis.net/ont/sf#Solid>
<http://www.opengis.net/ont/sf#MultiSolid>
<http://www.opengis.net/ont/sf#Unknown>
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns the geometry type of each U.S. Congressional district polygon.
SELECT cdist, gtype
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (ogcf:geometryType(?cgeom) AS ?gtype)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.24 ogcf:getSRID
Format
ogcf:getSRID(geom : geomLiteral) : xsd:anyURI
Description
Returns the spatial reference system URI for geom
.
Usage Notes
The URI returned has the form <http://www.opengis.net/def/crs/EPSG/0/{srid}>
, where {srid}
is a valid spatial reference system ID from the European Petroleum Survey Group (EPSG).
For URIs that are not in the EPSG Geodetic Parameter Dataset, the URI returned has the form <http://xmlns.oracle.com/rdf/geo/srid/{srid}>
, where {srid}
is a valid spatial reference system ID from Oracle Spatial and Graph.
For the default spatial reference system, WGS84 Longitude-Latitude, the URI <http://www.opengis.net/def/crs/OGC/1.3/CRS84>
is returned.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds spatial reference system URIs for U.S. Congressional district polygons.
SELECT csrid
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:getSRID(?cgeom) AS ?csrid)
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.25 ogcf:intersection
Format
ogcf:intersection (geom1 : geomLiteral, geom2 : geomLiteral) : ogc:wktLiteral
Description
Returns a geometry object that is the topological intersection (AND operation) of geom1
and geom2
.
Parameters
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the U.S. Congressional district polygons whose centroid is within the intersection of two specified polygons.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfWithin(orageo:centroid(?cgeom),
ogcf:intersection(
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral,
"Polygon((-83.2 34.3, -83.0 34.3, -83.0 34.5, -83.2 34.5, -83.2 34.3))"^^ogc:wktLiteral))) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.26 ogcf:is3D
Format
ogcf:is3D(geom : geomLiteral) : xsd:boolean
Description
Returns true
if the spatial dimension of geom is 3.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example checks to see if there are any 3-dimensional U.S. Congressional district polygons.
SELECT ask
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
ASK
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom
FILTER(ogcf:is3D(?cgeom)) }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.27 ogcf:isEmpty
Format
ogcf:isEmpty(geom : geomLiteral) : xsd:boolean
Description
Returns true
if geom
is an empty
geometry.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example checks to see if there are any empty U.S. Congressional district geometries.
SELECT ask
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
ASK
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom
FILTER(ogcf:isEmpty(?cgeom)) }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.28 ogcf:isMeasured
Format
ogcf:isMeasured(geom : geomLiteral) : xsd:boolean
Description
Returns true
if geom
has a measure value.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example checks to see if there are any U.S. Congressional district geometries with measure values.
SELECT ask
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
ASK
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom
FILTER(ogcf:isMeasured(?cgeom)) }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.29 ogcf:isSimple
Format
ogcf:isSimple(geom : geomLiteral) : xsd:boolean
Description
Returns true
if geom
is a simple geometry.
That is, the geometry has no inconsistent features such as self intersection, identical
consecutive vertices, and so on.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT is used to determine if a
geometry is simple. The geometry is simple if SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT returns
TRUE
.
See also the OGC GeoSPARQL specification.
Example
The following example returns any non-simple Congressional district geometries.
SELECT cdist, cgeom
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist ?cgeom
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom
FILTER(!ogcf:isSimple(?cgeom)) }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.30 ogcf:length
Format
ogcf:length(geom : geomLiteral, units : xsd:anyURI) : xsd:double
Description
Returns the length of the geom
. The length is the maximum
distance between any two points in the geom
.
Parameters
- geom
-
Geometry object. Specified as a query variable or a constant
geomLiteral
value. - units
-
Unit of measurement:
- A URI of the form
<http://xmlns.oracle.com/rdf/geo/uom/{SDO_UNIT}>
(for example,<http://xmlns.oracle.com/rdf/geo/uom/M>
). Any SDO_UNIT value from the MDSYS.SDO_DISTANCE_UNITS table will be recognized. See the section about Unit Of Measurement Support in Oracle Spatial Developer's Guide for more information about unit of measurement specification. - A URI from the QUDT vocabulary of units that has an equivalent unit in
MDSYS.SDO_DISTANCE_UNITS table. For example,
<http://qudt.org/vocab/unit/M>
for meter.
- A URI of the form
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the maximum length in meters of the longest U.S. Congressional district.
SELECT maxl
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (max(ogcf:length(?cgeom, <http://qudt.org/vocab/unit/M>)) AS ?maxl)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.31 ogcf:maxX
Format
ogcf:maxX(geom : geomLiteral) : xsd:double
Description
Returns the maximum X coordinate value for geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the maximum X coordinate value for each U.S. Congressional district.
SELECT cdist, maxX
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (ogcf:maxX(?cgeom) AS ?maxX)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.32 ogcf:maxY
Format
ogcf:maxY(geom : geomLiteral) : xsd:double
Description
Returns the maximum Y coordinate value for geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the maximum Y coordinate value for each U.S. Congressional district.
SELECT cdist, maxY
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (ogcf:maxY(?cgeom) AS ?maxY)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.33 ogcf:maxZ
Format
ogcf:maxZ(geom : geomLiteral) : xsd:double
Description
Returns the maximum Z coordinate value for geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the maximum Z coordinate value for a constant geometry.
SELECT maxZ
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:maxZ("<http://www.opengis.net/def/crs/EPSG/0/4327> POLYGON((-75 44 10, -75 43 11,
-74 43 11, -74 44 11, -75 44 10))"^^ogc:wktLiteral) AS ?maxZ)
WHERE
{ }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.34 ogcf:metricArea
Format
ogcf:metricArea(geom : geomLiteral) : xsd:double
Description
Returns the area of geom
in square meters.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the area in square meters for each U.S. Congressional district.
SELECT name, ma
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name (ogcf:metricArea(?cgeom) AS ?ma)
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.35 ogcf:metricBuffer
Format
ogcf:metricBuffer(geom : geomLiteral, radius : xsd:double) : ogc:wtkLiteral
Description
Returns a buffer polygon with the specified radius in meters around a geometry.
Parameters
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the U.S. Congressional district polygons that are within a 1000–meter buffer around a specified point.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (
ogcf:sfWithin(?cgeom,
ogcf:metricBuffer("POINT(-71.46444 42.7575)"^^ogc:wktLiteral,
1000)))
}'
,sem_models('gov_all_vm'), null
,null
,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.36 ogcf:metricLength
Format
ogcf:metricLength(geom : geomLiteral) : xsd:double
Description
Returns the length of geom
in meters. The length is the
maximum distance between any two points in geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the maximum length in meters of the longest U.S. Congressional district.
SELECT cdist, maxl
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (max(ogcf:metricLength(?cgeom)) AS ?maxl)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.37 ogcf:metricPerimeter
Format
ogcf:metricPerimeter(geom : geomLiteral) : xsd:double
Description
Returns the length of the outer boundary of geom
in
meters.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the maximum perimeter in meters across the set of U.S. Congressional districts.
SELECT cdist, maxp
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (max(ogcf:metricPerimeter(?cgeom)) AS ?maxp)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.38 ogcf:minX
Format
ogcf:minX(geom : geomLiteral) : xsd:double
Description
Returns the minimum X coordinate value for geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the minimum X coordinate value for each U.S. Congressional district.
SELECT cdist, minX
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (ogcf:minX(?cgeom) AS ?minX)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.39 ogcf:minY
Format
ogcf:minY(geom : geomLiteral) : xsd:double
Description
Returns the minimum Y coordinate value for geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the minimum Y coordinate value for each U.S. Congressional district.
SELECT cdist, minY
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (ogcf:minY(?cgeom) AS ?minY)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.40 ogcf:minZ
Format
ogcf:minZ(geom : geomLiteral) : xsd:double
Description
Returns the minimum Z coordinate value for geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the minimum Z coordinate value for a constant geometry.
SELECT minZ
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:minZ("<http://www.opengis.net/def/crs/EPSG/0/4327> POLYGON((-75 44 10, -75 43 11, -74 43 11,
-74 44 11, -75 44 10))"^^ogc:wktLiteral) AS ?minZ)
WHERE
{ }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.41 ogcf:numGeometries
Format
ogcf:numGeometries(geom : geomLiteral) : xsd:int
Description
Returns the number of geometries in geom
.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the number of geometries in a constant geometry collection.
SELECT ng
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (ogcf:numGeometries("GEOMETRYCOLLECTION(POINT(-75 44), LINESTRING(-75 44, -75 45), POLYGON((-75 44, -75 43, -74 43, -74 44, -75 44)))"^^ogc:wktLiteral) AS ?ng)
WHERE
{ }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.42 ogcf:perimeter
Format
ogcf:perimeter(geom : geomLiteral, units : xsd:anyURI) : xsd:double
Description
Returns the length of the outer boundary of geom
measured in
units
.
Parameters
- geom
-
Geometry object. Specified as a query variable or a constant
geomLiteral
value. - units
-
Unit of measurement:
- A URI of the form
<http://xmlns.oracle.com/rdf/geo/uom/{SDO_UNIT}>
(for example,<http://xmlns.oracle.com/rdf/geo/uom/M>
). Any SDO_UNIT value from the MDSYS.SDO_DISTANCE_UNITS table will be recognized. See the section about Unit Of Measurement Support in Oracle Spatial Developer's Guide for more information about unit of measurement specification. - A URI from the QUDT vocabulary of units that has an equivalent unit in
MDSYS.SDO_DISTANCE_UNITS table. For example,
<http://qudt.org/vocab/unit/M>
for meter.
- A URI of the form
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the maximum perimeter in meters across the set of U.S. Congressional districts.
SELECT maxp
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT (max(ogcf:perimeter(?cgeom, <http://qudt.org/vocab/unit/M>)) AS ?maxp)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.43 ogcf:relate
Format
ogcf:relate(geom1 : geomLiteral, geom2 : geomLiteral, pattern-matrix : xsd:string) : xsd:boolean
Description
Returns true
if the topological relationship between geom1
and geom2
satisfies the specified DE-9IM pattern-matrix. Returns false
otherwise.
Parameters
- geom1
-
Geometry object. Specified as a query variable or a constant
geomLiteral
value. - geom2
-
Geometry object. Specified as a query variable or a constant
geomLiteral
value. - pattern-matrix
-
A dimensionally extended 9-intersection model (DE-9IM) intersection pattern string consisting of
T
(true) andF
(false) values. A DE-9IM pattern string describes the intersections between the interiors, boundaries, and exteriors of two geometries.
Usage Notes
When invoking ogcf:relate
with a query variable and a constant geometry, always use the query variable as the first parameter and the constant geometry as the second parameter.
For best performance, geom1
should be a local variable (that is, a variable that appears in the basic graph pattern that contains the ogcf:relate
spatial filter).
It is recommended to use a LEADING(?var)
HINT0 hint when the query involves a restrictive ogcf:relate
spatial filter on ?var
.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See the OGC Simple Features Specification (OGC 06-103r3) for a detailed description of DE-9IM intersection patterns. See also the OGC GeoSPARQL specification.
Example
The following example finds the U.S. Congressional district that contains a specified point.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:relate(?cgeom,
"POINT(-71.46444 42.7575)"^^ogc:wktLiteral,
"TTTFFTFFT")) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '
));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.44 ogcf:sfContains
Format
ogcf:sfContains(geom1 : geomLiteral, geom2 : geomLiteral) : xsd:boolean
Description
Returns true
if geom1
spatially contains geom2
as defined by the OGC Simple Features specification (OGC 06-103r3). Returns false
otherwise.
Parameters
Usage Notes
When invoking this function with a query variable and a constant geometry, always use the query variable as the first parameter and the constant geometry as the second parameter.
For best performance, geom1
should be a local variable (that is, a variable that appears in the basic graph pattern that contains the ogcf:sfContains
spatial filter).
It is recommended to use a LEADING(?var)
HINT0 hint when the query involves a restrictive ogcf:sfContains
spatial filter on ?var
.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds U.S. Congressional district polygons that spatially contain a constant polygon.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfContains(?cgeom,
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.45 ogcf:sfCrosses
Format
ogcf:sfCrosses(geom1 : geomLiteral, geom2 : geomLiteral) : xsd:boolean
Description
Returns true
if geom1
spatially crosses geom2
as defined by the OGC Simple Features specification (OGC 06-103r3). Returns false
otherwise.
Parameters
Usage Notes
When invoking this function with a query variable and a constant geometry, always use the query variable as the first parameter and the constant geometry as the second parameter.
For best performance, geom1
should be a local variable (that is, a variable that appears in the basic graph pattern that contains the ogcf:sfCrosses
spatial filter).
It is recommended to use a LEADING(?var)
HINT0 hint when the query involves a restrictive ogcf:sfCrosses
spatial filter on ?var
.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds U.S. Congressional district polygons that spatially cross a constant polygon.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfCrosses(?cgeom,
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.46 ogcf:sfDisjoint
Format
ogcf:fDisjoint(geom1 : geomLiteral, geom2 : geomLiteral) : xsd:boolean
Description
Returns true
if the two geometries are spatially disjoint as defined by the OGC Simple Features specification (OGC 06-103r3). Returns false
otherwise.
Parameters
Usage Notes
The ogcf:sfDisjoint
filter cannot use a spatial index for evaluation, so performance will probably be much worse than with other simple features spatial functions.
See also the OGC GeoSPARQL specification.
Example
The following example finds U.S. Congressional district polygons that are spatially disjoint from a constant polygon.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfDisjoint(?cgeom,
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.47 ogcf:sfEquals
Format
ogcf:sfEquals(geom1 : geomLiteral, geom2 : geomLiteral) : xsd:boolean
Description
Returns true
if the two geometries are spatially equal as defined by the OGC Simple Features specification (OGC 06-103r3). Returns false
otherwise.
Parameters
Usage Notes
When invoking this function with a query variable and a constant geometry, always use the query variable as the first parameter and the constant geometry as the second parameter.
For best performance, geom1
should be a local variable (that is, a variable that appears in the basic graph pattern that contains the ogcf:sfEquals
spatial filter).
It is recommended to use a LEADING(?var)
HINT0 hint when the query involves a restrictive ogcf:sfEquals
spatial filter on ?var
.
See Spatial Support for information about representing , indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds U.S. Congressional district polygons that are spatially equal to a constant polygon.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfEquals(?cgeom,
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.48 ogcf:sfIntersects
Format
ogcf:sfIntersects(geom1 : geomLiteral, geom2 : geomLiteral) : xsd:boolean
Description
Returns true
if the two geometries are not disjoint as defined by the OGC Simple Features specification (OGC 06-103r3). Returns false
otherwise.
Parameters
Usage Notes
When invoking this function with a query variable and a constant geometry, always use the query variable as the first parameter and the constant geometry as the second parameter.
For best performance, geom1
should be a local variable (that is, a variable that appears in the basic graph pattern that contains the ogcf:sfIntersects
spatial filter).
It is recommended to use a LEADING(?var)
HINT0 hint when the query involves a restrictive ogcf:sfIntersects
spatial filter on ?var
.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds U.S. Congressional district polygons that intersect a constant polygon.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfIntersects(?cgeom,
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.49 ogcf:sfOverlaps
Format
ogcf:sfOverlaps(geom1 : geomLiteral, geom2 : geomLiteral) : xsd:boolean
Description
Returns true
if geom1
spatially overlaps geom2
as defined by the OGC Simple Features specification (OGC 06-103r3). Returns false
otherwise.
Parameters
Usage Notes
When invoking this function with a query variable and a constant geometry, always use the query variable as the first parameter and the constant geometry as the second parameter.
For best performance, geom1
should be a local variable (that is, a variable that appears in the basic graph pattern that contains the ogcf:sfOverlaps
spatial filter).
It is recommended to use a LEADING(?var)
HINT0 hint when the query involves a restrictive ogcf:sfOverlaps
spatial filter on ?var
.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds U.S. Congressional district polygons that spatially overlap a constant polygon.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfOverlaps(?cgeom,
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.50 ogcf:sfTouches
Format
ogcf:sfTouches(geom1 : geomLiteral, geom2 : geomLiteral) : xsd:boolean
Description
Returns true
if the two geometries spatially touch as defined by the OGC Simple Features specification (OGC 06-103r3). Returns false
otherwise.
Parameters
Usage Notes
When invoking this function with a query variable and a constant geometry, always use the query variable as the first parameter and the constant geometry as the second parameter.
For best performance, geom1
should be a local variable (that is, a variable that appears in the basic graph pattern that contains the ogcf:sfTouches
spatial filter).
It is recommended to use a LEADING(?var)
HINT0 hint when the query involves a restrictive ogcf:sfTouches
spatial filter on ?var
.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds U.S. Congressional district polygons that spatially touch a constant polygon.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfTouches(?cgeom,
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.51 ogcf:sfWithin
Format
ogcf:sfWithin(geom1 : geomLiteral, geom2 : geomLiteral) : xsd:boolean
Description
Returns true
if geom1
is spatially within geom2
as defined by the OGC Simple Features specification (OGC 06-103r3). Returns false
otherwise.
Parameters
Usage Notes
When invoking this function with a query variable and a constant geometry, always use the query variable as the first parameter and the constant geometry as the second parameter.
For best performance, geom1
should be a local variable (that is, a variable that appears in the basic graph pattern that contains the ogcf:sfWithin
spatial filter).
It is recommended to use a LEADING(?var)
HINT0 hint when the query involves a restrictive ogcf:sfWithin
spatial filter on ?var
.
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds U.S. Congressional district polygons that are spatially within a constant polygon.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ # HINT0={LEADING(?cgeom)}
?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfWithin(?cgeom,
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral)) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.52 ogcf:spatialDimension
Format
ogcf:spatialDimension(geom : geomLiteral) : xsd:integer
Description
Returns the spatial dimension of geom
. That is, the number of
dimensions used for the spatial coordinates of geom
. It does not include
any dimensions used for measure values.
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example returns the spatial dimension of each U.S. Congressional district polygon.
SELECT cdist, sd
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (ogcf:spatialDimension(?cgeom) AS ?sd)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.53 ogcf:symDifference
Format
ogcf:symDifference(geom1 : geomLiteral, geom2 : geomLiteral) : ogc:wktLiteral
Description
Returns a geometry object that is the topological symmetric difference (XOR operation) of geom1
and geom2
.
Parameters
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the U.S. Congressional district polygons that are within a 100-kilometer buffer around a specified point.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfWithin(orageo:centroid(?cgeom),
ogcf:symDifference(
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral,
"Polygon((-83.2 34.3, -83.0 34.3, -83.0 34.5, -83.2 34.5, -83.2 34.3))"^^ogc:wktLiteral))) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.54 ogcf:transform
Format
ogcf:transform(geom : geomLiteral, srsIRI xsd:anyURI) : ogc:wktLiteral
Description
Transforms geom
to the spatial reference system defined by
srsIRI.
Parameters
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Supported spatial reference system IRIs have the following form
<http://www.opengis.net/def/crs/EPSG/0/{srid}>
, where
{srid}
is a valid spatial reference system ID defined by the European
Petroleum Survey Group (EPSG). For IRIs that are not in the EPSG Geodetic Parameter Dataset,
spatial reference system IRIs of the following form are supported
<http://xmlns.oracle.com/rdf/geo/srid/{srid}>
, where
{srid}
is a valid spatial reference system ID from Oracle Spatial.
Example
The following example projects each Congressional distinct polygon to the NH state plane coordinate reference system (EPSG:3613).
SELECT cdist, nhg
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?cdist (ogcf:transform(?cgeom, <http://www.opengis.net/def/crs/EPSG/0/3613>) AS ?nhg)
WHERE
{ ?cdist orageo:hasExactGeometry ?cgeom }'
,sem_models('gov_all_vm'), null
, null ,null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support
B.1.55 ogcf:union
Format
ogcf:union(geom1 : geomLiteral, geom2 : geomLiteral) : ogc:wktLiteral
Description
Returns a geometry object that is the topological union (OR operation) of geom1
and geom2
.
Parameters
Usage Notes
See Spatial Support for information about representing, indexing, and querying spatial data in RDF.
See also the OGC GeoSPARQL specification.
Example
The following example finds the U.S. Congressional district polygons whose centroid is within the union of two specified polygons.
SELECT name, cdist
FROM table(sem_match(
'PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX ogcf: <http://www.opengis.net/def/function/geosparql/>
PREFIX orageo: <http://xmlns.oracle.com/rdf/geo/>
PREFIX pol: <http://www.rdfabout.com/rdf/schema/politico/>
PREFIX usgovt: <http://www.rdfabout.com/rdf/schema/usgovt/>
SELECT ?name ?cdist
WHERE
{ ?person usgovt:name ?name .
?person pol:hasRole ?role .
?role pol:forOffice ?office .
?office pol:represents ?cdist .
?cdist orageo:hasExactGeometry ?cgeom
FILTER (ogcf:sfWithin(orageo:centroid(?cgeom),
ogcf:union(
"Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^ogc:wktLiteral,
"Polygon((-83.2 34.3, -83.0 34.3, -83.0 34.5, -83.2 34.5, -83.2 34.3))"^^ogc:wktLiteral))) } '
,sem_models('gov_all_vm'), null
,null, null, null, ' ALLOW_DUP=T '));
Parent topic: GeoSPARQL Functions for Spatial Support