A core concept of GIS is answering questions about datasets. From the point of view of a database; SQL with spatial extensions is a way of asking such questions. What other ways can questions be expressed in a machine readable text based form? What are the benefits of different approaches?
I can only think of 3 types of spatial query, ignoring any attribute or hash based queries.
Spatial queries based on geometry, and are used to find the relationships between vector features. SQL spatial queries are really just an API low level alogorithms such as Bentley-Ottmann - used in OpenLayers to check if two lines intersect.
As Kirk mentioned the types of relationship between features have standardised on the dimensionally extended nine-intersection model:
- Touches (meets)
- Within (inside)
It can be argued that Spatial queries based on indexes are a simplified form of geometry queries. Most geometry queries use a spatial index as a first pass query to filter out irrelevant features before comparing individual geometries which is more time consuming. These are also implemented in NoSQL databases such as MongoDB.
- Spatial queries based on graph theory. These types of query are implemented in GIS through tools such as Network Analyst, and again at a low level are algorithms.
- Spatial queries based on raster grids and set theory (and fuzzy set theory).
There are a few implementations that combine the above, such as StarSpan that combines raster and vector queries - although it really hides a preprocessing step.
There are numerous APIs that implement these types of queries that are both machine and text readable. There's a good discussion on different implementations and their problems here.
The paper Towards a 3d Spatial Query Language breaks spatial operators into 4 types, based on the query rather than datatype (which perhaps makes more sense):
- directional operators (such as above, below, northOf, southOf)
- topological operators (such as touch, contain, equal, inside)
- metric operators (such as distance)
- Boolean operators (such as union, intersection)
It also brings in terminology to deal with 3d features (body and surface), which are not included in DE-I9M.
1 - There are some studies with this software: http://nlp.uned.es/MLQA06/papers/ferres.pdf
Despite it's more related to internet searches, it could provide some guidance on how to translate human language to computer language.
Googling 'GeoTALP-Q' also provides more articles on the subject.
2-GeoDjango provides an API for spatial queries, it's a translation from SQL to a Object Oriented language that can speed up a lot of tedious work like writing PL/python functions for complex spatial queries. It's limited by the database you use.