Lecture 3: Object Concepts as Categories Nick Rossiter, Computing Science, Newcastle University, England

Slides:



Advertisements
Similar presentations
Four-level Architecture for Closure in Interoperability EFIS, 17th-18th July 2003 Nick Rossiter & Michael Heather Informatics, Northumbria University
Advertisements

© 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev.
Review for Final Exam Lecture Week 14. Problems on Functional Dependencies and Normal Forms.
The Relational Model System Development Life Cycle Normalisation
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Relations.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
Normalization I.
1 Category Theory in a ( E,M ) -category Some aspects of category theory, in particular related to universality, can be developed in any finitely complete.
Functions, Sequences, and Sums
ER- and EER-to-Relational Mapping
Module Title? DBMS E-R Model to Relational Model.
Web-Enabled Decision Support Systems
Solving fixpoint equations
CS-1Q IM Revision 21 January Revision CS-1Q IM Lecture 10 Phil Gray Simon Gay.
Module #18: Relations, part I
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 3/1 Copyright © 2004 Please……. No Food Or Drink in the class.
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Database Systems Lecture # 7 8 th Feb, Conceptual and Logical Design Person buys Product name pricenamessn Conceptual Model: Relational Model: (plus.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Categories and Computer Science
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 Domain Classes.
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (2)
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Introduction.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
1 The Contravariancy of Anticipatory Systems Dimitrios Sisiaridis, Michael Heather & Nick Rossiter Northumbria University, Newcastle NE2 1XE, UK Symposium.
The Representation of Reality in Computational Form Nick Rossiter Visiting Fellow with Michael Heather and Dimitrios Sisiaridis Computing, Engineering.
1 Introduction to modeling ER modelling Slides for this part are based on Chapters 8 from Halpin, T. & Morgan, T. 2008, Information Modeling and Relational.
Lecture 2: Introduction to Category Theory Nick Rossiter, Computing Science, Newcastle University, England
Strings and Languages CS 130: Theory of Computation HMU textbook, Chapter 1 (Sec 1.5)
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Databases Illuminated Chapter 3 The Entity Relationship Model.
Computing & Information Sciences Kansas State University Friday, 26 Jan 2008CIS 560: Database System Concepts Lecture 2 of 42 Friday, 29 August 2008 William.
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
9/23/2012ISC329 Isabelle Bichindaritz1 Normalization.
Balanced Category Theory Claudio Pisani Calais, June 2008.
1 Typing in Information Systems Nick Rossiter, Michael Heather Computer Science and Digital Technologies Northumbria University, Newcastle NE1 8ST, UK.
The theory behind Functional Programming Functional: based on lambda calculus / combinators, recursion theory, category theory. By contrast with other.
advanced data modeling
Problem Statement How do we represent relationship between two related elements ?
Dr Gordon Russell, Napier University Data Analysis 1 - V2.0 1 Data Analysis 1 Unit 2.1.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
Fundamentals, Design, and Implementation, 9/e Appendix B The Semantic Object Model.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
ECE DIGITAL LOGIC LECTURE 6: BOOLEAN ALGEBRA Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 02/01/2016.
Introduction to modeling
© D. Wong Functional Dependencies (FD)  Given: relation schema R(A1, …, An), and X and Y be subsets of (A1, … An). FD : X  Y means X functionally.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Normalization and FUNctional Dependencies. Redundancy: root of several problems with relational schemas: –redundant storage, insert/delete/update anomalies.
Discrete Mathematics Lecture # 17 Function. Relations and Functions  A function F from a set X to a set Y is a relation from X to Y that satisfies the.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
Normalization.
CS 480: Database Systems Lecture 22 March 6, 2013.
CS100: Discrete structures
Overview of Entity‐Relationship Model
How to test Whether Subschemes in BCNF??
Discrete Math (2) Haiming Chen Associate Professor, PhD
Practical Relevance Examples Class Laboratory
Math/CSE 1019N: Discrete Mathematics for Computer Science Winter 2007
Conditions for Interoperability
Introduction to modeling
The Process Semantics of Time and Space as Anticipation
Presentation transcript:

Lecture 3: Object Concepts as Categories Nick Rossiter, Computing Science, Newcastle University, England

Introduction Look at use of categories for application: –Modelling of object information systems Introduce further categorical constructions: –Functors –Cartesian Closed Categories –Natural Transformations

Classes as Categories Classes have –identifiers: represented by a categorical object –attributes: represented by an arrow from the identifier (as source) to each attribute (as target) arrows of type assignment arrows can be monic or epic

Classes as Categories -- Methods –methods: represented by arrows from one or more attributes to another attribute. arrows of type function We define the Category Class in the universal category Set to have the above constructions.

Example Class Category Studentd ependency function StudentIdStudentName {Module Module Title Mark} AverageMark Will structure some of this later as pullback (N:M)

Example Class - Observations StudentId is initial object of category Identifiers/keys are usually initial objects No terminal object as it stands StudentId StudentName is not monic nor epic Module ModuleTitle is monic (1:1)

Example Class - Types The class category Student forms one type for use elsewhere in the system Arrows are also typed e.g. –Module ModuleTitle is monic –StudentId is in the domain available for student identifiers in the discrete category S: s: SStudentId (or s:1 S StudentId) There must be a mapping for the instance s from the discrete category S to StudentId

Constraints: Example of Keys Constraints such as normalization tests can be applied e.g. Boyce-Codd Normal Form (BCNF) For a relation, say R(a,b,c,d), can determine the candidate keys from the given (non- trivial) functional dependencies. Can then test whether every determinant (source of non-trivial functional dependency) is a candidate key

Procedure for Normalization Test 1 Take category CLASS Transform CLASS to POS where: –the objects are the powerset of those in CLASS –the arrows are the orderings by projection (trivial functional dependencies) Create a category DEP holding the non- trivial functional dependencies. Embed POS and DEP in a category PRJ

Procedure for Normalization Test 2 Determine limit of singleton attributes in PRJ (greatest lower bound) if it exists If no limit, determine maximal lower bounds. Assign limit or maximal lower bounds to candidate key.

Example of Normalization Test 1 CLASS: objects a,b,c, arrow a b identity arrows for each object POS: objects powerset of a,b,c (2 3 ) arrows trivial dependencies as projections

Example of Normalization Test 2 PRJ: as POS but with addition of non- trivial dependency ab empty {a} {b}{c} {a,b}{a,c}{b,c} trivial {a,b,c} non-trivial

Example of Normalization Test 3 Let Y = {{a}, {b}, {c}} (singleton attributes) Limit Y = {a,c} (greatest lower bound) Candidate key = {a,c} Determinant = {a} So not BCNF as not every determinant is a candidate key.

Further Category Constructions: The Functor Categories are mapped from one to another by a higher-order function called a Functor. A functor F maps from category A to B by: –assigning each F(a) to B –assigning each F(f) to B where a is an object in A and f is an arrow in A

Functors Preserve Composition F(f 1 ) o F(f 2 ) = F(f 1 o f 2 ) F c= F(c) fhF(f)F(h) ba F(b)F(a) g F(g)

Functors Preserve Identities Functors preserve identities: F(1 a ) = 1 F(a) That is: F (1 a : a a) = 1 F(a) : F(a) F(a)

Functors are Arrows They are composable F : A B G: BC CH = G o F G H BA F

Functors are Associative Their evaluation is associative. The order of evaluation of three or more composed functors does not matter

Scope of Functors Can preserve source category structure in target category: F: A B Full and faithful functor: A,B same structure

Free Functors Can assign additional structures For example assign to each set its powerset (all combinations): POWER: CLASSPOS assigns the powerset of the set, say Y, in CLASS to POS. Free functor

Forgetful Functors Can forget structure For example forget set functions in a Set category. REMOVE_FUNCTIONS: Set Discrete Underlying (Forgetful) functor Returns elements only

Functors for Embedding The functors EMBED1: POSPRJ EMBED2: DEPPRJ embed the arrows of POS and DEP in PRJ. Inclusion functor

Identity Functor Can identify a category 1 A : AA 1 A is identity functor for category A

Relationships between Classes Association: by pullback Student pi l f Student x mark ExamMark pi r g Exam

Semantics of Pullbacks Gives constraints of entity-relationship modelling of relationships: –cardinality of 1:1, 1:N, N:M –mandatory or optional participation –can paste together pullbacks to give n-ary relationships –colimit of diagram includes the link object, the name of which appears as the product suffix

Inheritance Through coproducts: as cone Manager+Employee ManagerEmployee

Inheritance as Commuting Diagram More detailed representation as commuting diagram fManager i l UManager+ gi r Employee Employee Gives unqualified union (U is universal object)i l o f = i r o g

Cartesian Closed Categories Widespread use in computing science A Cartesian closed category has: –a terminal object –products –exponentials (connectivity - no discrete objects)

Examples Cartesian Closed The diagrams for products, coproducts, pullbacks and pushouts are examples of Cartesian closed categories Further example: A A X B X C Bemptyset C has products, terminal object (empty set) and connectivity (no discrete objects)

Object Instantiation The Extension -- the category OBJECT representing the objects associated with each category Functors relate intension to extension: Data: CLASSOBJECT and extension to intension: Name: OBJECT CLASS

Constraints with Functors The functors preserve types, composition, identities and limits of the intension in the extension. P o E = ITYPE E = Name P I CLASSOBJECT E

Information System Queries D : CLASS OBJECT D is database with CLASS as intension and OBJECT as extension Query q on D returns subset of database DS with intension CLASSDS and extesnion OBJECTDS: DS : CLASSDS OBJECTDS

Query DS Query is: q: DS D DS is subset of D Both DS and D are functors

Natural Transformation q is natural transformation as it maps from one functor to another Functors must be of similar type Assigns underlying categorical objects and arrows of one functor to another

Simple View D CLASS OBJECT q CLASSDSOBJECTDS DS

Details of Natural Transformation DS(source(f)) q a D(source(f)) DS(f)D(f) DS(target(f))q b D(target(f)) For each f in CLASSDS, the equation: D(f) o q a = q b o DS(f)must hold

Further Reading Categories for the Working Mathematician Mac Lane, Saunders 2nd edition Springer-Verlag (1998). Prototyping a Categorical Database in P/FDM, Nelson, D A, & Rossiter, B N, Proc. 2nd Int. Workshop Advances in Databases and Information Systems (ADBIS'95), Moscow, June 1995, Springer-Verlag Workshops in Computing, ISBN , (1996).