Download presentation
Presentation is loading. Please wait.
Published byOlivia Dawson Modified over 9 years ago
1
Wrappers in Mediator-Based Systems
2
Introduction Mediator Wrapper Source 1 Source 2 Query Result
3
The wrapper(extractor) consists of: One or more predefined queries (based on source) SQL Web page Suitable communication mechanism for sending and receiving information to/from source/mediator. Wrapper
4
Template for Query Patterns Design a wrapper – Build templates for all possible queries that the mediator can ask. Mediator schema: AutosMed (serialNo,model,color,autoTrans,dealer) Source schema: Cars (serialNo,model,color,autoTrans,navi,…) Mediator -> wrapper for cars of a given color ($c): SELECT * FROM AutoMed WHERE color = ‘$c’; => SELECT serialNo,model,color,autoTrans,’dealer1’ FROM Cars WHERE color = ‘$c’; Wrapper Template describing queries for cars of a given color Templates needed: Pow (2,n) for n attributes For all possible queries from the mediator
5
Wrapper Generators The software that creates the wrapper is Wrapper Generator. Driver Table Source Templates Wrapper Generator Queries Results Wrapper
6
Wrapper Generators Wrapper Generator: Creates a table that holds the various query patterns contained in templates. Source queries associated with each of them. The Driver: Accept a query from the mediator. Search the table for a template that matches the query. Send the query to the source. Return the response to the Mediator.
7
Filters Consider the Car dealer’s database. The Wrapper template to get the cars of a given model and color is: SELECT * FROM AutoMed WHERE model = ‘$m’ and color = ‘$c’; => SELECT serialNo,model,color,autoTrans,’dealer1’ FROM Cars WHERE model = ‘$m’ and color = ‘$c’; Another approach is to have a Wrapper Filter: The Wrapper has a template that returns a superset of what the query wants. Filter the returned tuples at the Wrapper and pass only the desired tuples. Position of the Filter Component: At the Wrapper At the Mediator
8
Filters To find the blue cars of model Ford: Use the template to extract the blue cars. Return the tuples to the Mediator. Filter to get the Ford model cars at the Mediator. Store at the temporary relation: TempAutos (serialNo,model,color,autoTrans,dealer) Filter by executing a local query: SELECT * FROM TempAutos WHERE model = ‘FORD’;
9
Other Operations at the Wrapper It is possible to take the joins at the Wrapper and transmit the result to Mediator. Suppose the Mediator is asked to find dealers and models such that the dealer has two red cars, of the same model, one with and one without automatic transmission: SELECT A1.model, A1.dealer FROM AutosMed A1, AutosMed A2 WHERE A1.model = A2.model AND A1.color = ‘red’ AND A2.color = ‘red’ AND A1.autoTrans = ‘no’ and A2.autoTrans = ‘yes’; Wrapper can first obtain all the red cars: SELECT * FROM AutosMed WHERE color = ‘red’; RedAutos (serialNo,model,color,autoTrans,dealer)
10
Other Operations at the Wrapper The Wrapper then performs a join and the necessary selection. SELECT DISTINCT A1.model, A1.dealer FROM RedAutos A1, RedAutos A2 WHERE A1.model = A2.model AND A1.autoTrans = ‘no’ AND A2.autoTrans = ‘yes’;
11
Thank You
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.