Pervasive e-commerce with XML Babak Esfandiari Carleton University Ottawa, Canada.

26
Pervasive e-commerce with XML Babak Esfandiari Carleton University Ottawa, Canada

Transcript of Pervasive e-commerce with XML Babak Esfandiari Carleton University Ottawa, Canada.

Pervasive e-commerce with XML

Babak EsfandiariCarleton University

Ottawa, Canada

XML introduction eXtensible Markup Language “a markup language for documents

containing structured information” (Walsh) this structure is defined mainly with a set

of tags subset of SGML HTML can be seen as an instance of XML

(it is not really though, but that is not important…)

XML example

<?xml version="1.0" ?><!-- a simple tagset for museums><Museum name="Louvre">

<city> Paris</city>

</Museum>

DTD Document Type Definition Describes the XML tagset

<!DOCTYPE Museum [ <!ELEMENT Museum (city)> <!ATTLIST Museum name CDATA #REQUIRED> <!ELEMENT city (#PCDATA)>]>

Not mandatory (!)

XML - what for? content is independent from rendering meta-data makes search easier standard tags enable data interchange

across tools format for data and object persistence,

human readable and editable no need for a custom parser anymore

TourTags “The purpose of TourTags.org is to

foster dialogue within the community in order to arrive at open standards for conducting electronic commerce by settling on common tag sets and methods in which they are to be used.”

supports IFITT’s RMSIG

XML and TourTags derive a tagset from RMSIG specs discuss/modify the tagset use the tagset for B2B (ebXML) allow device-neutral access to

business info we have a process…

The Acronym Hell Diagram our process is a series of

transformations

UML

XMI

XML/DTD

ebXML

Webform

XML

VoiceXML

WML

HTML

meta-data registration

document

display

Meta-data Why not directly model tags?

Tags are not for modeling! Lack of a graphical notation Semantically poor:

Hard to represent relationships XML can be seen as one

possible mapping of a model The RMSIG has chosen

UML…

UML

XMI

XML/DTD

Meta-data UML: Unified Modeling

Language Object-oriented Graphical Covers:

Requirements Static representation Activities and processes

UML

XMI

XML/DTD

Meta-data A UML class diagram:

UML

XMI

XML/DTD

-name : String

Museum City

Meta-data But we need the tags! Is it possible to transform

UML into XML? We can use XMI

XMI is the direct textual representation of UML using the XML format

Most UML tools support XMI

UML

XMI

XML/DTD

Meta-data A sample XMI document:<Class>

<name>Museum</name><feature>

<Attribute><name>name</name></Attribute>

</feature></Class>

UML

XMI

XML/DTD

Meta-data We still need to transform

XMI into our XML tagset Since a DTD describes the

structure of an XML document, it is the ideal target!

What is the easiest way to do the concrete transformation?

UML

XMI

XML/DTD

Transformations Different methods:

Parsing: use existing XML parsing libraries based on standard APIs (SAX, DOM) with a programming language

Transformations: specify the transformations in a (yet

another) XML document called an XSLT stylesheet

Use an XSLT processor (Saxon, XT, …)

XSLT example (excerpt)<xsl:stylesheet><xsl:template match="Class">

blah <xsl:value-of select="name"/> blah<xsl:apply-templates select="feature/Attribute"/>

</xsl:template><xsl:template match="feature/Attribute">

<xsl:value-of select="name"/></xsl:template></xsl:stylesheet>

XSLT example The XSLT in the previous slide, applied

on the Museum XMI, should generate something like:blah Museum blah name

Nothing exciting but you get the idea!

Meta-data Some of the issues in the

transformation from XMI to DTD: Ambiguity in choice of attributes and

elements -> open for discussion! Inheritance: compound the inherited

attributes Composition: recursively add sub-

elements, or use separate documents

DTDs support for primitive types is limited… XML schema an alternative

UML

XMI

XML/DTD

Registration The resulting DTDs can now be

used for B2B e-commerce We now have a domain

“ontology” to base transactions on!

We can use this ontology to: Publish/advertize a business Search for a business

We need a registry to enable that

ebXML

Webform

Registration ebXML is one of the leading

consortiums for e-business It describes a standard for B2B

registries Third parties (TourTags?) have the

opportunity to create and host such registries

To access such registries and allow publishing and search, Web forms are an intuitive front-end interface Guess what…

ebXML

Webform

Registration We can use the DTDs and XSLT

to generate such web forms! The web forms for publishing and

search are very similar Each leaf element or attribute

becomes a field to fill in Better support (than DTDs) for data

types would allow for a better customization of the data fields

ebXML

Webform

Museum name:

Registration Different deployment

scenarios are possible for registries: Traditional Client/server Peer to peer

Decentralized Less resource intensive

ebXML

Webform

Document rendering The result of a registry

search is an XML document that follows the structure specified by our DTD

Such a document does not contain any instructions for rendering (i.e. display)

This is a good thing!

XML

VoiceXML

WML

HTML

Search and rendering rendering adapted to

device: XML -> HTML for web browser XML -> WML for cell phones XML -> VoiceXML for regular

phones Yes, we can use XSLT again! No duplication of data! No need to maintain

redundant documents!

XML

VoiceXML

WML

HTML

Conclusion A completely XML-based process

that takes us from the inception of a domain ontology to the delivery of business info

The process relies on a series of transformations

References xml.org rmsig.org tourtags.org ebxml.org

It had to be on the web!