Modeling geographic data Temporal Databases

Slides:



Advertisements
Similar presentations
1 DATA STRUCTURES USED IN SPATIAL DATA MINING. 2 What is Spatial data ? broadly be defined as data which covers multidimensional points, lines, rectangles,
Advertisements

The Role of Error Map and attribute data errors are the data producer's responsibility, GIS user must understand error. Accuracy and precision of map and.
Jan. 2014Dr. Yangjun Chen ACS Outline Spatial Databases -Theme -Map -Geographic objects -Modeling geographic data Temporal Databases - Transaction.
Multidimensional Indexing
Multidimensional Data Rtrees Bitmap indexes. R-Trees For “regions” (typically rectangles) but can represent points. Supports NN, “where­am­I” queries.
1 Enviromatics Spatial database systems Spatial database systems Вонр. проф. д-р Александар Маркоски Технички факултет – Битола 2008 год.
Image Indexing and Retrieval using Moment Invariants Imran Ahmad School of Computer Science University of Windsor – Canada.
Multidimensional Data. Many applications of databases are "geographic" = 2­dimensional data. Others involve large numbers of dimensions. Example: data.
COMP 451/651 B-Trees Size and Lookup Chapter 1.
Jan. 2013Dr. Yangjun Chen ACS Outline Signature Files - Signature for attribute values - Signature for records - Searching a signature file Signature.
2-dimensional indexing structure
Geodatabases by Shawn J. Dorsch Spatial Databases Part 2.
Return to Outline Copyright © 2009 by Maribeth H. Price 6-1 Chapter 6 Spatial Joins.
Spatial Information Systems (SIS) COMP Spatial queries and operations.
West Hills College Farm of the Future. West Hills College Farm of the Future Where are you NOW?! Precision Agriculture – Lesson 3.
Multiple-key indexes Index on one attribute provides pointer to an index on the other. If V is a value of the first attribute, then the index we reach.
PROCESS IN DATA SYSTEMS PLANNING DATA INPUT DATA STORAGE DATA ANALYSIS DATA OUTPUT ACTIVITIES USER NEEDS.
Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008.
19 th Advanced Summer School in Regional Science An introduction to GIS using ArcGIS.
COMP 451/651 Multiple-key indexes
R-Trees 2-dimensional indexing structure. R-trees 2-dimensional version of the B-tree: B-tree of maximum degree 8; degree between 3 and 8 Internal nodes.
GTECH 201 Lecture 03 Data measurements Data errors.
Spatial and temporal data management Nothing puzzles me more than time and space; and yet nothing troubles me less, as I never think about them Charles.
Spatial and temporal data management Nothing puzzles me more than time and space; and yet nothing troubles me less, as I never think about them Charles.
Oracle Data Definition Language (DDL)
Module 3: Table Selection
Spatial Database Souhad Daraghma.
Spatial Data Management Chapter 28. Types of Spatial Data Point Data –Points in a multidimensional space E.g., Raster data such as satellite imagery,
Introduction to SQL Steve Perry
Chapter 3 Digital Representation of Geographic Data.
Tables tables are rows (across) and columns (down) common format in spreadsheets multiple tables linked together create a relational database entity equals.
1 Spatial Data Models and Structure. 2 Part 1: Basic Geographic Concepts Real world -> Digital Environment –GIS data represent a simplified view of physical.
CS 338The Relational Model2-1 The Relational Model Lecture Topics Overview of SQL Underlying relational model Relational database structure SQL DDL and.
A Quick Introduction to GIS
Benjamin Post Cole Kelleher.  Availability  Data must maintain a specified level of availability to the users  Performance  Database requests must.
Cartography Developing a Spatial Perspective. Developing spatial awareness F Two interconnected concepts of objects and measurements. F Use objects to.
Experience with XML Schema Ashok Malhotra Schema Usage  Mapping XML Schema and XML documents controlled by the Schema to object classes and instances.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Spatial and temporal data management Nothing puzzles me more than time and space; and yet nothing troubles me less, as I never think about them Charles.
Copyright © 2014 Pearson Canada Inc. 5-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5a Database Design Part 2: Using Information Technology.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
N5 Databases Notes Information Systems Design & Development: Structures and links.
Geog. 314 Working with tables.
Spatial Data Management
Database System Architecture and Implementation
Microsoft Office Access 2010 Lab 2
Chapter 4 Attribute Data.
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Information Systems Today: Managing in the Digital World
Spatial Database Systems
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
RELATIONAL DATABASE MODEL
Translation of ER-diagram into Relational Schema
Spatial Data Models Raster uses individual cells in a matrix, or grid, format to represent real world entities Vector uses coordinates to store the shape.
Databases and Information Management
ORACLE SQL Developer & SQLPLUS Statements
What is a Database and Why Use One?
CPSC-310 Database Systems
Database.
ISU-GIS Training and Research Center
SQL LANGUAGE and Relational Data Model TUTORIAL
Spatial and temporal data management
Database Systems Instructor Name: Lecture-3.
Databases and Information Management
Foreign key (FK) is defined as follows:
Database Design and Programming
Information System Analysis
CPSC-608 Database Systems
Databases and Information Management
Donghui Zhang, Tian Xia Northeastern University
Presentation transcript:

Modeling geographic data Temporal Databases Outline Spatial Databases Theme Map Geographic objects Modeling geographic data Temporal Databases - Transaction time, valid time - Anchored time, instance, interval - Modeling temporal data Jan. 2018 Dr. Yangjun Chen ACS-4902

Spatial data management - A spatial database is a data management system for the collection, storage, manipulation and output of spatially referenced information. Theme: refers to data describing a particular topic (e.g., scenic lookouts, rivers, cities) and is the spatial counterpart of an entity type. When a theme is presented on a screen or paper, it is commonly seen in conjunction with a map. Color may be used to indicate different themes (e.g., blue for rivers and black for roads). - Map: A map will usually have a scale, legend, and possibly some explanatory text. Jan. 2018 Dr. Yangjun Chen ACS-4902

Spatial data management Geographic objects: A geographic object is an instance of a theme (e.g., a river). attributes spatial components: geometry and topology Geometry refers to the location-based data: shape, length Topology refers to spatial relationships among objects: adjacency Jan. 2018 Dr. Yangjun Chen ACS-4902

Spatial data management Data type for spatial elements: points, lines and regions Data type Dimensions Example Point Scenic lookout Line 1 River Region 2 County Jan. 2018 Dr. Yangjun Chen ACS-4902

A database for political units: unitName unitCode unit-population boundId boundPath 1 n political-unit has boundary 1 contains A boundary is represented by an ordered set of line segments (a path). m cityName city cityLocation Example: Canada has a boundary for the continental portion, and each of its sovereign islands, such as Prince Edward Island. Jan. 2018 Dr. Yangjun Chen ACS-4902

Map a geographic data model to tables: Geometric data type in PostgreSQL: Geometric type BOX CIRCLE LINE LSEG PATH POINT POLYGON Representation ((x1, y1), (x2, y2)) <(x, y), r> [(x1, y1), (x2, y2)] ((x1, y1), …) [(x1, y1), …] (x, y) Description Rectangular box Circle (center and radius) Infinite line Finite line segment Closed path (similar to polygon) Open path Point in space Polygon (similar to closed path) Jan. 2018 Dr. Yangjun Chen ACS-4902

Map a geographic data model to tables: Table definition for Political unit data model: CREATE TABLE political_unit ( unitname VARCHAR(30) NOT NULL, unitcode CHAR(2), unitpop DECIMAL(6, 2), PRIMARY KEY (unitcode)); CREATE TABLE boundary ( boundid INTEGER, boundpath PATH NOT NULL, PRIMARY KEY (boundid), CONSTRAINT fk_boundary_polunit FOREIGN KEY (unitcode) REFERENCES political_unit); CREATE TABLE city ( cityname VARCHAR(30), cityloc POINT NOT NULL, PRIMARY KEY (unitcode, cityname), CONSTRAINT fk_city_polunit FOREIGN KEY (unitcode) REFERENCES political_unit); Jan. 2018 Dr. Yangjun Chen ACS-4902

Northern Ireland Republic of Ireland Londonderry Belfast Sligo Galway Dublin Republic of Ireland Limerick Tipperary Cork Jan. 2018 Dr. Yangjun Chen ACS-4902

Insert statements for populating database INSERT INTO political_unit VALUES (‘Republic of Ireland’, ‘ie’, 3.9); INSERT INTO political_unit VALUES (‘Northern Ireland’, ‘ni’, 1.7); INSERT INTO boundary VALUES (1, ‘[(9, 8), (9, 3), (4, 1), (2, 2), (1, 3), (3, 5), (3, 6), (2, 6), (2, 9), (5, 9), (5, 10), (6, 11), (7, 11), (7, 10), (6, 9), (7, 8), (7, 9), (8, 9), (8, 8), (9, 8)]’, ‘ie’); (2, ‘[(7, 11), (9, 11), (10, 9), (10, 8), (8, 8), (8, 9), (7, 9), (7, 8), (6, 9), (7, 10), (7, 11)]’, ‘ni’); INSERT INTO city VALUES (‘Dublin’, ‘(9, 6)’, ‘ie’); INSERT INTO city VALUES (‘Cork’, ‘(5, 2)’, ‘ie’); INSERT INTO city VALUES (‘Limerick’, ‘(4, 4)’, ‘ie’); INSERT INTO city VALUES (‘Galway’, ‘(4, 6)’, ‘ie’); INSERT INTO city VALUES (‘Sligo’, ‘(9, 6)’, ‘ie’); INSERT INTO city VALUES (‘Tipperary’, ‘(5, 3)’, ‘ie’); INSERT INTO city VALUES (‘Belfast’, ‘(9, 9)’, ‘ni’); INSERT INTO city VALUES (‘Londonderry’, ‘(7, 10)’, ‘ni’); Jan. 2018 Dr. Yangjun Chen ACS-4902

Geometric functions and operators in PostgreSQL for processing spatial data Functions: Function Returns double precision integer Description length of item Number of points LENGTH(OBJECT) NPOINTS(PATH) Operators: Operator Description <-> Distance between << Is left of? <^ Is below? >> Is right of? >^ Is above? Jan. 2018 Dr. Yangjun Chen ACS-4902

What is the length of the Republic of Ireland border? Queries: What is the length of the Republic of Ireland border? SELECT SUM(LENGTH(boundpath)) * 37.5 AS “Border (kms)” FROM Political_unit, boundary WHERE unitname = “Republic of Ireland” AND political_unit.unitcode = boundary.unitcode; Border (kms) 1353.99 Jan. 2018 Dr. Yangjun Chen ACS-4902

2. How far, as the crow flies, is it from Sligo to Dublin? Queries: 2. How far, as the crow flies, is it from Sligo to Dublin? SELECT (orig.cityloc<->dest.cityloc) * 37.5 AS “Distance (kms)” FROM city orig, city dest WHERE orig.cityname = ‘Sligo’ AND dest.cityname = ‘Dublin’; Distance (kms) 167.71 Jan. 2018 Dr. Yangjun Chen ACS-4902

3. What is the closest city to Limerick? Queries: 3. What is the closest city to Limerick? SELECT dest.cityname FROM city orig, city dest WHERE orig.cityname = ‘Limerick’ AND orig.cityloc <-> dest.cityloc = (SELECT MIN(orig1.cityloc<->dest1.cityloc) FROM city orig1, city dest1 WHERE orig1.cityname = ‘Limerick’ AND dest1.cityname <> ‘Limerick’); cityname Tipperary Jan. 2018 Dr. Yangjun Chen ACS-4902

4. What is the westernmost city? SELECT west.cityname FROM city west Queries: 4. What is the westernmost city? SELECT west.cityname FROM city west WHERE NOT EXISTS (SELECT * FROM city other WHERE other.cityloc << west.cityloc); cityname Limerick Galway Jan. 2018 Dr. Yangjun Chen ACS-4902

5. What is the westernmost city in the Republic of Ireland? Queries: 5. What is the westernmost city in the Republic of Ireland? SELECT west.cityname FROM city west, political_unit p WHERE west.unitcode = p.unitcode and p.unitname = ‘Republic of Ireland’ and NOT EXISTS (SELECT * FROM city other WHERE other.cityloc << west.cityloc and other.unitcode = p.unitcode and other.unitname = ‘Republic of Ireland’) cityname Limerick Galway Jan. 2018 Jan. 2014 Dr. Yangjun Chen ACS-4902 Dr. Yangjun Chen ACS-4902 15

6. What is the westernmost city in the Northern Ireland? Queries: 6. What is the westernmost city in the Northern Ireland? SELECT west.cityname FROM city west, political_unit p WHERE west.unitcode = p.unitcode and p.unitname = ‘Northern Ireland’ and NOT EXISTS (SELECT * FROM city other WHERE other.cityloc << west.cityloc and other.unitcode = p.unitcode and other.unitname = ‘Northern Ireland’) cityname Londonderry Jan. 2018 Dr. Yangjun Chen ACS-4902

7. What is the westernmost city in Ireland? Queries: 7. What is the westernmost city in Ireland? SELECT west.cityname FROM city west, political_unit p WHERE west.unitcode = p.unitcode and (p.unitname = ‘Republic of Ireland’ or p.unitname =‘Northern Ireland’) and NOT EXISTS (SELECT * FROM city other WHERE other.cityloc << west.cityloc) and other.unitcode = p.unitcode and (other.unitname = ‘Republic of Ireland’ or other.unitname = ‘Northern Ireland’) cityname Limerick Galway Jan. 2018 Dr. Yangjun Chen ACS-4902

A B-tree, often used to store data in one-dimensional database, R-tree: A B-tree, often used to store data in one-dimensional database, can be extended to n dimensions, where n  2. An R-tree is the extension of a B-tree. Each internal node of an R-tree is a tuple of the following form: p1, v1, p2, v2, …, pm-1, vm-1, pm where pi (i = 1, …, m) is a pointer and vj (j = 1, …, m -1) is a pair: <(x1, y1), (x2, y2)>, where x1 and y1 are the coordinates of the lower-left corner of the minimum boundary rectangle, the smallest possible rectangle enclosing an object; and x2 and y2 are for the upper-right corner. Jan. 2018 Dr. Yangjun Chen ACS-4902

R-tree: A D B E C Y X … X Y A B C D E data file Jan. 2018 Dr. Yangjun Chen ACS-4902

How is an R-tree used to accelerate searching? Using a mouse, a user could outline a region on a map displayed on a screen. The minimum bounding rectangle for this region would then be calculated and the coordinates used to locate geographic objects falling within the minimum boundary, which would be used to search the R-tree along a path. Jan. 2018 Dr. Yangjun Chen ACS-4902

Suppose that the local cellular phone company adds a POP (point of presence, or base station) at the position shown below. 100 school POP house1 house2 road1 road2 pipeline Jan. 2018 Dr. Yangjun Chen ACS-4902

R-trees ((0, 0), (60, 50)) ((20, 20), (100, 80)) road1 road2 house1 school POP road1 house2 house1 pipeline road2 100 ((0, 0), (60, 50)) ((20, 20), (100, 80)) road1 road2 house1 school house2 pipeline pop Records for geographic objects Jan. 2018 Dr. Yangjun Chen ACS-4902

Insert a new region r into an R-tree. 100 school POP road1 house2 house1 pipeline ((70, 5), (95, 15)) road2 house3 100 Jan. 2018 Dr. Yangjun Chen ACS-4902

Insert a new region r into an R-tree. Search the R-tree, starting at the root. If the encountered node is internal, find a subregion into which r fits. If there is more than one such region, pick one and go to its corresponding child. If there is no subregion that contains r, choose any subregion such that it needs to be expanded as little as possible to contain r. ((70, 5), (95, 15)) ((0, 0), (60, 50)) ((20, 20), (100, 80)) road1 road2 house1 school house2 pipeline pop Jan. 2018 Dr. Yangjun Chen ACS-4902

If we expand the lower subregion, corresponding to the first Two choices: If we expand the lower subregion, corresponding to the first leaf, then we add 1000 square units to the region. If we extend the other subregion by lowering its bottom by 5 units, then we add 1200 square units. ((0, 0), (95, 50)) ((20, 20), (100, 80)) Road1 road2 house1 house3 school house2 pipeline pop Jan. 2018 Dr. Yangjun Chen ACS-4902

Insert a new region r into an R-tree. If the encountered node v is a leaf, insert r into it. If there is no room for r, split the leaf into two and distribute all subregions in them as evenly as possible. Calculate the ‘parent’ regions for the new leaf nodes and insert them into v’s parent. If there is the room at v’s parent, we are done. Otherwise, we recursively split nodes going up the tree. Add POP (point of presence, or base station) Suppose that each leaf has room for 6 regions. ((0, 0), (100, 100)) road1 road2 house1 school house2 pipeline Jan. 2018 Dr. Yangjun Chen ACS-4902

Split the leaf into two and distribute all the regions evenly. Calculate two new regions each covering a leaf. ((0, 0), (60, 50)) ((20, 20), (100, 80)) road1 road2 house1 school house2 pipeline pop Jan. 2018 Dr. Yangjun Chen ACS-4902

Managing temporal data - With a temporal database, stored data have an associated time period indicating when the item was valid or stored in the database. Transaction time: the timestamp applied by the system when data are entered and cannot be changed by an application. It can be applied to a particular item or row. For example, the old and new price of a product would automatically have separate timestamps when they are entered into the database. Jan. 2018 Dr. Yangjun Chen ACS-4902

Difference between transaction time and valid time: - Valid time: the actual time at which an item was a valid or true value. It can be changed by an application. For example, consider the case where a firm plans to increase its prices on a specific date. It might post new prices some time before their effective date. Difference between transaction time and valid time: Valid time records when the change takes effect, and transaction time records when the change was entered. - Storing transaction time is essential for database recovery because the DBMS can roll back the database to a previous state. - Valid time provides a historic record of the state of the database. Jan. 2018 Dr. Yangjun Chen ACS-4902

- Anchored time: a time having a defined starting point (e,g., October 15, 2003) DATE TIMESTAMP instance anchored interval [instance1, instance2] temporal time unanchored Example: 45 minutes Example: [2003-01-01, 2003-01-23] Jan. 2018 Dr. Yangjun Chen ACS-4902

- Interval (unanchored time) in SQL-99 It is a single value expressed in some unit or units of time (e.g., 6 years, 5 days, 7 hours). Example: CREATE TABLE planet ( pltname VARCHAR(7), pltday INTERVAL, pltyear INTERVAL, pk_planet PRIMARY KEY(pltname)); pltday – rotationl period pltyear – orbital period Jan. 2018 Dr. Yangjun Chen ACS-4902

INSERT INTO planet VALUE (‘MERCURY’, ‘1407.51 hours’, ‘0.24 years’); Example: INSERT INTO planet VALUE (‘MERCURY’, ‘1407.51 hours’, ‘0.24 years’); Planet Rotation period (hours) Orbital period (years) Mercury 1407.51 0.24 Venus -5832.44 0.62 Earth 23.93 1.00 Mars 24.62 1.88 Jupiter 9.92 11.86 Saturn 10.66 29.45 Uranus 17.24 84.02 Neptune 16.11 164.79 Pluto 153.28 247.92 Jan. 2018 Dr. Yangjun Chen ACS-4902

Modeling temporal data Consider an application for managing information on Shares: SHARE shrprice shrcode shrname shrqty shrdiv shrearn However, share price, quantity owned, dividend and price-to-earning ratio are all time-varying. The above data model is not able to capture this feature. So temporal information should be added. Jan. 2018 Dr. Yangjun Chen ACS-4902

Modeling temporal data shrcode shrname 1 1 S-P SHARE S-E 1 1 S-T S-D shrearn M N L J shrpricetime PRICE Trading-TRANSACTION DIVIDEND EARNINGS shrprice shrqty shrdiv shrearndate shrqtytime shrtansprice shrdivdate Jan. 2018 Dr. Yangjun Chen ACS-4902

Modeling temporal data Comments: Adding attributes to tables to handle temporal data does not make it a temporal database. - no built-in functions for querying time-varying data - queries with time concepts cannot be specified in SQL TSQL (Temporal Structured Query Language): - there is a proposal to make TSQL and ANSI and ISO standard - TempDB project in IBM - Microsoft working on a temporal database Jan. 2018 Dr. Yangjun Chen ACS-4902