3. Logical Models and Query Languages - PowerPoint PPT Presentation

1 / 47
About This Presentation
Title:

3. Logical Models and Query Languages

Description:

... one can perform on the spatial object ... Extending Data Models with Spatial ADTs (2/6) ... Test a spatial object for a given property. Ex) convex, connected ... – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 48
Provided by: dbKon
Category:

less

Transcript and Presenter's Notes

Title: 3. Logical Models and Query Languages


1
3. Logical Models and Query Languages
  • 2007-09-20
  • Hong-Koo Kang
  • Department of Computer Science Engineering
  • Konkuk University
  • E-mail hkkang_at_db.konkuk.ac.kr
  • URL http//db.konkuk.ac.kr

2
Introduction
  • This chapter
  • How the representation and querying of geographic
    objects can be supported by the DBMS
  • Abstract Data Type(ADT)
  • Combinations of data types and operations
  • Ex) type polygon, its operation PolygonArea
  • Encapsulation
  • ADTs are encapsulated in the sense that they are
    accessible only through the operations defined on
    them
  • The DBMS need not have any knowledge on the ADT
    implementation

3
3.1 Reference Schemas (1/2)
  • Administrative Units (Schema 1)
  • A country (ex the United States or Germany)
    consists of states, and a single state, in turn,
    consists of counties
  • The diamond shaped symbol(?)
  • Between two entity types express an aggregation
    relationship
  • Ex) a State consists of Counties
  • The solid circle symbol(?)
  • Is used to denote a one-to-many relationship

Figure 3.1 Administrative units in the United
States (schema 1)
4
3.1 Reference Schemas (2/2)
  • Highway Network Among Cities (Schema 2)
  • A highway entity consists of sections
  • A section may be shared by several highways
  • Many-to-many relationship
  • The sections of highways connect cities to each
    other
  • A section starts in a given city and ends in
    another
  • Land Use (Schema 3)
  • A particular area in the plane is associated with
    a type of use
  • Such as housing, agricultural area, and forest

Figure 3.2 Highway network among cities (schema 2)
5
3.2 Reference Queries (1/4)
  • Query classification
  • Queries with alphanumeric criteria (ALPHA-)
  • Queries with a spatial criteria (SPAT-)
  • Ex) an operation that applies to the spatial part
    of one or several geographic objects
  • Interactive queries (INTER-)
  • which require participation from the end user
  • Ex) to select a particular area by drawing it on
    a display device using a mouse
  • Schema
  • Administrative units (ADM)
  • Roads (R)
  • Land use (LU)
  • Ex) ALPHA-ADM2 for the second alphanumeric query
    on administrative units

6
3.2 Reference Queries (2/4)
  • Queries with alphanumeric criteria are as follows
  • ALPHA-ADM1
  • Number of inhabitants in the County of San
    Francisco
  • ALPHA-ADM2
  • List of the counties of the State of California
  • ALPHA-ADM3
  • Number of inhabitants in the United States
  • ALPHA-R1
  • Number of lanes in the first section of
    Interstate 99
  • ALPHA-R2
  • Name of all sections that constitute Interstate
    99

7
3.2 Reference Queries (3/4)
  • Queries involving spatial criteria are as follows
  • SPAT-ADM4
  • Counties adjacent to the County of San Francisco
    in the same state
  • SPAT-ADM5
  • Display of the State of California
  • SPAT-ADM6
  • Counties larger than the largest county in
    California
  • SPAT-R3
  • Length of Interstate 99
  • SPAT-ADM-R1
  • All highways going through the State of
    California
  • SPAT-ADM-LU1
  • Display of all residential area in the County of
    San Jose
  • SPAT-ADM-LU2
  • Overlay of the themes of administrative units and
    land use

8
3.2 Reference Queries (4/4)
  • Interactive queries are as follows
  • INTER-ADM7
  • Description of the county pointed to on the
    screen
  • INTER-ADM8
  • Counties that intersect a given rectangle on the
    screen
  • INTER-ADM9
  • Parts of counties within a given rectangle on the
    screen
  • INTER-R5
  • Description of the section pointed to on the
    screen
  • INTER-R6
  • Description of the highway of which a section is
    pointed to on the screen

9
3.3 Spatial Abstract Data Types
  • Extending Data Models with Spatial ADTs
  • Designing Spatial ADTs
  • Exploring Relationships Between Spatial Objects
    Topological Predicates

10
Extending Data Models with Spatial ADTs (1/6)
  • Spatial ADTs Basic Concepts
  • The list of operations that one can perform on
    the spatial object
  • Independently of its internal representation
  • ex) Testing of intersection with other objects,
    area size calculation
  • Geographic data models and spatial data models

11
Extending Data Models with Spatial ADTs (2/6)
  • The abstraction of the region in the geographic
    data model allows for any choice of spatial data
    model
  • Ex) spaghetti, network, or topological

12
Extending Data Models with Spatial ADTs (3/6)
  • Choosing Appropriate Types
  • A set of possible choices for geometric types

13
Extending Data Models with Spatial ADTs (4/6)
  • Simple choices in representing spatial objects
  • Type point (zero-dimensional)
  • A point is an instance of this type
  • Type polyline, line in short (one-dimensional)
  • A list of pairwise connected segments
  • An endpoint can be shared by, at most, two
    segments
  • Type region ?? (two-dimensional)
  • Any set of nonoverlapping polygons
  • We do not consider polygons with holes

14
Extending Data Models with Spatial ADTs (5/6)
  • Defining Spatial ADT Operations
  • The result of the operation must be either any
    atomic type provided by the DBMS or one of the
    three abstract types

15
Extending Data Models with Spatial ADTs (6/6)
  • Region ADT operations
  • PointInRegion region?point -gt bool
  • Overlaps region?region -gt bool
  • OverlapsRect region?rectangle -gt bool
  • Clipping region?rectangle -gt region
  • Intersection region?region -gt region
  • Meets region?region -gt bool
  • Area region -gt real
  • RegionUnion region -gt region
  • Line ADT operations
  • PointInline line?point -gt bool
  • Length line -gt real
  • OverlapsLR line?region -gt bool
  • Point ADT operations
  • Distance region?point -gt real

16
Designing Spatial ADTs (1/5)
  • The spatial operation classification
  • Unary operations with Boolean result
  • Test a spatial object for a given property
  • Ex) convex, connected
  • Unary operations with scalar result
  • Computing the length, area size, and perimeter of
    a spatial object
  • Unary operations with spatial result
  • Topological transforms
  • Rotation, translation, scale change, symmetry
  • Boundary
  • Mapping a d-dimensional object into a
    (d-1)-dimensional one (d gt 0)
  • Object extraction
  • minimal bounding rectangle, region centroid

17
Designing Spatial ADTs (2/5)
  • N-ary operations with spatial result
  • Voronoi diagram construction of a set of points
  • and convex hull
  • Binary operations with spatial result
  • Ex) intersection, union, difference
  • Binary operations with Boolean result (spatial
    predicates)
  • Topological predicates
  • Ex) intersects, contains, adjacent
  • Direction predicates
  • Ex) above, North of
  • Metric predicates
  • Whether the distance between two objects is less
    than a given number of units
  • Binary operations with scalar result
  • Ex) Distance

18
Designing Spatial ADTs (3/5)
  • Semantics of Operations
  • An operation may have different meanings
    depending on the dimension considered
  • For example, intersection operation
  • Two convex polygons
  • Always a single convex polygon
  • Two nonconvex polygons
  • May generate many polygons
  • A line and a polygon
  • The part of the line inside the polygon
  • The intersection points between the line and the
    boundary of the polygon
  • Two lines
  • A segment
  • The set of segments common to the two lines given
    as argument
  • The set of points of intersection between the two
    lines
  • Two adjacent polygons or regions
  • Regularized intersection the returned value is
    empty
  • Geometric intersection the returned value is
    their common boundary

19
Designing Spatial ADTs (4/5)
20
Designing Spatial ADTs (5/5)
  • The result of spatial operations should satisfy
    one of the existing types
  • The limits of simple type system
  • The intersection of a line and a region returns
    many points
  • The union of two (poly)lines is not a (poly)line
  • The difference of two polygons (without holes)
    may be a polygon with a hole
  • Weak typing
  • Chooses a type large enough to remain closed
    under a set of common operations
  • Ex) geometry a set of either points or polygons
  • Strong typing
  • Control on the operations
  • Ex) Modeling a line by as set of segments enables
    us to perform a union of lines

21
Exploring Relationships Between Spatial Objects
Topological Predicates (1/5)
  • Focus on topological relationship between two
    objects
  • Definitions for the relations
  • Function point(x)
  • The set of points that belongs to a spatial
    region x
  • Set operations
  • , ?, ?, n
  • Definition of following relations
  • x y corresponds to point(x) point(y)
  • x ? y corresponds to point(x) ? point(y)
  • x inside y corresponds to point(x) ? point(y)
  • x outside y corresponds to point(x) n point(y)
    Ø
  • x intersects y corresponds to point(x) n point(y)
    ? Ø

22
Exploring Relationships Between Spatial Objects
Topological Predicates (2/5)
  • 4-intersection schema
  • With the notion of boundary and interior
  • Overlap and meets can be distinguished
  • By comparing whether or not boundaries and
    interiors of two spatial regions intersect
  • ??
  • A non-empty set of points
  • A0 interior of A
  • dA boundary of A

23
Exploring Relationships Between Spatial Objects
Topological Predicates (3/5)
24
Exploring Relationships Between Spatial Objects
Topological Predicates (4/5)
25
Exploring Relationships Between Spatial Objects
Topological Predicates (5/5)
26
3.4 Relational Models Extended with ADT
  • Representation of reference schemas
  • Reference Queries

27
Representation of reference schemas (1/3)
  • Administrative units (schema 1)

28
Representation of reference schemas (2/3)
  • Highway network and cities (schema 2)

29
Representation of reference schemas (3/3)
  • Land Use (schema 3)

30
Reference Queries (1/9)
  • ALPHA-ADM1
  • Number of inhabitants in the County of San
    Francisco
  • ALPHA-ADM2
  • List of the names of the counties in the State of
    California

31
Reference Queries (2/9)
  • ALPHA-ADM3
  • Number of inhabitants of the United States of
    America
  • ALPHA-R1
  • Number of lanes in the first section of
    Interstate 99

32
Reference Queries (3/9)
  • ALPHA-R2
  • Names of sections that constitute Interstate 99

33
Reference Queries (4/9)
  • SPAT-ADM4
  • Counties adjacent to the County of San Francisco
    in the same state
  • SPAT-ADM5
  • Display of the State of California

34
Reference Queries (5/9)
  • SPAT-ADM6
  • Counties larger than the largest county in
    California
  • SPAT-R3
  • Length of Interstate 99

35
Reference Queries (6/9)
  • SPAT-ADMR1
  • All highways going through the State of
    California
  • SPAT-ADM-LU1
  • Display of all residential areas in the County of
    San Jose

36
Reference Queries (7/9)
  • SPAT-ADM-LU2
  • Overlay of the themes of administrative units and
    land use

37
Reference Queries (8/9)
  • INTER-ADM7
  • Description of the county pointed to on the
    screen
  • INTER-ADM8
  • Counties that intersect a given rectangle on the
    screen
  • INTER-ADM9
  • Parts of counties within a given rectangle on the
    screen

38
Reference Queries (9/9)
  • INTER-R5
  • Description of the section pointed to on the
    screen
  • INTER-R6
  • Description of the highway of which a section is
    pointed to on the screen

39
3.5 Object-Oriented Models
  • A Brief Overview of Object-Oriented DBMS
  • Representation of Reference Schemas
  • Spatial Classes
  • Reference Queries

40
A Brief Overview of Object-Oriented DBMS
  • Database systems object-oriented programming
    languages
  • Object Identity
  • Using an identifier or oid (object identifier)
  • Types, Classes, and Methods
  • Type corresponds to its structure and to the
    operations
  • Class objects with same type are grouped into
    classes
  • Method express behavior of objects
  • Encapsulation
  • One accesses objects only via the methods defined
    on the class they belong to
  • Without any knowledge of their detail of
    implementation
  • Inheritance
  • To define a (sub)class from an existing
    (super)class with a refinement of its structure
  • Ex) Person -gt Student

41
Representation of Reference Schemas (1/3)
  • Each theme and each spatial ADT is materialized
    by a class
  • Administrative Units (Schema 1)

42
Representation of Reference Schemas (2/3)
  • Highway Network (Schema 2)

43
Representation of Reference Schemas (3/3)
  • Land Use (Schema 3)

44
Spatial Classes (1/2)
45
Spatial Classes (2/2)
  • Methods in class Region
  • method pointInRegion (p Point) in class Region
    boolean
  • method overlaps (r Region) in class Region
    boolean
  • method overlapsRect (r Rectangle) in class
    Region boolean
  • method clipping (r Rectangle) in class Region
    Region
  • method intersection (r Region) in class Region
    Region
  • method meets (r Region) in class Region boolean
  • method area in class Region real
  • Methods in class Line
  • method pointInLine (p Point) in class Line
    boolean
  • method length in class Line real
  • method overlapsLR (r Region) in class Line
    boolean
  • Methods in class Point
  • method distance (r Region) in class Point real

46
Reference Queries (1/2)
  • OQL
  • Similar to SQL
  • Proposed by the Object Database Management
    Group(ODMG)
  • To access complex structures, to run methods, and
    to return a result that may be structured in a
    complex way
  • Queries with Alphanumeric Criteria
  • ALPHA-ADM1
  • Number of inhabitants in the County of San
    Francisco

47
Reference Queries (2/2)
  • Queries Involving Spatial Criteria
  • SPAT-R3
  • Length of Interstate 99
Write a Comment
User Comments (0)
About PowerShow.com