28
Your Mediators need Data Conversion!* Sophie Cluet, Claude Delobel, Jerome Simeon, K Smaga By Prapulla Bajjuri

Your Mediators need Data Conversion!* Sophie Cluet, Claude Delobel, Jerome Simeon, K Smaga By Prapulla Bajjuri

Embed Size (px)

Citation preview

Your Mediators need Data Conversion!*

Sophie Cluet, Claude Delobel, Jerome Simeon, K Smaga

By

Prapulla Bajjuri

Introduction

• Converts the data from one format to another

• It provides tools for the specification and the implementation of data conversions among heterogeneous data sources.

• YAT model uses graphs for representation

• YATL is rule-based

Translation Scenario

RDBMS OODBMS

SGML Files HTML files

YAT/relationalwrapper

YAT/SGMLwrapper

YAT/HTMLwrapper

YAT/ODMGwrapper

YATL translationrel + sgml ->odmg

YATL translationOdmg -> html

YAT Model

• Consists of set of patterns and variable domains

• Two kinds of variables

(i) Data Variables

(ii) Pattern Variables

• The domain of data variable is the set of all data constants and variable names

• The domain of pattern variable is the set of all its instance patterns.

• Ground pattern.

Yat:

Att

Ptype

Psup:Pcar:

Pclass:

The YAT model

S2:S1:C1:

The Golf GTI modelThe car schema model

The ODMG model

Ptype:

class

car

L & Yat L

*

Yat

VV

Class

Class_name

Ptype

*Att

Y: int V String..V Tuple V*

Z: (set, list, bag, array)

V &Pclass

Ptype

*

name

S1:str

desc suppliers

S2:str set

&Psup

*

&Pcar

… …class

car

name desc

“Golf” “The 1995 volksGolf GTI….”

suppliers

set

&s1 &s2

Model Instantiation

• It relies on pattern instantiation which itself relies on variable domain inclusion.

(i) Each pattern of the instance model must be an instance of some pattern of the source model

(ii) A variable can be instantiated either by a constant belonging to the variable’s domain or by a variable whose domain is a subset.

Pattern for car objects

Pcar: classcar(names1:string, descS2:string, suppliersset&Psup)

The YAT Language

• It is declarative and rule-based

• Deals with heterogeneity

• Deals with collections

• Detects cyclic programs

• Supports graphical interface

• Typing in YATL

Rule 1

Psup(SN) :Class supplier ( name SN, city C, zip Z)

Pbr :brochure( number Num, title T, model Year, desc D, suppls supplier ( name SN, address Add)),Year > 1975,C is city(Add),Z is zip(Add)

*

Rule 2

Pcar(pbr) :Class car ( name T, desc D, suppliers

set &Psup(SN) )

Pbr :brochure( number Num, title T, model Year, desc D, suppls supplier ( name SN, address Add)),{ }

*

Rule 1’

Psup(SN) :Class supplier ( name SN, city C, zip Z, sells set &Pcar(Pbr) )

Pbr :brochure( number Num, title T, model Year, desc D, suppls supplier ( name SN, address Add)),

C is city(Add),Z is zip(Add)

{ }

*

Dealing with heterogeneity

Suppliers Relational Database Schema

suppliers[sid: integer, name: string, city: string, address: string, tel: string]

Cars[cid: integer, broch_num: string]

Sales[sid: integer, cid: integer, year: integer, sold: integer]

Rule 3

Psup(SN) :Class car ( name T, desc D, suppliers set &Psup(Sid))

Pbr :brochure( number Num, title T, model Year, desc D, suppls supplier ( name SN, address Add)),Rsuppliers:Suppliers row (sid Sid, name SN, city C, addressAdd2, tel Tel).

Rcars:Cars row (cid Cid, broch_num Num),sameaddress(Add, C, Add2)

*

*

*

*

Dealing with collections

• YATL handles sets and lists.

• It provides one primitive for grouping and another for ordering.

• It allows to grouping on some criteria and ordering on others.

• Arrays can also be manipulated using YAT language.

Rule 4

Pallsups( ) :

list &Psup(SN)

Pbr :brochure( number Num, title T, model Year, desc D, suppls supplier ( name SN, address Add)),

*

[]SN

Rule 5

New (Id) : Id:

Mat Y X A Mat X Y A[]J []I I J

Mat:

Output Transposed MatrixInput Matrix

Mat:

110 22 20 300 330100

Polo golf polo golf polo golf

Paris nice caen

sales sales

Polo golf

Paris nice caen paris nice caen

100 22 300 110 20 330

Detecting cyclic programs

• Removing the & symbol in Rules 1’ and 2 introduces cycle in the program

• Statically detecting cycles in a YATL program is undecidable

• This can be done by constructing dependency graph of dereferenced functions

• It rejects conversion programs working by recursion on the input tree.

• Rejects programs that are not safe-recursive.

Typing in YATL

• Input and output models can easily be inferred by considering

(i) input and output patterns

(ii) predicate/function signatures

(iii) variable domains

Rule 1Psup(SN) :Class supplier ( name SN, city C, zip Z)

Pbr :brochure(…… suppls supplier ( name SN, address Add)),Year > 1975,C is city(Add),Z is zip(Add)

*

Customizing programs

• Converts any ODMG data into HTML• An object is converted into HTML page• An atomic value is converted into a string• A collection is converted into a list of HTML items• An object reference is converted into an HTML anchor

HtmlPage(Pclass) :Html( head title Classname, body(h1Classname, ul li, ( Att2, HtmlElement(Ptype))))

Pclass :class Classname Att Ptype, Att2 is concat(Att, “ : “)

Web 1

HtmlElement( Ptype) : S Ptype : Data, S is data_to_string(Data)

Web 2

•An object is converted into an HTML page

•An atomic value converted into a string

HtmlElement(Ptype) :ul li( Att2, HtmlElement(P2: Ptype))

Ptype :tuple Att P2:Ptype, Att2 is concat(Att, “ : “)

Web 3

HtmlElement( Ptype) : Ptype : ul li HtmlElement(P2:Ptype) X:{ set, bag} P2 : Ptype

Web 4

* *

**

• A collection is converted into a list of HTML elements.

•A tuple is converted into a list of HTML items

HtmlElement(Ptype) :

ol li HtmlElement(P2:Ptype))

Ptype :X : {list,array} P2:Ptype

Web 5

HtmlElement( Ptype) : Ptype : &Ptype,A( href & HtmlPage(Pclass), Pclass : cont Classname) class Classname P2:Ptype

Web 6

o(I)I

•A object reference is converted into an HTML anchor.

•A list or array is converted into a list of HTML elements.

HtmlPage(Pcar) :html( head title car, body(h1car, ul( li ( ”name:”, T1), li( ”age:”, D1), li( ”suppliers:”, ul li a ( href HtmlPage(Psup), cont Classname)))))

Pcar :Class car ( nameT, desc D, suppliers set &Psup), Psup: classClassnameP2:Ptype, T1 is data_to_string(T), D1 is data_to_string(D)

*

*

Example

Combining programs

• YATL interpreter organizes the set of rules of a program hierarchically.

• For a given input pattern, the more specific rules matching the input are applied first then less specific rules are tried.

• User may also enforce the rule hierarchy.

Composing programs

• Using YATL , it is possible to compose two programs and generate a more efficient program.

• Composition mechanism: It takes two programs and checks whether they are compatible and produces the new program by combining them.

• Here it takes SGMLODMG and ODMGHTML and produces SGMLHTML

Example• Prg1: M1M2• Prg2: M2’M3• System instantiates prg2 with the patterns of

M2.• Prg2’: M2M3’

YAT Architecture

• It does not provide the ability to query or update external sources.

• System is composed into three main parts

(i) The specification environment

(ii) The runtime environment

(iii) A library of programs and formats

YAT Architecture

Import wrapper

Import wrapper

Graphical User Interface

Specification Environment

Static Typing

YAT pattern/ YATL rules management module

YATL programInstantiation module

Library of programs and models

Exportwrapper

Target 1

Runtime environment

YAT Patterns/YATL rulesManagement module

Type checker

YATL interpreter External Functions &

Predicates evaluation

Source 1 Source 2

Questions….?

Thank You