2013 topic 8 database design ii - schemas
TRANSCRIPT
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
1/42
DESIGNING THE DATABASE
(ii)
The implementation model:
Managing the attributes
(a forestry example)
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
2/42
References:
GIS A Computing Perspective, M.F.
Worboys (with M.J. Duckham for
second edition). Taylor &Francis,
London, 2004. Ch. 2.
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
3/42
Why are we concerned with the
database design?
Database design mostly concerns the attributes of
the real world objects represented in the GIS.
In modern GIS packages changing the attributes
is rather easyas in adding extra columns tothe attribute tables and putting in values.
But care should be taken to avoid putting the
same attributes into several tables as this maythreaten the integrity of the database (e.g.
Landparcel/landcover/house). We maintain
integrity through the DML task of JOIN.....
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
4/42
What does a JOIN need?
ANS:
Appropriate PRIMARY keys
COMMON keysFOREIGN keys
The processes we look at today will helpensure these are correctly allocated,
inserted and used, based on different
IMPLEMENTATION MODELS
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
5/42
The depth of a workers involvement in
GIS influences the Implementation Model
used
the external model(for those who use theGIS generated information);
the conceptual model(for those whogenerate the GIS information);
the internalmodel (for those who design
and construct the GIS database whichgenerates the GIS information); and
the phys ical model (for those wi threspons ibi l i ty for how the data are actually
sto red on the sto rage devices).
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
6/42
Resulting in:
EXTERNAL SCHEMA
CONCEPTUAL SCHEMA INTERNAL (or LOGICAL) SCHEMA
(physical schema)
note: Schema = Graphic Diagrams
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
7/42
The External schema is that understood by theprofessional for whom the DBM System (DBMS)offers decision support in the task of administrating,
for example, schools or health centres. Theprofessional may never actually be able, or required,to build or manipulate the DBMS (which isincorporated in the GIS).
At this external level there will be different perceptions thus different external implementation modelsexisting for different perceptions.
For example, certain real world entities such asphysician/forest may, by some, be seen to beentities in their own right, but by others merely as anattribute (e.g. of a clinic/landparcel).
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
8/42
Preparation for design at theexternal level (to produce the
external schema of theimplementation model)
Identify stakeholders (main and subsidiary)
Examine working practices/rules of the
(main and subsidiary) stakeholders
Establish spatial rules (GIS not other IS)
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
9/42
An external view by a health
administrator concerned with
facilities
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
10/42
another external view
perhaps that of an administrator
concerned with HR
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
11/42
external view by an education
administrator
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
12/42
alternate external view
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
13/42
alternate external view
considering working rules
Health andSafety Executive
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
14/42
alternate external view
considering working rules
Local PoliceStation
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
15/42
The conceptual level of the implementation modelis that understood by the DBMS operator or user,who will know (or will be able to know) which entities
are reallyrepresented in the database and whattheir attributes are. The DBMS operator will eitherknowor via a data dictionarybe able to find outhow data on entities and attributes are stored in the
database.
For example from the data dictionary the operator willbe able to find out what Foreign Keys an entity
holds; or that the attribute YOC represents Year-of-Construction; or whether an attribute is representedas a character variable, numerical variable (oranother type) and how it should be expressed, etc.
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
16/42
Two steps to generate
CONCEPTUAL SCHEMA
1. Form the network schema
2. Form the ERM (Entity-
Relation Model) model
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
17/42
Network schema (1)
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
18/42
Network Schema (2)
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
19/42
ERM
of Sports or
Educat ion
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
20/42
West District East District
South District
NATION
District
Forest
Tree Firepath
1
m
m
n
1
m m
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
21/42
f
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
22/42
Finally from the conceptual
schema, produce a preliminary list
of entities and their attributesFOREST area, perimeter, owner, main-tree-
species..+UID, FK1, FK2
TREE species, YOP, forest..+UID, FK1, FK2DISTRICT name, area, perimeter, capital, chief-
executive.+UID, FK1, FK2
FIREPATH width, length, slope..+UID, FK1, FK2
SCHOOL name, address, director, no-of-students..+UID, FK1, FK2
Primary key
Foreign Key
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
23/42
The Internal (or Logical) level is usually
that understood by the Database (DB)
Designer (sometimes called the GIS
Designer in the context of GIS) and theDatabase Administrator (DBA).
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
24/42
Every identified ENTITY is listed with its attributes one of theseattributes being its unique identifier (underlined, below):
MINISTER (Ministers_NI_Nr, MINISTRY_NAME, MINISTRY_Code_NRSALARY_BAND.)
DIRECTOR (Directors_NI_Nr, DIRECTORATE, SALARY BAND.)
SCHOOL (SCHOOL_NR, Heads_NI_Nr,DIRECTORs_NI_Nr,ADDRESS, ...)
FOREST (FOREST_NR, Forest_NAME, YOP, AREA, PERIMETER..)
FIREPATH (FIREPATH_NR, FOREST_NR,YOC, LENGTH, WIDTH.)
TREE (TREE_NR, FOREST_NR,YOP, SPECIES, HEIGHT.)
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
25/42
Then the dependent entitiesespecially if the
relationship is mandatorymust have a Foreign
Key (bold red below) added:
DIRECTOR(DIRECTORs_NI_NR, Directorate,
Ministry_Code_Nr, NAME, DOB,
HOME_ADDRESS) SCHOOL (SCHOOL_NR, DIRECTORS_NI_NR,
HEAD, SCHOOL_ADDRESS, SCHOOL TYPE)
FIREPATH (FIREPATH_NR, FOREST_NR, YOC,LENGTH, WIDTH, SLOPE)
TREE(TREE_NR, FOREST_NR, YOP,
MAJORITY_SPECIES, VALUE_1990)
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
26/42
sometimes shown graphically
Note: if the conceptual schema was well made, then establishing the logicalschema is easy..
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
27/42
A further example..
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
28/42
The case study
Commercial timber companies wish, together, todesign and implement a GIS to increaseefficiencies.
The Ministry of Forestry will provide some support,and possibly the Ministry of Tourism and touroperators as they all need some informationrelated to forests, for their own decision support.
How can a GIS be designed to meet the needs ofthese (financial) supporters?
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
29/42
Spatial RULES - 1
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
30/42
Spatial RULES -2
1. A commercial forest is completely covered by
contiguous polygons of forest stands or clearings.2. The forest can be crossed by linear features such as
roads, paths, etc., which results in the subdivision ofthe stands and clearings into sub-stands or sub-clearingsboth can be referred to as forestry
management units.3. Plant or animal habitats are non-contiguous polygons
which overlie one or more forest stand or clearingpolygons, and may extend beyond one commercialforest into another, or into non commercial forest land.
4. Within the forest are human sites (e.g. restaurants,toilets, storage sheds, points of interest) andwatchtowers represented as point features, which mayor may not be accessible by paths, tracks, etc.
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
31/42
External schemacommercial
timber company
Year of clearing
No. of carriageways
Year of Planting
Road,Track,PathSegments
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
32/42
External schemaMin. Forestry
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
33/42
External schemaMin. of Tourism
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
34/42
External Schematour operators
Forest walking
Tour
Road, Track, Pathsegments
Forest Stand/ Clearing L,R
Nearby Watch Tower
1,2,3
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
35/42
CONCEPTUAL SCHEMA -1
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
36/42
CONCEPTUAL SCHEMA - 2
1
m
m
1
1
1
m
m
m
m
m
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
37/42
Internal schema
Relation Attributes
TIMBER_COMPANY TC_UID, NAME, CONTACT, CEO, MINISTRY_NR
FOREST F_UID, TC_UID, NAME, ACREAGE, LA
STAND_or_CLEARING SC_UID, F_UID, FOREST_SPECIES_1,
FOREST_SPECIES_2
HABITAT H_UID, F_UID1, F_UID2, SPECIES_1, SPECIES_2ROAD_TRACK_or_PATH RTP_UID, T_UID, F_UID, FMU_UID_1, FMU_UID_2,
WIDTH, SURFACE, YOC, NR_TRACKS
FORESTRY_MANAGEMENT_UNIT FMU_UID, SC_UID, ACREAGE
HUMAN_SITE HS_UID, FMU_UID, RTP_UID, NAME, CONTACT,
CEO, RESOURCE
TOUR_OPERATOR TO_UID, NAME, CONTACT, CEO, MINISTRY_CONTACT
TOUR T_UID, TO_UID, COST, START, END, WAYPOINT1,WAYPOINT2, WAYPOINT3, WAYPOINT4
WATCH_TOWER WT_UID, SC_UID, HEIGHT, CONTACT, CEO
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
38/42
DATA DICTIONARY
This contains instructions for the system operators to follow as they define (build) thedatabase. Some entries might be:
Relation: TIMBER_COMPANY
TC_UID width 11, integer, unique identifier of Timber Company
provided by the DBA
NAME width 20, character, legal name of the company
CONTACT width 14, character, telephone number of registered office
CEO width 20, character, firstname_middleinitial_familyname ofchief executive officer of timber company
MINISTRY_NR width 11, integer, unique identifier of Ministry provided bythe DBA
Relation: FOREST
F_UID width 11, integer, unique identifier of Forest provided bythe DBA
TC_UID width 11, numeric, unique identifier of Timber Companyprovided by the DBA
NAME width 20, character, name of the forest
ACREAGE width 14, numeric, areal dimension of forest in hectares
LA width 20, character, name of the Local Authority
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
39/42
..small fragments of relations
NR
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
40/42
do th is
Start the relation (table) for two more relations (as
has already been done for TIMBER_COMPANYand FOREST), and, using Excel, populate these
new relations for at least two entities..for
example STAND_OR_CLEARING or
WATCHTOWER .. using fictional (or real orimagined or simulated) data.
for subm ission (by 17:00 1s tNovember 2013)
and summative assessment (5%)..
Thank you!
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
41/42
RELATIONS:STAND_OR_CLEARING
WATCHTOWER
-
8/13/2019 2013 Topic 8 Database Design II - Schemas
42/42