1 / 6

Nested Relations

Nested Relations. Flat schemas often have replicated data values in their relations. Nested schemas allow us to collapse some of these replicated data values. NrBeds RoomNr (NrBeds ( RoomNr )* )* 2 1 2 1

tara-nelson
Download Presentation

Nested Relations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Nested Relations • Flat schemas often have replicated data values in their relations. • Nested schemas allow us to collapse some of these replicated data values. NrBeds RoomNr (NrBeds ( RoomNr )* )* 2 1 2 1 2 2 2 2 3 3 1 4 1 4 1 5 5

  2. Redundancy in Nested Schemes • The redundancy definition is the same as for flat relations. • If a hidden value can be uniquely determined or if a value change causes a constraint violation, the value is redundant. (NrBeds (RoomNr (View)* )* )* 2 1 Sea Forest City 2 Sea Forest 3 City (View (RoomNr NrBeds)* )* Sea 1 2 2 2 Forest 1 2 2 2 City 1 2 3 2

  3. NNF: Redundancy Free Nested Schemas Input: a canonical, acyclic, binary hypergraph H. Output: a set of nested schemas with no potential redundancy. Repeat Mark an unmarked node in H as the first attribute in a new nested schema. While an unmarked edge is incident on a marked node A: Mark the edge. If A  B: Add B with A; Mark B. If A  B: Add B with A; Mark B if all B’s incident edges are marked. If A  B: Nest B under A; Mark B. Else (A — B): Nest B under A; Mark B if all B’s incident edges are marked. Until all nodes have been marked

  4. Nested Schema Generation Example 1. (NrBeds, (RoomNr, RoomName, Cost, (View)*, (GuestNr, GuestName)* )* )* 2. (RoomNr, RoomName, Cost, NrBeds, (View)*, (GuestNr, GuestName)* )* 3. (GuestNr, GuestName, RoomNr)* (RoomNr, RoomName, Cost, NrBeds (View)* )*

  5. Redundancy Prevention x a 1 y b 2 z (A ( B C )* )* a x 1 y 1 2 b y 1 2 z 2 … causes this redundancy. This replication ...

  6. Generalizationfor N-ary Relationship Sets • “Composite nodes” can be treated as a single node. • (B C (A)* (D)* )* • (D (B C)* )*; (A B C)* • Or, n-ary edges (n3) can be converted to an object set and n binary relationship sets. • NNF, basically: • Schemes should be constructed along hypergraph paths. • Schemes should not violate the natural 1-many hierarchical structure.

More Related