INF1343, Winter 2011 Data Modeling and Database Design Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.

Slides:



Advertisements
Similar presentations
Three-Step Database Design
Advertisements

RDF and RDB 1 Some slides adapted from a presentation by Ivan Herman at the Semantic Technology & Business Conference, 2012.
Management Information Systems, Sixth Edition
ETEC 100 Information Technology
3-1 Chapter 3 Data and Knowledge Management
“DOK 322 DBMS” Y.T. Database Design Hacettepe University Department of Information Management DOK 322: Database Management Systems.
Managing & Integrating Enterprise Data with Semantic Technologies Susie Stephens Principal Product Manager, Oracle
Information storage: Introduction of database 10/7/2004 Xiangming Mu.
GRITS Working with AVM Data Astronomy Visualization Metadata June 11th, 2010 Casey Rosenthal
XML Overview. Chapter 8 © 2011 Pearson Education 2 Extensible Markup Language (XML) A text-based markup language (like HTML) A text-based markup language.
Entity Recognition via Querying DBpedia ElShaimaa Ali.
Concepts and Terminology Introduction to Database.
MIS 327 Database Management system 1 MIS 327: DBMS Dr. Monther Tarawneh Dr. Monther Tarawneh Week 2: Basic Concepts.
Intro – Part 2 Introduction to Database Management: Ch 1 & 2.
Database Basics BCIS 3680 Enterprise Programming.
Chapter 3: Relational Databases
ORM Basics Repository Pattern, Models, Entity Manager Ivan Yonkov Technical Trainer Software University
XML 1. Chapter 8 © 2013 Pearson Education, Inc. Publishing as Prentice Hall SAMPLE XML SCHEMA (XSD) 2 Schema is a record definition, analogous to the.
Fall CIS 764 Database Systems Engineering L11: Object Relational Mapping … (a) ORM, Object persistence (b) Pets sequence.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
CCT395, Week 4 Database Design and ER Modeling This presentation is licensed under Creative Commons Attribution License, v To view a copy of this.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT395, Week 12 Storage, Grid Computing, Review This presentation is licensed under Creative Commons Attribution License, v To view a copy of this.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
INF1343, Week 6 Implementing a Database with SQL This presentation is licensed under Creative Commons Attribution License, v To view a copy of this.
CCT395, Week 11 Review, Permissions Physical Storage and Performance This presentation is licensed under Creative Commons Attribution License, v. 3.0.
CCT395, Week 6 Implementing a Database with SQL and a Case Study Exercise This presentation is licensed under Creative Commons Attribution License, v.
Management Information Systems by Prof. Park Kyung-Hye Chapter 7 (8th Week) Databases and Data Warehouses 07.
CCT395, Week 2 Introduction to SQL Yuri Takhteyev September 15, 2010
Geographic Information Systems GIS Data Databases.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
INF1343, Week 4 Database Design and ER Modeling This presentation is licensed under Creative Commons Attribution License, v To view a copy of this.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
CCT395, Week 5 Translating ER into Relations; Normalization This presentation is licensed under Creative Commons Attribution License, v To view a.
CCT395, Week 7 SQL with PHP This presentation is licensed under Creative Commons Attribution License, v To view a copy of this license, visit
INF1343, Winter 2011 Data Modeling and Database Design Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
Databases and the MVC Model
CIS 336 AID Your Dreams Our Mission/cis336aid.com
Translating ER into Relations; Normalization
Review Databases and Objects
Databases – Exam questions
An Introduction to database system
Special Topics in CCIT: Databases
CCT1343, Week 2 Single-Table SQL Yuri Takhteyev University of Toronto
RDF and RDB 1 Some slides adapted from a presentation by Ivan Herman at the Semantic Technology & Business Conference, 2012.
MongoDB Er. Shiva K. Shrestha ME Computer, NCIT
Database Management:.
Information Systems Today: Managing in the Digital World
Database Design and Implementation
Data Modeling and Database Design
Data Modeling and Database Design INF1343, Winter 2012 Yuri Takhteyev
Database Design and Implementation
Microsoft Access 2003 Illustrated Complete
Data Modeling and Database Design INF1343, Winter 2012 Yuri Takhteyev
Databases.
MANAGING DATA RESOURCES
Semi-Structured data (XML Data MODEL)
Data Model.
Databases and Information Management
Database Design Hacettepe University
CMPE/SE 131 Software Engineering March 9 Class Meeting
Databases and the MVC Model
Database Management Systems
Triple Stores.
Geographic Information Systems
Presentation transcript:

INF1343, Winter 2011 Data Modeling and Database Design Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution License, v To view a copy of this license, visit This presentation incorporates images from the Crystal Clear icon collection by Everaldo Coelho, available under LGPL from

Week 9 Databases and Objects (after reviewing old material)

Schedule Intro SQL Design Interfacin g Security XML Objects Storage Scale April 4: Final exam

Final Exam Skills: weeks 1-6 (SQL, ER, translation, normalization) Concepts: weeks 1-12 E.g.: “Why does XML have to do with databases?”

ER Relational XML RDF OO

Relational vs ER Relational: relations (tables), records (rows), fields, PKs, FKs. ER: entities, attributes, relationships.

Relational vs ER ER: Conceptual + a visual language Relational: Physical / conceptual RM is more flexible. (Not necessarily a good thing!) Can translate from ER into RM. (Not always the other way around!)

ER → RM Translation entities → relations (tables) instances → records (rows) attributes → fields relationships → PK/FK constraints

Limitations Dually mandatory relationships become problematic in RM. buildingroom

Limitations No easy way to represent the mandatory “many” end. buildingroom homeworldcharacterbuildingroom ✓ ✗

Comments on ER - Reality vs representation - Duplication of information - Determining an instance vs a set

Comments on RM - Candidate keys - Tables without PKs - 1NF, 2NF, 3NF 1NF: letter vs spirit; repeated values vs free form 2NF: dependency on a part the PK country_code → country_name 3NF: dependency on non-key attributes series_code → series_name, target, goal series_name → target, goal target → goal

ER Relational XML RDF OO

RM vs XML RM: simple records advantage: ease of retrieval, consistency XML: complex documents advantage: exchange / serialization JSON, YAML: a similar data model to XML, different serialization syntax DB1 XML (often over HTTP)

SQL Support in RDBMS Direct XML export mysql --xml -e "use starwars; select * from persona;" mysqldump --xml starwars Direct XML import LOAD XML command in MySQL 5.1 (to be installed soon). Storing XML as a data type Available in some systems, includes (some) XPATH support. (Not in MySQL 5.1, but you can store XML in a BLOB.)

ER Relational XML RDF OO

The Web of Data Modest: Exchanging data via HTTP in XML “APIs”, “Open data”, e.g.: command=predictions&a=ttc&r=510&s=spadsuss_n Ambitious: Same, but interlinked. “Semantic web” RDF: metadata in “triple” foaf: ObiWan a foaf:Person ObiWan foaf:knows Yoda SPARQL – a bit like SQL adapted for RDF

Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch.

ER Relational XML RDF OO

Objects The “native” data format for many programming languages. Classes vs instances (cf. ER) Attributes vs Methods student. _address student.send_ (message) Encapsulation

DB the “Dumb” Way cursor=db.cursor() query = TEMPLATE % species cursor.execute(query); rows = cursor.fetchall() print " " for row in rows: print " " for x in [0,1,3]: print " ", row[x], " " print " "

DB the “Dumb” Way cursor=db.cursor() query = TEMPLATE % species cursor.execute(query); rows = cursor.fetchall() print " " for row in rows: print " " for x in [0,1,3]: print " ", row[x], " " print " "

DB the OO Way results=db.find_species(species) print " " for result in results: print " " print " ", result.name, " " print " ", result.size, " " print " ", result.gender, " " print " "

ER Relational XML RDF OO

Object-Relational Mapping Option 1: Map objects to relations (code → database) Option 2: Map relations to objects (database → code)

Option 2 Manual: We setup a mapping pet.name → getName($name) setName($name) Automatic: The software figures it out (“introspection”)

Examples Rails / ActiveRecord (Ruby) Django (Python) Hibernate (Java) Doctrine (PHP)

Django Defining the model in Python: /django/mysite/books/models. py

Django Using the model: cd /django/mysite python manage.py shell In the Python console: from books.models import Publisher p = Publisher(name="U of T Press", city="Toronto", country="Canada") p.save()

Django from books.models import Publisher p = Publisher(name="Spadina Press", city="Toronto", country="Canada") p.save() results = Publisher.objects.filter( country="Canada") for x in results : print "%s (%s)" % (x.name, x.city)

Questions?