Introduction

The purpose of this project can be described in two folds. First, we design a bidirectional transformation language, called BiXJ, which can execute in two directions: forward direciton and backward direction.

In the forward direction, it generates (materialized) views from source data, while in the backward direction, it can updates the source data according to the updates made on views.

Second, we use this bidirecitonal langauge to interpret XQuery, which is a powerful language to query XML data. As a result, XQuery, called Bidirectional XQuery then, can also execute in two directions. And in the backward direction, the updates on views are reflected back into the source data made up this view. By this way, we address the view updating problem for XQuery.

Bidirectional XQuery can be used to publish and synchronize data in a distributed or network environment.

Documents

1. Dongxi Liu, Zhenjiang Hu and Masato Takeichi. Bidirectional Interpretation of XQuery. In Proc. PEPM 2007, Nice, Fance.

1. Dongxi Liu. User Manual of BiXJ.

Download

1.  X2B: a translator from XQuery Core expressions to BiXJ code. [download]

   usage: java -jar X2B.jar filename  (the file filename contains the XQuery core expression to be interpreted bidirectionally, which can be generated from Galax XQuery Engine.)

   output: filename.bix [filename-lib.bix]

          (the file filename.bix is a BiXJ program, and the optional file filename-lib.bix contains BiXJ definitions of user-defined XQuery functions in filename.)

2. BiXJ: a bidirectional language interpreter. [download]

     usage  1): java -jar BiXJ.jar filename.bix 0 (the file filename is to be executed in the forward direction.)

     output 1): filename-view.xml [filename-view-type.xml]

               (The filename-view.xml contains the view, and the optional file filename-view-type.xml contains the view type.)

     usage  2): java -jar BiXJ.jar filename.bix 1 (the file filename is to be executed in the backward direction.)

     output 2): The source data file specified in the query of XQuery core is updated.  

Examples

 Each example includes several files, containing the source XML data, its type and an XQuery core expression, respectively. In addition, for each example, an updated view sample  and the corresponding XQuery query are also accompanied for reference.

The XQuery core expressions are generated from the corresponding XQuery exoressions by using Galax XQuery Engine.

 The valid updats on views include three kinds: modification, insertion and deletion. An insertion needs to be marked by a special attribute u="ins", and a deletion by u="del". Modifications do not need to be marked.       

1. This example queries books which are published by "Addison-Wesley" after the year 1991.

      [Source Data]  [Type of the Source Data] [XQuery Core] [Sample View Updates] [XQuery]

      In the sample view updates, the newyear attribute of the first book is modified to 1997, and its title is modified by adding three + in the head; the title of the second book is deleted ; a new book is inserted in the third place. 

2. This example builds the table of contents for a book. A section of the book may includes subsections, so it is processed by a recursive function.

      [Source Data]  [Type of the Source Data] [XQuery Core] [Sample View Updates] [XQuery]

      In the sample view updates, the id attribute of the first section and its title are modified, and the title of its second subsection is deleted. There is a new second section inserted, including several subsections. There is also a newly inserted subsection in the third (or the original second) section.

3. This example removes the root tag and also the tag of each book element, such that the contents of all books are flatten.

     [Source Data] [Type of the Source Data] [XQuery Core] [Sample View Updates] [XQuery

      In the sample view updates, a lot of new title and author elements are inserted. After the backward execution, some inserts are put into new books, and others are put back into the existing books. The updated source data is still valid with respect to its type.

4. This example demonstrates the soring function.

      [Source Data] [Type of the Source Data] [XQuery Core] [Sample View Updates] [XQuery]

More examples will be added...


2006-9-10:

    1) The inserted elements are allowed to contain attributes, demonstrated by the sample updates the example 1 and example 2.

    2) Sorting functions are implemented in BiXJ.

2006-10-25:

    1) The "order by" in XQuery can be translated into BiXJ code.

    2) More syntax constructs in XQuery core are supported.

2006-12-04:

    1) The new implementation of BiXJ is more robust and efficient.

2007-05-28:

    1) X2B and BiXJ are both updated. The code from Galax can be processed by X2B directly.