Skip Headers
Oracle® Database Semantic Technologies Developer's Guide
11g Release 2 (11.2)

E25609-05
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

B SEM_MATCH Support for Spatial Queries

This appendix provides reference information for SPARQL extension functions for performing spatial queries in SEM_MATCH. To use these functions, you must understand the concepts explained in Section 1.6.6, "Spatial Support".

This appendix includes the following functions:


orageo:area

Format

orageo:area(geom1 : orageo:WKTLiteral, unit : Literal) : xsd:decimal

Description

Returns the area of geom1 in terms of the specified unit of measure.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

unit

Unit of measurement: a quoted string with an SDO_UNIT value from the MDSYS.SDO_DIST_UNITS table (for example, "unit=SQ_KM"). See the section about unit of measurement support in Oracle Spatial Developer's Guide for more information about unit of measurement specification.

Usage Notes

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_AREA function in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional district polygons with areas greater than 10,000 square kilometers.

SELECT name, cdist
FROM table(sem_match(
'{ ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:area(?cgeom, "unit=SQ_KM") > 10000) }'
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:buffer

Format

orageo:buffer(geom1 : orageo:WKTLiteral, distance : xsd:decimal, unit : Literal) : orageo:WKTLiteral

Description

Returns a buffer polygon at a specified distance around or inside a geometry.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

distance

Distance value. Distance value. If the value is positive, the buffer is generated around geom1; if the value is negative (valid only for polygons), the buffer is generated inside geom1.

unit

Unit of measurement: a quoted string with an SDO_UNIT value from the MDSYS.SDO_DIST_UNITS table (for example, "unit=KM"). See the section about unit of measurement support in Oracle Spatial Developer's Guide for more information about unit of measurement specification.

Usage Notes

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_BUFFER function in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional district polygons that are completely inside a 100 kilometer buffer around a specified point.

SELECT name, cdist
FROM table(sem_match(
'{ # HINT0={LEADING(?cgeom)}
   ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (
     orageo:relate(?cgeom, 
       orageo:buffer("POINT(-71.46444 42.7575)"^^orageo:WKTLiteral,
                     100, "unit=KM"),
      "mask=inside")) }'
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:centroid

Format

orageo:centroid(geom1 : orageo:WKTLiteral) : orageo:WKTLiteral

Description

Returns a point geometry that is the centroid of geom1. (The centroid is also known as the "center of gravity.")

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

Usage Notes

For an input geometry consisting of multiple objects, the result is weighted by the area of each polygon in the geometry objects. If the geometry objects are a mixture of polygons and points, the points are not used in the calculation of the centroid. If the geometry objects are all points, the points have equal weight.

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_CENTROID function in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional district polygons with centroids within 200 kilometers of a specified point.

SELECT name, cdist
FROM table(sem_match(
'{ ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:withinDistance(orageo:centroid(?cgeom), 
      "POINT(-71.46444 42.7575)"^^orageo:WKTLiteral,
      "distance=200 unit=KM")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:convexHull

Format

orageo:convexHull(geom1 : orageo:WKTLiteral) : orageo:WKTLiteral

Description

Returns a polygon-type object that represents the convex hull of geom1. (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.)

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

Usage Notes

A convex hull is a convenient way to get an approximation of a complex geometry object.

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_CONVEX_HULL function in Oracle Spatial Developer's Guide.

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(
'{ ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:relate(orageo:convexHull(?cgeom), 
      "POINT(-71.46444 42.7575)"^^orageo:WKTLiteral,
      "mask=contains")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:difference

Format

orageo:difference(geom1 : orageo:WKTLiteral, geom2 : orageo:WKTLiteral) : orageo:WKTLiteral

Description

Returns a geometry object that is the topological difference (MINUS operation) of geom1 and geom2.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

geom2

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

Usage Notes

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_UNION function in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional district polygons whose centroid is inside the difference of two specified polygons.

SELECT name, cdist
FROM table(sem_match(
'{ ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:relate(orageo:centroid(?cgeom), 
      orageo:difference("Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, 
                         -83.6 34.5, -83.6 34.1))"^^orageo:WKTLiteral,
                        "Polygon((-83.2 34.3, -83.0 34.3, -83.0 34.5, 
                         -83.2 34.5, -83.2 34.3))"^^orageo:WKTLiteral),
      "mask=inside")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:distance

Format

orageo:distance(geom1 : orageo:WKTLiteral, geom2 : orageo:WKTLiteral, unit : Literal) : xsd:decimal

Description

Returns the distance between the nearest pair of points or segments of geom1 and geom2 in terms of the specified unit of measure.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

geom2

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

unit

Unit of measurement: a quoted string with an SDO_UNIT value from the MDSYS.SDO_DIST_UNITS table (for example, "unit=KM"). See the section about unit of measurement support in Oracle Spatial Developer's Guide for more information about unit of measurement specification.

Usage Notes

Use orageo:withinDistance instead of orageo:distance whenever possible, because orageo:withinDistance has a more efficient index-based implementation.

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_DISTANCE function in Oracle Spatial Developer's Guide.

Example

The following example finds the ten nearest U.S. Congressional districts to a specified point and orders them by distance from the point.

SELECT name, cdist
FROM table(sem_match(
'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 (orageo:nearestNeighbor(?cgeom, 
      "POINT(-71.46444 42.7575)"^^orageo:WKTLiteral,
      "sdo_num_res=10")) }
 ORDER BY ASC(orageo:distance(?cgeom,
                "POINT(-71.46444 42.7575)"^^orageo:WKTLiteral,
                "unit=KM"))'
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '))
ORDER BY sem$rownum;

orageo:intersection

Format

orageo:intersection(geom1 : orageo:WKTLiteral, geom2 : orageo:WKTLiteral) : orageo:WKTLiteral

Description

Returns a geometry object that is the topological intersection (AND operation) of geom1 and geom2.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

geom2

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

Usage Notes

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_INTERSECTION function in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional district polygons whose centroid is inside the intersection of two specified polygons.

SELECT name, cdist
FROM table(sem_match(
'{ ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:relate(orageo:centroid(?cgeom), 
      orageo:intersection("Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, 
                           -83.6 34.5, -83.6 34.1))"^^orageo:WKTLiteral,
                          "Polygon((-83.2 34.3, -83.0 34.3, -83.0 34.5, 
                           -83.2 34.5, -83.2 34.3))"^^orageo:WKTLiteral),
      "mask=inside")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:length

Format

orageo:length(geom1 : orageo:WKTLiteral, unit : Literal) : xsd:decimal

Description

Returns the length or perimeter of geom1 in terms of the specified unit of measure.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

unit

Unit of measurement: a quoted string with an SDO_UNIT value from the MDSYS.SDO_DIST_UNITS table (for example, "unit=KM"). See the section about unit of measurement support in Oracle Spatial Developer's Guide for more information about unit of measurement specification.

Usage Notes

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_LENGTH function in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional district polygons with lengths (perimeters) greater than 1000 kilometers.

SELECT name, cdist
FROM table(sem_match(
'{ ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:legnth(?cgeom, "unit=KM") > 1000) }'
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:mbr

Format

orageo:mbr(geom1 : orageo:WKTLiteral) : orageo:WKTLiteral

Description

Returns the minimum bounding rectangle of geom1, that is, the single rectangle that minimally encloses geom1.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

Usage Notes

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_MBR function in Oracle Spatial Developer's Guide.

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(
'{ ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:relate(orageo:mbr(?cgeom), 
      "POINT(-71.46444 42.7575)"^^orageo:WKTLiteral,
      "mask=contains")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:nearestNeighbor

Format

orageo:nearestNeighbor(geom1: orageo:WKTLiteral, geom2 : orageo:WKTLiteral, param : Literal) : xsd:boolean

Description

Returns true if geom1 is a nearest neighbor of geom2, where the size of the nearest neighbors set is specified by param; returns false otherwise.

Parameters

geom1

Geometry object. Specified as a query variable.

geom2

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

param

Determines the behavior of the operator. See the Usage Notes for the available keyword-value pairs.

Usage Notes

In the param parameter, the available keyword-value pairs are:

  • distance=n specifies the maximum allowable distance for the nearest neighbor search.

  • sdo_num_res=n specifies the size of the set for the nearest neighbor search.

  • unit=unit specifies the unit of measurement to use with distance value. If you do not specify a value, the unit of measurement associated with the data is used.

geom1 must be a local variable (that is, a variable that appears in the basic graph pattern that contains the orageo:nearestNeighbor spatial filter).

It is a good idea to use a 'LEADING(?var)' HINT0 hint when your query involves a restrictive orageo:relate spatial filter on ?var.

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_NN operator in Oracle Spatial Developer's Guide.

Example

The following example finds the ten nearest U.S. Congressional districts to a specified point.

SELECT name, cdist
FROM table(sem_match(
'{ # HINT0={LEADING(?cgeom)}
   ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:nearestNeighbor(?cgeom, 
      "POINT(-71.46444 42.7575)"^^orageo:WKTLiteral,
      "sdo_num_res=10")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:relate

Format

orageo:relate(geom1: orageo:WKTLiteral, geom2 : orageo:WKTLiteral, param : Literal) : xsd:boolean

Description

Returns true if geom1 and geom2 satisfy the topological spatial relation specified by the param parameter; returns false otherwise.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

geom2

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

param

Specifies a list of mask relationships to check. See the list of keywords in the Usage Notes.

Usage Notes

The following param values (mask relationships) can be tested:

  • ANYINTERACT: Returns TRUE if the objects are not disjoint.

  • CONTAINS: Returns CONTAINS if the second object is entirely within the first object and the object boundaries do not touch; otherwise, returns FALSE.

  • COVEREDBY: Returns COVEREDBY if the first object is entirely within the second object and the object boundaries touch at one or more points; otherwise, returns FALSE.

  • COVERS: Returns COVERS if the second object is entirely within the first object and the boundaries touch in one or more places; otherwise, returns FALSE.

  • DISJOINT: Returns DISJOINT if the objects have no common boundary or interior points; otherwise, returns FALSE.

  • EQUAL: Returns EQUAL if the objects share every point of their boundaries and interior, including any holes in the objects; otherwise, returns FALSE.

  • INSIDE: Returns INSIDE if the first object is entirely within the second object and the object boundaries do not touch; otherwise, returns FALSE.

  • ON: Returns ON if the boundary and interior of a line (the first object) is completely on the boundary of a polygon (the second object); otherwise, returns FALSE.

  • OVERLAPBDYDISJOINT: Returns OVERLAPBDYDISJOINT if the objects overlap, but their boundaries do not interact; otherwise, returns FALSE.

  • OVERLAPBDYINTERSECT: Returns OVERLAPBDYINTERSECT if the objects overlap, and their boundaries intersect in one or more places; otherwise, returns FALSE.

  • TOUCH: Returns TOUCH if the two objects share a common boundary point, but no interior points; otherwise, returns FALSE.

Values for param can be combined using the logical Boolean operator OR. For example, 'INSIDE + TOUCH' returns INSIDE+TOUCH if the relationship between the geometries is INSIDE or TOUCH or both INSIDE and TOUCH; it returns FALSE if the relationship between the geometries is neither INSIDE nor TOUCH.

When invoking orageo: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 orageo:relate spatial filter).

It is a good idea to use a 'LEADING(?var)' HINT0 hint when your query involves a restrictive orageo:relate spatial filter on ?var.

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_RELATE operator in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional district that contains a specified point.

SELECT name, cdist
FROM table(sem_match(
'{ # HINT0={LEADING(?cgeom)}
   ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:relate(?cgeom, 
      "POINT(-71.46444 42.7575)"^^orageo:WKTLiteral,
      "mask=contains")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '
));

orageo:union

Format

orageo:union(geom1 : orageo:WKTLiteral, geom2 : orageo:WKTLiteral) : orageo:WKTLiteral

Description

Returns a geometry object that is the topological union (OR operation) of geom1 and geom2.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

geom2

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

Usage Notes

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_UN ION function in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional district polygons whose centroid is inside the union of two specified polygons.

SELECT name, cdist
FROM table(sem_match(
'{ ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:relate(orageo:centroid(?cgeom), 
      orageo:union("Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, 
                    -83.6 34.5, -83.6 34.1))"^^orageo:WKTLiteral,
                   "Polygon((-83.2 34.3, -83.0 34.3, -83.0 34.5, 
                    -83.2 34.5, -83.2 34.3))"^^orageo:WKTLiteral),
      "mask=inside")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:withinDistance

Format

orageo:withinDistance(geom1 : orageo:WKTLiteral, geom2 : orageo:WKTLiteral, distance : xsd:decimal, unit : Literal) : xsd:boolean

Description

Returns true if the distance between geom1 and geom2 is less than or equal to distance when measured in unit; returns false otherwise.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

geom2

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

distance

Distance value.

unit

Unit of measurement: a quoted string with an SDO_UNIT value from the MDSYS.SDO_DIST_UNITS table (for example, "unit=KM"). See the section about unit of measurement support in Oracle Spatial Developer's Guide for more information about unit of measurement specification.

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 orageo:withinDistance spatial filter).

It is a good idea to use a 'LEADING(?var)' HINT0 hint when your query involves a restrictive orageo:withinDistance spatial filter on ?var.

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_WITHIN_DISTANCE operator in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional districts that are within 100 kilometers of a specified point.

SELECT name, cdist
FROM table(sem_match(
'{ # HINT0={LEADING(?cgeom)}
   ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:withinDistance(?cgeom, 
      "POINT(-71.46444 42.7575)"^^orageo:WKTLiteral,
      100, "KM")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));

orageo:xor

Format

orageo:xor(geom1 : orageo:WKTLiteral, geom2 : orageo:WKTLiteral) : orageo:WKTLiteral

Description

Returns a geometry object that is the topological symmetric difference (XOR operation) of geom1 and geom2.

Parameters

geom1

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

geom2

Geometry object. Specified as a query variable or a constant orageo:WKTLiteral value.

Usage Notes

See Section 1.6.6 for information about representing , indexing, and querying spatial data in RDF.

See also the SDO_GEOM.SDO_XOR function in Oracle Spatial Developer's Guide.

Example

The following example finds the U.S. Congressional district polygons whose centroid is inside the symmetric difference of two specified polygons.

SELECT name, cdist
FROM table(sem_match(
'{ ?person usgovt:name ?name .
   ?person pol:hasRole ?role .
   ?role pol:forOffice ?office .
   ?office pol:represents ?cdist .
   ?cdist orageo:hasExactGeometry ?cgeom 
   FILTER (orageo:relate(orageo:centroid(?cgeom), 
      orageo:xor("Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, 
                  -83.6 34.5, -83.6 34.1))"^^orageo:WKTLiteral,
                 "Polygon((-83.2 34.3, -83.0 34.3, -83.0 34.5, 
                  -83.2 34.5, -83.2 34.3))"^^orageo:WKTLiteral),
      "mask=inside")) } '
,sem_models('gov_all_vm'), null, 
,sem_aliases(
   sem_alias('usgovt','http://www.rdfabout.com/rdf/schema/usgovt/'),
   sem_alias('pol','http://www.rdfabout.com/rdf/schema/politico/'))
,null, null, null, ' ALLOW_DUP=T '));