Download presentation
Presentation is loading. Please wait.
1
Chapter 21 Information Integration 21.3 Wrappers in Mediator-Based Systems Presented by: Kai Zhu Professor: Dr. T.Y. Lin Class ID: 220
2
Intro Templates for Query patterns Templates for Query patterns Wrapper Generator Wrapper Generator Filter Filter
3
Wrappers in Mediator-based Systems Wrappers in Mediator-based Systems More complicated than that in most data warehouse system. More complicated than that in most data warehouse system. Able to accept a variety of queries from the mediator and translate them to the terms of the source. Able to accept a variety of queries from the mediator and translate them to the terms of the source. The result is communicated with the mediator. The result is communicated with the mediator.
4
How to design a wrapper? How to design a wrapper? Classify the possible queries that the mediator can ask into templates, which are queries with parameters that represent constants.
5
Templates for Query Patterns: Use notation T=>S to express the idea that the template T is turned by the wrapper into the source query S. Use notation T=>S to express the idea that the template T is turned by the wrapper into the source query S.
6
Example 1 Example 1 Dealer 1 Cars (serialNo, model, color, autoTrans, navi, … ) For use by a mediator with schema AutoMed (serialNo, model, color, autoTrans, dealer)
7
We denote the code representing that color by the parameter $c, then the template will be: We denote the code representing that color by the parameter $c, then the template will be: SELECT * FROM AutosMed WHERE color = ’ $c ’ ; => SELECT serialNo, model, color, autoTrans, ’ dealer1 ’ FROM Cars WHERE color= ’ $c ’ ; (Template T => Source query S)
8
There will be total 2 n templates if we have the option of specifying n attributes. There will be total 2 n templates if we have the option of specifying n attributes.
9
Wrapper Generators The wrapper generator creates a table holds the various query patterns contained in the templates. The wrapper generator creates a table holds the various query patterns contained in the templates. The queries of the source are associated with each. The queries of the source are associated with each.
10
A driver is used in each wrapper, the task of the driver is to: The mediator from the query is accepted. The mediator from the query is accepted. Search the table for a template that matches the query. Search the table for a template that matches the query. The source query is sent to the source, again using a “ plug-in ” communication mechanism. The source query is sent to the source, again using a “ plug-in ” communication mechanism. The response is processed by the wrapper. The response is processed by the wrapper.
11
Filter There are wrapper filter for supporting more queries. There are wrapper filter for supporting more queries.
12
Example 2 Example 2 If wrapper is designed with more complicated template with queries specify both model and color. If wrapper is designed with more complicated template with queries specify both model and color. SELECT * FROM AutosMed WHERE model = ’ $m ’ AND color = ’ $c ’ ; => SELECT serialNo, model, color, autoTrans, ’ dealer1 ’ FROM Cars WHERE model = ’ $m ’ AND color= ’ $c ’ ;
13
Now we suppose the only template we have is color. However the wrapper is asked by the Mediator to find “ blue Gobi model car. ” Now we suppose the only template we have is color. However the wrapper is asked by the Mediator to find “ blue Gobi model car. ”
14
Solution: 1. Use template with $c= ‘ blue ’ find all blue cars and store them in a temporary relation: TemAutos (serialNo, model, color, autoTrans, dealer) 2.The wrapper then return to the mediator the desired set of automobiles by excuting the local query: SELECT* FROM TemAutos WHERE model= ’ Gobi ’ ;
15
Thank you
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.