Abstract:
A method of processing a query about an Extensible Markup Language (XML) data. The XML query processing method includes the first step of representing the XML data in the form of an XML graph, the second step of creating and updating an Adaptive Path indEX (APEX) based on frequently used paths extracted from previously processed XML queries and the XML graph, and the third step of processing an XML query using the APEX. The XML query processing is capable of improving the performance of processing the query by extracting frequently used paths from path expressions having been used as queries for XML data and updating the APEX through the use of the frequently used paths.

Description:
BACKGROUND OF THE INVENTION 
   1. Field of the Invention 
   The present invention relates to an index structure capable of allowing users to effectively retrieve data represented by extensible markup language (see T. Bray, J. Paoli, C. M. Sperberg-McQueen, and E. Maler. Extensible Markup Language (XML) 1.0 (second edition). W3C) that is the de facto standard for the representation and exchange of data on the Internet, and a method of managing the same, and more particularly to a method of processing XML queries using an adaptive path index, which utilizes frequently used paths. Thus, the query performance for XML data can be significantly improved and storage space can be reduced compared with conventional path indexes. 
   2. Description of the Prior Art 
   The emergence of the Internet has dramatically increased the amount of data of all kinds available electronically. To overcome the limitations of Hyper Text Markup Language (HTML) and solve the complexity of Standard Generalized Markup Language (SGML), extensible Markup Language (XML) was proposed by the World Wide Web Consortium (W3C) in 1998. 
   XML can describe a wide range of data, from regular to irregular, from flat to deeply nest, and tree shaped to graph shaped structure. Due to the flexibility of XML, XML is rapidly emerging as the de facto standard for the representation and exchange of data on the next generation Web application. 
   Various query languages for retrieving data represented in XML have been proposed. XML query languages, such as XPath (see J. Clark and S. DeRose. XML path language (Xpath) version 1.0. W3C Recommendation) and XQuery (see S. Boag, C. Chamberlin, M. Fernandez, D. Florescu, J. Robie, J. Simeon, and M. Stefanescu. Xquery 1.0: An XML query language. Working draft), use path expressions to traverse an irregular structure consisting of XML elements. Thus, the navigation of irregularly structured XML data is one of essential components for processing XML queries. Since the elements may be scattered at different location in the disk, the performance of processing an XML query results in significant degradation. Furthermore, when an XML query consisting of a partial matching path expression is processed, all elements constituting XML data must be traversed, which is very inefficient. 
   Meanwhile, a structural summary and a path index speed up the XML query evaluation by allowing only the relevant portions of XML data to be traversed with respect to a given path expression. As a result, structural summary extraction and path index generation techniques have received a lot of attention as schemes of improving the XML query performance. Goldman and Widom developed a path index that is called “strong DataGuide” (see R. Goldman and J. Widom. DataGuides: Enable query formulation and optimization in semistructured database. VLDB 1997.). This index was proposed to extract the structural information of Semi-structural data such as XML data, and records simple paths starting from a root element without overlapping. The building algorithm of the strong DataGuide emulates an algorithm for converting Non-deterministic Finite Automata (NFA) into Deterministic Finite Automata (DFA)(see J. E. Hopcraft and J. D. Ullman. Introduction to Automata Theory, Language, and Computation. 1979). Accordingly, this scheme is problematic in that, in the case where given XML data has a complicated graph structure, the size of the strong DataGuide may become larger than that of original XML data. 
   Milo and Suciu proposed another index called “1-Index” (see T. Milo and D. Suciu. Index structures for path expression. ICDT. 1999). 1-Index is identical with strong DataGuide in that information of all paths is maintained. 1-Index generates indexes using backward stimulation and backward simulation which are originated from the graph verification area. This method is that two nodes are integrated into a single node when the two nodes exist and two path sets starting from the two nodes are identical with each other. This method allows a graph, such as a non-deterministic finite automata, to be obtained, unlike strong DataGuide. However, when a given input graph takes a tree form, 1-Index and strong DataGuide are identical with each other. Accordingly, 1-Index can be considered a non-deterministic variation of strong DataGuide. 
   In the field of object-oriented database, to support frequently used reference chains between two object instances, Access Support Relation (ASR) has been used (see A. Kemper and G. Moerkotte. Access support relations: An indexing method for object bases. Information Systems, 17(2): 117-145, 1992). However, ASR materializes the reference chains of arbitrary lengths, and is problematic in that it can support only predefined subset of paths. 
   Cooper et al. proposed Index Fabric that is conceptually similar to strong DataGuide in that all paths starting from a root element are maintained (see B. Cooper, N. Sample, M. J. Franklin, G. R. Hjaltason, and M. Shadmon. A fast index for semistructured data. VLDB. 2001). Index Fabric encodes the paths of elements having data values to be converted into strings, and maintains them using a string index, such as Patricia Trie. However, Index Fabric is disadvantageous in that a parent-child relationship among elements cannot be maintained. Accordingly, Index Fabric is ineffective in partial matching path expressions that must employ a parent-child relationship. 
   Many queries on XML Data have the partial matching path expressions because user of XML data does not take the structure of the data into account, and intentionally uses a partial matching path expression so as to obtain desired results. The above-described XML path indexes, such as strong DataGuide, 1-Index, Index Fabric, etc., record all paths starting from a root element, so the index must be exhaustively traversed, thus deteriorating performance. Furthermore, these path indexes are generated only through the use of data. Thus, they do not take advantage of query workload to effectively process frequently used path expressions. 
   SUMMARY OF THE INVENTION 
   Accordingly, the present invention has been made keeping in mind the above problems occurring in the prior art, and an object of the present invention is to provide a method of processing a query for XML data having an irregular structure using an Adaptive Path indEX for XML data (APEX), which is capable of improving the performance of processing the query by extracting frequently used paths from path expressions having been used as queries for XML data and updating the APEX using the frequently used paths. 
   In order to accomplish the above object, the present invention provides a method of processing a query about XML data, comprising the first step of representing the XML data in the form of an XML graph; the second step of creating and updating an Adaptive Path indEX for XML data (APEX) based on frequently used paths extracted from previously processed XML queries and the XML graph; and the third step of processing an XML query using the APEX. 
   In contrast to the traditional indexes such as Data Guide and 1-Index, the APEX of the present invention does not maintain all paths starting from a root element, but utilizes frequently used paths to improve the performance of processing a query. Further, the existing path indexes are constructed through the use of only XML data, while the method of the present invention extract paths frequently used from query workloads in a data mining manner and utilizes the frequently used paths. 
   Specifically, the APEX and the method of processing a query in accordance with the present invention are characterized by providing a method having the following solutions. 
   (1) An APEX consists of a hash tree and a graph structure. The hash tree maintains information on the incoming paths of the nodes of the graph structure, so a partial matching path expression can be effectively processed by traversing the hash tree. 
   (2) In order to extract information on frequently used paths, a concept used in a sequential pattern mining technique is utilized. 
   (3) The APEX of the present invention achieves a size smaller than the existing path indexes by maintaining an index structure using frequently used paths. 
   (4) The APEX of the present invention reduces the overhead of creating and managing indexes in such a way that the index is changed by finding changed frequently used paths when the frequently used paths are changed. 

   
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The above and other objects, features and advantages of the present invention will be more clearly understood from the following detailed description taken in conjunction with the accompanying drawings, in which: 
       FIG. 1  is a view showing a structure for managing an APEX according to the present invention; 
       FIG. 2  is a view showing an example of XML data; 
       FIG. 3  is an XML graph showing the structure of the XML data; 
       FIG. 4  is a view showing an example of the APEX; 
       FIG. 5  is a view showing a hash table of a hash tree for the APEX; 
       FIG. 6  is a view showing an algorithm of creating an initial APEX; 
       FIG. 7  is a view showing an example of the initial APEX; 
       FIG. 8  is a view showing an algorithm of extracting frequently used paths; 
       FIG. 9  is a view showing an algorithm of updating the APEX; 
       FIG. 10  is a graph showing the performances of single path expressions for Play data; 
       FIG. 11  is a graph showing the performances of single path expressions for FlixML data; 
       FIG. 12  is a graph showing the performances of single path expressions for GedML data; 
       FIG. 13  is a graph comparing the performances of complex path queries; and 
       FIG. 14  is a graph comparing the performances of value-path complex queries. 
   

   DESCRIPTION OF THE PREFERRED EMBODIMENTS 
   Reference now should be made to the drawings, in which the same reference numerals are used throughout the different drawings to designate the same or similar components. 
     FIG. 1  is a view showing a structure for managing an APEX according to the present invention. As shown in  FIG. 1 , an APEX management module chiefly includes three modules, including an initialization module  11 , a frequently used path extraction module  13  and an update module  15 . The initialization module  11  is a module that is used to initially create an APEX without query workloads only when APEX is built first. That is, this initialization module  11  creates an initial APEX APEX 0    12  that is the initial form of the APEX. The initial APEX APEX 0  is a simplest one, and used as a seed to build a more sophisticated APEX. The path extraction module  13  and the update module  15  are modules that use a workload  14 , that is, a collection of queries using a current APEX, and are used to more effectively create an APEX  16  using frequently used paths. In this case, the workload  14  consists of a collection of single path expressions in the form of  1   i . 1   i+1 . . . . . 1   j+1 . 1   j . The path extraction module  13  and the update module  15  are repeatedly performed whenever the workload  14  is changed. 
   Hereinafter, the structure of XML data used in the present invention is described in brief, and the structure of the APEX proposed in the present invention is described based on the description of the structure of XML data. Thereafter, the method of managing an APEX is described. 
     FIG. 2  is a view showing an example of the XML data. The structure of the example can be represented by a label-edge graph as illustrated in  FIG. 3 , which is referred to as an XML graph. An ID-IDREF relationship shown in  FIG. 3  is represented by an edge extending from an IDREF type node to a node that represents an element having an ID type attribute corresponding to the IDREF type node. The label of the edge has the label of a corresponding element. The label of an edge indicating a node for an IDREF type element starts with “@”. 
   On the XML graph, paths that are each formed by a succession of labels exist, and are used as path expressions. The following relationship can exist between the paths. If the relationship shown in the following Definition 1 exists between random paths A and B, it is stated that “the path B includes in the path A.” 
   Definition 1 
   If the relationship, a 1 =b i , a 2 =b i+1 , . . . , and a n =b i+−1 , 1≦i, and i+n−1≦m exists between a path A=a 1 .a 2 . . . . .a n  and a path B=b 1 .b 2 . . . . .b n , it is stated that “the path A is included in the path B” or “the path A is a subpath of the path B”. Further, if the path A is a subpath of the path B and m=i+n−1, the path A is a suffix of the path B. 
   Additionally, a frequency at which a path p on the XML graph is used in given XML path expressions is referred to as a support of the path “p”, and is represented as the following Equation 1.
 
 sup ( p )=| Q|/|W|   (1)
 
where |W|=the number of given path expressions, and |Q|=the number of path expressions each including the path “p”.
 
   In the method of managing an APEX in accordance with the present invention, required paths defined in the following Definition 2 are extracted and the APEX is managed using the required paths. 
   Definition 2 
   If a support of the path “p” existing on an XML graph sup(p) is greater than a user-specified minimum support minSup, or the length of the path p is 1, the path p is referred to as a required path. A path having a support greater than the user-specified minimum support minSup is referred to as a frequently used path. 
   An edge set T(p) with respect to a path “p” is defined as the following Definition 3. 
   Definition 3 
   When P= 1   i . . . . . 1   j−1 . 1   j , T(p)={&lt;o j−1 ,o j &gt;|o i−1 . 1   i .o i . . . .  1   j , o j } 
   where o k−1  and o k  are nodes existing on the XML graph with respect to a label  1   k  shown on the path p, and an edge having the label  1   k  extending from o k−1  to o k  exists on the XML graph. 
   When the path p is the suffix of the path q from the Definition 3, it can be appreciated that T(p) ⊃ T(q). For example, on the graph of  FIG. 3 , a path name is a suffix of a path actor.name. In this case, it can be appreciated that T(name)={&lt;2, 3&gt;, &lt;4, 5&gt;, &lt;7, 11&gt;, &lt;12, 13&gt;} and T(actor.name)={&lt;2, 3&gt;, &lt;4, 5&gt;}. Accordingly, it can be appreciated that T(name) ⊃ T(actor.name). It requires an excessive storage resources to manage sets of edges T(p) with respect to all paths falling within a set of required paths. Accordingly, in the present invention, an extent of a path “p” is defined as described in the following definition 4 and is managed. 
   Definition 4 
   It is assumed that the set of some of the paths of an XML graph starting from a root is Q XML  and the set of required paths is R. With respect to a path p, it is assumed that Q G (P)={1|1∈Q XML  and p is a suffix of 1} and Q A (p)={1|1∈Q XML  and every path q (≠p) ∈ R having p as a suffix is a suffix of 1}. If Q (p)=Q G (p)−Q A (p), the extent E(p) is defined as ∪ r∈Q (p) T(r). 
   When q with respect to a random path p is a path having p as a suffix, it can be appreciated that T(p)=∪ ∀q E(q). 
   For example, when it is assumed that actor.name is a frequently used path with respect to the XML graph of  FIG. 3 , it can be appreciated that E(name)={&lt;7, 11&gt;, &lt;12, 13&gt;}, E(actor.name)={&lt;2, 3&gt;, &lt;4, 5&gt;} and T(name)=E (name) ∪E (actor.name). 
     FIG. 4  shows an APEX when required paths for  FIG. 3  are all paths each having a length of 1 and direct.movie, @movie.movie, actor.name. This drawing illustrates the index having a graph structure, and may be further provided with a hash tree to support more effective lookups. 
   A hash tree maintains information on required paths, and maps the nodes of the graph structure to the required paths. Each node of the hash tree is provided with a hash table, and each entry of the hash table consists of five fields as shown in detail in  FIG. 5 . In this drawing, “label, count, new, xnode and next” become the key values of the entry. The “count” field represents the frequency of use of a path represented by a corresponding entry, that is, the support of the path. The “new” field represents whether a corresponding entry is newly created. The “xnode” field represents a single node existing on the graph structure of the APEX. Finally, the “next” field represents a next node in the hash tree. 
   The graph structure provides information on the structural summary of a given XML graph, the nodes of the graph structure are mapped to the entries of the hash tree in a 1:1 correspondence, and the nodes of graph structure have the extents of required paths represented by the entries of the hash tree. Additionally, if t x =s y  with respect to two random nodes x and y of the graph structure, an edge &lt;s x , t x &gt;falling within the extent of x and an edge &lt;s y , t y &gt;falling within the extent of y, an edge extending from the node x to the node y of the graph structure exists. Further, a label used to group edges falling within y is used as the label of the edge. Especially for the root node of the XML graph, a node is created on the initial APEX and a virtual edge consisting of &lt;null, root node&gt; is stored as the extent of a corresponding node. Further, this node is expressed as xroot for convenience. Further, when a path q having p as a suffix with respect to a random path p is a frequently used path and E(p) is not a null set, E(p) is managed by creating an entry “remainder” and a corresponding node. For example, in  FIG. 4 , E(name) is stored in a node &amp; 12 , which is registered in an entry “reminder” of a lower node downstream of an entry “name” of a root node in a hash tree. 
   In  FIG. 4 , information on a required path direct.movie can be obtained by looking up the information in the hash tree in a reverse direction. For example, information on the required path direct.movie can be looked up by looking up an entry “direct” in a lower node indicated by an entry “movie” of a root node in the hash tree. 
   In  FIG. 6 , an algorithm of creating an initial APEX APEX 0  is illustrated.  FIG. 7  shows the initial APEX APEX 0  of  FIG. 3 . As described above, the APEX consists of a hash tree and a graph structure. Accordingly, the initial APEX APEX 0  is constructed as shown in  FIG. 7 . 
   The initial APEX creating algorithm of  FIG. 6  creates an extent by grouping edges according to labels while traversing the nodes of an XML graph in a depth first traversal manner, creates a node for the creation of the extent on a graph structure, and registers the node in a hash tree. The node for an edge set is created in the initial APEX APEX 0 , and the node and the label are registered in the hash tree. After the initial APEX APEX 0  is created, information on a frequently used path is extracted from a workload and the APEX is continuously updated using this information. With this process, a currently used XML query can be more effectively supported. 
   The frequently used path extraction module is described below. 
   Conventional sequential pattern mining algorithms (see M. N. Garofalakis, R. Rastogi, and K. Shim. SPIRIT: Sequential pattern mining with regular expression constraints. VLDB 1999) using an anti-monotonicity property at the step of pruning can be used to extract frequently used paths. However, since the properties of a sequence that is an object of the conventional sequential pattern mining algorithms are different from those of a path, a modification is required. For example, when a sequence (A, B, C) is frequent, it can be stated that all subsequences (A, B), (B, C) and (A, C) of the sequence (A, B, C) are frequent. However, even though a path expression A.B.C is frequently used, it cannot be stated that a path expression A.C is frequently used. The reason for this is that a path A.C is not a subpath of a path A.B.C. 
   Therefore, the present invention provides a frequently used path extraction algorithm as shown in  FIG. 8 . As shown in  FIG. 8 , the frequently used path extraction algorithm consists of the steps of counting the frequency and pruning. The hash tree is used to track the changes of the pattern of use of XML queries. After the performance of the frequently used path extraction algorithm is completed, the hash tree maintains only some of given XML path expressions that are information on required paths. 
   At the step of counting the frequencies of use (supports), the hash tree that is a principal data structure constituting part of an APEX is used so as to extract the frequencies of all paths appearing in a set of path expressions, that is, frequently used paths. In this case, in order to count the frequencies of use of XML path expressions currently used, the “count” and “new” fields of all entries existing in the hash tree are set to 0 and false, respectively. Further, the frequencies of use of all paths appearing in a set of given XML path expressions Q workload  are counted. At this step, if a new entry is created in the hash table, a new field of the newly created entry is set to TRUE. 
   At the step of pruning, entries each having a support smaller than the user-specified minimum support minSup are all removed. In this case, like the sequential pattern mining, information on infrequently used paths is effectively removed from the hash tree using the anti-monotonicity property in which, when sup(p) of a random path p is smaller than minSup, sup(p) of all paths each including p is smaller than minSup. 
   If information on frequently used paths is extracted from the given path expressions, a current APEX should be updated using the extracted information. For this purpose, a new APEX can be created by re-traversing the XML graph from the beginning. However, this approach requires excessive time and costs, so an APEX updating cost is reduced using the APEX updating algorithm of  FIG. 9  in the present invention. The basic scheme of the APEX updating algorithm is to examine whether the nodes of a graph structure are valid with respect to the hash tree, remove invalid nodes and create nodes for newly created entries, while traversing the graph structure of the APEX. Additionally, the extents of newly created nodes are created. 
   The method of processing an XML query according to the present invention is described below. When a random path p i   n = 1   i . . . . . 1   n−1 . 1   n  is given as a query, the hash tree is traversed using p i   n . If p i   n  is a required path, a path q having p i   n  as a suffix exists in a hash tree and results T(p i   n )=∪ ∀q E(q) can be obtained with respect to the extents E(q) of the nodes of a graph structure indicated by the node pointer of an entry corresponding to the path q. If only a path P k   n =1 k . . . . . 1   n  (i&lt;k≦n) is looked up in the hash tree, the edge set T(P k   n ) of the path P k   n  is obtained using the path P k   n . A similar step is repeated until a path P i   j =1 i . . . . . 1   j  (i≦j≦n) is looked up in the hash tree, that is, an edge set T(P i   j ) is obtained. A target edge set T(P i   n ) can be obtained by joining obtained T(P i   j ), . . . , T(P k   n ). 
   For a complex path query  1   i .*. 1   j , query results can be obtained after converting the complex path query  1   i .*. 1   j  into a path set  1   i . 1   i+1 . . . . . 1   j . using a query pruning and converting technique (see M. F. Fernandez and D. Suciu. Optimizing regular path expressions using graph schemas. ICDE. 1998.). Value-path mixed queries, such as a query “extract nodes fulfilling a random condition from nodes fulfilling random path expressions,” can be processed using various methods, including a method in which nodes fulfilling a random path are extracted through the use of an APEX of the present invention and it is determined whether the nodes fulfill the random path expression,” or method in which nodes fulfilling a random condition and nodes fulfilling a path expression are obtained from nodes existing on XML data and the intersection of the two node sets is obtained. 
   In order to measure the efficiency of the method of the present invention in processing an XML query, tests on various XML queries and XML data were carried out. Actual XML data and the three following XML data generated by an actual DTD were used as test data as described below. 
   (1) Play: XML document produced by converting Shakespeare&#39;s plays into XML forms (source: http://oasis-open.org/cover/xml.html) 
   (2) FlixML: XML document used as a document for a B-movie guide and having a somewhat complicated structure (source: http://www.xml.com) 
   (3) GedML: XML document used to represent data of genealogy and having a very complicated structure (source: http://www.oasis-open.org/cover/xml.html, 2001) 
   Additionally, in order to measure the performance of processing a query for XML data, there are generated data having the various numbers of elements as shown in table 1. 
   
     
       
             
             
             
             
           
             
             
             
             
             
             
             
             
             
             
           
         
             
               TABLE 1 
             
             
                 
             
             
               Data 
                 
                 
                 
             
             
               kind 
               Play 
               FlixML 
               GedMl 
             
             
                 
             
           
           
             
                 
             
           
        
         
             
               Name 
               four- 
               shakes- 
               shakes- 
               Flix01. 
               Flix02. 
               Flix03. 
               Ged01. 
               Ged02. 
               Ged03. 
             
             
                 
               tragedy.xml 
               11.xml 
               all.xml 
               Xml 
               xml 
               xml 
               xml 
               xml 
               xml 
             
             
               Number 
               22791 
               48818 
               179691 
               14734 
               41691 
               335401 
               8259 
               36228 
               381046 
             
             
               of 
             
             
               elements 
             
             
                 
             
           
        
       
     
   
   5,000 single label path expressions, that is, a succession of labels such as  1   i . 1   i+1 . . . . . 1   j , 500 complex path expressions having the form of  1   i .*. 1   j , and 1,000 value-path expressions in which path expressions and values were expressed together were used as queries. The single path expression is expressed in the form of // 1   i ./ 1   i+1 / . . . / 1   n  of Xquery that is an XML query standard, the complex path label path expression is expressed in the form of // 1   i //1 j , and the value-path expression is expressed in the form of // 1   i ./ 1   i+1 / . . . /1 j [text()=value]. Further, the efficiency of the present invention was compared with those of DataGuide (SDG), IndexFabic and APEX 0 . Further, since the form of the APEX might be changed by the user-specified minimum support minSup, tests were carried out while the value was varied from 0.002 to 0.05. 20% of the single path expressions were used as an XML data query set used to extract frequently used paths. 
     FIGS. 10 ,  11  and  12  show the times that are required to process 5,000 single path expressions.  FIGS. 13 and 14  show the time that is required to process complex path expressions and value-path expressions about shake — 11.xml, Flix02.xml and Ged02.xml. In  FIG. 12 , the performance of SDG of Ged03.xml is about 125000 seconds, and in  FIG. 13 , the performance of APEXO of Ged02.xml is about 210000. 
   As the structure of XML data becomes more complicated, the performance of the APEX increases further. In the case of DataGuide or Index Fabric, all paths starting from the root of XML data are maintained. That is, as the structure of XML data becomes more complicated, the number of paths increases, and consequently the amount of information that must be traversed when a query is processed increases. In contrast, the APEX maintains only information of frequently used paths, so it can effectively process a query. 
   Further, the user-specified minimum support minSup influences the performance of processing the query. As the user-specified minimum support minSup becomes smaller, the number of frequently used paths increases. However, as shown in  FIGS. 10 to 12 , even though the number of frequently used paths increases, the performance of processing the XML query is not always improved. The reason for this is that, as the structure of a path index becomes complicated, a region to be traversed increases, and consequently the performance of traversal is deteriorated more. In the above-described tests, when the user-specified minimum support minSup was 0.005, the APEX exhausted greatest performance. 
   As described above, the present invention provides a method of processing a query about XML data using the APEX, which is capable of effectively obtaining query results using frequently used paths through the use of the APEX when looking up XML data. Further, the method of the present invention reduces a burden of updating an index to reflect the change of the index when the pattern of XML queries is changed. Accordingly, the method of the present invention can be applied to the fields of using XML data, such as electronic commerce and Internet document search. 
   Although the preferred embodiments of the present invention have been disclosed for illustrative purposes, those skilled in the art will appreciate that various modifications, additions and substitutions are possible, without departing from the scope and spirit of the invention as disclosed in the accompanying claims.