Type Inheritance and Relational Theory

Book description

Type inheritance is that phenomenon according to which we can say, for example, that every square is also a rectangle, and so properties that apply to rectangles in general apply to squares in particular. In other words, squares are a subtype of rectangles, and rectangles are a supertype of squares. Recognizing and acting upon such subtype / supertype relationships provides numerous benefits: Certainly it can help in data modeling, and it can also provide for code reuse in applications. For these reasons, many languages, including the standard database language SQL, have long supported such relationships. However, there doesn’t seem to be any consensus in the community at large on a formal, rigorous, and abstract model of inheritance. This book proposes such a model, one that enjoys several advantages over other approaches, not the least of which it is that it’s fully compatible with the well known relational model of data.

Topics the model covers include:

  • Both single and multiple inheritance
  • Scalar, tuple, and relation inheritance
  • Type lattices and union and intersection types
  • Polymorphism and substitutability
  • Compile time and run time binding

All of these topics are described in detail in the book, with numerous illustrative examples, exercises, and answers. The book also discusses several alternative approaches. In particular, it includes a detailed discussion and analysis of inheritance as supported in the SQL standard.

Publisher resources

View/Submit Errata

Table of contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. About the Author
  5. Contents
  6. Preface
  7. Foreword
  8. Part I: Preliminaries
    1. Chapter 1: Background
      1. Inheritance arises naturally
      2. A fundamental concept
      3. The suppliers-and-parts database
      4. A little history
      5. Exercises
      6. Answers
    2. Chapter 2: Types without Inheritance
      1. Values vs. variables
      2. What’s a type?
      3. Scalar vs. nonscalar types
      4. Types vs. representations
      5. The TYPE statement
      6. Operators
      7. Type generators
      8. Miscellaneous issues
      9. Concluding remarks
      10. Exercises
      11. Answers
    3. Chapter 3: Types with Inheritance
      1. Why inheritance?
      2. Toward a model of inheritance
      3. Single vs. multiple inheritance
      4. Scalars, tuples, and relations
      5. The running example
      6. More terminology
      7. Substitutability
      8. A BNF grammar
      9. More terminology bis
      10. Concluding remarks
      11. Exercises
      12. Answers
    4. Chapter 4: The Inheritance Model
      1. The IM prescriptions
  9. Part II: Scalar Types, Single Inheritance
    1. Chapter 5: Basic Definitions
      1. IM Prescription 1: Types are sets
      2. IM Prescription 2: Subtypes are subsets
      3. IM Prescription 3: “Subtype of” is reflexive
      4. IM Prescription 4: “Subtype of” is transitive
      5. IM Prescription 5: Proper and immediate subtypes and supertypes
      6. IM Prescription 6: Scalar root and leaf types
      7. IM Prescription 7: Disjoint and overlapping types
      8. Exercises
      9. Answers
    2. Chapter 6: Scalar Values with Inheritance
      1. IM Prescription 8: Common subtypes and supertypes
      2. Common subtypes
      3. Common supertypes
      4. Intersection types vs. union types
      5. Concluding remarks
      6. Exercises
      7. Answers
    3. Chapter 7: Scalar Variables with Inheritance
      1. IM Prescription 9: Model of a scalar variable
      2. Inclusion polymorphism
      3. Implementation versions
      4. Code reuse
      5. Overloading polymorphism
      6. Substitutability
      7. Exercises
      8. Answers
    4. Chapter 8: Specialization by Constraint etc.
      1. IM Prescription 10: Specialization by constraint
      2. Specialization constraints
      3. Specialization by constraint
      4. IM Prescription 11: Assignment with inheritance
      5. Generalization by constraint
      6. Concluding remarks
      7. Exercises
      8. Answers
    5. Chapter 9: Equality Comparisons etc.
      1. IM Prescription 12: Equality with inheritance
      2. IM Prescription 13: Join etc. with inheritance
      3. Equivalence of expressions
      4. Exercises
      5. Answers
    6. Chapter 10: Treating and Type Testing
      1. IM Prescription 14: TREAT
      2. IM Prescription 15: Type testing
      3. Exercises
      4. Answers
    7. Chapter 11: Substitutability
      1. IM Prescription 16: Value substitutability
      2. IM Prescription 17: Operator signatures
      3. IM Prescription 18: Read-only parameters to update operators
      4. IM Prescription 19: Variable substitutability
      5. Exercises
      6. Answers
    8. Chapter 12: Union and Dummy Types
      1. IM Prescription 20: Union and dummy types etc.
      2. Union types
      3. Dummy types
      4. Types alpha and omega
      5. Exercises
      6. Answers
    9. Chapter 13: Interlude: The S by C Controversy
      1. The three out of four “rule”
      2. What does inheritance really mean?
      3. Benefits of S by C
      4. What about objects?
      5. Some implementation considerations
      6. Postscript: A note on foreign keys
  10. Part III: Scalar Types, Multiple Inheritance
    1. Chapter 14: An Overview of Multiple Inheritance
      1. The running example
      2. Possible representations
      3. Possible representations continued
      4. Operators
      5. Type graphs
      6. Two remarks on operator inheritance
      7. IM Prescriptions 1-7 revisited
      8. Type definitions
      9. Exercises
      10. Answers
    2. Chapter 15: IM Prescriptions 8 - 9 Revisited
      1. Least specific common subtypes
      2. Most specific types
      3. Leaf types
      4. Most specific common supertypes
      5. Overlapping regular types
      6. An extended example
      7. Model of a scalar variable
      8. Exercises
      9. Answers
    3. Chapter 16: IM Prescriptions 10 - 20 Revisited
      1. IM Prescriptions 10-15
      2. IM Prescriptions 16-20
      3. Exercises
      4. Answers
  11. Part IV: Tuple and Relation Inheritance
    1. Chapter 17: Tuple / Relation Values with Inheritance
      1. Tuple / relation prescriptions
      2. IM Prescription 21: Empty types
      3. IM Prescription 22: Tuple / relation subtypes and supertypes
      4. IM Prescription 23: Proper and immediate tuple / relation subtypes and supertypes
      5. Exercises
      6. Answers
    2. Chapter 18: Tuple / Relation Values with Inheritance (cont.)
      1. IM Prescription 24: Common tuple / relation subtypes and supertypes
      2. Common tuple subtypes
      3. Common tuple supertypes
      4. Common relation subtypes
      5. Common relation supertypes
      6. Closing remarks
      7. Exercises
      8. Answers
    3. Chapter 19: Tuple / Relation Maximal and Minimal Types etc.
      1. IM Prescription 25: Tuple / relation maximal and minimal types
      2. IM Prescription 26: Tuple / relation root and leaf types
      3. Exercises
      4. Answers
    4. Chapter 20: Tuple / Relation Variables with Inheritance
      1. IM Prescription 27: Tuple / relation most specific types
      2. IM Prescription 28: Model of a tuple / relation variable
      3. IM Prescriptions 11-15 revisited
      4. Exercises
      5. Answers
  12. Part V: Other Approaches
    1. Chapter 21: Structural Inheritance
      1. An introductory example
      2. Tuple types, values, and variables
      3. Subtables and supertables
      4. Scalar types revisited
      5. Structural inheritance for scalar types using the Manifesto model
      6. Postscript: A survey of the literature
      7. Exercises
      8. Answers
    2. Chapter 22: Inheritance in SQL
      1. SQL scalar types without inheritance
      2. SQL nonscalar types without inheritance
      3. The SQL approach to inheritance
  13. Appendixes
    1. Appendix A: Encapsulation Is a Red Herring
      1. What does encapsulation mean?
      2. But what about ad hoc query?
      3. We don’t always want encapsulation
      4. Scalar vs. nonscalar types
      5. Summary
    2. Appendix B: Persistence Not Orthogonal to Type
      1. POTT violates data independence
      2. POTT causes additional complexity
      3. Concluding remarks
      4. Postscript: The first and second manifestos
    3. Appendix C: Glossary of Terms
  14. Footnotes
    1. Preface
    2. Chapter 1: Background
    3. Chapter 2: Types without Inheritance
    4. Chapter 3: Types with Inheritance
    5. Chapter 5: Basic Definitions
    6. Chapter 6: Scalar Values with Inheritance
    7. Chapter 7: Scalar Variables with Inheritance
    8. Chapter 8: Specialization by Constraint etc.
    9. Chapter 9: Equality Comparisons etc.
    10. Chapter 10: Treating and Type Testing
    11. Chapter 11: Substitutability
    12. Chapter 12: Union and Dummy Types
    13. Chapter 13: Interlude: The S by C Controversy
    14. Chapter 14: An Overviewof Multiple Inheritance
    15. Chapter 15: IM Prescriptions 8–9 Revisited
    16. Chapter 16: IM Prescriptions 10–20 Revisited
    17. Chapter 17: Tuple/Relation Values with Inheritance
    18. Chapter 18: Tuple / Relation Valueswith Inheritance (cont.)
    19. Chapter 19: Tuple / Relation Maximaland Minimal Typesetc.
    20. Chapter 20: Tuple / Relation Variables with Inheritance
    21. Chapter 21: Structural Inheritance
    22. Chapter 22: Inheritance in SQL
    23. Appendix A: Encapsulation Isa Red Herring
    24. Appendix B: Persistence Not Orthogonal to Type
  15. Index
  16. Type Inheritance and Relational Theory

Product information

  • Title: Type Inheritance and Relational Theory
  • Author(s): C.J. Date
  • Release date: September 2016
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491959992