Data Integration. Lecture 23. Instructor: Sudeepa Roy. CompSci 516 Data Intensive Computing Systems. CompSci 516: Data Intensive Computing Systems

Similar documents
. Relation and attribute names: The relation and attribute names in the mediated. Describing Data Sources. 3.1 Overview and Desiderata

Figure 5.1: Query processing in a data integration system. This chapter focuses on the reformulation step, highlighted in the dashed box.

Announcements. Reading Material. Recap. Today 9/17/17. Storage (contd. from Lecture 6)

Lecture 3 SQL - 2. Today s topic. Recap: Lecture 2. Basic SQL Query. Conceptual Evaluation Strategy 9/3/17. Instructor: Sudeepa Roy

Lecture 2 SQL. Announcements. Recap: Lecture 1. Today s topic. Semi-structured Data and XML. XML: an overview 8/30/17. Instructor: Sudeepa Roy

Announcement. Reading Material. Overview of Query Evaluation. Overview of Query Evaluation. Overview of Query Evaluation 9/26/17

By Robin Dhamankar, Yoonkyong Lee, AnHai Doan, Alon Halevy and Pedro Domingos. Presented by Yael Kazaz

Lecture 3 More SQL. Instructor: Sudeepa Roy. CompSci 516: Database Systems

CompSci 516 Database Systems. Lecture 2 SQL. Instructor: Sudeepa Roy

CSC 261/461 Database Systems Lecture 19

Database Heterogeneity

INSTITUTO SUPERIOR TÉCNICO Gestão e Tratamento de Informação

DSE 203 DAY 1: REVIEW OF DBMS CONCEPTS

Introduction to database design

Lecture 5 Design Theory and Normalization

CompSci 516 Data Intensive Computing Systems

Lecture 2 SQL. Instructor: Sudeepa Roy. CompSci 516: Data Intensive Computing Systems

Storage and Indexing

CompSci 516: Database Systems. Lecture 20. Parallel DBMS. Instructor: Sudeepa Roy

CompSci 516: Database Systems

Databases and Information Retrieval Integration TIETS42. Kostas Stefanidis Autumn 2016

CS143: Relational Model

Introduction to Databases, Fall 2005 IT University of Copenhagen. Lecture 2: Relations and SQL. September 5, Lecturer: Rasmus Pagh

Announcements. Reading Material. Today. Different File Organizations. Selection of Indexes 9/24/17. CompSci 516: Database Systems

Today s topics. Null Values. Nulls and Views in SQL. Standard Boolean 2-valued logic 9/5/17. 2-valued logic does not work for nulls

CSC 261/461 Database Systems Lecture 5. Fall 2017

CISC 3140 (CIS 20.2) Design & Implementation of Software Application II

Databases - Relations in Databases. (N Spadaccini 2010) Relations in Databases 1 / 16

CompSci 516: Database Systems

CS 4320/5320 Homework 2

L12: ER modeling 5. CS3200 Database design (sp18 s2) 2/22/2018

Announcements If you are enrolled to the class, but have not received the from Piazza, please send me an . Recap: Lecture 1.

imap: Discovering Complex Semantic Matches between Database Schemas

Tutorial 2: Relational Modelling

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

Databasesystemer, forår 2005 IT Universitetet i København. Forelæsning 8: Database effektivitet. 31. marts Forelæser: Rasmus Pagh

Modern Database Systems CS-E4610

CS317 File and Database Systems

Introduction to Information Systems

Information Retrieval

Mini-Project, Exam, Etc

CompSci 516 Data Intensive Computing Systems. Lecture 11. Query Optimization. Instructor: Sudeepa Roy

Introduction to Database Systems CSE 444. Lecture #1 March 26, 2007

CSE-6490B Final Exam

Outline. Database Management Systems (DBMS) Database Management and Organization. IT420: Database Management and Organization

CS425 Midterm Exam Summer C 2012

Exam Marco Kuhlmann. This exam consists of three parts:

download instant at The Relational Data Model

Lecture 8 Index (B+-Tree and Hash)

Overview of the Class and Introduction to DB schemas and queries. Lois Delcambre

Relational Model, Relational Algebra, and SQL

9/8/2018. Prerequisites. Grading. People & Contact Information. Textbooks. Course Info. CS430/630 Database Management Systems Fall 2018

CompSci 516 Database Systems

CompSci 516: Database Systems

Data Integration Systems

Relational Database Systems 1

Introduction to Data Management. Lecture #4 (E-R Relational Translation)

In-class activities: Sep 25, 2017

Estimating the Quality of Databases

Database Technology Introduction. Heiko Paulheim

Information Retrieval CSCI

Fundamentals of Databases

Database Systems CSE 414

Administrivia. The Relational Model. Review. Review. Review. Some useful terms

Relational Model & Algebra. Announcements (Tue. Sep. 3) Relational data model. CompSci 316 Introduction to Database Systems

Data Integration: Querying Heterogeneous Information Sources Using Source Descriptions & Data Integration: The Teenage Years

CSE 154, Autumn 2012 Final Exam, Thursday, December 13, 2012

Please pick up your name card

CS W Introduction to Databases Spring Computer Science Department Columbia University

Information Systems for Engineers. Exercise 10. ETH Zurich, Fall Semester Hand-out Due

Conceptual Data Models for Database Design

Distributed Data Management

CSCI-6421 Final Exam York University Fall Term 2004

Database System Concepts and Architecture

Introduction to Data Management. Lecture #1 (Course Trailer ) Instructor: Chen Li

Relational Model and Algebra. Introduction to Databases CompSci 316 Fall 2018

Part I: Data Mining Foundations

Project Revision. just links to Principles of Information and Database Management 198:336 Week 13 May 2 Matthew Stone

TIM 50 - Business Information Systems

Lecture 13: Analysis Modeling

CS157a Fall 2018 Sec3 Home Page/Syllabus

CMPT 354: Database System I. Lecture 5. Relational Algebra

Introduction to Data Management. Lecture #4 (E-R à Relational Design)

2. E/R Design Considerations

Course Outline and Objectives: Database Programming with SQL

Lecture 10 - Chapter 7 Entity Relationship Model

Introduction to Data Management. Lecture 16 (SQL: There s STILL More...) It s time for another installment of...

Chapter 11 Databases. Computer Concepts 2013

Data about data is database Select correct option: True False Partially True None of the Above

TIM 50 - Business Information Systems

Computer-based Tracking Protocols: Improving Communication between Databases

CS430/630 Database Management Systems Spring, Betty O Neil University of Massachusetts at Boston

The Relational Model

CPSC 340: Machine Learning and Data Mining. Non-Parametric Models Fall 2016

Conceptual Design. The Entity-Relationship (ER) Model

Database Applications (15-415)

Part 11: Collaborative Filtering. Francesco Ricci

Polls on Piazza. Open for 2 days Outline today: Next time: "witnesses" (traditionally students find this topic the most difficult)

IBM InfoSphere Information Server Version 8 Release 7. Reporting Guide SC

Transcription:

CompSci 516 Data Intensive Computing Systems Lecture 23 Data Integration Instructor: Sudeepa Roy Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 1

Announcements No class next week thanksgiving recess! We meet again on 11/30 (Wed) Final report first draft due on 11/28 (Mon) night but can update until Friday 12/2 night send me an email if you update I will post a message on piazza looking for three groups who will present on 11/30 (Wed) the remaining seven groups present on 12/2 (Fri) 10 minutes talk/demo for each group (8 mins talk + 2 mins questions) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 2

Today s topic An overview of data integration Some optional additional slides at the end Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 3

Reading Material Optional Reading: The Principles of Data Integration book by AnHai Doan, AlonHalevy, Zack Ives The lecture slides are based on Ch. 1, 3, 5 of this book Data integration PODS 2005 tutorial by Phokion Kolaitis (more on the theoretical aspects ) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 4

What is Data Integration? 1/2 Internet and WWW have revolutionized people s access to digital data We take it for granted that a search query into a browser taps into millions on documents and databases and returns what we are looking for Systems on the Internet must efficiently and accurately process and serve a large amount pf data Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 5

What is Data Integration? 2/2 Unlike traditional RDBMS, the new services need the ability to Share data among multiple organizations Integrate data on a flexible and efficient fashion Data integration: A set of techniques that enable building systems geared for flexible sharing and integration of data across multiple autonomous data providers. Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 6

Why data integration? 1/2 With issues like normalizations, and trade-offs in design choices, different people design different schemas for the same data Sometimes different needs as well not all attributes are needed by all people Sometimes people want to share their data collaborators researchers who want to publish data for others use Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 7

Why data integration? 2/2 In the Web, Many websites posting job applications, hotel or flight deals, movie information To keep up with new information and for new need, you may have to look at all of them But now there are websites where you can access all e.g. TripAdvisor helps you see the price of the same hotel on the hotel website, hotels.com, booking.com, expedia,. But this type of data integration has its challenges too Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 8

Why data integration? 2/2 In the Web, Many websites posting job applications, hotel or flight deals, movie information To keep up with new information and for new need, you may have to look at all of them But now there are websites where you can access all e.g. TripAdvisor helps you see the price of the same hotel on the hotel website, hotels.com, booking.com, expedia,. But this type of data integration has its challenges too Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 9

Challenges in Data Integration: 1. Query Offer uniform access to a set of autonomous and heterogeneous data sources Query: query disparate data sources, sometimes update them Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 10

Challenges in Data Integration: Number of sources: 2. Number of sources challenging even for 10 or 2 data sources amplified for hundreds of sources say in Webscale Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 11

Challenges in Data Integration: Heterogeneity: 3. Heterogeneity data sources were developed independently of each other databases, files, html different schema and references some structured some unstructured Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 12

Challenges in Data Integration: Autonomy: 4. Autonomy the sources may not belong to the same administrative entity even then may be run by different organizations may not have full access to the data there may be privacy concerns the sources may change their formats and access patterns at any time without notifying Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 13

Virtual Data Integration Architecture Wrapper Mediated Schema Wrapper Three components Data sources Wrappers Mediated Schema Wrapper Wrapper RDBMS 1 RDBMS 2 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 14

Virtual Data Integration Architecture Wrapper Mediated Schema Wrapper Wrapper Wrapper Data sources can be any data model like relational dbms with SQL interface XML with Xquery interface HTML RDBMS 1 RDBMS 2 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 15

Virtual Data Integration Architecture Wrapper Mediated Schema Wrapper Wrapper Wrapper Wrappers programs that send queries to a data source receives answers apply some basic transformations e.g. to a web form source translate query to a http request with a url when the answer comes back as an html file, extract tuples RDBMS 1 RDBMS 2 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 16

Virtual Data Integration Architecture Wrapper Mediated Schema Wrapper Wrapper Wrapper Mediated schema built for the data integration application contains only the aspects that are relevant may not contain all attrbutes does not store any data typically logical schema for posing queries by the users RDBMS 1 RDBMS 2 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 17

Source Descriptions Wrapper Mediated Schema Wrapper Wrapper Wrapper Specify the property of the sources that the system needs to know main components are semantic mappings relate the schema of the sources to the attributes in the mediated schema specified declaratively between data sources and mediated schema not between two sources also specifies whether sources are complete or not limited access patterns to sources RDBMS 1 RDBMS 2 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 18

source S2 may not contain all the movie showing times in the entire country source S3 may be known to contain all movie showing times in New York in order to get an answer from the source S1, there needs to be an input for at least one of its attributes Example Movie: Title, director, year, genre Actors: title, actor Plays: movie, location, starttime Reviews: title, rating, description Movies name, actors, director, genre Cinemas place, movie, start Cinemas in NYC cinema, title, starttime Cinemas in SF location, movie, startingtime Reviews title, date, grade, review S1 S2 S3 S4 S5 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 19

Example: Query on the Mediated Schema SELECT title, starttime FROM Movie, Plays WHERE Movie.title = Plays.movie AND location="new York" AND director="woody Allen" Movie: Title, director, year, genre Actors: title, actor Plays: movie, location, starttime Reviews: title, rating, description show times of movies in NYC directed by Woody Allen Movies name, actors, director, genre Cinemas place, movie, start Cinemas in NYC cinema, title, starttime Cinemas in SF location, movie, startingtime Reviews title, date, grade, review S1 S2 S3 S4 S5 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 20

S2: may not contain all the movie showing times in the entire country S3: known to contain all movie times in NYC S1: to get an answer there needs to be an input for at least one of its attributes Example: Reformulation on source databases: 1/5 Tuples for Movie can be obtained from source S1 but the attribute title needs to be reformulated to name SELECT title, starttime FROM Movie, Plays WHERE Movie.title = Plays.movie AND location="new York" AND director="woody Allen" Movie: Title, director, year, genre Actors: title, actor Plays: movie, location, starttime Reviews: title, rating, description Movies name, actors, director, genre Cinemas place, movie, start Cinemas in NYC cinema, title, starttime Cinemas in SF location, movie, startingtime Reviews title, date, grade, review S1 S2 S3 S4 S5 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 21

S2: may not contain all the movie showing times in the entire country S3: known to contain all movie times in NYC S1: to get an answer there needs to be an input for at least one of its attributes Example: Reformulation on source databases: 2/5 Tuples for Plays can be obtained from either source S2 or S3 Since the latter is complete for showings in NYC, we choose it over S2 SELECT title, starttime FROM Movie, Plays WHERE Movie.title = Plays.movie AND location="new York" AND director="woody Allen" Movie: Title, director, year, genre Actors: title, actor Plays: movie, location, starttime Reviews: title, rating, description Movies name, actors, director, genre Cinemas place, movie, start Cinemas in NYC cinema, title, starttime Cinemas in SF location, movie, startingtime Reviews title, date, grade, review S1 S2 S3 S4 S5 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 22

S2: may not contain all the movie showing times in the entire country S3: known to contain all movie times in NYC S1: to get an answer there needs to be an input for at least one of its attributes SELECT title, starttime FROM Movie, Plays WHERE Movie.title = Plays.movie AND location="new York" AND director="woody Allen" Movie: Title, director, year, genre Actors: title, actor Plays: movie, location, starttime Reviews: title, rating, description Example: Reformulation on source databases: 3/5 Source S3 requires the title of a movie as input but such a title is not specified in the query Movies name, actors, director, genre the query plan must first access source S1 then feed the movie titles returned from S1 as inputs to S3 Cinemas place, movie, start Cinemas in NYC cinema, title, starttime Cinemas in SF location, movie, startingtime Reviews title, date, grade, review S1 S2 S3 S4 S5 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 23

S2: may not contain all the movie showing times in the entire country S3: known to contain all movie times in NYC S1: to get an answer there needs to be an input for at least one of its attributes Example: Reformulation on source databases: 4/5 Options of logical query plan: access S1, S3 could access S1 then S2 as well (possibly not complete) SELECT title, starttime FROM Movie, Plays WHERE Movie.title = Plays.movie AND location="new York" AND director="woody Allen" Movie: Title, director, year, genre Actors: title, actor Plays: movie, location, starttime Reviews: title, rating, description Then query optimization as in traditional database system take a logical plan output a physical plan Movies name, actors, director, genre Cinemas place, movie, start Cinemas in NYC cinema, title, starttime Cinemas in SF location, movie, startingtime Reviews title, date, grade, review S1 S2 S3 S4 S5 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 24

S2: may not contain all the movie showing times in the entire country S3: known to contain all movie times in NYC S1: to get an answer there needs to be an input for at least one of its attributes Example: Reformulation on source databases: 5/5 Then query execution execute the physical query plan May ask the optimizer to reconsider the plan (unlike RDBMS), e.g. if S3 is too slow SELECT title, starttime FROM Movie, Plays WHERE Movie.title = Plays.movie AND location="new York" AND director="woody Allen" Movie: Title, director, year, genre Actors: title, actor Plays: movie, location, starttime Reviews: title, rating, description sometimes contingencies are included in original plan tradeoff between complexity of plan and ability to respond to unexpected events Movies name, actors, director, genre Cinemas place, movie, start Cinemas in NYC cinema, title, starttime Cinemas in SF location, movie, startingtime Reviews title, date, grade, review S1 S2 S3 S4 S5 Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 25

Schema Mapping should handle the discrepancies between source and the mediated schema: 1/4 Relation and attribute names description in the mediated schema (MS) the same as review in S5 name of Actors in MS and is S3 in NYCCinemas are not the same Movie: Title, director, year, genre Actor: title, name Plays: movie, location, starttime Reviews: title, rating, description Mediated schema S7: MovieYears(title, year) S1: Actor (AID, firstname, lastname, nationality, yearof Birth) Movie (MID, title), AcrtorPlays(AID, MID) MovieDetail (MID, directorm genre, year) S2: Cinemas(place, movie, start) S3: NYCCinemas(name, title, starttime) S4: Reviews(title, date, grade, review) S5: MovieGenres(title, genre) S6: MovieDirectors(title, dir) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 26

Schema Mapping should handle the discrepancies between source and the mediated schema: 2/4 Tabular organization In MS, Actor stores movie title and actor name In S1, a join is needed that has to be specified by the mapping Movie: Title, director, year, genre Actor: title, name Plays: movie, location, starttime Reviews: title, rating, description Mediated schema S7: MovieYears(title, year) S1: Actor (AID, firstname, lastname, nationality, yearof Birth) Movie (MID, title), AcrtorPlays(AID, MID) MovieDetail (MID, directorm genre, year) S2: Cinemas(place, movie, start) S3: NYCCinemas(name, title, starttime) S4: Reviews(title, date, grade, review) S5: MovieGenres(title, genre) S6: MovieDirectors(title, dir) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 27

Schema Mapping should handle the discrepancies between source and the mediated schema: 3/4 Domain coverage the coverage and level of detail may differ S1 stores more info about actors than in MS Movie: Title, director, year, genre Actor: title, name Plays: movie, location, starttime Reviews: title, rating, description Mediated schema S7: MovieYears(title, year) S1: Actor (AID, firstname, lastname, nationality, yearof Birth) Movie (MID, title), AcrtorPlays(AID, MID) MovieDetail (MID, directorm genre, year) S2: Cinemas(place, movie, start) S3: NYCCinemas(name, title, starttime) S4: Reviews(title, date, grade, review) S5: MovieGenres(title, genre) S6: MovieDirectors(title, dir) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 28

Schema Mapping should handle the discrepancies between source and the mediated schema: 3/4 Data level variations GPA as a letter grade vs. a numeric score of 4.0 scale S1 stores actor names in two columns, MS stores in one Movie: Title, director, year, genre Actor: title, name Plays: movie, location, starttime Reviews: title, rating, description Mediated schema S7: MovieYears(title, year) S1: Actor (AID, firstname, lastname, nationality, yearof Birth) Movie (MID, title), AcrtorPlays(AID, MID) MovieDetail (MID, directorm genre, year) S2: Cinemas(place, movie, start) S3: NYCCinemas(name, title, starttime) S4: Reviews(title, date, grade, review) S5: MovieGenres(title, genre) S6: MovieDirectors(title, dir) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 29

Three Desired Properties of Schema Mapping Languages 1/3 Flexibility significant differences between disparate schemas the languages should be very flexible should be able to express a wide variety of relationships between schemas Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 30

Three Desired Properties of Schema Mapping Languages 2/3 Efficient reformulation our goal is to use the schema mapping to reformulate queries we should be able to develop reformulation algorithms whose properties are well understood and are efficient in practice often competes with flexibility, because more expressive languages are typically harder to reason about Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 31

Three Desired Properties of Schema Mapping Languages 3/3 Easy update for a formalism to be useful in practice, it needs to be easy to add and remove sources If adding a new data source potentially requires inspecting all other sources, the resulting system will be hard to manage for a large number of sources Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 32

Three standard schema mapping languages 1. Global-as-View (GAV) 2. Local-as-View (LAV) 3. Global-Local-as-View (GLAV) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 33

Global-as-View (GAV) GAV defines the mediated schema (MS) as a set of views over the data sources Mediated Schema = Global schema An intuitive approach Mediated schema (MS) G G i = some relation in G X i denotes attributes in G i Source schema S 1, S 2,, S n Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 34

GAV Definition A GAV schema mapping M is a set of expressions of the form: G i (X i ) Q(S 1, S 2,, S n ) open world assumption instances computed for MS are assumed to be incomplete or, G i (X i ) = Q(S 1, S 2,, S n ) closed world assumption instances computed for MS are assumed to be complete Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 35

GAV Example Movie(title, director, year, genre) S1.Movie(MID, title), S1.MovieDetail(MID, director, genre, year) Movie(title, director, year, genre) S5.MovieGenres(title, genre), S6.MovieDirectors(title, director), S7.MovieYears(title, year) Plays(movie, location, starttime) S2.Cinemas(location, movie, starttime) Plays(movie, location, starttime) S3.NYCCinemas(location, movie, starttime) Movie: Title, director, year, genre Actor: title, name Plays: movie, location, starttime Reviews: title, rating, description Mediated schema S7: MovieYears(title, year) S1: Actor (AID, firstname, lastname, nationality, yearof Birth) Movie (MID, title), AcrtorPlays(AID, MID) MovieDetail (MID, directorm genre, year) S2: Cinemas(place, movie, start) S3: NYCCinemas(name, title, starttime) S4: Reviews(title, date, grade, review) S5: MovieGenres(title, genre) S6: MovieDirectors(title, dir) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 36

Discussions: GAV 1/2 Suppose we have a data source S8 that stored pairs of (actor, director) who worked together on movies. The only way to model this source in GAV is with the following two descriptions that use NULL: Actors(NULL, actor) S8(actor, director) Movie(NULL, director, NULL, NULL) S8(actor, director) These descriptions create tuples in the mediated schema that include NULLs in all columns except one S8: ActTogether(actor, director) Movie: Title, director, year, genre Actor: title, name Plays: movie, location, starttime Reviews: title, rating, description Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 37

Discussions: GAV 2/2 If the source S8 includes the tuples (Keaton, Allen) and (Pacino, Coppolag), then the tuples computed for the mediated schema would be: Actors(NULL, Keaton), Actors(NULL, Pacino) Movie(NULL, Allen, NULL, NULL), Movie(NULL, Coppola, NULL, NULL) Now suppose we have the following query that recreates S8: Q(actor, director) :- Actors(title, actor), Movie(title, director, genre, year) We would not be able to retrieve the tuples from S8 because the source descriptions lost the relationship between actor and director. S8: ActTogether(actor, director) Movie: Title, director, year, genre Actor: title, name Plays: movie, location, starttime Reviews: title, rating, description Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 38

Local As View (LAV) describes each data source as precisely as possible and independently of any other sources opposite approach to GAV Mediated schema (MS) G Source schema S 1, S 2,, S n X i denotes attributes in S i Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 39

LAV Definition A LAV schema mapping M is a set of expressions of the form: S i (X i ) Q i (G) open world assumption or, S i (X i ) = Q i (G) closed world assumption but completeness about data sources, not about the MS Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 40

LAV Example S5.MovieGenres(title, genre) Movie(title, director, year, genre) S6.MovieDirectors(title, director) Movie(title, director, year, genre) S7.MovieYears(title, year) Movie(title, director, year, genre) S8(actor, dir) Movie(title, director, year, genre), Actors(title, actor) Can also specify constraints on the contents S9(title, year, comedy ) Movie(title, director, year, comedy ), year 1970 Movie: Title, director, year, genre Actor: title, name Plays: movie, location, starttime Reviews: title, rating, description Mediated schema S7: MovieYears(title, year) S1: Actor (AID, firstname, lastname, nationality, yearof Birth) Movie (MID, title), AcrtorPlays(AID, MID) MovieDetail (MID, directorm genre, year) S2: Cinemas(place, movie, start) S3: NYCCinemas(name, title, starttime) S4: Reviews(title, date, grade, review) S5: MovieGenres(title, genre) S6: MovieDirectors(title, dir) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 41

Global-Local-As-View (GLAV) GAV and LAV can be combined into GLAV Has the expressive power of both The expressions in the schema mapping include a query over the data sources on the left hand side a query on the mediated schema on the right-hand side Mediated schema (MS) G Source schema S 1, S 2,, S n Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 42

GLAV Definition A GLAV schema mapping M is a set of expressions of the form: Q S (X) Q G (X) open world assumption or, Q S (X) = Q G (X) closed world assumption Q G is a query over G whose head variables are X Q S is a query over data sources S 1, S 2,, S n where the head variables are also S Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 43

GLAV Example Suppose S1 is known to have comedies produced after 1970 only S1.Movie(MID, title), S1.MovieDetail(MID, director, genre, year) Movie(title, director, comedy", year), year 1970 Movie: Title, director, year, genre Actor: title, name Plays: movie, location, starttime Reviews: title, rating, description Mediated schema S7: MovieYears(title, year) S1: Actor (AID, firstname, lastname, nationality, yearof Birth) Movie (MID, title), AcrtorPlays(AID, MID) MovieDetail (MID, directorm genre, year) S2: Cinemas(place, movie, start) S3: NYCCinemas(name, title, starttime) S4: Reviews(title, date, grade, review) S5: MovieGenres(title, genre) S6: MovieDirectors(title, dir) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 44

Optional/Additional Slides Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 45

optional slide Schema Matchings and Mappings Specify matches, e.g. attribute name in one source corresponds to attribute title in another location is a concatenation of city, state, zipcode Elaborate matches into semantic mappings using queries like SQL Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 46

Challenges optional slide The tasks of creating the matches and mappings are often difficult they require a deep understanding of the semantics of the schemas of the data sources and ofthe mediated schema This knowledge is typically distributed among multiple people these people are not necessarily database experts and may need help There is no algorithm that will take two arbitrary database schemas and flawlessly produce correct matches and mappings goal is to create tools that educe the time by giving suggestions to the designer Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 47

Two database schemas optional slide DVD-VENDOR Movies(id, title, year) Products(mid, releasedate, releasecompany, baseprice, rating, salelocid) Locations(lid, name, taxrate) AGGREGATOR Items(name, releaseinfo, classification, price) Attributes and tables in a schema are called its elements The aggregator is not interested in all the details of the product, but only in the attributes that are shown to its customers Schema DVD-VENDOR has 14 elements 11 attributes (e.g., id, title, and year) and three tables (e.g., Movies) Schema AGGREGATOR has five elements four attributes and one table. Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 48

Semantic mapping optional slide DVD-VENDOR Movies(id, title, year) Products(mid, releasedate, releasecompany, baseprice, rating, salelocid) Locations(lid, name, taxrate) AGGREGATOR Items(name, releaseinfo, classification, price) A query expression that relates a schema S with a schema T recall GAV, LAV, GLAV Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 49

optional slide Semantic mapping - Example 1 DVD-VENDOR Movies(id, title, year) Products(mid, releasedate, releasecompany, baseprice, rating, salelocid) Locations(lid, name, taxrate) AGGREGATOR Items(name, releaseinfo, classification, price) the title of Movies in the DVD-VENDOR schema is the name attribute in Items in the AGGREGATOR schema. SELECT name as title FROM Items DVD-VENDOR FROM AGGREGATOR Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 50

optional slide Semantic mapping - Example 2 DVD-VENDOR Movies(id, title, year) Products(mid, releasedate, releasecompany, baseprice, rating, salelocid) Locations(lid, name, taxrate) AGGREGATOR Items(name, releaseinfo, classification, price) get the price attribute of the Items relation in the AGGREGATOR schema by joining the Products and Locations tables in the DVD- VENDOR schema.. SELECT ( baseprice * (1 + taxrate )) AS price FROM Products, Locations WHERE Products. salelocid = Locations.lid AGGREGATOR FROM DVD-VENDOR Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 51

optional slide Semantic mapping - Example 3 DVD-VENDOR Movies(id, title, year) Products(mid, releasedate, releasecompany, baseprice, rating, salelocid) Locations(lid, name, taxrate) AGGREGATOR Items(name, releaseinfo, classification, price) Get the entire tuple in Items table from DVD-VENDOR SELECT title AS name, releasedate AS releaseinfo, rating AS classification, baseprice * (1 + taxrate ) AS price FROM Movies, Products, Locations WHERE Movies.id = Products.mid AND Products. salelocid = Locations.lid AGGREGATOR FROM DVD-VENDOR Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 52

Semantic Matches optional slide Relates a set of elements in schema S to a set of elements in schema T without specifying the details of the nature of relationship (as SQL queries) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 53

Why are matching and optional slide mapping difficult? The semantics may not be fully captured in the schemas rating may imply movie rating, customer rating, etc sometimes accompanied by English text, hard for systems to parse and understand Schema clues can be unreliable two elements may have the same name but different meaning, like name or title Semantics can be subjective what plot-summary means sometimes a committee of experts vote Combining data may be difficult need to figure out a join path full/left/right outer join or inner join may need filter conditions the designer has figure these out inspecting a large amount of data erroneous and labor prone Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 54

Components in a schema optional slide matching system Matchers Combiners Constraint Enforcers Match Selectors Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 55

1. Matchers optional slide schemas similarity matrix takes two schemas S and T as input outputs a similarity matrix assigns to each element pair s of S and t of T a number between 0 and 1 higher the number, s and t are more similar e.g. name <name: 1, title : 0:5> releaseinfo <releasedate : 0:6, releasecompany: 0.4> price <baseprice : 0:5> Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 56

Types of Matchers optional slide Name-based matchers compares the names of elements but almost never written the same way uses techniques for string matching as edit distance, Jaccard measure etc.; synonyms; normalization (capital letters); hyphens; etc Instance-based matchers Look at data instances, builds recognizers (dictionaries), computes overlaps, classification Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 57

2. Combiners optional slide matrix. matrix matrix merges the similarity matrices output by the matchers into a single one can take the average, minimum, maximum, or a weighted sum of the similarity scores Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 58

Types of Combiners optional slide Average combiners: Suppose k matchers to predict the scores between the element s i of schema S and the element t j of schema T then an average combiner will compute the score between these two elements as the average from these k matchers Hand-crafted scripts e.g. if s i = address, return score of naïve-bayes classifer, else average Weighted combiner gives weights to each matcher Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 59

3. Constraint Enforcers optional slide matrix constraints matrix In addition to clues and heuristics, domain knowledge plays an important role in pruning candidate matches e.g. knowing that many movie titles contain four words or more, but most location names do not, can help us guess that Items.name is more likely to match Movies.title than Locations.name an enforcer enforces such constraints on the candidate matches it transforms the similarity matrix produced by the combiner into another one that better reflects the true similarities Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 60

optional slide Types of Constraint Enforcers : 1/2 There may be hard or soft domain integrity constraints Hard constraints must be applied The enforcer will not output any match combination that violates them Soft constraints are of more heuristic nature, and may actually be violated in correct match combinations the enforcer will try to minimize the number (and weight) of the soft constraints being violated but may still output a match combination that violates one or more of them Formally, we attach a cost to each constraint For hard constraints, the cost is 1 for soft constraints, the cost can be any positive number. Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 61

optional slide Types of Constraint Enforcers : 2/2 e.g. c1: If A Items.code, then A is a key (weight = infinity) c2 If A Items.desc, then any random sample of 100 data instances of A must have an average length of at least 20 words (weight = 1.5) c3: If more than half of the attributes of Table U matches those of Table V, then U is similar to V (weight = 1) Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 62

4. Match Selectors optional slide matrix matches Produces matches from the similarity matrix output by the constraint enforcer name <title : 0:5> releaseinfo <releasedate : 0:6> classication <rating : 0:3> price <baseprice : 0:5> Given the threshold 0.5, the match selector produces matches: name title, releaseinfo releasedate, and price baseprice Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 63

Types of Match Selectors optional slide The simplest selection strategy is thresholding all pairs of schema elements with similarity score exceeding a given threshold are returned as matches More complex strategies include formulating the selection as an optimization problem over a weighted bipartite graph Duke CS, Fall 2016 CompSci 516: Data Intensive Computing Systems 64