Model-driven Rule-based Mediation in
XML Data Exchange
Yongxin Liao, Dumitru Roman, Arne J. Berre
SINTEF ICT, Oslo, Norway
October 5 2010
October 5, 2010
Outline
Intro to XML Data Exchange
FloraMap: Flora2-based XML data transformation
Technique: steps and examples
Implementation and experiments
Implementation and experiments
Generic XML Data Exchange Framework
Related Work
Outline
Intro to XML Data Exchange
FloraMap: Flora2-based XML data transformation
Technique: steps and examples
Implementation and experiments
Implementation and experiments
Generic XML Data Exchange Framework
Related Work
XML Data Exchange
g
Ubiquitous in B2B collaborations
Need for agile interoperability and scalability in B2B collaborations
Automate as much as possible XML data exchange between enterprise
systems
XML data cannot be directly and fully automatically exchanged
between B2B systems
Lack of standardized XML canonical models or schemas
Semantic differences and inconsistencies between conceptual models
Option: provide techniques and tools to support humans in reconciling
the differences and inconsistencies between the data models of the
parties involved in a data exchange
Generic XML Data Exchange
Generic XML Data Exchange
Transformation Layer Company X Company Y Source Target Source XSD Target XSD Schema transformations D i ti Source XML Target XML Instance transformations Design-time Run-time (Instances) (Instances)
Overall Approach
pp
Overall Approach
A lifting mechanism of XML schemas and instances to an
object-oriented model
Use an object oriented rule language/engine as the underlying
j
g
g
g
y g
mechanism for providing an abstract, object-oriented model of
XML schemas and instances, as well as for specification and
execution of the mappings at the model level
Benefits:
Allow the mappings creator to focus on the semantic,
object-oriented model behind the XSD schemas and specify the
oriented model behind the XSD schemas and specify the
mappings at a more abstract, semantic level
Allow both specification and execution of data mappings (i.e.
design- and run-time mapping) in a single unifying framework
design and run time mapping) in a single, unifying framework
Outline
Intro to XML Data Exchange
FloraMap: Flora2-based XML data transformation
Technique: steps and examples
Implementation and experiments
Implementation and experiments
Generic XML Data Exchange Framework
Related Work
Why Flora2?
y
Flora2
http://flora.sourceforge.net/
Declarative, object-oriented knowledge base language
Open source programming environment
Features:
Features:
Formal logical foundations, semantics
Frame-based
Rule-based
Higher-order
Declarative treatment of actions, database dynamics
,
y
Powerful introspection: querying schema, rules
Powerful meta-programming facilities
Typing modularization
Flora2 – Simple examples
p
p
Object description:
John[
name
->‘John Doe’,
phones
->{
6313214, 6313214},
children
->{Bob Mary}]
attribute
object Id
Syntax basics:
Object ids:
children
->{Bob, Mary}]
Mary[
name
->’Mary Doe’,
phones
->{
2121234, 2121237},
children
->{Anne, Alice}]
ISA hierarchy
:
John
:
Person
class membership
j
Terms like in Prolog – John, abc, f(john,34),
Car(red,20000)
IsA hierarchy:
O:C – object O is a
member
of class C
John
:
Person
Mary
:
Person
alice
:
Student
Student
:: Person
subclass relationship
Type signature
:
C::S – C is a
subclass
of S
Structure (
object-atoms
):
O [
Method
−>
Value] – invocation of
method
T
(
i
)
Type signature
:
Person[ born => integer,
ageAsOf(integer) => integer,
name => string,
address => string,
children => person].
rule definition
Type (
signature-atoms
):
Class [
Method
=>
Class] – a method
signature
Combinations of the above:
\/, /\, negation, quantifiers
Rule
:
?X : Redcar :- ?X:Car , ?X[color -> red].
rule definition
//\\, and
Query: John’s children who were born when he was 30+ years old:
\/, /\, negation, quantifiers
FloraMap – Semantic-based transformation of
XML data
XML data
Source XSD TargetXSDMediation Engine
ed
o
g e
(Logical) OO representation of Source XSD (Logical) OO representation of Target XSD Semantic Mapping (Logical) OO representation of (Logical) OO representation of pp g (specification and execution) Design-time Run-time Source XML Target XML p Source XML representation of Target XML (Instances) (Instances)Source XSD: Company X
<element name="InvoiceCompanyX">
<complexType>
Target XSD: Company Y
<element name="InvoiceCompanyY">
<complexType>
<sequence>
<element name="Bizszam" type="xs:string“/>
<element name="Ev" type="xs:string“/>
<element name="Kanyvho" type="xs:string“/>
<element name="Bizkelt" type="xs:string“/>
<sequence>
<element name="InvoiceNumber" type="string"/>
<element name="AccDate" type="string"/>
<element name="InvoiceDate" type="string"/>
<element name="DeliveryAddress" minOccurs="0">
1
2
6
<element name
Bizkelt type
xs:string />
<element name="city" type="string" minOccurs="0"/>
<element name="zip" type="int" minOccurs="0"/>
<element name="street" type="string"
minOccurs="0"/>
element name
DeliveryAddress minOccurs
0
<complexType>
<sequence>
<element name="city" type="string" minOccurs="0"/>
<element name="zip" type="string" minOccurs="0"/>
4
3
5
</sequence>
</complexType>
</element>
<element name="DoorNo" type="string"
minOccurs="0"/>
<element name="street" type="string" minOccurs="0"/>
</sequence>
</complexType>
5
</complexType>
</element>
</sequence>
</complexType>
</element>
Mapping rules
InvoiceCompanyX in source is mapped to InvoiceCompanyY in target:
1. Bizszamin source is the same as InvoiceNumberin target
2. Bizkeltin source is the same as InvoiceDatein target
3. city in source is the same as DeliveryAddress.cityin target
4.zip in source is the same as DeliveryAddress.zip in target
5. streetin source is the same as DeliveryAddress.streetin target
6. AccDatein target is a concatenation of Evin the source, a delimiter, Kanyvhoin the source, a delimiter, and the string ’01’, i.e.
Example – XML Data Exchange
p
g
Source XML: Company X
<InvoiceCompanyX>
Target XML: Company Y
<?xml version="1.0"?>
< InvoiceCompanyY >
<InvoiceNumber>I 001</InvoiceNumber>
<InvoiceCompanyX>
<Bizszam>I_001</Bizszam>
<Ev>2010</Ev>
<Kanyvho>05</Kanyvho>
<Bizkelt>2010 05 18</Bizkelt>
<InvoiceNumber>I_001</InvoiceNumber>
<AccDate>2010_05_01</AccDate>
<InvoiceDate>2010-05-18</InvoiceDate>
<DeliveryAddress>
it
O l
/ it
<Bizkelt>2010-05-18</Bizkelt>
<city>Oslo</city>
<zip>1234</zip>
<street>First Street</street
>
<city>Oslo</city>
<zip>1234</zip>
<DoorNo> </DoorNo>
<street>First Street </street>
</InvoiceCompanyX>
</DeliveryAddress>
XSD to Flora2
Source XSD TargetXSDMediation Engine
ed
o
g e
(Logical) OO representation of Source XSD (Logical) OO representation of Target XSD Semantic Mapping (Logical) OO representation of (Logical) OO representation of pp g (specification and execution) Source XML Target XML p Source XML representation of Target XML (Instances) (Instances)XSD to Flora2 mapping
Situation
XSD
Flora2 Abstract
Flora2 Special
(the “clean” conceptual model of the schema, i.e. no XML/XSD assumptions)
(XML/XSD specific information, needed for generating structure of target instances)
Top-level Element with BaseType
<Element name=”name” type=”string”/> name[name {1:1} *=>string].
Top-level Element with ComplexType <Element name=”name”> C l T name[firstname {1:1} *=>string]. [l t {1 1} * t i ] Elements[name->firstname]. El t [ l t ] with ComplexType <ComplexType>
<Sequence>
<Element name=”firstname” type=”string”/> <Element name=”lastname” type=”string”/> <Sequence>
</ComplexType>
name[lastname {1:1} *=> string]. Elements[name->lastname].
Sequences[name->[firstname,lastname]]. </ComplexType> </Element> Top-level Element with SimpleType <Attribute name=”age”> <SimpleType> <restriction base="int"> <maxInclusive value="200"/> age[base {1:1} *=>int]. age[maxInclusive->’200’]. <maxInclusive value 200 /> </restriction> </SimpleType> </Attribute > Top-level Attribute with BaseType
<Attribute name=”age” type=”integer”/> age[age {1:1} *=>integer]. yp Top-level Attribute with SimpleType <Attribute name=”age”> <SimpleType> <restriction base="int"> <maxInclusive value="200"/> <minInclusive value="0"/> age[base {1:1} *=>int]. age[maxInclusive->’200’]. age[minInclusive->’0’]. </restriction>
XSD to Flora2 mapping (cont’)
Situation
XSD
Flora2 Abstract
Flora2 Special
Top-level ComplexType
<ComplexType type=”nameType”> <Sequence>
<Element name=”firstname” type=”string”>
nameType[firstname {1:1} *=>string]. nameType[lastname {1:1} *=>string].
Elements[nameType->firstname]. Elements[nameType->lastname]. Sequences[nameType->[firstname, Element name firstname type string
<Element name=”lastname” type=”string”> <Sequence> </ComplexType> Sequences[nameType [firstname, lastname]]. Top-level SimpleType <SimpleType name=’nameType’> <restriction base="string"> nameType[base {1:1} *=>string]. nameType[Enumeration->’A’] p yp <restriction base string >
<enumeration value=“A"> <enumeration value=“B"> </restriction> </SimpleType> nameType[Enumeration > A ]. nameType[Enumeration->’B’].
Top-level Group <group name="nameGroup"> nameGroup[firstname {1:1} *=>string] Groups[nameGroup->nameGroup] Top level Group <group name nameGroup >
<sequence>
<element name="firstname" type="string"/> <element ref="lastname"/> </sequence> </group> nameGroup[firstname {1:1} >string]. nameGroup[lastname*=> lastname]. Groups[nameGroup >nameGroup] Elements[nameGroup->fristname]. Elements[nameGroup->lastname]. Sequences[nameGroup ->[firstname,lastname]]. Top-level AttributeGroup <attributeGroup name="IdentifyGroup"> <attribute name="job" type="string"/> <attribute ref="title"/>
</attributeGroup >
IdentifyGroup [job {1:1} *=>string]. IdentifyGroup [title {1:1} *=>title].
attributeGroups[IdentifyGroup -> IdentifyGroup].
Attributes[IdentifyGroup -> job]. Attributes[IdentifyGroup -> title].
XSD to Flora2 mapping (cont’)
Situation
XSD
Flora2 Abstract
Flora2 Special
S Ch i El t ” ” [fi t {1 1} * t i ] El t [ fi t ] Sequence ,Choice, All <Element name=”name”> <ComplexType> <Sequence>
<Element name=”firstname” type=”string”> <Choice>
<Element name=”title” type=”string”>
name[firstname {1:1} *=> string]. name[title {1:1} *=> string]. name[job {1:1} *=> string]. Elements[name->firstname]. Elements[name->title]. Elements[name->job]. Sequences[name->[firstname, Sub_name3]].
Choices[Sub name3->[title job]] <Element name title type string >
<Element name=”job” type=”string”> </Choice> <Sequence> </ComplexType> </Element> Choices[Sub_name3 >[title,job]]. Extension (simplecontent, complexcontent) <ComplexType name=”nameType”> <simpleContent> <extension base="PersonNameType"> <attribute name="title" type="string"/> </extension>
name :: PersonNameType. nameType [title {1:1} *=> string].
Attribute[nameType->title].
</simpleContent> </ComplexType>
XSD to Flora2 mapping (cont’)
XSD import to Flora2 import
Import namespace in XSD
[‘fil
Ab t
t fl ’>>
] i Fl
2 b t
t fil
[‘filename_Abstract.flr’>>namespace] in Flora2 abstract file
[‘filename_Special.flr’>>namespace] in Flora2 special file
Keep the element name and replace the “:” with “_” in the type
XSD Import
Flora2 Abstract
Flora2 Special
XSD Import
Flora2 Abstract
Flora2 Special
<schema xmlns:ccts=“abcd">
<import namespace=“abcd" schemaLocation="../Information.xsd"/> <element name=”person”> <complexType> <sequence> ?- [‘path/Information_ Abstract.flr’>>ccts] person[name {1:1} *=> ccts_nameType]. person[‘ccts:age’ {1:1} *=> ccts_age]. person[work {1:1} *=> personwork]. personwork[‘ccts:workType’ {1:1} ?- [‘path/Information_Special.flr’>>ccts] Elements[person -> name]. Elements[person -> ‘ccts:age’]. Elements[person -> work]. <sequence>
<element name=”name” type=”ccts:nameType”/> <element ref=”ccts:age”/> <element name=“work”> <complexType> <simpleContent> personwork[ ccts:workType {1:1} *=> ccts_workType]. <extension base=“ccts:workType“/> </simpleContent> </complexType> </element> </sequence> </ l T > </complexType> </element> </schema>
Example
p
Source XSD: Company X
<xs:element name="InvoiceCompanyX">
Flora2 Abstract:
Company X
Namespace[value->'xs:'].
InvoiceCompanyX [Bizszam{1:1}*=>'xs:string'].
InvoiceCompanyX [Ev{1:1}*=>'xs:string'].
<xs:element name= InvoiceCompanyX >
<xs:complexType>
<xs:sequence>
<xs:element name="Bizszam" type="xs:string“/>
<xs:element name="Ev" type="xs:string“/>
InvoiceCompanyX [Ev{1:1}
xs:string ].
InvoiceCompanyX [Kanyvho{1:1}*=>'xs:string'].
InvoiceCompanyX [Bizkelt{1:1}*=>'xs:string'].
InvoiceCompanyX [city{0:*}*=>'xs:string'].
InvoiceCompanyX [zip{0:*}*=>'xs:int'].
<xs:element name="Kanyvho" type="xs:string“/>
<xs:element name="Bizkelt" type="xs:string“/>
<xs:element name="city" type="xs:string"
minOccurs="0"/>
< s element name " ip" t pe " s int"
InvoiceCompanyX [street{0:*}*=>'xs:string'].
Flora2 Special:
Company X
Sequences[InvoiceCompanyX ->['Bizszam','Ev',
<xs:element name="zip" type="xs:int"
minOccurs="0"/>
<xs:element name="street" type="xs:string"
minOccurs="0"/>
</xs:sequence>
'Kanyvho',’Bizkelt','city','zip','street']].
Elements[InvoiceCompanyX ->Bizszam].
Elements[InvoiceCompanyX ->Ev].
Elements[InvoiceCompanyX ->Kanyvho].
Elements[InvoiceCompanyX >Bizkelt]
q
</xs:complexType>
</xs:element>
Elements[InvoiceCompanyX ->Bizkelt].
Elements[InvoiceCompanyX ->city].
Elements[InvoiceCompanyX ->zip].
Elements[InvoiceCompanyX ->street].
Example
Target XSD: Company Y
<xs:element name="InvoiceCompanyY">
<xs:complexType>
<xs:sequence>
Flora2 Abstract:
Company Y
Namespace[value->'xs:'].
YInvoice[DocumentNumber{1:1}*=>'xs:string'].
<xs:sequence>
<xs:element name="InvoiceNumber" type="xs:string"/>
<xs:element name="AccDate" type="xs:string"/>
<xs:element name="InvoiceDate" type="xs:string"/>
<xs:element name="DeliveryAddress" minOccurs="0">
YInvoice[DocumentDate{1:1}*=>'xs:string']. YInvoice[InvoiceDate{1:1}*=>'xs:string']. YInvoice[DeliveryAddress{1:1}*=>YInvoiceDeliveryAddress] YInvoiceDeliveryAddress[city{1:1}*=>'xs:string']. YInvoiceDeliveryAddress[country{1:1}*=>'xs:string']. YInvoiceDeliveryAddress[zip{1:1}*=>'xs:string']
<xs:complexType>
<xs:sequence>
<xs:element name="city" type="xs:string"
minOccurs="0"/>
<xs:element name="zip" type="xs:string"
YInvoiceDeliveryAddress[zip{1:1}*=> xs:string ].
YInvoiceDeliveryAddress[DoorNumber{1:1}*=>'xs:string']. YInvoiceDeliveryAddress[StreetNumber{1:1}*=>'xs:string'].
Flora2 Special:
Company Y
<xs:element name= zip type= xs:string
minOccurs="0"/>
<xs:element name="DoorNo" type="xs:string"
minOccurs="0"/>
<xs:element name="street" type="xs:string"
Sequences[LogoInvoice->['DocumentNumber','DocumentDate ','InvoiceDate','DeliveryAddress',TheOrderEnd]]. Elements[YInvoice->DocumentNumber]. Elements[YInvoice->DocumentDate]. Elements[YInvoice->InvoiceDate]. Elements[YInvoice >DeliveryAddress]
minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
Elements[YInvoice->DeliveryAddress]. Sequences[YInvoiceDeliveryAddress->['city','country','zip', ‘DoorNumber','StreetNumber',TheOrderEnd]]. Elements[YInvoiceDeliveryAddress->city]. Elements[YInvoiceDeliveryAddress->country]. Elements[YInvoiceDeliveryAddress->zip].</xs:sequence>
</xs:complexType>
[ y p] Elements[YInvoiceDeliveryAddress->DoorNumber]. Elements[YInvoiceDeliveryAddress->StreetNumber].XML source to Flora2
Source XSD TargetXSDMediation Engine
ed
o
g e
(Logical) OO representation of Source XSD (Logical) OO representation of Target XSD Semantic Mapping (Logical) OO representation of (Logical) OO representation of pp g (specification and execution) Source XML Target XML p Source XML representation of Target XML (Instances) (Instances)XML source instances to Flora2 objects
j
Steps:
XML instance file loaded in Flora2, resulting in a Flora2 tree
Flora2 abstract source file loaded in Flora2
Generate the Flora2 object structure according to the Flora2 abstract and
query the value from Flora2 tree
Object names are constructed by concatenating “obj_” + a unique number (e.g.
1_1_2) generated from the unique location in the tree
XML instance (person.xml)
Flora2 tree
Flora2 objects
<person> <name> <firstname>Dumitru</firstname> obj_:person[name->{obj_1}]. obj_1:personname[firstname->’ Dumitru ’]. obj_1:personname[lastname->’ Roman’]. <lastname>Roman</lastname> </name> <age>30</age> <address>Oslo, Norway</address> </person> obj_:person[age->30].
Example
p
Source XML: Company X
<InvoiceCompanyX>InvoiceCompanyX <Bizszam>I_001</Bizszam> <Ev>2010</Ev> <Kanyvho>05</Kanyvho> <Bizkelt>2010-05-18</Bizkelt> <city>Oslo</city>Flora2 Objects: Company X
<zip>1234</zip>
<street>First Street</street> </InvoiceCompanyX>
Flora2 Abstract:
Company X
Flora2 Objects: Company X
obj: InvoiceCompanyX ['Bizszam'->'I_001']. obj: InvoiceCompanyX ['Ev'->'2010']. obj: InvoiceCompanyX ['Kanyvho'->'05']. obj: InvoiceCompanyX ['Bizkelt'->'2010-05-18'].
bj I i C X [' i ' 'O l ']
p
y
Namespace[value->'xs:']. InvoiceCompanyX [Bizszam{1:1}*=>'xs:string']. InvoiceCompanyX [Ev{1:1}*=>'xs:string']. InvoiceCompanyX [Kanyvho{1:1}*=>'xs:string']. InvoiceCompanyX [Bizkelt{1:1}*=>'xs:string'].obj: InvoiceCompanyX ['city'->'Oslo']. obj: InvoiceCompanyX ['zip'->'1234'].
p y [ { } g ] InvoiceCompanyX [city{0:*}*=>'xs:string']. InvoiceCompanyX [zip{0:*}*=>'xs:int']. InvoiceCompanyX [street{0:*}*=>'xs:string'].
Semantic Mapping
Source XSD TargetXSDMediation Engine
ed
o
g e
(Logical) OO representation of Source XSD (Logical) OO representation of Target XSD Semantic Mapping (Logical) OO representation of (Logical) OO representation of pp g (specification and execution) Source XML Target XML p Source XML representation of Target XML (Instances) (Instances)Example
(d
i
ti
)
Schema Mapping Rules: CompanyX2CompanyY
O T O ([I i C X] [ I i C Y])
(design time)
OneToOne([InvoiceCompanyX],[ InvoiceCompanyY]).OneToOne([InvoiceCompanyX,Bizszam],[ InvoiceCompanyY,InvoiceNumber ]). OneToOne([InvoiceCompanyX,Bizkelt],[InvoiceCompanyY,InvoiceDate ]). OneToOne([InvoiceCompanyX,City],[InvoiceCompanyY,DeliveryAddress, city]). OneToOne([InvoiceCompanyX,Zip],[InvoiceCompanyY,DeliveryAddress, zip]). OneToOne([InvoiceCompanyX,Street],[InvoiceCompanyY,DeliveryAddress, stree]).([ p y , ],[ p y , y , ]) ManyToOne([[InvoiceCompanyX,EV],‘_’,[InvoiceCompanyX,KANYVHO],‘_’,‘01’],[InvoiceCompanyY, AccDate]).
Executable Mapping Rules:CompanyX2Company Y
Flora2 Abstract: Company X
Namespace[value->'xs:'] ?- [‘InvoiceCompanyX.flr'>>SourceInstances]. ?-?h: CompanyX@SourceInstances,newoid{?t},newoid{?t_4}, insert{ ?t: InvoiceCompanyY[InvoiceNumber->?t_1], ?t: InvoiceCompanyY [AccDate->?t_2], ?t: InvoiceCompanyY [InvoiceDate->?t_3], ?t I i C Y [D li Add >?t 4] Namespace[value > xs: ]. InvoiceCompanyX [Bizszam{1:1}*=>'xs:string']. InvoiceCompanyX [Ev{1:1}*=>'xs:string']. InvoiceCompanyX [Kanyvho{1:1}*=>'xs:string']. InvoiceCompanyX [Bizkelt{1:1}*=>'xs:string']. InvoiceCompanyX [city{0:*}*=>'xs:string'].
InvoiceCompanyX [zip{0:*}*=>'xs:int'] ?t: InvoiceCompanyY [DeliveryAddress->?t_4],
?t_4: InvoiceCompanyYDeliveryAddress[city->?t_4_1], ?t_4: InvoiceCompanyYDeliveryAddress[zip->?t_4_2], ?t_4: InvoiceCompanyYDeliveryAddress[street->?t_4_4] |
?t 1=?h.Bizszam@SourceInstances,
Flora2 Abstract: Company Y
Namespace[value->'xs:'].
YInvoice[DocumentNumber{1:1}*=>'xs:string']
InvoiceCompanyX [zip{0: } > xs:int ]. InvoiceCompanyX [street{0:*}*=>'xs:string']. ?t_1 ?h.Bizszam@SourceInstances, flora_concat_items([?h.Ev@SourceInstances,_, ?h.Kanyvho@SourceInstances,_01],?t_2)@_plg(flrporting), ?t_3=?h.Bizkelt@SourceInstances, ?t_4_1=?h.city@SourceInstances, ?t_4_2=?h.zip@SourceInstances, YInvoice[DocumentNumber{1:1}*=> xs:string ]. YInvoice[DocumentDate{1:1}*=>'xs:string']. YInvoice[InvoiceDate{1:1}*=>'xs:string']. YInvoice[DeliveryAddress{1:1}*=>YInvoiceDeliveryAddress] YInvoiceDeliveryAddress[city{1:1}*=>'xs:string']. YInvoiceDeliveryAddress[country{1:1}*=>'xs:string']. ?t_4_4=?h.street@SourceInstances}. y [ y{ } g ] YInvoiceDeliveryAddress[zip{1:1}*=>'xs:string'].
Example
(
ti
)
(run time)
Flora2 Objects: Company X
obj: InvoiceCompanyX ['Bizszam'->'I_001']. obj: InvoiceCompanyX ['Ev'->'2010'].
Executable Mapping Rules:CompanyX2Company Y
?- [‘InvoiceCompanyX.flr'>>SourceInstances].
h @ id{ } id{ } obj: InvoiceCompanyX [ Ev 2010 ]. obj: InvoiceCompanyX ['Kanyvho'->'05']. obj: InvoiceCompanyX ['Bizkelt'->'2010-05-18']. obj: InvoiceCompanyX ['city'->'Oslo'].
obj: InvoiceCompanyX ['zip'->'1234'].
obj: InvoiceCompanyX ['street'->'First Street']. ?-?h: CompanyX@SourceInstances,newoid{?t},newoid{?t_4}, insert{ ?t: InvoiceCompanyY[InvoiceNumber->?t_1], ?t: InvoiceCompanyY [AccDate->?t_2], ?t: InvoiceCompanyY [InvoiceDate->?t_3], ?t: InvoiceCompanyY [DeliveryAddress->?t_4], ?t 4: InvoiceCompanyYDeliveryAddress[city->?t 4 1]
Flora2 Objects : Company Y
Obj:CanonicalModelInvoice[InvoiceNumber->’I_001’]. Obj:CanonicalModelInvoice[AccDate->'2010_05_01']. Obj:CanonicalModelInvoice[InvoiceDate->’ 2010-05-18']. ?t_4: InvoiceCompanyYDeliveryAddress[city >?t_4_1], ?t_4: InvoiceCompanyYDeliveryAddress[zip->?t_4_2], ?t_4: InvoiceCompanyYDeliveryAddress[street->?t_4_4] | ?t_1=?h.Bizszam@SourceInstances, flora_concat_items([?h.Ev@SourceInstances,_, Obj:CanonicalModelInvoice[InvoiceDate 2010 05 18 ]. Obj:CanonicalModelInvoice[DeliveryAddress->{obj_4}]. obj_4:CanonicalModelInvoiceDeliveryAddress[city->’Oslo, Norway']. obj_4:CanonicalModelInvoiceDeliveryAddress[zip->‘1234']. obj_4:CanonicalModelInvoiceDeliveryAddress[street-> ?h.Kanyvho@SourceInstances,_01],?t_2)@_plg(flrporting), ?t_3=?h.Bizkelt@SourceInstances, ?t_4_1=?h.city@SourceInstances, ?t_4_2=?h.zip@SourceInstances, ?t_4_4=?h.street@SourceInstanc}. ‘First Street'].
Flora2 target objects to XML target instances
Source XSD TargetXSDMediation Engine
ed
o
g e
(Logical) OO representation of Source XSD (Logical) OO representation of Target XSD Semantic Mapping (Logical) OO representation of (Logical) OO representation of pp g (specification and execution) Source XML Target XML p Source XML representation of Target XML (Instances) (Instances)Example
p
Flora2 Objects: Company Y
Obj:CanonicalModelInvoice[InvoiceNumber->’I_001’]. Obj:CanonicalModelInvoice[AccDate->'2010_05_01']. Obj:CanonicalModelInvoice[InvoiceDate >’ 2010 05 18']
Flora2 Abstract:
Company Y
Namespace[value->'xs:']. YInvoice[DocumentNumber{1:1}*=>'xs:string']. YInvoice[DocumentDate{1:1}*=>'xs:string'] Obj:CanonicalModelInvoice[InvoiceDate-> 2010-05-18 ]. Obj:CanonicalModelInvoice[DeliveryAddress->{obj_4}]. obj_4:CanonicalModelInvoiceDeliveryAddress[city-> ’Oslo, Norway']. obj_4:CanonicalModelInvoiceDeliveryAddress[zip-> ‘1234']. YInvoice[DocumentDate{1:1} => xs:string ]. YInvoice[InvoiceDate{1:1}*=>'xs:string']. YInvoice[DeliveryAddress{1:1}*=>YInvoiceDeliveryAddress] YInvoiceDeliveryAddress[city{1:1}*=>'xs:string']. YInvoiceDeliveryAddress[country{1:1}*=>'xs:string']. YInvoiceDeliveryAddress[zip{1:1}*=>'xs:string']. obj_4:CanonicalModelInvoiceDeliveryAddress[street-> ‘First Street'].
XML Instances: Company Y
YInvoiceDeliveryAddress[DoorNumber{1:1}*=>'xs:string']. YInvoiceDeliveryAddress[StreetNumber{1:1}*=>'xs:string'].Flora2 Special:
Company Y
p
y
<?xml version="1.0"?> < InvoiceCompanyY >
<InvoiceNumber>I_001</InvoiceNumber> <AccDate>2010_05_01</AccDate>
<InvoiceDate>2010 05 18</InvoiceDate>
Flora2 Special:
Company Y
Sequences[LogoInvoice->['DocumentNumber','DocumentDate ','InvoiceDate','DeliveryAddress',TheOrderEnd]]. Elements[YInvoice->DocumentNumber]. Elements[YInvoice->DocumentDate]. Elements[YInvoice->InvoiceDate] <InvoiceDate>2010-05-18</InvoiceDate> <DeliveryAddress> <city>Oslo</city> <zip>1234</zip> <DoorNo> </DoorNo> <street>First Street </street> Elements[YInvoice >InvoiceDate]. Elements[YInvoice->DeliveryAddress]. Sequences[YInvoiceDeliveryAddress->['city','country','zip', ‘DoorNumber','StreetNumber',TheOrderEnd]]. Elements[YInvoiceDeliveryAddress->city]. Elements[YInvoiceDeliveryAddress->country]. </DeliveryAddress> </ InvoiceCompanyY> Elements[YInvoiceDeliveryAddress->zip]. Elements[YInvoiceDeliveryAddress->DoorNumber].
Implementation in Flora2
p
XSD
source
XSD
target
XSD to OO
Flora2 Schema
source
Flora2 Schema
target
XSD/XML file
OO to OO
source
target
Flora2 program (rules)
Flora2 file (facts)
XML to OO
OO to XML
Flora2 Instance
source
Flora2 Instance
target
XML
source
XML
target
Experiment: XSDs to Flora
p
XSDs2Flora
350 400 450 500 150 200 250 300 SimpleExSimpleEx Info SimpleEx CM Infomatix DISystemer NES 0
50 100 150
LOGO SimpleEx Info SimpleEx CM Infomatix DISystemer NES Time(Seconds) 0.249 0.219 0.242 3.84 59.295 430.518
Experiment: Complete mapping
p
p
pp g
600
700
XMLs2Flora
60
70
80
Flora2XML
200
300
400
500
20
30
40
50
60
0
100
1
100
500
1000 2000 3000 4000
0
10
20
1
100
500
1000
2000
3000
4000
300
350
400
450
Flora Mappings
800
1000
Total Mapping Time
50
100
150
200
250
0
200
400
600
800
0
50
1
100
500
1000
2000
3000
4000
Outline
Intro to XML Data Exchange
FloraMap: Flora2-based XML data transformation
Technique: steps and examples
Implementation and experiments
Implementation and experiments
Generic XML Data Exchange Framework
Related Work
Generic M-N desing- and run-time XML data
transformation
transformation
Source XSD1 Target XSD1 Canonical Model (CM) XSD Source XSD2 Target XSD2 Source XSDn Target XSDm…
…
Design-time Run-time Source XMLi (Instances) Target XMLj (Instances) CM XML (Instances)XML data transformation in B2B – Overview
(General scenario)
(General scenario)
ERP Vendor Layer
(design-time)
ERP Vendor Layer
(design-time) ERP Vendor A XSD ERP Vendor B XSD
R
A
R
B
Canonical Model (CM) XSD IAA1 XSD…
IAAn XSDR
IAB1 XSD…
IABn XSDA
+
R
B
+
Instance Application Layer
(design-time)
A
B
Are
R
A+and
R
B+
consistent ?
Yes
(with possible warnings)
No
(with errors)
Collaboration Party Agreement (IAA1, IAB1)
Instance Application Layer
(run-time)
Instance Application Layer
(run-time)
IAA1XML CM XML IAB1XML
Collaboration Party Agreement (IAA1, IAB1)
(RA+, R B+) Revise RA +and R B+
Steps:
1. Design of RAand RB 2. Design of RA+and R B+ B1 g A B3. Consistency check of RA+ and R B+
a) If inconsistent, revise RA+and/or R B+
Generic Mapping Framework
pp g
I t
Informal
End User Layer
Instances I t Informal Mapping Rules Schemas Instances f li ti f li ti f li tiMediation Layer
Formalized Mapping Rules (Schemas) S Formalized Schemas S Formalized Schemas Formalized Mapping Rules (Objects) Formalized Instances formalization formalization formalizationautomatic generation
C
it
Ch
k
M
i
E
ti
Consitency Checker
(Reasoner)
Mapping Execution
(Reasoner)
Formalized InstancesOutline
Intro to XML Data Exchange
FloraMap: Flora2-based XML data transformation
Technique: steps and examples
Implementation and experiments
Implementation and experiments
Generic XML Data Exchange Framework
Related Work
Areas of Related Work
Object-oriented representations of XML/XSD
MDE model transformations
The use of rule-based logical systems for data
i
/
h
h
’t b
t
id l i
ti
t d i
mapping/exchange hasn’t been yet widely investigated in
the community
Outline
Intro to XML Data Exchange
FloraMap: Flora2-based XML data transformation
Technique: steps and examples
Implementation and experiments
Implementation and experiments
Generic XML Data Exchange Framework
Related Work
Conclusions and Future Work
FloraMap – promising technique for XML data exchange
Allows both specification and execution of data mappings in a
single, unifying framework
End-to-end solution to the problem of XML data exchange
Planned extensions:
End-to-end mappings between multiple sources and multiple
targets
targets
Consistency checking
Inclusion of other types of schemas (not only XSDs)
(S
i )A t
t d
ti
f
t bl
i
l
Thank you!