OGC 09-157, GeoSPARQL - A geographic query language for RDF data    (27Q9)

A proposal for an OGC Draft Candidate Standard    (27Q8)

Version: 1.0.0    (27HQ)

Editors: Matthew Perry and John Herring    (27Q6)

Copyright © 2009 Open Geospatial Consortium, Inc. All Rights Reserved. To obtain additional rights of use, visit http://www.opengeospatial.org/legal/. Warning This document is not an OGC Standard. It is distributed for review and comment. It is subject to change without notice and may not be referred to as an OGC Standard. Document type: OGC® Draft Candidate Standard Document subtype: Proposal Document stage: Draft Document language: English Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation. Contents Foreword viii Introduction ix 1 Scope 1 2 Conformance 1 3 Normative references 1 4 Terms and definitions 2 5 Conventions: 2 5.1 Symbols and abbreviated terms\ 2 5.2 XML namespaces 2 6 Properties and Predicates 4 6.1 Semantics 4 6.2 Features and Feature Properties as RDF Objects 4 6.2.1 Representation of Feature data as a queryable RDF graph 4 6.2.2 GML mechanisms (extended example) 6 6.3 Standard RDF Properties of Geometry 8 6.3.1 Semantics 8 6.3.2 RDF Property: ogc:asGML 8 6.3.3 RDF Property: ogc:dimension 9 6.3.4 RDF Property: ogc:coordinateDimension 9 6.3.5 RDF Property: ogc:spatialDimension 10 6.3.6 RDF Property: ogc:geometryType 10 6.3.7 RDF Property: ogc:srid 10 6.3.8 RDF Property: ogc:isEmpty 11 6.3.9 RDF Property: ogc:isSimple 11 6.3.10 RDF Property: ogc:is3D 11 6.3.11 RDF Property: ogc:isMeasured 12 6.3.12 RDF Property: ogc:envelope 12 6.3.13 RDF Property: ogc:boundary 12 6.4 Predicates: Simple Feature defined Spatial Relations 13 6.4.1 Requirements for Standard Binary Spatial Relations 13 6.4.2 Spatial Predicate: ogc:equals 13 6.4.3 Spatial Predicate: ogc:disjoint 14 6.4.4 Spatial Predicate: ogc:intersects 14 6.4.5 Spatial Predicate: ogc:touches 15 6.4.6 Spatial Predicate: ogc:crosses 15 6.4.7 Spatial Predicate: ogc:within 16 6.4.8 Spatial Predicate: ogc:contains 16 6.4.9 Spatial Predicate: ogc:overlaps 16 6.5 Predicates: RCC8 and Egenhofer defined Spatial Relations 17 6.5.1 Requirements for RCC8 and Egenhofer Spatial Relations 17 6.6 Domain-specific SPARQL Filter Functions 18 6.6.1 Filter Function: ogc:relate 18 6.6.2 Filter Function: ogc:distance 19 6.6.3 Filter Function: ogc:buffer 19 6.6.4 Filter Function: ogc:convexHull 19 6.6.5 Filter Function: ogc:intersection 19 6.6.6 Filter Function: ogc:union 19 6.6.7 Filter Function: ogc:difference 20 6.6.8 Filter Function: ogc:symDifference 20 6.6.9 Filter Function: ogc:locateAlong 20 6.6.10 Filter Function: ogc:locateBetween 20 6.7 OWL-based Spatial Reasoning 21 Bibliography 22    (27HS)

Table of Requirements    (27HT)

Req 1 When converting an application schema for a GFM dataset into an RDF representation, for each feature and for each object used as property values, a similarly named RDF class will be created in the RDF schema to be used for the SPARQL query language. 4 Req 2 In a queryable RDF graph, a feature shall be represented as a URI, to allow it to be used either as a subject or object with any predicate (property) 4    (27HU)

Req 3 In a queryable RDF graph, an attribute value shall be represented as a URI, a blank node or as a literal. Any attribute value that can also have properties represented in an RDF triple shall be represented as a URI. 4    (27HV)

Req 4 The URI used to represent a feature instance or property value in a queryable RDF graph shall be navigable to or convertible into the actual value of that data. 5    (27HW)

Req 5 When converting an application schema for a GFM dataset into an RDF representation, for each feature property, a similarly named RDF property or predicate shall be created in the RDF schema that can be used to link feature instances to the appropriate property value instances and used for the SPARQL query language. 5    (27HX)

Req 6 When converting an application schema for a GFM dataset into an RDF representation, for each feature to be used in a spatial query based on its geometry, the property containing the geometry that carries the source for the spatial Booleans will be subtyped from a primary geometry property in the common RDF schema. 5    (27HY)

Req 7 When applying a spatial predicate defined in this standard, to features with a geometry-valued property subclassed under the primary geometry property, the value of the predicate shall be equal to the value of the corresponding spatial predicate applied to the primary geometry. 5    (27HZ)

Req 8 When applying a spatial predicate defined in this standard to features without a primary geometry, the value of the predicate will be either stated directly by a RDF assertion or derivable as a logical consequence of other values of the spatial predicates. 5    (27I0)

Req 9 Logical derivation rules for a particular implementation of a SPARQL query engine shall be available to the users of that engine. 5    (27I1)

Req 10 The following RDF Properties shall be used directly in SPARQL triple patterns to retrieve information about instances of ogc:Geometry and to test for existence of binary spatial relations between instances of ogc:Geometry. 8    (27I2)

Req 11 The value of the ogc:geometryType shall be a URI. 10    (27I3)

Req 12 The value of the ogc:srid shall be a URI. 10    (27I4)

Req 13 For each spatial Boolean predicate in Simple Features, there will be a named external predicate function in the namespace ogcf that corresponds to that predicate. 13    (27I5)

Req 14 For each spatial Boolean external predicate function in ogcf, there shall be a similarly named RDF predicate to be used directly in SPARQL triple patterns to retrieve information about spatial relations between instances of features with primary geometries. 13    (27I6)

Req 15 For each spatial Boolean external predicate function in ogcf, the corresponding similarly named RDF predicate shall be available for use directly in SPARQL triple patterns to assert the same spatial relationship information about instances of features with or without primary geometries. 13    (27I7)

Req 16 For those features with a declared type with a declared primary geometry, the calculated spatial predicates and any asserted spatial predicates shall be maintained to be consistent. 13    (27I8)

i. Preface    (27I9)

This draft standard defines an enhanced query language based on SPARQL that uses an RDF (Resource Description Framework) representation for geographic information based on the General Feature Model (from ISO 19109) and spatial predicates consistent with the spatial schema (from ISO 19107), and query predicates for geometric and topological operators (from Simple Feature, or ISO 19125)    (27IA)

ii. Submitting organizations The following organizations submitted this Implementation Specification to the Open Geospatial Consortium Inc. as a Request For Comment (RFC): Oracle USA    (27IB)

iii. Submission contact points    (27IC)

All questions regarding this submission should be directed to the editor or the submitters:    (27ID)

==CONTACT COMPANY EMAIL==    (27IE)

John R. Herring Oracle USA john.herring@oracle.com Matthew Perry Oracle USA matthew.perry@oracle.com Xavier Lopez Oracle USA xavier.lopez@oracle.com    (27IF)

iv. Revision history Date Release Author Paragraph modified Description    (27IG)

 27 Oct. 2009	 Draft	 Matthew Perry	 Clause 6	  Technical Draft
 11 Nov. 09	 Draft	 John R. Herring	 All	 Creation    (27IH)

v. Changes to the OGC® Abstract Specification The OGC® Abstract Specification does not require changes to accommodate this OGC® standard.    (27II)

==Foreword==    (27IJ)

Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. Open Geospatial Consortium Inc. shall not be held responsible for identifying any or all such patent rights. However, to date, no such rights have been claimed or identified. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by any implementation of the specification set forth in this document, and to provide supporting documentation.    (27IK)

==THIS VERSION==    (27IL)

This version of the document is a general outline of the functionality that will act as a seed for a proposal team to be organized after the Mountain View meetings of the OGC (December 2009). It generally lays out the functionality of a geographically enabled SPARQL language that can be implemented using ARQ from the Jena project [9] using only SPARQL defined extension mechanisms.    (27IM)

Anyone interested in participating in such an endeavor is invited to contact Xavier Lopez of Oracle.    (27IN)

Technical comments from anyone may be sent to John Herring and Matthew Perry of Oracle.    (27IO)

==Introduction==    (27IP)

RDF (Resource Description Framework) is, among other things, a data model built on edge-node "graphs." Each link in a graph consists of three things (with many aliases depending on the mapping from other types of data models):    (27IQ)

1. Subject (start node, instance (OOPL), feature, blank node)    (27IR)

2. Predicate (verb, property, attribute, relation, member(OOPL), link, reference) 3. Object (value, end node, a Subject)    (27IS)

Any of the three values in a single triple can be represented via a URI (with an optional fragment identifier). Subjects and objects are called nodes and can be represented as a blank node (usually with a local identifier with no meaning). Objects can also be represented as a literal value. Note that the same node may play the role of a Subject in some edges, and the part of the Object in others. Almost all data can be presented or represented in RDF. In particular, it is an easy match to the (feature-instance-by-id, attribute, value) tuples of the General Feature Model, and for the relational model as (table primary key, column, value). Complex information can often be expressed as graphs, or lexically as list of triples using common identifiers for nodes used in common, having the same value or identifier.    (27IT)

From http://dbpedia.org/page/SPARQL: SPARQL is an RDF query language; its name is a recursive acronym that stands for SPARQL Protocol and RDF Query Language. It was standardized by the RDF Data Access Working Group (DAWG) of the World Wide Web Consortium, and is considered a key semantic web technology. On 15 January 2008, SPARQL became an official W3C Recommendation. SPARQL allows [a] query to consist of triple patterns, conjunctions, disjunctions, and optional patterns.    (27IU)

SPARQL queries work on RDF representations of data by finding patterns that match templates in the query, in effect finding information graphs in the RDF data based on the templates and filters (constraints on nodes) expressed in the query. This query template is represented in the SPARQL query by a set of parameterized “query variables” appearing in a sequence of RDF triples and filters. If the query processor finds a set of triples in the data (converted to an RDF graph in some predetermined standard manner) then the values that the “query variables” take on in those triples become a solution to the query request. The values of the variables are returned in the query result in a format based on the “SELECT” clause of the query (similar to SQL). In addition to predicates defined in this manner, the SPARQL query may contain filter functions that can be used to constrain the values of the nodes. Several mechanisms are available to extend filter functions to allow for predicates calculated directly on data values. The SPARQL specification [6] in section 11.6 (http://www.w3.org/TR/rdf-sparql-query/#extensionFunctions) describes the mechanism for invocation of such a filter function.    (27IV)

SPARQL queries may be prefixed with globally defined namespace prefixes. Spatial examples are given in the text of this draft candidate standard. This draft candidate standard takes SPARQL as it is defined by the W3C RDF DAWG, and extends it to deal with feature data as defined in GML or Simple Features. It will include at a minimum the functionality of the Simple Features for SQL or SQL/MM spatial operations.    (27IW)

==GeoSPARQL - A geographic query language for RDF data==    (27IX)

1 Scope    (27IY)

The purpose of this document is to define a spatial extension to the SPARQL query language for geographic information as defined in OGC.    (27IZ)

2 Conformance    (27J0)

Conformance with this specification shall be checked using all the relevant tests specified in Annex A (normative). The framework, concepts, and methodology for testing, and the criteria to be achieved to claim conformance are specified in ISO 19105: Geographic information — Conformance and Testing. There is only one conformance class for SPARQL as the language is not type specific. It should be consistent with any data store using a compliant geometry and feature model, similar to that used in Simple Features for SQL or GML.    (27J1)

==3 Normative references==    (27J2)

The following normative documents contain provisions that, through reference in this text, constitute provisions of this draft candidate standard. For dated references, subsequent amendments to, or revisions of, any of these publications do not apply. However, parties to agreements based on this draft candidate standard are encouraged to investigate the possibility of applying the most recent editions of the normative documents indicated below. For undated references, the latest edition of the normative document referred to applies.    (27J3)

[1] ISO 19109: Geographic information — Geomatics — Rules for application schemas [2] RDF/XML Syntax Specification (Revised), W3C Recommendation 10 February 2004. [3] RDF Semantics, W3C Recommendation, 10 February 2004 [4] Resource Description Framework (RDF): Concepts and Abstract Syntax, W3C Recommendation 10 February 2004 [5] RIF Overview, W3C Working Draft 1 October 2009 [6] SPARQL Query Language for RDF, W3C Recommendation 15 January 2008 [7] SWRL: A Semantic Web Rule Language Combining OWL and RuleML, W3C Member Submission 21 May 2004 [8] ISO 19107:2003 Geographic information — Geomatics — Spatial Schema    (27J4)

==4 Terms and definitions== For the purposes of this document, the terms and definitions given in any of the normative reverences and the following apply.    (27J5)

==5 Conventions: ==    (27J6)

5.1 Symbols and abbreviated terms\    (27J7)

In this draft candidate standard, the following common acronyms are used: RDF: Resource Description Framework SPARQL: SPARQL Protocol and RDF Query Language GML: Geography Markup Language GFM General Feature Model (as defined in ISO 19109) RCC Region Connection Calculus W3C: World Wide Web Consortium (http://www.w3.org/) WKT Well Known Text (as defined by Simple Features or ISO 1`9125) XML: eXtended Markup Language    (27J8)

5.2 XML namespaces    (27J9)

The following namespace prefixes are used throughout this document. ogc http://www.opengis.net/rdf — The OGC-wide data type and operators as RDF definitions including contributions from GML and Simple Features ogcf http://www.opengis.net/rdf/functions — The external function definitions – currently unsure of the syntax to use here – a issue for the SWG to decide rcc http://www.opengis.net/rdf/rcc — The OGC wide operators for the RCC (region connection calculus operators gml http://www.opengis.net/gml/3.2 gmlr http://www.opengis.net/gml/3.2/rdf - representation of the same schema in RDF, probably the result of a style sheet transformation of the above. xsd http://www.w3.org/2001/XMLSchema rdf http://www.w3.org/1999/02/22-rdf-syntax-ns rdfs http://www.w3.org/2000/01/rdf-schema my http://somewhere/ApplicationSchema — The application schema for the data, probably GML myrdf http://somewhere/ApplicationSchema/rdf - representation of the same schema in RDF, probably the result of a style sheet transformation of the above. This is the equivalent of having the following at the beginning of each query of the equivalent “xmlns” declarations in the heading of any “xml.” PREFIX ogc: <http://www.opengis.net/rdf#> PREFIX gml: <http://www.opengis.net/gml/3.2> PREFIX gmlr: <http://www.opengis.net/gml/3.2/rdf> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX my: <http://somewhere/ApplicationSchema> PREFIX myrdf: <http://somewhere/ApplicationSchema.rdf> The rdfs:Datatype ogc:GMLLiteral is used to indentify serialized GML elements in RDF and is defined as follows. <rdfs:Datatype rdf:about="http://www.opengis.net/rdf#GMLLiteral"> <rdfs:subClassOf rdf:resource= "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"/> <rdfs:label>GMLLiteral</rdfs:label> <rdfs:comment> The datatype of GML literal values. </rdfs:comment> </rdfs:Datatype> Each ogc:GMLLitteral will contain a complete GML element that represents either a feature instance or a property value instance. The use of GML as opposed to another serialization mechanism (such as GeoJSON) is not meant to preclude the use of any other mechanism for creating value expressions, but is a default assumption necessary to create the working prototypes that will be used to created implementations. Other variants of GeoSPARQL may settle on other serialization mechanisms.    (27JA)

==6 Properties and Predicates==    (27JB)

6.1 Semantics To use SPARQL on arbitrary geographic feature data sets as defined by OGC and ISO TC 211, a standard mechanism must be laid out to determine how RDF graph representations of those data sets will be constructed. This clause uses the GFM from ISO 19109, as used in GML, to specify the mechanism for how any ISO 19109 feature data set can be represented by an RDF graph. This RDF view of the data can be virtual.    (27JC)

6.2 Features and Feature Properties as RDF Objects    (27JD)

6.2.1 Representation of Feature data as a queryable RDF graph To use SPARQL to query feature data represented either in a GML file (or similar serialization) or in a datastore supporting the GFM, there are restriction as to how the representation in the graph can be made. Req 1 When converting an application schema for a GFM dataset into an RDF representation, for each feature and for each object used as property values, a similarly named RDF class will be created in the RDF schema to be used for the SPARQL query language. Req 2 In a queryable RDF graph, a feature shall be represented as a URI, to allow it to be used either as a subject or object with any predicate (property) Req 3 In a queryable RDF graph, an attribute value shall be represented as a URI, a blank node or as a literal. Any attribute value that can also have properties represented in an RDF triple shall be represented as a URI. Editor’s Note: It may be possible to use blank nodes for Features, but the general theory for object-oriented databases (to which XML datastore have a strong resemblance) usually requires all information to be rooted at a first-class object, i.e. one having an externally accessible and temporally persistent identity, in this case a URI. The literal value of an attribute should use either a simple type defined for XML schema, or a simple or complex type defined in a particular XML for the support of the GFM dataset. If this is the case, the literal of a complex type should be a character string of the XML element representing the value, and the literal for a simple type should be a character string as used in XML instance documents. If XML data sources are not used, then the literal representation should be a parseable character string as specified in an extension of this standard. NOTE Simple Features defines a WKT for geometry that could be used as such a parseable string. GeoJSON could also be used. Any profile or extension of GeoSPARQL should specify the type of serialization supported.    (27JE)

Req 4 The URI used to represent a feature instance or property value in a queryable RDF graph shall be navigable to or convertible into the actual value of that data. The navigation of the URI may be done using a standard HTTP protocol interpretation or it may be accomplished by a dataset specific register that maps the URIs to specific data instance values. Req 5 When converting an application schema for a GFM dataset into an RDF representation, for each feature property, a similarly named RDF property or predicate shall be created in the RDF schema that can be used to link feature instances to the appropriate property value instances and used for the SPARQL query language. Req 6 When converting an application schema for a GFM dataset into an RDF representation, for each feature to be used in a spatial query based on its geometry, the property containing the geometry that carries the source for the spatial Booleans will be subtyped from a primary geometry property in the common RDF schema. These mechanisms are illustrated in Figure 1. Req 7 When applying a spatial predicate defined in this standard, to features with a geometry-valued property subclassed under the primary geometry property, the value of the predicate shall be equal to the value of the corresponding spatial predicate applied to the primary geometry. It is possible that this requirement will map a GFM that uses single inheritance to one that uses multiple inheritance. This is not a problem because RDF as used in SPARQL has no restriction on inheritance. Req 8 When applying a spatial predicate defined in this standard to features without a primary geometry, the value of the predicate will be either stated directly by a RDF assertion or derivable as a logical consequence of other values of the spatial predicates. Req 9 Logical derivation rules for a particular implementation of a SPARQL query engine shall be available to the users of that engine.    (27JF)

Figure 1: RDF template for Feature-Property-Value This model is based on the General Feature Model defined in ISO 19109, and used in GML, ISO 19136. When converted to RDF graphs, a Feature (as a Subject) will have properties that have values. For example, suppose in the original application schema, we have my:Parcel feature with a geometry object valued property called my:extent which is represented spatially as a polygon. Then the RDF schema would include a myrdf:Parcel class for the subject, a myrdf:extent predicate for the property and a gmlr:Polygon class for the object as stated by the above requirements. The RDF graph representation of this information would then look like the graph in Figure 1: The parcel will be represented by a URI traceable back to the datastore source for that feature. Depending on the implementation, the polygon will be represented either by a parseable literal from which a geometry value can be derived (in this version, a GML literal), or by a URI traceable back to the datastore source value for the property instance.    (27JG)

6.2.2 GML mechanisms (extended example) When following the above requirements and using a GML data source, Features Objects acting in Subjects in an RDF triple will connect to Property Value Objects or literals using the predicates defined from the application schemas in which they are defined. It should be possible to create these RDF declarations using a style sheet directly from GML and the application schema. In doing so, there must first be the GML feature root class as follows: <rdfs:Class rdf:about= "http://www.opengis.net/gml/3.2#AbstractFeature"> <rdfs:isDefinedBy rdf:resource= "http://www.opengis.net/gml/3.2"/> <rdfs:label>Feature</rdfs:label> <rdfs:subClassOf rdf:resource= "http://www.w3.org/2000/01/rdf-schema#Resource"/> <rdfs:comment> The class featue, superclass of everything feature. </rdfs:comment> </rdfs:Class> Then from the Application Schema, the concrete classes for features will be defined as subclasses of Feature above. The example for Parcel here is a direct subtype, but any number of intermediary classes is acceptable. <rdfs:Class rdf:about="http://somewhere/ApplicationSchema#Parcel"> <rdfs:isDefinedBy rdf:resource= "http://somewhere/ApplicationSchema#"/> <rdfs:label>Parcel</rdfs:label> <rdfs:subClassOf rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractFeature"/> <rdfs:comment> A local application schema feature for parcels. </rdfs:comment> </rdfs:Class> All geometry objects eventually subtype from the GML root type Abstract Geometry. <rdfs:Class rdf:about= "http://www.opengis.net/gml/3.2#AbstractGeometry"> <rdfs:isDefinedBy rdf:resource= "http://www.opengis.net/gml/3.2"/> <rdfs:label>Geometry</rdfs:label> <rdfs:subClassOf rdf:resource= "http://www.w3.org/2000/01/rdf-schema#Resource"/> <rdfs:comment> The class geometry, superclass of all geometry. </rdfs:comment> </rdfs:Class> When using the gmlr:Geometry, the data representation used in this standard will be a GML literal, see Clause 6.3.2. Parallel to the subtyping in GML, all geometric objects will eventually be a specialization of abstract geometry. We will leave out the details, but will assume for our examples, that this has been completed in the preparation work. All geometric properties in GML subtype from the GML root type for geometric properties. <rdf:Property rdf:about= "http://www.opengis.net/gml/3.2#GeometryProperty"> <rdfs:isDefinedBy rdf:resource= "http://www.opengis.net/gml/3.2# "> <rdfs:label>GeometryProperty</rdfs:label> <rdfs:comment> </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractFeature"/> <rdfs:range rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> </rdf:Property> Stepping outside of GML for a moment, we need to select a primary geometry property for each feature class. RDF does not care about multiple inheritance, so we can create a non-GML property class and then insert it in wherever it is needed. <rdf:Property rdf:about= "http://www.opengis.net/rdf#PrimaryGeometry "> <rdfs:label>PrimaryGeometry</rdfs:label> <rdfs:comment> The geometry to be used in the spatial operations </rdfs:comment> <rdfs:subPropertyOf rdf:resource= "http://www.opengis.net/gml/3.2/RDF#GeometryProperty"/> </rdf:Property> For Parcel, we can assume that the primary geometry property is “extent.” Here, we include the inheritance from the GML Geometry Property. If the application schema contains a further classing hierarchy, then the second subproperty element below could be something from the application schema. <rdf:Property rdf:about= "http://somewhere/ApplicationSchema#extent "> <rdfs:label>extent</rdfs:label> <rdfs:comment> </rdfs:comment> <rdfs:subPropertyOf rdf:resource= "http://www.opengis.net/rdf#PrimaryGeometry"/> <rdfs:subPropertyOf rdf:resource= "http://www.opengis.net/gml/3.2/RDF#GeometryProperty"/> <rdfs:domain rdf:resource= "http://somewhere/ApplicationSchema#Parcel"/> <rdfs:range rdf:resource= "http://www.opengis.net/gml/3.2/RDF#Polygon"/> </rdf:Property> The inclusion of this property in the RDF schema used by GeoSPARQL, means that this geometry will be used whenever a spatial Boolean is implied by a rule.    (27JH)

6.3 Standard RDF Properties of Geometry 6.3.1 Semantics Req 10 The following RDF Properties shall be used directly in SPARQL triple patterns to retrieve information about instances of ogc:Geometry and to test for existence of binary spatial relations between instances of ogc:Geometry. These properties were originally defined in ISO 19107, and used in Simple Features and other OGC and ISO standards. In a RDF dataset, ogc:Geometry instance may be represented as blank nodes. 6.3.2 RDF Property: ogc:asGML Any geometry needs a literal representation that may be passed to an external function for calculations. For this standard, this will be a GML element (GMLLiteral) <rdf:Property rdf:about="http://www.opengis.net/rdf#asGML"> <rdfs:label>asGML</rdfs:label> <rdfs:comment> The GML serialization of this geometric object. </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.opengis.net/gml/3.2/RDF#GMLLiteral/> </rdf:Property> 6.3.3 RDF Property: ogc:dimension The dimension is topological dimension of this geometric object, which must be less than or equal to the coordinate dimension. In non-homogeneous collections, this will return the largest topological dimension of the contained objects. <rdf:Property rdf:about="http://www.opengis.net/rdf#dimension"> <rdfs:label>dimension</rdfs:label> <rdfs:comment> The topological dimension of this geometric object, which must be less than or equal to the coordinate dimension. In non-homogeneous collections, this will return the largest topological dimension of the contained objects. </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.w3.org/2001/XMLSchema#Integer"/> </rdf:Property> 6.3.4 RDF Property: ogc:coordinateDimension The coordinate dimension is dimension of direct position (coordinate tuples) used in the definition of this geometric object. <rdf:Property rdf:about= "http://www.opengis.net/rdf#coordinateDimension"> <rdfs:label>coordinateDimension</rdfs:label> <rdfs:comment> </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#Integer"/> </rdf:Property> 6.3.5 RDF Property: ogc:spatialDimension The spatial dimension is dimension of the spatial portion of the direct positions (coordinate tuples) used in the definition of this geometric object. If the direct positions do not carry a measure coordinate, this will be equal to the coordinate position. <rdf:Property rdf:about= "http://www.opengis.net/rdf#spatialDimension"> <rdfs:label>spatialDimension</rdfs:label> <rdfs:comment> </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.w3.org/2001/XMLSchema#Integer"/> </rdf:Property> 6.3.6 RDF Property: ogc:geometryType The geometry type is a URI representing the type of the geometry instance as defined in ISO 19107. Req 11 The value of the ogc:geometryType shall be a URI. The use of URI’s makes more sense than the normal character string in an RDF context. These values should be a simple OGC ontology based on the spatial schema class hierarchy for Geometry. <rdf:Property rdf:about="http://www.opengis.net/rdf#geometryType"> <rdfs:label>geometryType</rdfs:label> <rdfs:comment>The IRI of the instantiable subtype of ogc:Geometry of which this geometric object is an instantiable member.</rdfs:comment> <rdfs:domain rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> </rdf:Property> 6.3.7 RDF Property: ogc:srid The spatial reference identifier (srid) is a URI representing the spatial reference system used in the geometry instance Req 12 The value of the ogc:srid shall be a URI. The use of URI’s makes more sense than the normal character string in an RDF context. These values should be a simple ontology based on the coordinate reference system registry for the CRSs used. <rdf:Property rdf:about="http://www.opengis.net/rdf#srid"> <rdfs:label>srid</rdfs:label> <rdfs:comment> The Spatial Reference System ID for this geometric object. </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= " http://www.opengis.net/rdf#srid"/> </rdf:Property> 6.3.8 RDF Property: ogc:isEmpty The isEmpty Boolean will be set to TRUE, only if the geometry contains no points. The usual representation for this in GML is as an empty collection. <rdf:Property rdf:about="http://www.opengis.net/rdf#isEmpty"> <rdfs:label>isEmpty</rdfs:label> <rdfs:comment>(TRUE) if this geometric object is the empty Geometry. If true, then this geometric object represents the empty point set for the coordinate space.</rdfs:comment> <rdfs:domain rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#Boolean"/> </rdf:Property> 6.3.9 RDF Property: ogc:isSimple The isSimple Boolean will be set to TRUE, only if the geometry contains no self-intersections, with the possible exception of its boundary. <rdf:Property rdf:about="http://www.opengis.net/rdf#isSimple"> <rdfs:label>isSimple</rdfs:label> <rdfs:comment>(TRUE) if this geometric object has no anomalous geometric points, such as self intersection or self tangency.</rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.w3.org/2001/XMLSchema#Boolean"/> </rdf:Property> 6.3.10 RDF Property: ogc:is3D The is3D Boolean will be set to TRUE, only if the geometry uses three spatial dimensions. This would have to be consistent with the srid, which would have to reference three spatial dimensions. <rdf:Property rdf:about="http://www.opengis.net/rdf#is3D"> <rdfs:label>is3D</rdfs:label> <rdfs:comment>(TRUE) if this geometric object has z coordinate values.</rdfs:comment> <rdfs:domain rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#Boolean"/> </rdf:Property> 6.3.11 RDF Property: ogc:isMeasured The isMeasured Boolean will be set to TRUE, only if the geometry uses an extra measure coordinate offset in addition to the spatial dimensions. The measure coordinate “m” would be most likely be associated to some type of linear reference system associated to the feature. <rdf:Property rdf:about="http://www.opengis.net/rdf#isMeasured"> <rdfs:label>isMeasured</rdfs:label> <rdfs:comment>(TRUE) if this geometric object has m coordinate values. </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.w3.org/2001/XMLSchema#Boolean"/> </rdf:Property> 6.3.12 RDF Property: ogc:envelope The ogc:envelope property will be a GMLLiteral representing the minimum bounding rectangle of the geometry. <rdf:Property rdf:about="http://www.opengis.net/rdf#envelope"> <rdfs:label>envelope</rdfs:label> <rdfs:comment> The GML serialization of the minimum bounding box for this Geometry. The polygon is defined by the corner points of the bounding box [(MINX, MINY), (MAXX, MINY), (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)]. Minimums for Z and M may be added. The simplest representation of an Envelope is as two direct positions, one containing all the minimums, and another all the maximums. In some cases, this coordinate will be outside the range of validity for the Spatial Reference System. </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.opengis.net/rdf#GMLLiteral"/> </rdf:Property> 6.3.13 RDF Property: ogc:boundary The ogc:boundary property will be a GMLLiteral representing the boundary of the geometry. <rdf:Property rdf:about="http://www.opengis.net/rdf#boundary"> <rdfs:label>boundary</rdfs:label> <rdfs:comment>The GML serialization of the closure of the combinatorial boundary of this geometric object.</rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.opengis.net/rdf#GMLLiteral"/> </rdf:Property> 6.4 Predicates: Simple Feature defined Spatial Relations 6.4.1 Requirements for Standard Binary Spatial Relations Req 13 For each spatial Boolean predicate in Simple Features, there will be a named external predicate function in the namespace ogcf that corresponds to that predicate. Req 14 For each spatial Boolean external predicate function in ogcf, there shall be a similarly named RDF predicate to be used directly in SPARQL triple patterns to retrieve information about spatial relations between instances of features with primary geometries. Req 15 For each spatial Boolean external predicate function in ogcf, the corresponding similarly named RDF predicate shall be available for use directly in SPARQL triple patterns to assert the same spatial relationship information about instances of features with or without primary geometries. Req 16 For those features with a declared type with a declared primary geometry, the calculated spatial predicates and any asserted spatial predicates shall be maintained to be consistent. The definition mechanism for these spatial operators is defined in ISO 19107, and specific operators are defined in Simple Features and other OGC and ISO standards using that mechanism (and the relate operator from Simple Features). These predicates can be interpreted as derived from the geometry instance values or they can be specified directly for features as RDF triples. So given a proper base for the URIs the following would be valid: 6.4.2 Spatial Predicate: ogc:equals The Boolean predicate ogc:equals is defined by the following: <rdf:Property rdf:about="http://www.opengis.net/rdf#equals"> <rdfs:label>equals</rdfs:label> <rdfs:comment>Exists if the subject ogc:Geometry spatially equals the object ogc:Geometry. </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> </rdf:Property> The linkage between geometry and features requires the following "rules:" Forall ?g1 ?g2 ?g1GML ?g2GML ( ?g1[ogc:equals->?g2] :- And ( ?g1[ogc:asGML->?g1GML] ?g2[ogc:asGML->?g2GML] External (ogcf:equals(?g1GML, ?g2GML)) ) )    (27JI)

Forall ?f1 ?f2 ?g1 ?g2 ( ?f1[ogc:equals->?f2] :- And ( ?f1[ogc:PrimaryGeometry->?g1] ?f2[ogc:PrimaryGeometry->?g2] ?g1[ogc:equals->?g2]) ) ) This pattern of rules that link the geometry “relation” to the geometry function of the same name; and of the feature “relation” to the geometry “relation” will be repeated for each of the spatial predicates. 6.4.3 Spatial Predicate: ogc:disjoint The Boolean predicate ogc:disjoint is defined by the following: <rdf:Property rdf:about="http://www.opengis.net/rdf#disjoint"> <rdfs:label>disjoint</rdfs:label> <rdfs:comment>Exists if the subject ogc:Geometry is spatially disjoint from the object ogc:Geometry. </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> </rdf:Property> 6.4.4 Spatial Predicate: ogc:intersects The Boolean predicate ogc:intersects is defined by the following: <rdf:Property rdf:about="http://www.opengis.net/rdf#intersects"> <rdfs:label>intersects</rdfs:label> <rdfs:comment>Exists if the subject ogc:Geometry spatially intersects the object ogc:Geometry. </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> </rdf:Property> 6.4.5 Spatial Predicate: ogc:touches The Boolean predicate ogc:touches is defined by the following: <rdf:Property rdf:about="http://www.opengis.net/rdf#touches"> <rdfs:label>touches</rdfs:label> <rdfs:comment>Exists if the subject ogc:Geometry spatially touches the object ogc:Geometry. </rdfs:comment> <rdfs:domain rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource= "http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> </rdf:Property> Examples “touches”: Find all land parcels with some type of commercial zoning that touch some arterial street. SELECT ?parcel ?hwy WHERE { ?parcel rdf:type my:CommercialParcel . ?hwy rdf:type my:Street . ?parcel ogc:touches ?hwy } 6.4.6 Spatial Predicate: ogc:crosses The Boolean predicate ogc:crosses is defined by the following: <rdf:Property rdf:about="http://www.opengis.net/rdf#crosses"> <rdfs:label>crosses</rdfs:label> <rdfs:comment>Exists if the subject ogc:Geometry spatially crosses the object ogc:Geometry. </rdfs:comment> <rdfs:domain rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> </rdf:Property> 6.4.7 Spatial Predicate: ogc:within The Boolean predicate ogc:within is defined by the following: <rdf:Property rdf:about="http://www.opengis.net/rdf#within"> <rdfs:label>within</rdfs:label> <rdfs:comment>Exists if the subject ogc:Geometry is spatially within the object ogc:Geometry. </rdfs:comment> <rdfs:domain rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> </rdf:Property> 6.4.8 Spatial Predicate: ogc:contains The Boolean predicate ogc:contains is defined by the following: <rdf:Property rdf:about="http://www.opengis.net/rdf#contains"> <rdfs:label>contains</rdfs:label> <rdfs:comment>Exists if the subject ogc:Geometry spatially contains the object ogc:Geometry. </rdfs:comment> <rdfs:domain rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> </rdf:Property> 6.4.9 Spatial Predicate: ogc:overlaps The Boolean predicate ogc:overlaps is defined by the following: <rdf:Property rdf:about="http://www.opengis.net/rdf#overlaps"> <rdfs:label>overlaps</rdfs:label> <rdfs:comment>Exists if the subject ogc:Geometry spatially overlaps the object ogc:Geometry. </rdfs:comment> <rdfs:domain rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> <rdfs:range rdf:resource="http://www.opengis.net/gml/3.2/RDF#AbstractGeometry"/> </rdf:Property> 6.5 Predicates: RCC8 and Egenhofer defined Spatial Relations 6.5.1 Requirements for RCC8 and Egenhofer Spatial Relations The Region Connection Calculus (RCC-8), see [13] and [10], and the original Egenhofer operators, see [11] and [12], both define the same set of eight operators based on the distinct operations on Regions in 2-space. Since they can be implemented using the same relate function defined for the Simple feature predicates (and are in fact equal to some of them) there is no additional work in including them in the SPARQL language. Since may of the alternatives SPARQL dialects The list below is the Egenhofer mask, the RCC-name and the Egenhofer-name for the "basic 8." Table 1 -- RCC and Egenhofer original eight operators RCC Short Name RCC Long Name Egenhofer Name Mask in Relate for non-empty regions DC disconnected disjoint FFTFFTTTT EC externally connected meet FFTFTTTTT PO partially overlapping overlap TTTTTTTTT TPP tangential proper part coveredBy TFFTTFTTT TPPi tangential proper part inverse covers TTTFTTFFT NTPP non-tangential proper part inside TFFTFFTTT NTPPi non-tangential proper part inverse contains TTTFFTFFT EQ equal equal TFFFTFFFT    (27JJ)

Figure 2 -- RCC 8 (from Wikipedia [14]) Table 2 -- RCC and Egenhofer operator names RCC Short Name RCC Long Name Egenhofer Name ogc Namespace rcc Namespace DC disconnected disjoint ogc:disjoint rcc:dc EC externally connected meet ogc:meets rcc:ec PO partially overlapping overlap ogc:overlaps rcc:po TPP tangential proper part coveredBy ogc:coveredBy rcc:tpp TPPi tangential proper part inverse covers ogc:covers rcc:tppi NTPP non-tangential proper part inside ogc:inside rcc:ntpp NTPPi non-tangential proper part inverse contains ogc:contains rcc:ntppi EQ equal equal ogc:equals rcc:eq 6.6 Domain-specific SPARQL Filter Functions 6.6.1 Filter Function: ogc:relate This document defines this and the following SPARQL filter functions for expressing spatial queries. These functions can be used in the FILTER clause of a SPARQL query. ogcf:relate (geom1: ogc:GMLLiteral, geom2: ogc: GMLLiteral matrix: xsd:String): xsd:Boolean Returns TRUE if geom1 is spatially related to geom2 by testing for intersections between the interior, boundary and exterior of the two geometric objects as specified by the values in the matrix. Otherwise, this returns FALSE. Note This function uses DE-9IM intersection pattern from Simple Features instead of relation names. If the names can be associated to default constant masks, then the text would be easier to read by the users. 6.6.2 Filter Function: ogc:distance ogcf:distance ( geom1: ogc:GMLLiteral, geom2: ogc:GMLLiteral): xsd:Double Returns the shortest distance between any two Points in the two geometric objects as calculated in the spatial reference system of geom1. 6.6.3 Filter Function: ogc:buffer ogcf:buffer ( geom: ogc:GMLLiteral,    (27JK)

	radius: xsd:real): ogc:GMLLiteral    (27JL)

This function returns a geometric object that represents all Points whose distance from geom1 is less than or equal to the distance. Calculations are in the spatial reference system of geom1. Because of the limitations of interpolation, there will often be some relatively small error in the ogcf:buffer distance, but it should be as near the resolution of the coordinates used.    (27JM)

6.6.4 Filter Function: ogc:convexHull ogcf:convexHull ( geom1: ogc:GMLLiteral,    (27JN)

							geom2: ogc:GMLLiteral): ogc:GMLLiteral    (27JO)

This function returns a geometric object that represents all Points in the convex hull of geom1. 6.6.5 Filter Function: ogc:intersection ogcf:intersection ( geom1: ogc:GMLLiteral,    (27JP)

								geom2: ogc:GMLLiteral): ogc:GMLLiteral    (27JQ)

This function returns a geometric object that represents all Points in the intersection of geom1 with geom2. 6.6.6 Filter Function: ogc:union ogcf:union ( geom1: ogc:GMLLiteral,    (27JR)

					geom2: ogc:GMLLiteral): ogc:GMLLiteral    (27JS)

This function returns a geometric object that represents all Points in the union of geom1 with geom2.    (27JT)

6.6.7 Filter Function: ogc:difference ogcf:difference ( geom1: ogc:GMLLiteral,    (27JU)

							geom2: ogc:GMLLiteral): ogc:GMLLiteral    (27JV)

This function returns a geometric object that represents all Points in the set difference of geom1 with geom2 6.6.8 Filter Function: ogc:symDifference ogcf:symDifference ( geom1: ogc:GMLLiteral,    (27JW)

									geom2: ogc:GMLLiteral): ogc:GMLLiteral    (27JX)

This function returns a geometric object that represents all Points in the symmetric difference of geom1 with geom2    (27JY)

6.6.9 Filter Function: ogc:locateAlong ogcF:locateAlong ( geom: ogc:GMLLiteral,    (27JZ)

								m: 	xsd:Double): ogc:GMLLiteral    (27K0)

This function returns a geometric object that represents any Point matches the specified m coordinate value. If the point is unique, the return value is an ogc:Point. 6.6.10 Filter Function: ogc:locateBetween ogcf:locateBetween ( geom: ogc:GMLLiteral,    (27K1)

									mStart: xsd:Double,
									mEnd: 	xsd:Double):	ogc:GMLLiteral    (27K2)

This function returns a geometric object that represents the specified range of m measure values inclusively.    (27K3)

6.7 OWL-based Spatial Reasoning The following OWL assertions hold to aid in reasoning based on explicitly stated spatial relations [list may not be complete]: ogc:equals rdf:type owl:TransitiveProperty ogc:equals rdf:type owl:SymmetricProperty ogc:equals rdf:type owl:ReflexiveProperty ogc:touches rdf:type owl:SymmetricProperty ogc:contains rdf:type owl:TransitiveProperty ogc:within rdf:type owl:TransitiveProperty ogc:disjoint owl:inverseOf ogc:intersects ogc:contains owl:inverseOf ogc:within ogc:overlaps rdfs:subPropertyOf ogc:intersects ogc:crosses rdfs:subPropertyOf ogc:intersects ogc:contains rdfs:subPropertyOf ogc:intersects ogc:within rdfs:subPropertyOf ogc:intersects    (27K4)

==Bibliography== [9] ARQ - A SPARQL Processor for Jena, available at http://jena.sourceforge.net/ARQ/. [10] Cohn, Anthony G., Brandon Bennett, John Gooday, Nicholas Mark Gotts: Qualitative Spatial Representation and Reasoning with the Region Connection Calculus. GeoInformatica, 1, 275–316, 1997. [11] Egenhofer Max, A Formal Definition of Binary Topological Relationships, Third International Conference on Foundations of Data Organization and Algorithms (FODO), Paris, France, W. Litwin and H. Schek (eds.), Lecture Notes in Computer Science, Vol. 367, Springer-Verlag, pp. 457-472, June 1989. available at http://www.spatial.maine.edu/~max/RC2.html [12] Egenhofer, Max and J. Herring Categorizing Binary Topological Relations Between Regions, Lines, and Points in Geographic Databases, Technical Report, Department of Surveying Engineering, University of Maine, 1990. (revised versions in NCGIA Technical Report 91-7 and NCGIA Technical Report 94-1) [13] Randell, D. A., Cui, Z. and Cohn, A. G.: A spatial logic based on regions and connection, Proc. 3rd Int. Conf. on Knowledge Representation and Reasoning, Morgan Kaufmann, San Mateo, pp. 165–176, 1992. [14] Wikipedia, Region Connected Calculus, http://en.wikipedia.org/wiki/Region_connection_calculus    (27K5)