220 likes | 248 Views
Spatial SQL: A Query and Presentation Language. Max J. Egenhofer (Presenter: Yi-Shin Chen). Outline. Introduction Spatial query language Guidelines for an SQL Extension Requirements for Spatial Query Languages Separating retrieval and display instructions Spatial SQL
E N D
Spatial SQL: A Query and Presentation Language Max J. Egenhofer (Presenter: Yi-Shin Chen)
Outline • Introduction • Spatial query language • Guidelines for an SQL Extension • Requirements for Spatial Query Languages • Separating retrieval and display instructions • Spatial SQL • Spatial domain, operations, data definition, selecting by pointing • GPL • Display Mode, variables, scale, window, context, content • Conclusion
Introduction • The need for spatial query language • Geographic Information System (GIS), Image Database, Remote Sensing • Existing query languages are insufficient • Only address the particular properties of lexical data • Treat spatial data as integers and strings • Spatial Data have additional properties • Geometry • Graphical presentation
Example SELECT ImageName FROM S_Images WHERE RECTANGLE(-77.748125, 38.695 , -77.348125 , 39.095) OVERLAPS area Query Result : image4/W775647N389000.jpg image4/W775644N388927.jpg image4/W775644N388855.jpg image4/W775641N388783.jpg image4/W775555N389000.jpg image4/W775552N388927.jpg image4/W775550N388855.jpg image4/W775547N388783.jpg image4/W775463N389002.jpg image4/W775461N388930.jpg image4/W775458N388858.jpg image4/W775455N388786.jpg
Introduction -II • Extending an existing language with spatial concepts • Reason: spatial databases contain both spatial and non-spatial data that will be the subject of user queries SQL + Spatial Concepts = Spatial SQL
Guidelines for an SQL Extension • SELECT-FROM-WHERE clause should keep • Three categories of queries • Exclusively about spatial properties • About non-spatial properties • Combine spatial and non-spatial properties • Should allow the user to pose non-spatial queries appropriately • SELECT-FROM-WHERE is already complex enough to use
Separating Retrieval and Display Instructions • User expectations • Pose several queries in a raw • Only modify the graphical parameter of objects • Integration of a full display description into the query language would make each user query unnecessarily complex and long • Retrieval language -> Spatial SQL • Presentation language -> GPL
Spatial Domain • Provides a higher level abstraction of data • Four spatial domains: • Spatial_0, Spatial_1, Spatial_2, Spatial_3 • Spatial relationships refer to spatial concepts such as topology and metric • Only the specified spatial operations and relationships apply to spatial attributes
Spatial Data Definition • In general, a spatial relation will have exactly one spatial attribute CREATE TABLE city (name char(100) geometry spatial_2); • Spatial SQL does not prevent from defining several spatial attributes for a object CREATE TABLE ocean (name char(100) geometry spatial_2 generalized_geometry spatial_0);
Spatial Operations – part one • Functions upon a spatial attribute • Dimension, boundary, interior, bounding-Nodes, bounding-Edges, interior-Nodes, interior-Areas SELECT boundary (geometry) FROM city WHERE name = “Los Angeles” • Deal with arithmetic operations • Length, area, volume, perimeter, extreme coordinates, complement, convex hull SELECT area (geometry) FROM city WHERE name = “Los Angeles”
Spatial Operations – part two • Binary spatial operations • Distance, direction, angle, minimum, average • Prefix formulation [Distance(city.geometry, highway.geometry)] SELECT city.name FROM city, ocean WHERE distance (city.geometry, ocean.geometry) < 100KM • Binary topologies relationships • Disjoint, meet, overlap, covers, inside, contains, equal, left/right, north/south, over/under SELECT city.name FROM city, ocean WHERE city.geometry MEET ocean.geometry
Selection by Pointing • Interactive communication with drawing is enabled with the PICK qualifier which allows users to formulate queries. SELECT name FROM city WHERE geometry=PICK • Ambiguities in the selection may exist • User will be offered the possible choices and then asked to identify the target
GPL • The concept of the display environment • The query result is rendered according the display description • Offers instructions to SET or CANCEL a graphic specification (can be qualified with PERMANENT) SET MODE highlight • With IMMEDIATELY to update the current display prior to asking the next query SET IMMEDIATELY COLOR red
Display Mode • Six display mode • Conventional alphanumeric display • NEW: starting a new drawing ex. SET MODE new; • OVERLAY: adding the result onto a existing drawing • REMOVE: erasing the result from a drawing • INTERSECT: determining the common objects on the display and in the query result • HIGHLIGHT: emphasizing the result • Non-spatial attributes in the SELECT clause will be represented as label
Visual Variables • Graphic attributes can be specified for either an entire spatial relation or instances of spatial relations SET LEGEND COLOR black PATTERN dashed • User can check the current setting by “looking at the legend” • This part of GPL depends upon the user’s hardware
Scale and Window • The scale of the graphical presentation can be described with the command SET SCALE SET SCALE n (representing a scale factor of 1:n) • The window describing the area to be displayed can be described with SET WINDOW • The window can be determined by • two pairs of coordinates • the minimal bounding rectangle from the result SET WINDOW SELECT geometry FROM road WHERE town.name = “Orono”;
Context • The interpretation of graphical presentation is extremely depend on the context and environment • GPL allows the user to define spatial relation with SET CONTEXT as graphical context which is during query processing merged with the actual user query SET CONTEXT FOR road.geometry SELECT building.geometry, road.name FROM road.parcel, building;
Content • A needed control mechanism with which user may examine the content of a drawing • The content is the logical combination of queries the result of which were combined with OVERLAY and REMOVE • Content is only observable (cannot SET or MODIFY) SHOW Content
Appendix • Conventional Spatial Database • Geodetic DataBlade Module http://examples.informix.com/frameset.html#top?initial_page=/doc/case_studies/datablade/geo/geoLOC.html • NCR Teradata Object Relational Database (TOR) • Oracle Spatial • ESRI Spatial Database Engine (SDE) • systems like Oracle, Microsoft SQL Server, Sybase, IBM DB2, and Informix