Top Banner
WebNet 2001 TU/e technische universiteit eindhoven October 26, 2001 1 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology Dept. of Computer Science
28

TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

Mar 31, 2015

Download

Documents

Cory Curington
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 1

XML to XML through XML

Pim Lemmens

Geert-Jan Houben

Eindhoven University of Technology

Dept. of Computer Science

Page 2: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 2

XML to XML through XML

How Adaptation of XML Transformations May Be Done by the

Same Tool As Used for the Transformations Themselves

Page 3: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 3

Hera ArchitectureRelational Database

Object-Oriented Database

XML Database

ODB-XML Wrapper

RDB-XML Wrapper

Mediator/ Integrator

Logical Presentation

Logical-WML Presentation

HTML Presentation

SMIL Presentation

WML Presentation

Logical-SMIL Presentation

Logical-HTML Presentation

Information Retrieval

Hypermedia Presentation

…Query

Use

r/P

latf

orm

A

dapt

atio

n

Page 4: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 4

XML Transformations

• Document screening• Data retrieval, querying• Applying style sheets

• Adaptation of those transformations to– User profiles– Platform requirements– Producer preferences– ..

Page 5: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 5

Transformations in HERA

Genericquery

Adaptedquery

Sourcedata

Genericstylesheet

Adaptedstylesheet

Outputdata

Filtereddata

Queryadaptation

Stylesheetadaptation

Page 6: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 6

Transformation Tools

• XSLT

• XQuery

• Something different (for adaptation): HTL

Page 7: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 7

Single Tool for All Transformations

• transformation of documents• transformation of transformation specifications transformation specifications ~ documents

• transformation specification: schema• document: instance

schema ~ instance

Page 8: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 8

Transformation and Document

House query (schema):

<house>

<price>

120,000

</price>

</house>

House doc (instance):…<house id=“h123”> <price> 100,000 </price> <address>..</address></house><house id=“h234”>…

Page 9: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 9

Requirements for HERA Transformations

• Isomorphism between schema and instance

• Separate items separately accessible

• Separation of input and output document specifications

• One uniform mechanism for specifying structure, values and operations, independent of their use

Page 10: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 10

Req 1: Isomorphism Schema - Instance

• Schema element/attribute name = instance element/attribute name

• Schema children or attributes of element instance children or attributes of element

• Schema element/attribute values instance element/attribute values

• Arbitrary length list in instance represented by e.g. special kind of loop in schema

Page 11: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 11

Req 2: Separate Items Separately Accessible

All HTL entities should be accessible to HTL:• Items to be found in input• Values to be changed• Items to be used for output• Operands to be used in calculations DOM nodes:

• Elements• Attributes• Text nodes

Page 12: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 12

DOM Nodes

<house year=“1980”> <price> 120,000 </price> Nice house in good condition</house>

“120,000”

house

year price

“Nice ..

“1980”

Page 13: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 13

Req 3: Separation of Input & Output Spec

• Output spec not limited by input spec requirements

• Input spec not limited by output spec requirements

• Requires links between input and output spec• Output and input spec may use same formalism

Page 14: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 14

Req 4: One Mechanism for All

• Output specification (structure, values, names)

• Input selection (structures, values, names)

• Calculation (operators, operands)

All described using templates

Page 15: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 15

Input and Output Templates

Input template

<htl:template> <house htl:id=“123”> <price/> <address/> <city/> </house></htl:template>

Output template

…<htl:template>…<htl:select idref=“123”> <expenses> <htl:value-of> <price/> </htl:value-of> </expenses>…………

Page 16: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 16

Requirements for HERA Transformations

Recap:

• Isomorphism between schema and instance

• Separate items separately accessible

• Separation of input and output document specifications

• One mechanism for specifying structure, values and operations

Page 17: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 17

Why Not Use XSLT?

+ Well tested, efficient and widely available

– Structure of specification very different from structure of documents

– Paths defined using XPath: expressions hard to transform

– Input driven: processing (and output) order determined by input document.

Page 18: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 18

Why Not Use XQuery?

+ Separate query and output generation parts

+ Output spec has XML structure

– But, input spec has not an XML structure: query part needs string parsing

Page 19: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 19

HTL: HERA Transformation Language

• Templates: used for input spec, output spec and calculation spec

• Separate output spec & input spec templates• Templates may use sub-templates

• Filter specification: input data to be used• Selection specification: retrieved data to be

inserted in output or used for calculations

Page 20: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 20

Templates and Sub-templates

<a>

<b> .. </b>

<c> <htl:param idref=“p”/> </c>

<d/>

</a>

<htl:template htl:id=“p”> <q> <r> </htl:template>

Page 21: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 21

Filtering and Selection

Filter specificationOutput specification

Page 22: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 22

Templates and Path Expressions

<htl:template>

<a>

<b htl:id=“xyz”>

<d/> <e/> <f/>

</b>

</a>

</htl:template>

Equivalent XPath expression when

accessed through idref “xyz”:

a/b[d e f]

Page 23: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 23

Templates and Calculations

<htl:attribute name=“a”> <htl:from> <htl:operator op=“+”> <price/> 10 </htl:operator> </htl:from></htl:attribute>

XPath:

[@a &gt; (price + 10)]

Page 24: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 24

List of HTL Elements

• htl:transform• htl:template• htl:output• htl:attribute• htl:from• htl:to• htl:operator• htl:param

• htl:any• htl: descendant• htl:select• htl:name-of• htl:value-of• htl:copy• (attribute) htl:id

Page 25: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 25

Implementation

XSLT:+ Proven technology+ HTL-to-XSLT conversion by XSLT+ Semantics defined in terms of XSLT+ Use of XPath operators– Additional translation step required– Use of separate XSLT templates and modes not

possible

Page 26: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 26

Conclusions

• Tool for XML transformations that allows transformations on transformations– Schema isomorphic to instance– Basic entities correspond to DOM nodes– Separation of input & output specification– All expressions represented by XML structures

• Implementation: XSLT

Page 27: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 27

Contact Information

W.J.M. Lemmens

Eindhoven University of Technology

P.O. Box 513

NL 5600 MB Eindhoven

E-mail: [email protected]

Phone: (+31)(0)402473755

Page 28: TU/e technische universiteit eindhoven WebNet 2001October 26, 20011 XML to XML through XML Pim Lemmens Geert-Jan Houben Eindhoven University of Technology.

WebNet 2001

TU/e technische universiteit eindhoven

October 26, 2001 28