Anda di halaman 1dari 15

More Functional Dependencies for XML

Sven Hartmann and Sebastian Link


Information Science Research Centre Massey University, Palmerston North, New Zealand

Abstract. In this paper, we present a new approach towards functional dependencies in XML documents based on homomorphisms between XML data trees and XML schema graphs. While this approach allows us to capture functional dependencies similar to those recently studied by Arenas/Libkin and by Lee/Ling/Low, it also gives rise to a further class of functional dependencies in XML documents. We address some essential dierences between the two classes of functional dependencies under discussion resulting in dierent expressiveness and dierent inference rules. Examples demonstrate that both classes of functional dependencies appear quite naturally in practice and, thus, should be taken into consideration when designing XML documents.

Introduction

The Extensible Markup Language (XML) [7] is nowadays commonly used as a prime format for publishing and exchanging data on the web. In most cases, so far, a data provider stores data in a relational database and transforms the data to XML whenever necessary. As long as XML is used as a mere markup language according to its original intention there is in general no need for persistent storage of XML documents. In addition, however, there is an increasing number of applications using native XML documents. Often, the targets of modern information systems are much too complex to be stored in relational tables with semi-structured data e.g. from molecular biology being the most prevalent example. There is an ongoing trend to use XML for representing these new forms of data as XML provides a simple, universal and widely accepted standard for describing complex data structures. If XML is expected to serve as a rst class data model, eective means for the management of persistent XML documents as databases are needed. As is true for managing traditional data, the management of XML data requires capabilities to cope with integrity, consistency, data independence, recovery, redundancy, views, access rights, integration, and the enforcement of standards and normal forms. Unfortunately, XML itself provides only syntax but does not carry the semantics of the data. However, in relational databases, integrity constraints have been proven useful in making a good design, in preventing update anomalies, and in allowing the application of ecient methods for data storage and access, and for query optimization. Understanding this situation, several classes of integrity constraints have been extended to or newly dened for XML including key dependencies, inclusion dependencies, inverse constraints, and path constraints. In
L. Kalinichenko et al. (Eds.): ADBIS 2003, LNCS 2798, pp. 355369, 2003. c Springer-Verlag Berlin Heidelberg 2003

356

S. Hartmann and S. Link

addition, properties such as axiomatization and satisability have been studied for these constraints. For details, see [1,3,811,17]. Functional dependencies other than key dependencies have been little investigated for XML so far. From relational databases, it is well-known that inserting or modifying data in the presence of a functional dependency is a major source of update anomalies due to redundant data [5,6]. Consequently, functional dependencies have been most widely studied in the literature on the relational database model and are most widely used in practice, cf. [2]. In particular, popular normal forms such as 3NF or BCNF avoiding important kinds of data redundancy are dened on the basis of functional dependencies. In view of this experience it is rather astonishing that functional dependencies so far did not receive adequate attention in the literature on XML. In fact, there are only two papers [4,13] addressing these constraints. Both dene functional dependencies on the basis of paths in XML documents. This approach goes back to earlier research on functional dependencies in semantic and object-oriented data models [15,18]. As we will see later on, there are functional dependencies in XML documents which are not captured by this approach. Our objective is to dene functional dependencies on the basis of subgraphs of XML data trees and XML schema trees. This approach is a natural generalization of functional dependencies in relational databases. In addition, it allows us to specify functional dependencies similar to those studied by Arenas/Libkin [4] and Lee/Ling/Low [13] as well as further functional dependencies for XML which appear quite naturally in practice. The present paper is organized as follows. In Section 2, we give examples of functional dependencies to be discussed within this paper. In Section 3, we assemble some basic terminology to be used later on. In particular, we provide the notions of XML graphs and v-subgraphs. On the basis of these notions, we propose two denitions of functional dependencies for XML in Section 4. In Section 5, we study interactions of functional dependencies for XML and discuss inference rules.

An Example

Consider the XML data tree in Fig. 1 containing data on courses organized by the dancing club of the local high school. (A precise denition of XML data trees will be given in the subsequent section. The XML document corresponding to this XML data tree is shown in Fig. 14 in the appendix.) It happens that neither gentlemen nor ladies change their dance partners, that is, for every pair in the XML data tree He determines She, and vice versa. Both observations are likely to be called functional dependencies. Now consider the XML data tree in Fig. 2. It is obvious that the observed functional dependencies do no longer hold. Nevertheless the data stored in this tree is not independent from each other: whenever two courses coincide in all their pairs then they coincide in their rating, too. That is, in every course the set of Pairs determines the Rating. The reason for this might be straightforward.

More Functional Dependencies for XML


E E Course A Feb 1
Date Root

357

E Course E ARating

E Course E BRating

E
He

Pair

Date

A Date Feb 5
He

E Tom

E She Jane

Feb 2
He

Pair

Pair

Pair She

E Pair BHe

Rating

E Tom

E Jane

She

E Jim

He

E Tina

She

E E Tom Jane

E Jim

E Tina

She

Fig. 1. An XML data tree carrying some functional dependency.


E E Course A
Date Root

E Course E BRating

E Course E BRating

Date

A Date Feb 5
He

Feb 2
He

Pair

Pair

Feb 3
He

Pair

Pair

Pair She

E Pair A+
He

Rating

E Tom

E Jane

She

E Jim

He

E Tina

She

E Tom

E Jane

She

E Jim

He

E Tina

She

E E Tom Tina

E Jim

E Jane

She

Fig. 2. Another XML data tree still carrying some functional dependency.

Suppose, during every course each pair is asked whether they enjoyed dancing with each other (and suppose that the answer will not change over time). Afterwards, the average rating is calculated for the course and stored within the XML document. This, in fact, leads to the functional dependency observed in Fig. 2. Surprisingly, both Arenas/Libkin [4] as well as Lee/Ling/Low [13] introduced the rst kind of functional dependencies for XML, while the second kind has been neglected so far in the literature on XML. The reason for this is the path-based approach towards functional dependencies used in both papers. This motivated us to investigate a subgraph-based approach which allows us to cope with both kinds of functional dependencies.

Graphs and Trees for XML

Within this paper we use a fairly simple XML graph model, which is still powerful enough to point out essential dierences between both kinds of functional dependencies under discussion. We assume that the reader is familiar with basic notions from graph theory such as graphs, trees and paths. For a comprehensive introduction to graph theory, we refer to [12]. Note that all graphs within this paper are considered to be nite, directed and without parallel arcs.

358

S. Hartmann and S. Link

3.1

Rooted Graphs and Trees

A rooted graph is a directed acyclic graph G = (VG , AG ) with one distinguished vertex rG , called the root of G, such that every vertex of G can be reached from rG by passing a directed path of forward arcs. In a rooted graph every vertex but rG has at least one predecessor, while rG has no predecessor. For every vertex v, let SuccG (v) denote its (possibly empty) set of successors in G. Vertices without successors are said to be leaves. Let LG VG denote the set of leaves of G. A rooted tree is a rooted graph T = (VT , AT ) where every vertex v VT but the root rT has exactly one predecessor. 3.2 XML Graphs and Trees

Rooted graphs are frequently used to illustrate the structure of XML documents, see e.g. [1,4,9,11,14]. In general, we suppose that there are xed sets EN ames of element names and AN ames of attribute names, and a xed symbol S indicating text. An XML graph is a rooted graph G together with two mappings name : VG EN ames AN ames and kind : VG {E, A} assigning every vertex its name and kind, respectively. If G is, in particular, a rooted tree we also speak of an XML tree. The symbols E and A tell us whether a vertex represents an element or an attribute, respectively. We suppose that vertices of kind A are always leaves, while vertices of kind E can be either leaves or non-leaves. In addition, we suppose that vertices of kind E have a name from EN ames, while vertices of kind A have a name from AN ames. An XML data tree is an XML tree T together with an evaluation val : LT ST RIN G assigning every leaf a (possibly empty) string. An XML schema graph is an XML graph G together with a mapping f req : AG {1, } assigning every arc its frequency. We suppose that arcs terminating in vertices of kind A always have frequency 1, while arcs terminating in vertices of kind E may have frequency 1 or . In Fig. 5, for example, we marked all arcs of frequency by a . Further, we suppose that no vertex in an XML schema graph G has two successors sharing both their kind and their name. Hence, the rst graph in Fig. 3 may serve as an XML schema graph, while the second one
Root

E
E E A Date E E
He Root Course

E Course A
Date

E E
Rating

Course Rating

E Pair
He

A Date E E
He Pair She

E E E
Pair

Pair She

Rating

She

He

She

Fig. 3. Two XML trees with vertex labels illustrating names and kinds of vertices.

More Functional Dependencies for XML


E E Course A Feb 1
Date Root

359

E Course E ARating

E Course E BRating

E
He

Pair

Date

A Date Feb 5
He

E Tom

E She Jane

Feb 2
He

Pair

Pair

Pair She

E Pair A+
He

Rating

E Tom

E Jane

She

E Jim

He

E Tina

She

E E Tom Tina

E Jim

E Jane

She

Fig. 4. An XML data tree with additional labels for the leaves illustrating their values.
Root

E * Course E A Date E * Pair E


He

Rating

She

Fig. 5. An XML schema tree with additional labels indicating -frequencies.

does not. If G is, in particular, an XML tree we also speak of an XML schema tree. Note that XML schema graphs should not be mixed up with the popular language XML Schema [16] which can be used to describe XML documents. Instead, we use this term to emphasize the analogy with a database schema in traditional database design. A further remark concerning the frequencies is called for. Our intention is to use XML schema graphs to describe XML documents. In this sense, the frequency of an arc a = (v, w) between two vertices of kind E tells us whether elements of the XML document modelled by the vertex v may contain many elements modelled by the vertex w or no more than a single one. In the example of Fig. 5, this means that a course may contain several pairs, but only one rating. It is rather easy to determine the frequencies when deriving an XML schema graph from a DTD. In this case every element, that is, every vertex v of kind E comes along with a regular expression exp(v) over the alphabet EN AM ES or is associated with text, that is, exp(v) = S. We suppose that the regular expression contains only names of successors of v in G, that is, exp(v) {name(w) : kind(w) = E and w SuccG (v)} . Consequently, every leaf of kind E is associated with the empty expression or with text. As an example, consider the XML schema tree in Fig. 5 and assume we are given the regular expressions exp(vRoot ) = Course, exp(vCourse ) = (P air, Rating), exp(vP air ) = (He, She) as well as exp(vRating ) = S, exp(vHe ) = S and exp(vShe ) = S indicating that

360

S. Hartmann and S. Link

the latter elements are associated with text. From exp we may derive the frequency f req(a) of every arc a = (v, w) between two vertices of kind E: it is if there is some word in the regular language dened by the expression exp(v) which contains the name of w more than once, and 1, otherwise. Though the authors of [4,13] assumed the existence of a DTD, their ideas straightforward translate to XML schema graphs. In practice, XML documents do not always possess DTDs, but may be developed either from scratch or using some other description. Therefore, we prefer to use XML schema graphs rather than DTDs for the denition of functional dependencies. The advantage is that XML schema graphs may easily be generated from native XML documents. 3.3 Homomorphisms between XML Graphs

Let G and G be two XML graphs, and consider a mapping : VG VG . We call the mapping root-preserving if the root of G is mapped to the root of G, that is, (rG ) = rG . Further, is kind-preserving if the image of a vertex is of the same kind as the vertex itself, that is, kind(v ) = kind((v )) for all v VG . Finally, is name-preserving if the image of a vertex carries the same name as the vertex itself, that is, name(v ) = name((v )) for all v VG . The mapping is a homomorphism between G and G if the following conditions hold: (i) every arc of G is mapped to an arc of G, that is, (v , w ) AG implies ((v ), (w )) AG , (ii) is root-, kind- and name-preserving. A homomorphism may be naturally extended to the arc set of G : given an arc a = (v , w ) of G , (a ) denotes the arc ((v ), (w )) of G. As an example, consider the two XML trees in Fig. 3. There is a unique name-preserving mapping which maps the vertices of the second graph G to the vertices of the rst graph G. (That is, all vertices with name Course in the second graph are mapped to the single vertex with name Course in the rst graph, etc.) It is not dicult to check, that this mapping satises conditions (i) and (ii) mentioned above, i.e., is a homomorphism. Let T be an XML data tree and G an XML schema graph. T is said to be compatible with G if there is a homomorphism : VT VG between T and G such that for every arc a = (v, w) of frequency 1 in G its pre-images in T are mutually vertex-disjoint. Due to our denition of XML schema graphs there is exactly one root-, kind- and name-preserving mapping from VT to VG , that is, if the homomorphism exists then it is unique. For example, consider the XML data tree T in Fig. 4 and the XML schema tree T in Fig. 5. Again, the unique name-preserving mapping from VT to VT is a homomorphism between T and T . On comparing both trees and checking the frequencies, it turns out that T is in fact compatible with T . A homomorphism : VG VG between XML graphs G and G is an isomorphism if is bijective and 1 is a homomorphism, too. Then G is said to be isomorphic to G or a copy of G. Moreover, we call two isomorphic XML data trees T and T equivalent if the isomorphism : VT VT between them

More Functional Dependencies for XML


vcourse E A Date E E
He

361

Course Pair She Rating

vcourse E E E E
He

Course Pair Rating

Fig. 6. Two vCourse -subgraphs of the XML tree T in Fig. 5, where vCourse denotes the vertex with name Course in T . The subgraph on the left hand side is the total vCourse -subgraph T (vCourse ) of T .
vcourse,1 E Course A Feb 1
Date

vcourse,2 E Course E ARating

vcourse,3 E Course E BRating

E
He

Pair

Date

A Date Feb 5
He

E Tom

E She Jane

Feb 2
He

Pair

Pair

Pair She

E Pair A+
He

Rating

E Tom

E Jane

She

E Jim

He

E Tina

She

E E Tom Tina

E Jim

E Jane

She

Fig. 7. Three total subgraphs of the XML tree T in Fig. 4. Their roots vCourse,1 , vCourse,2 and vCourse,3 are just the three vertices with name Course in T . These three total subgraphs are the pre-images of the total vCourse -subgraph T (vCourse ) of the XML tree T in Fig. 5 under the unique homomorphism between T and T .

is also evaluation-preserving, that is, val((v )) = val(v ) holds for every vertex v VT . 3.4 v-Subgraphs

Let G be a rooted graph, v be a vertex of G and L LG be a set of leaves of G. Consider the union U of all directed paths of G from v to some leaf in L = LU . We call U a v-subgraph of G. Clearly, every non-empty v-subgraph of an XML graph is itself an XML graph. In particular, a non-empty v-subgraph of an XML tree is again an XML tree. If U contains all leaves of G which may be reached from v by passing a directed path of G, then U is said to be the total v-subgraph of G and is denoted by G(v). Note that G(v) is maximal among the v-subgraphs of G and contains every other v-subgraph of G as a v-subgraph itself. Let G and G be XML graphs. A homomorphism : VG VG between them induces a mapping of the total subgraphs of G to the total subgraphs of G: given a total v -subgraph G (v ) of G , (G (v )) denotes the total (v )subgraph G((v )) of G. Note that the vertices and arcs of G (v ) are mapped to the vertices and arcs of (G (v )). Obviously, the number of pre-images of a total v-subgraph of G coincides with the number of pre-images of the vertex v.

362

S. Hartmann and S. Link


vcourse,2 E Course E ARating

vcourse,1 E Course E E Tom


He Pair

vcourse,3 E Course E BRating Rating Pair

E E Tom
He

Pair

Pair

E E Tom
He

E Pair A+
He

E Jim

He

E Jim

Fig. 8. The projections of the three XML trees in Fig. 7 to the vCourse -subgraph U on the right hand side of Fig. 6.

Let G and G be two XML graphs together with a homomorphism between them. An rG -subgraph U of G is a subcopy of G if U is isomorphic to some rG -subgraph U of G. A subcopy of G is maximal if it is not contained in any other subcopy of G. Note that copies of G in G are maximal subcopies, but not vice versa. Maximal subcopies are of special interest as an XML data tree compatible with some XML schema tree T does not necessarily contain copies of T . 3.5 Projections

Let G and G be XML graphs together with a homomorphism : VG VG between them. Given an rG -subgraph U of G, the projection of G to the subgraph U is the rG -subgraph U of G whose leaves are just the pre-images of the leaves of U , that is, LU = {u LG : (u) LU }. We denote U by G |U .

Functional Dependencies

We are now ready to discuss possible denitions of functional dependencies for XML. For an XML data tree T , there is usually more than just a single XML schema graph G such that T is compatible with G. It is well-known that every rooted graph G may be uniquely transformed into a rooted tree T by unfolding it, that is, by splitting vertices with more than one predecessor. For the sake of simplicity, we will restrict ourselves to functional dependencies dened with respect to a xed XML schema tree T . A functional dependency (or XFD, for short) is an expression v : X Y where v is a vertex of T , and X and Y are v-subgraphs of T . The natural question to be asked at this moment is: When does an XML data tree compatible with T satisfy this functional dependency? In order to give an appropriate answer, we consider a simple example of an XML data tree arising from a straightforward translation of a database relation to XML, see Fig. 9. The original database relation satises the functional dependency Class: Subject, Lecturer Room, that is, any two classes on the same subject given by the

More Functional Dependencies for XML


E
Root

363

* E Class A Date E
Subject

Lecturer

Room

Root

E Class A Date Feb 1 E


Subject

E Class
Room

E Class
Room

E Cs1

A Date Feb 2 E
Subject

A Date Feb 3 E
Subject

Room

Cs2 E
Lecturer

Cs1 E
Lecturer

Java

E Mary

Lecturer

XML

Mary

Java

Mary

Fig. 9. An XML schema tree and a compatible XML data tree arising from a traditional database relation.
E Class E
Subject

E Class E
Room

Lecturer

Fig. 10. The vClass -subgraphs X and Y of the XML schema tree in Fig. 9 involved in the XFD vClass : X Y under discussion.
vclass,1 E Class A Feb 1
Date Room

vclass,2 E Class A Date Feb 2 E


Subject Room

vclass,3 E Class A
Date Room

Subject

E Cs1

Cs2 E
Lecturer

Feb 3 E
Subject

Cs1 E
Lecturer

Java

E Mary

Lecturer

XML

Mary

Java

Mary

Fig. 11. The three pre-images of the total vClass -subgraph of the XML schema tree in Fig. 9. The rst and the third pre-image coincide in their projections to X as well as in their projections to Y .

same lecturer use the same room, too. This translates quite naturally to the XFD vClass : X Y , where X and Y are the two vClass -subgraphs in Fig. 10. On inspecting the three pre-images of the total vClass -subgraph of the XML schema graph we observe that for the rst and the third pre-image their projections to the the subgraph X are equivalent. Caused by the functional dependency under inspection their projections to the subgraph Y are equivalent, too.

364

S. Hartmann and S. Link

The discussion above advises a suitable generalization of functional dependencies to XML. However, it should be emphasized that in the simple example above the pre-images of the total vClass -subgraph are copies of the total vClass subgraph. In general, this is not the case as shown by the examples in the previous section. This observation gives rise to at least two possible interpretations of a functional dependency for XML: Functional Dependencies A First Interpretation: Consider an XML data tree T which is compatible with T and let be the unique homomorphism between them. T satises the XFD v : X Y if for any two maximal subcopies W1 and W2 of T (v) in T the projections W1 |Y and W2 |Y are equivalent whenever the projections W1 |X and W2 |X are equivalent. Functional Dependencies A Second Interpretation: Consider an XML data tree T which is compatible with T and let be the unique homomorphism between them. T satises the XFD v : X Y if for any two pre-images W1 and W2 of T (v) in T the projections W1 |Y and W2 |Y are equivalent whenever the projections W1 |X and W2 |X are equivalent. In order to distinguish between these two interpretations we shall speak of functional dependencies of the rst kind (or XFD1 , for short) and functional dependencies of the second kind (or XFD2 , for short). Reconsider the examples of functional dependencies discussed in Section 2. In the XML data tree in Fig. 1, we observed that He determines She within a pair. This gives rise to the XFD vP air : X Y , where X is the vP air -subgraph with the single leaf vHe , while Y is the vP air -subgraph with the single leaf vShe . The XML data tree in Fig. 1 satises this functional dependency both as an XFD1 and as an XFD2 . In the XML data tree in Fig. 2, we noticed that for every course the set of pairs determines the rating. This leads to the functional dependency vCourse : X Y , where X is the vCourse -subgraph with the leaves vHe and vShe , while Y is the vCourse -subgraph with the single leaf vRating . The XML data tree in Fig. 1 satises this functional dependency as an XFD2 , but not as an XFD1 .

Interactions between XFDs

As for ordinary database relations, the integrity satised by an XML data tree are usually not independent. The notions of implication and derivability (with respect to some rule system R) can be dened analogously to the notions in the relational database model, cf. [2]. A single constraint follows from a constraint set if holds in every XML data tree which satises . We also say that implies . Of course, one will not inspect all possible XML data trees compatible with a given XML schema graph in order to decide implications of a given set of XFDs. Rather, we are interested in inference rules which help to decide this question. An inference rule is an expression where is a subset of , and

More Functional Dependencies for XML


E
Course

365

Course

Course

* Pair E E
He

* Pair E E
She

* Pair E E
He

She

Fig. 12. The vCourse -subgraphs X, Y and X Y of the XML schema tree in Fig. 5.

states some condition on which has to be satised if we want to apply this rule. If contains a subset satisfying the condition , then may be derived from due to that inference rule. An inference rule is sound if implies every constraint which may be derived from due to that rule. The general problem is to nd a rule system R which allows us to derive every constraint which is implied by a given set within a xed constraint class. Such a rule system is said to be complete for this class. Let X, Y, Z be v-subgraphs of a given XML schema tree T , and let X Y denote the union of X and Y which is again a v-subgraph. The following rules may easily be obtained as generalizations of the well-known Armstrong rules for functional dependencies in the relational database model [5,6]: v:XY v : X Y, v : Y Z , , v :X X Y v:XZ

v:XY

Y is a v-subgraph of X,

called reexivity axiom, extension rule and transitivity rule. The reexivity axiom and the transitivity rule are sound for both kinds of XFDs, that is, XFD1 s and XFD2 s. Surprisingly, however, the extension rule is only sound for XFD1 s, but not for XFD2 s as the following example shows. Consider the XML schema tree T in Fig. 5 and its vCourse -subgraphs X, Y and X Y shown in Fig. 12. Further consider the XML data tree T in Fig. 4. The pre-images of the total vcourse -subgraph of the XML schema tree T are shown in Fig. 7, and their projections to the subgraphs X, Y and X Y in Fig. 13. The projections of the second and the third pre-image to X are equivalent, and so are the projections to Y . (Note, that the set of successors of a vertex is considered to be unordered. This is a usual convention in XML documents. For a discussion of this issue, we refer to Arenas/Libkin [4].) But the projections to X Y are not equivalent. Hence, the XFD2 vCourse : X Y holds, while the XFD2 vCourse : X X Y is violated. This proves the extension rule to be wrong for XFD2 s in general. It can be shown that for XFD2 s there is only a restricted extension rule applicable, namely v:XY X and Y are reconcilable, v :X X Y where two v-subgraphs X, Y are called reconcilable if there are v-subgraphs X of X and Y of Y such that X and Y share no arc of frequency and such that

366

S. Hartmann and S. Link


vcourse,1 E Course E E Tom
He Pair

vcourse,2 E Course

vcourse,3 E Course

E E Tom
He

Pair

Pair

E
He

Pair

Pair He

E Jim
E Course

E Tom

He

E Jim

vcourse,1 E Course E
Pair

vcourse,2

vcourse,3 E Course

E She Jane
vcourse,1 E Course E E Tom
He Pair

Pair

Pair

E E Tina
She

Pair She

Pair She

E Jane

She

E Tina
vcourse,3 E Course

E Jane

vcourse,2 E Course

E She Jane

E E Tom
He

Pair

Pair

E
He

Pair She

Pair He She

E Jane

She

E Jim

E Tina

She

E E Tom Tina

He

E Jim

E Jane

Fig. 13. The projections of the three pre-images of the total vCourse -subgraph of the XML schema tree T in Fig. 5 to the vCourse -subgraphs X, Y and X Y .

X Y = X Y holds. This means, that whenever X and Y share some arc (u, w) of frequency , then X contains the total w-subtree of Y or Y contains the total w-subtree of X. In the example above this condition is violated as X and Y both contain the arc (vCourse , vP air ), while their total vP air -subgraphs are obviously no subgraphs of one another, see Fig. 12. In order to obtain a sound and complete rule system for XFD2 s dened with respect to a xed vertex v of the XML schema tree T , we also need an additional axiom v : X T (v) all arcs of the directed path from rT to v in T have frequency 1,

which points out that the total v-subgraph T (v) of T has at most one pre-image in T unless the directed path from rT to v contains some arc of frequency . Finally, it should be mentioned that there are also interactions between XFD1 s and XFD2 s which give rise to the rule XFD1 v : X Y . XFD2 v : X Y

More Functional Dependencies for XML

367

As the example in Section 2 shows, the converse of this rule is not sound in general. This observation points out that XFD1 s impose stronger conditions on an XML data tree than XFD2 s do. Conversely, however, this means that an XML data tree can well violate v : X Y as an XFD1 , but satisfy v : X Y as an XFD2 .

Conclusion

In this paper we presented an approach towards functional dependencies for XML based on homomorphisms between XML data trees and XML schema graphs. Our approach allows us to capture functional dependencies similar to those studied in [4,13], but also a new class of functional dependencies in XML data trees. Both kinds of XFDs are likely to occur in XML documents and should be considered in order to describe well-designed XML documents. Consequently, they should not be treated as controversial concepts, but as concepts which complement each other. As mentioned in the introduction, there is an increasing number of applications using persistent XML documents, for example in molecular biology [19]. XML provides the capability of representing protein data or genetic data in a single, standardized data structure. Its simple syntax and the large variety of tools developed for handling XML documents are greatly expected to facilitate the management of molecular biology data. The success of XML raises hope that XML will soon serve as a rst-class data model for storing and handling all kinds of complex data. For that purpose, however, a dependency theory similar to the relational database model has to be developed. Note that XFD2 s, studied within this paper, frequently appear in molecular biology data, e.g. in situations where the outcome of some analysis of genetic information does not depend on a single input factor, but on a set of factors. We studied interactions of XFDs and, in particular demonstrated that the well-known extension rule is no longer valid for XFDs based on pre-images (that is, XFD2 s). Instead we presented a restricted extension rule which, together with some other rules, is powerful enough to describe implications of XFD2 s. Finally, we pointed out that XFDs based on maximal subcopies (that is, XFD1 s) always imply XFD2 s, but not the other way round. Hence there are XML documents violating an XFD1 , but satisfying the corresponding XFD2 . This raises the question for normal forms of XML data trees avoiding redundancy and update anomalies and ensuring well-designed XML documents. Arenas/Libkin [4] proposed such a normal form for XFDs based on maximal subcopies. Unfortunately, this normal form does not exclude redundancy due to XFDs based on pre-images. The same holds for other proposed normal forms e.g. [20] which, of course, have not been specially developed for XFD2 s. Nevertheless, we are condent that a slightly rened normal form can be dened which takes care of XFD2 s, too. This, however, is out of the scope of the present paper.

368

S. Hartmann and S. Link

References
1. S. Abiteboul, P. Buneman, and D. Suciu. Data on the web: From relations to semistructured data and XML. Morgan Kaufmann, 2000. 2. S. Abiteboul, R. Hull, and V. Vianu. Foundations of databases. Addison-Wesley, 1995. 3. M. Arenas, W. Fan, and L. Libkin. Whats hard about XML schema constraints. In DEXA 2002, pages 269278, 2002. 4. M. Arenas and L. Libkin. A normal form for XML documents. In PODS 2002, pages 8596. ACM, 2002. 5. W. W. Armstrong. Dependency structures of database relationship. Inform. Process., 74:580583, 1974. 6. W. W. Armstrong, Y. Nakamura, and P. Rudnicki. Armstrongs axioms. J. Formalized Math., 14, 2000. 7. T. Bray, J. Paoli, and C. Sperberg-McQueen, editors. Extensible Markup Language (XML) 1.0, W3C Recommendation, 2000. 8. P. Buneman, S. Davidson, W. Fan, and C. Hara. Reasoning about keys for XML. In DBPL 2001. Springer, 2001. 9. P. Buneman, S. Davidson, W. Fan, C. Hara, and W. Tan. Keys for XML. Computer Networks, 39:473487, 2002. 10. W. Fan and L. Libkin. On XML constraints in the presence of DTDs. In PODS 2001, pages 114125. ACM, 2001. 11. W. Fan and J. Simeon. Integrity constraints for XML. In PODS 2000, pages 2334. ACM, 2000. 12. D. Jungnickel. Graphs, networks and algorithms. Springer, 1999. 13. M. Lee, T. Ling, and W. Low. Designing functional dependencies for XML. In EDBT 2002, pages 124141. Springer, 2002. 14. T. Ling, M. Lee, and G. Dobbie. Applications of ORA-SS. In IIWAS 2001, pages 1728. Springer, 2001. 15. B. Thalheim. Entity-relationship modeling. Springer, Berlin, 2000. 16. H. Thompson, D. Beech, M. Maloney, and N. Mendelsohn, editors. XML Schema Part 1: Structures, W3C Recommendation, 2001. 17. V. Vianu. A web odyssey: From Codd to XML. In PODS 2001. ACM, 2001. 18. G. E. Weddell. Reasoning about functional dependencies generalized for semantic data models. ACM Trans. Database Systems, 17:3264, 1992. 19. R. K. Wong and W. Shui. Utilizing multiple bioinformatics information sources: An XML database approach. In BIBE 2001, pages 7380. Springer, 2001. 20. X. Wu, T. Ling, S. Lee, M. Lee, and G. Dobbie. NF-SS: A normal form for semistructured schema. In ER 2001 Workshops, pages 292305. Springer, 2001.

More Functional Dependencies for XML

369

Appendix

01<Root> 02 <Course Date=Feb 1> 03 <Pair> 04 <He>Tom</He> 05 <She>Jane</She> 06 </Pair> 07 <Ranking>A-</Ranking> 08 </Course> 09 <Course Date=Feb 2> 10 <Pair> 11 <He>Tom</He> 12 <She>Jane</She> 13 </Pair> 14 <Pair> 15 <He>Jim</He> 16 <She>Tina</She>

17 </Pair> 18 <Ranking>B-</Ranking> 19 </Course> 20 <Course Date=Feb 5> 21 <Pair> 22 <He>Tom</He> 23 <She>Jane</She> 24 </Pair> 25 <Pair> 26 <He>Jim</He> 27 <She>Tina</She> 28 </Pair> 29 <Ranking>B-</Ranking> 30 </Course> 31</Root>

Fig. 14. An XML document corresponding to the XML data tree in Fig. 1.

Anda mungkin juga menyukai