Key and foreign key constraints are useful for XML data in semantic specification, query optimization, and data transformation and integration . They provide a robust mechanism of identifying and referring to portions of an XML document. Several XML proposals, e.g., XML Schema  and XML Data , support key and foreign key specifications. These constraints, however, have not been used for data transformation in existing mapping tools. Therefore, we describe how key and foreign key constraints are utilized for semantically transforming one XML document into the other, and with this result we define reference mapping that improves mapping power. In addition, we introduce BizTrans X, a XSLT-based mapping tool that supports reference mapping.
XML, XSLT, Mapping, Integrity Constraints
XML is the standard format for data exchange between inter-enterprise applications on the Internet. To facilitate data exchange, industry groups define schemas or use electronic commerce solutions (e.g., ebXML, OBI, xCBL, RosettaNet, UDDI, and OAGIS) that specify the format of the XML data to be exchanged between their applications. Enterprises use these schemas to transform their business document into partner's one for the purpose of business-to-business e-commerce.
To efficiently transform between XML documents, many commercial tools with a graphic UI enable users to create mapping between elements and attributes in two different specifications, and execute transformations with mapping information. Nevertheless, existing tools have a fundamental limit in mapping; they use only syntactic structure of schemas to make a map between different documents. On the other hand, we noticed that semantic information such as key and foreign key constraints can be used to improve mapping power.
In this paper, we show how key and foreign key constraints are utilized for semantically transforming between XML documents, and with this result, we define reference mapping that improves mapping power. Finally, we introduce BizTrans X that is an XSLT-based XML-to-XML mapping tool implementing reference mapping.
BizTrans X is a graphical mapping tool that enables users to create a correspondence between elements and attributes in two different specification formats. This tool presents users with both source specification and target specification and enables users to graphically define transformation by drawing lines between elements and attributes in the tree view. A map represents structural transformation relationship between two specifications. BizTrans X uses the data in a map to generate XSLT . Then the XSLT output transforms a source document into a target one. As a result, users can efficiently transform between two documents without coding. Example snapshot is depicted in Figure 1.
Keys and foreign keys have been proposed for XML in, e.g., XML Schema  and XML Data . They express a fundamental part of the semantic of XML data, and they provide a robust mechanism of identifying and referring to portions of an XML document.
The current mechanism of the XML standard relies on ID and IDREF attributes. It is rather weak since, as opposed to keys and foreign keys, ID and IDREF attributes are neither typed nor scoped . In other words, one has little control over what a reference points to. In Figure 2, what transactionId refers to is not described in the schema, but semantically we can perceive the transactionId of the BusinessProcess to refer to the id of the BusinessTransaction.
This ID/IDREF relationship, however, can be used for transforming a source document into a target document. Therefore, we use this reference relationship between ID and IDREF to improve mapping power in BizTrans X, and we call this kind of mapping "reference mapping".
Many XML documents are structured differently while they have same logical structures. For example, in Figure 2 (A doted arrow is an annotation for illustration.), both source document and target document have a same logical structure, that is, a business process consists of several business transactions. However, one is represented by IDs and IDREFs and the other is represented by the parent-child tree relationship.
Consider that a user makes a map as in the Figure 2. S/he intends that each BusinessProcess element has BusinessTransaction elements whose id is same as transactionId of BusinessProcess. Nevertheless, XSL code generated by existing tools produces all combination of BusinessProcess elements and BusinessTransaction elements of the source document since existing mapping tools don't use ID/IDREF relationships for data transformation. In the Figure 3 (a), BusinessProcess with id=ID1 refers to the BusinessTransaction with id=ID3, and BusinessProcess with id=ID2 refers to the BusinessTransaction with id=ID4 in the source document. However, XSL code generated by existing tools produces an XML document in (b) whereas the result that users want to get is in (c).
To solve the problem above, BizTrans X provides a special mapping interface with a new function, and generates an XSL code for transforming source XML documents into target XML documents conforming to this mapping interface.
To provide intuitive mapping interface, we propose a special function called reference mapping and a link connecting two fields in a source specification with one field in a target specification. This mapping interface is shown in Figure 4 (Doted lines are annotations for illustration).
BizTrans X generates an XSLT code for the reference mapping. The output XSL code is presented in the Figure 5. A XML document conforming to a source specification is transformed to a XML document conforming to a target specification using this XSLT output without coding.
We have investigated how IDs and IDREFs work in transforming between different XML documents, and using ID/IDREF relationships, we proposed the idea of reference mapping. In order to support this idea, we implemented a mapping interface and XSLT algorithm in BizTrans X.