project P03

advertisement
Relational Database Schema Designer: CASE tool
Teaching Aid for Bernstein’s Algorithm
02 April 2015
CS4221 project presentation - by Group 03
Liu Wei Ran
Lu Nan
Wu Long
Zhao Yue
Agenda
•
Objective
•
Bernstein’s Algorithm and its shortcomings
•
Implementation
•
New Features
•
Future work
•
Demo
Objective
•
Implementation of enhanced Bernstein’s Algorithm
•
Teaching aid with interactive user interface
Bernstein’s Algorithm
•
Bernstein’s Algorithm was invented by Bernstein Philip in 1976
•
The algorithm consists of 6 steps
•
Produce 3NF with the fewest number of relations
Bernstein’s Algorithm
Given a relational schema R and a set of functional dependencies F
Step 1: Eliminate extraneous attributes from the left side of each FD in F to produce G.
Step 2: Find a non-redundant covering of G.
Step 3: Partition G into groups such that all FDs have identical left side in each group.
Step 4: Merge equivalent keys if left sides have the bijection relation to create J.
Step 5: Eliminate transitive dependencies.
Step 6: Construct relation consisting of all the attributes appearing in each group.
Shortcomings
1. It does not guarantee losslessness.
2. It does not find all the keys.
3. It does not remove all the superfluous attributes.
4. Relations produced depends on the non-redundant covering found.
5. BCNF schema may contain superfluous attributes.
Implementation
Step 1
•
[find_minimal_cover] : Step one and two, eliminate extraneous attributes and find
covering.
•
INPUT : <__G>, the set of functional dependencies
•
RETURN : <__H>, the minimum cover of the input functional dependencies
Implementation
Step 2
•
[partition] : Step three, partition the minimum cover <__H> into groups that has
identical left sides
•
INPUT : <__H>, the minimum cover
•
RETURN : <__partitioned_fds_list>, all the groups of partitioned functional
dependency list
Implementation
Step 3
•
[merge_keys] : Step four, merge equivalent keys.
•
INPUT : <__partitioned_fds_list> and <__H>
•
RETURN : <__merged_fds_list>, all merged groups of functional dependency list
Implementation
Step 4
•
[eliminate_transitive_fds] : Step five, find and remove transitive dependencies for the
input.
•
INPUT : <__merged_fds_list>
•
RETURN : <__final_fds_list>, the finalized group of functional dependency list
Implementation
Step 5
•
[contruct_relations] : Step six, construct relational schema for each groups.
•
INPUT : <__final_fds_list>
•
RETURN : <__relations>, all the relational schemas
New Features
1.Losslessness Checker
2.Superfluous Attribute Checker
3.Candidate Key Finder
Losslessness Checker
AB -> CD, A -> CD
Schema
['A', 'C', 'D']
A
C
B
D
1
1
0
1
Candidate Key Finder
AD -> B, B -> C, C -> D, AB -> E, AC -> F
Left
[‘A’]
Middle
[‘B’, ‘C’, ‘D’]
Right
[‘E’, ‘F’]
‘A’, ‘AB’, ‘AC’, ‘AD’, ‘ABC’, ‘ABD’, ‘ACD’
Superfluous Attribute Checker
[superfluous_attribute_detection_algorithm] : Check whether a given attribute is a
superfluous in a relational schema.
INPUT :
<relations> : The input relational schemas
<G> : The original functional dependency list
<test_relation> : A relation that is in the input relational schemas <relations>
<test_attribute> : The attribute that need to be tested for <test_relation>
RETURN : True if the <test_attribute> is superfluous in <test_relation>, False if it is not
Future work
• UI improvement
• Solve shortcoming 4 by using superfluous attribute checker to check
every attributes in all possible covers found, to get the best relations
results.
Demo
Q&A
Presentation by
Zhao Yue
Wu Long
Liu Wei Ran
Lu Nan
Thank You!
Presentation by
Zhao Yue
Wu Long
Liu Wei Ran
Lu Nan
Download