slanted W3C logo
Cover page images (keys)

Forward Compatibility with XTAN

Sandro Hawke (sandro@w3.org)
XML Versioning Symposium, at Balisage
11 August 2008
http://www.w3.org/2008/Talks/0811-xtan

XTAN

Forward compatibility is needed for web-scale systems to improve. ("There is no one administrator")

Making languages extensible -- predicting the future -- is too hard.

XML Transform-As-Needed (XTAN) may solve this problem (at some cost).

XTAN:

  1. You receive a document you don't understand
  2. Dereference the namespace to learn about transforms
  3. Transform it into something you do understand
  4. Assess the impact and (if usable) proceed

I'm here to talk about a new approach to forward compatibility. The approach is simply this: when you get an XML document you don't understand, you use the namespace URIs to lookup instructions for transforming it into something you do understand.

My claim is that in many cases this is a practical solution to the problem of versioning languages -- which is really a critical problem in building decentralized systems -- and it should be standardized and widely adopted.

This Talk

  1. High Level View
  2. Low Level Details
  3. Examples

High Level View

My background / Semantic Web (Context)

XTAN's background / RIF (Context)

Alice and Bob (Problem Statement)

alice and bob dialect tree This is the Forward Compatibility problem. What should the spec for alpha say?

Motivating Forward Compatibility

What if Alice rejects beta documents?

Bob has a difficult choice:

For the system to move forward, Bob needs to be able to publish in beta without causing problems for Alice.

RIF Translation Diagram

RIF dialect tree
a

Approaches to Forward Compatibility

XTAN Sketch for <blink>

If HTML had always had XTAN (and XML with namespaces), then browsers which didn't implement <blink> could have followed this process:

  1. Browser gets unrecognized <blink> element
  2. Browser uses namespace to get schema+annotations
  3. Multiple fallbacks are available: blink can be rewritten to use javascript (if available), CSS text-decoration: blink (if available), or just <b>. "Best" fallback transform is chosen.
  4. Browser renders the transformed content.

XTAN Sketch for <table>

For "table" there is no good fallback. Whatever we do will be very lossy.

At least with XTAN, the developers of "table" have a choice.

Low Level Details

This is a first-pass design.

Pre-Processor

Job: transform input document into desired input language

Parameters:
  1. Input document
  2. List of allowed (implemented) syntactic features
  3. (optional) cost/weights for impact areas
Command-line version (partial usage statement):
Usage: xtan [options] input-location

Options:
  -F FEATURES, --allowed-feature=FEATURES
                        Add this feature to the set of implemented features
  -W WEIGHTS, --weight=WEIGHTS
                        Add weight co-efficient for given impact type, format
                        is like '0.25 performance'

Lookup

Features

<xs:schema 
...
  <xs:element name="a" type="xs:string">
    <xs:annotation xtan:mayIndicate="feature-a"/>
  </xs:element>
</xs:schema>

Transforms

See RIF Design Choices presentation

Impact

Example Impact Handling Table

Scenario: Calendaring application uses RIF to support very complex scheduling rules.

Severity

Area of Impact

Soundness

Completeness

Performance

Presentation

> 0.5

Serious Error

Warning

Warning

Ignore

<= 0.5

Warning

Warning

Ignore

Ignore

Routing

Examples

Example: Hello World

Input:

<a xmlns="http://www.w3.org/2008/02/xtan/test/0100-hello-world/ns">
   Hello, World
</a>

Command Line:

xtan --allowed-feature feature-b data.xml

Output:

<b xmlns="http://www.w3.org/2008/02/xtan/test/0100-hello-world/ns">
    Hello, World
</b>

Hello World Schema

Schema:

<xs:schema 
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xtan="http://www.w3.org/2008/XTAN"
  xmlns:test1="http://www.w3.org/2008/02/xtan/test/1-ns"
  targetNamespace="http://www.w3.org/2008/02/xtan/test/1-ns"
  elementFormDefault="qualified"
  version="$Id: Overview.html,v 1.33 2008/08/11 18:16:53 sandro Exp $">

  <xs:annotation>
    <xs:appinfo>

      <xtan:Transform xtan:removes="feature-a" xtan:adds="feature-b">
	<xtan:operation>
	   <xtan:GlobalElementSubstitution xtan:old="a" xtan:new="b"/>
	</xtan:operation>
      </xtan:Transform>

    </xs:appinfo>
  </xs:annotation>

  <xs:element name="a" type="xs:string">
    <xs:annotation xtan:mayIndicate="feature-a"/>
  </xs:element>
</xs:schema>

Example: blink

Input:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US"
      xmlns:extn="http://www.w3.org/2008/02/xtan/test/0200-blink">
  <head>
    <title>Blink Demo</title>
  </head>
  <body>
    <p><extn:blink>Blinking Text</extn:blink></p>
  </body>
</html>

Command Line:

xtan --allowed-feature b-element data.xml

Output:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US"
      xmlns:extn="http://www.w3.org/2008/02/xtan/test/0200-blink">
  <head>
    <title>Blink Demo</title>
  </head>
  <body>
    <p><b>Blinking Text</b></p>
  </body>
</html>

If feature "css-blink" is allowed...

Command Line:

xtan --allowed-feature css-blink data.xml

Output:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US"
      xmlns:extn="http://www.w3.org/2008/02/xtan/test/0200-blink">
  <head>
    <title>Blink Demo</title>
  </head>
  <body>
    <p><span style="text-decoration: blink;">Blinking Text</span></p>
  </body>
</html>

Conclusions

Conclusions

Next Steps

Some Possible Questions