190 likes | 353 Views
Defining web schema transformers by example. Stephan Lechner, Michael Schrefl Johannes Kepler University Linz, Austria Homepage: http://www.dke.uni-linz.ac.at. Overview. Why web schema transformers? Why defining transformers by example? Semantics of by-example transformers
E N D
Defining web schema transformers by example Stephan Lechner, Michael Schrefl Johannes Kepler University Linz, Austria Homepage: http://www.dke.uni-linz.ac.at
Overview • Why web schema transformers? • Why defining transformers by example? • Semantics of by-example transformers • Process of defining and applying transformers • Conclusion
(e2) Artist (e1) Album (pg1) AlbumPage (a3) name (a1) title (a2) published (pg2) ArtistPage (dau1) Album (ln1) (e2) Artist (dau2) Artist (e1) Album Use case: a simple design step WebML Content and Hypertext Scheme: n (rel1) Artist2Album (rel2) Album2Artist 1 [(rel2) Album2Artist]
(e2) Artist (e1) Album (a3) name (a1) title (a2) published Please select releationship role $role2Resolve 1 Use case: using a transformer Transformer: Page classes after relationship role n (rel1) Artist2Album (rel2) Album2Artist 1
(e2) Artist (e1) Album (a3) name (a1) title (a2) published Apply 1 Use case: using a transformer n (rel1) Artist2Album (rel2) Album2Artist 1
(e2) Artist (e1) Album (pg1) AlbumPage (a3) name (a1) title (a2) published (pg2) ArtistPage (dau1) Album (ln1) (e2) Artist (dau2) Artist (e1) Album Use case: using a transformer n (rel1) Artist2Album (rel2) Album2Artist 1 [(rel2) Album2Artist]
(e2) Artist (e1) Album (a3) name (a1) title (a2) published Please select releationship role $role2Resolve 1 Use case: using a transformer n (rel1) Artist2Album (rel2) Album2Artist 1
(e2) Artist (e1) Album (a3) name (a1) title (a2) published 1 Use case: using a transformer n (rel1) Artist2Album ERROR: Relationship role $role2Resolve must be of mulitplicity „1“ (rel2) Album2Artist 1
Defining transformers byschema modification operations Input parameter: $role2Resolve Let $ent = $role2Resolve/attachedTo Let $entN = $ent/name Let $p = new pageclass ($entN + „Page“); Schema.insert ($p)
(e2) Artist (e1) Album (pg1) AlbumPage (a3) name (a1) title (a2) published (pg2) ArtistPage (dau1) Album (ln1) (e2) Artist (dau2) Artist (e1) Album Defining transformersby-example n (rel1) Artist2Album (rel2) Album2Artist 1 [(rel2) Album2Artist]
($srcEnt) $srcEntN ($tgtEnt) $tgtEntN ($ln) ($tdu) $tduN Defining transformersby-example Input Template Output Template ($tgtP) $tgtPN ($srcP) $srcPN ($sdu) $sduN 1 ($role2Resolve) ($tgtEnt) ($srcEnt) [($role2Resolve)] Let $srcPN = $srcEntN + „Page“ Let $tgtPN = $tgtEntN + „Page“ $… Explicit input parameter $ ... Implicit input parameter $ ... Parameter provided by input template $…New element variable
(e2) Artist (a3) name (pg2) ArtistPage (e2) Artist (dau2) Artist [(rel2) Album2Artist] Logical represenation of schemes • Scheme in terms of universes and functions: Assigned functions Universe members (rel2) … name (e2) = Artist name (a3) = name definedAt (a3) = e2 attachedTo (rel2) = e2 opposite (rel2) = e1 mul (rel2) = 1 1 e2 : E a3 : A Artist : N name : N 1 : Mul rel2 : R name (pg2) = ArtistPage name (dau2) = Album definedAt (dau2) = pg2 source (dau2) = e2 pg2 : P ArtistPage : N dau2 : DU Artist : N e2 : E rel2 : R
($srcEnt) $srcEntN ($tgtEnt) $tgtEntN Logical representation: Input templates • Explicit and implicit parameters, constants, and constraints: Universe members Pexpl: Pimpl: $srcEnt : E $srcEntN : N $tgtEnt : E $tgtEntN : N $role2Resolve : R Const: 1 : Mul 1 ($role2Resolve) Assigned functions Constraints: name ($srcEnt) = $srcEntN name ($tgtEnt) = $tgtEntN attachedTo (role2Resolve) = $tgtEnt opposite (role2Resolve) = $srcEnt mul (role2Resolve) = 1
Logical representation: Output templates • Parameters, new element variables, assignment statements: Vg: Universe members: Vpar: $tgtP = new P $tgtPN = $tgtEntN + Page $tdu = new DU $tduN = $tgtEntN ($tgtP) $tgtPN $role2Resolve $tgtEnt $tgtEntN ($tdu) $tduN Assignment statements: Assigned functions: name ($tgtP) = $tgtPN name ($tdu) = $tgtEntN definedAt ($tdu) = $tgtP source ($tdu) = $tgtEnt selCond ($tdu) = $role2Resolve ($tgtEnt) [($role2Resolve)] $tgtPN = $tgtEntN + „Page“
(e2) Artist (e1) Album (a3) name (a1) title (a2) published n (rel1) Artist2Album (rel2) Album2Artist 1 Evaluating transformer applications • Input template: Binding variables by checking constraints Pimpl: $srcEnt : E $srcEntN : N $tgtEnt : E $tgtEntN : N Pexpl: $role2Resolve : R Const: 1 : Mul Constraints: attachedTo (role2Resolve) = $tgtEnt opposite (role2Resolve) = $srcEnt mul (role2Resolve) = 1 name ($srcEnt) = $srcEntN name ($tgtEnt) = $tgtEntN Constraint violation! Application Is valid.
(pg2) ArtistPage (e2) Artist (dau2) Artist [(rel2) Album2Artist] Evaluating transformer applications • Output template: generating universe members and assigning functions Vg: $tgtP = new P $tgtPN = $tgtEntN + Page $tdu = new DU $tduN = $tgtEntN Univ. members generated: $tgtP = pg2 $tgtPN = ArtistPage $tdu = du2 $tduN = Artist Vpar: $role2Resolve = rel2 $tgtEnt = e2 $tgtEntN = Artist Assignment statements: name ($tgtP) = $tgtPN name ($tdu) = $tgtEntN definedAt ($tdu) = $tgtP source ($tdu) = $tgtEnt selCond ($tdu) = $role2Resolve Functions assigned: name (pg2) = ArtistPage name (du2) = Artist definedAt (du2) = pg2 source (du2) = e2 selCond (du2) = rel2
Deployed Script Input Scheme [WebML] Input Template [WebML] Input Scheme [logical] Input Template [logical] WebML2logical + interpreter WebML2logical + interpreter Script applicator Output Template [WebML] Output Template [logical] WebML2logical + interpreter Output Scheme [WebML] Output Scheme [logical] logical2WebML Process of defining and applying transformers
Conclusion and future work • Transformers-by-example for WebML • Applicable to other models/tools • Supporting modelling tasks • Generating hypertext views • Increasing language‘s power