尝试将我的关系转换为 BCNF (3.5NF)
Trying to convert my relation into BCNF (3.5NF)
我有一个酒店评论数据集。数据集中的每个文件都针对不同的酒店,并包含访客对该酒店的许多评论。我被分配了 5 个任务,列表:
1) 我数据集中的关系:
HotelReview(int: OverallRating, int: AveragePrice, url: URL, string: Author, string: Content, date: Date, int: No. Reader, int: No. Helpful, int: Overall, int: Value, int: Rooms, int: Location, int: Cleanliness, int: Checkin / front desk, int: Service, int: Business Service)
2)我的数据集的主键:
Author and URL (**Composite Key**)
3) 函数依赖:
• Content -> OverallRating, AveragePrice, URL, Author, Date, No. Reader, No. Helpful, Overall, Value, Rooms, Location, Cleanliness, Checkin / front desk, Service, Business Service
• Author, URL -> Content -> OverallRating, AveragePrice, URL, Content, Date, No. Reader, No. Helpful, Overall, Value, Rooms, Location, Cleanliness, Checkin / front desk, Service, Business Service
• Author, Date -> OverallRating, AveragePrice, URL, Author, Date, No. Reader, No. Helpful, Overall, Value, Rooms, Location, Cleanliness, Checkin / front desk, Service, Business Service
4) 潜在的候选键:
Content
但是现在我正在为第五个任务而苦恼。我被要求将我的关系规范化为 BCNF (3.5NF)。我已经研究了如何做到这一点,但这对我来说没有意义,而且我无法在我自己的关系中复制规范化。任何帮助和建议将不胜感激。
这是来自酒店数据集的示例文件:
<Overall Rating>4
<Avg. Price>3
<URL>http://...
<Author>everywhereman2
<Content>Old seattle getaway...
<Date>Jan 6, 2009
<img src="http://cdn.tripadvisor.com/img2/new.gif" alt="New"/>
<No. Reader>-1
<No. Helpful>-1
<Overall>5
<Value>5
<Rooms>5
<Location>5
<Cleanliness>5
<Check in / front desk>5
<Service>5
<Business service>5
<Author>RW53
<Content>Location! Location? view from room of nearby freeway
<Date>Dec 26, 2008
<No. Reader>-1
<No. Helpful>-1
<Overall>3
<Value>4
<Rooms>3
<Location>2
<Cleanliness>4
<Check in / front desk>3
<Service>-1
<Business service>-1
...new review e.t.c
这里是 table 形式的酒店评论示例:
蓝色调代表标识评论所涉及的酒店的列,而黄色列代表我的复合主键(作者和
感谢您的宝贵时间。
鉴于您的功能依赖性,有三个候选键:
{ (Author, Date) (Author, URL) (Content) }
如果你计算它们中的每一个的闭包,你可以很容易地验证这一点。
由于这个原因,关系已经是 Boyce-Codd 范式 (BCNF),因为对于每个依赖项,行列式都是一个(候选)键(这是 BCNF 的定义)。
我有一个酒店评论数据集。数据集中的每个文件都针对不同的酒店,并包含访客对该酒店的许多评论。我被分配了 5 个任务,列表:
1) 我数据集中的关系:
HotelReview(int: OverallRating, int: AveragePrice, url: URL, string: Author, string: Content, date: Date, int: No. Reader, int: No. Helpful, int: Overall, int: Value, int: Rooms, int: Location, int: Cleanliness, int: Checkin / front desk, int: Service, int: Business Service)
2)我的数据集的主键:
Author and URL (**Composite Key**)
3) 函数依赖:
• Content -> OverallRating, AveragePrice, URL, Author, Date, No. Reader, No. Helpful, Overall, Value, Rooms, Location, Cleanliness, Checkin / front desk, Service, Business Service
• Author, URL -> Content -> OverallRating, AveragePrice, URL, Content, Date, No. Reader, No. Helpful, Overall, Value, Rooms, Location, Cleanliness, Checkin / front desk, Service, Business Service
• Author, Date -> OverallRating, AveragePrice, URL, Author, Date, No. Reader, No. Helpful, Overall, Value, Rooms, Location, Cleanliness, Checkin / front desk, Service, Business Service
4) 潜在的候选键:
Content
但是现在我正在为第五个任务而苦恼。我被要求将我的关系规范化为 BCNF (3.5NF)。我已经研究了如何做到这一点,但这对我来说没有意义,而且我无法在我自己的关系中复制规范化。任何帮助和建议将不胜感激。
这是来自酒店数据集的示例文件:
<Overall Rating>4
<Avg. Price>3
<URL>http://...
<Author>everywhereman2
<Content>Old seattle getaway...
<Date>Jan 6, 2009
<img src="http://cdn.tripadvisor.com/img2/new.gif" alt="New"/>
<No. Reader>-1
<No. Helpful>-1
<Overall>5
<Value>5
<Rooms>5
<Location>5
<Cleanliness>5
<Check in / front desk>5
<Service>5
<Business service>5
<Author>RW53
<Content>Location! Location? view from room of nearby freeway
<Date>Dec 26, 2008
<No. Reader>-1
<No. Helpful>-1
<Overall>3
<Value>4
<Rooms>3
<Location>2
<Cleanliness>4
<Check in / front desk>3
<Service>-1
<Business service>-1
...new review e.t.c
这里是 table 形式的酒店评论示例:
蓝色调代表标识评论所涉及的酒店的列,而黄色列代表我的复合主键(作者和
感谢您的宝贵时间。
鉴于您的功能依赖性,有三个候选键:
{ (Author, Date) (Author, URL) (Content) }
如果你计算它们中的每一个的闭包,你可以很容易地验证这一点。
由于这个原因,关系已经是 Boyce-Codd 范式 (BCNF),因为对于每个依赖项,行列式都是一个(候选)键(这是 BCNF 的定义)。