System and method for efficient maintenance of indexes for XML files

Information

  • Patent Application
  • 20070220420
  • Publication Number
    20070220420
  • Date Filed
    March 16, 2006
    18 years ago
  • Date Published
    September 20, 2007
    17 years ago
Abstract
System and method for efficient maintenance of indexes for XML files are described. In one embodiment, the method comprises storing an XML document in an XML database; providing a first XML index definition document (“XIDD”) for defining a first index for the XML document, wherein the first XIDD is applied to the XML document to create a first set of index keys for the XML document stored in the XML database; responsive to a change to the XML document affecting an update node thereof, performing a limited, localized traversal of the XML document around the update node to determine whether the change affects the first set of index keys; and updating the first set of index keys as necessitated by the change.
Description

BRIEF DESCRIPTION OF THE DRAWINGS


FIG. 1 is a block diagram of an XML database system in accordance with an embodiment.



FIG. 2 illustrates an index definition document in accordance with an embodiment.



FIG. 3 is a schematic diagram of an in-memory tree structure representing the index definition document of FIG. 2.



FIG. 4 is a schematic representation of the interaction between a Master Table and two in-memory tree structures representing index definition documents.



FIG. 5 illustrates an XML document to which the index definition document illustrated in FIG. 2 may be applied in accordance with an embodiment.



FIG. 6 is a schematic diagram of the XML document of FIG. 7.



FIG. 7A illustrates the XML document of FIG. 5 subsequent to performance of an INSERT NODE operation thereon.



FIG. 7B illustrates the XML document of FIG. 5 subsequent to performance of a DELETE NODE operation thereon.



FIG. 7C illustrates the XML document of FIG. 5 subsequent to performance of an UPDATE NODE VALUE operation thereon.



FIG. 8 is a flowchart of an index key set update process in accordance with one embodiment.



FIG. 9A is a flowchart a node collection process portion of the index key set update process of FIG. 8.



FIG. 9B is a flowchart node combination process portion of the index key set update process of FIG. 8.



FIG. 10 illustrates an index definition tree and affected XML document for use in illustrating the node combination process of FIG. 9B.


Claims
  • 1. A method of efficiently managing indexes for an XML document stored in an XML database, the method comprising: providing a first XML index definition document (“XIDD”) for defining a first index for the XML document, wherein the first XIDD is applied to the XML document to create a first set of index keys for the XML document stored in the XML database;responsive to a change to the XML document affecting an update node thereof, performing a limited, localized traversal of the XML document around the update node to determine whether the change affects the first set of index keys; andupdating the first set of index keys as necessitated by the change.
  • 2. The method of claim 1 further comprising providing a master table that includes, for each node in the XIDD, an entry that points to the XIDD node.
  • 3. The method of claim 1 further comprising: providing at least one additional XIDD for defining at least one additional index for the XML document, wherein the at least one additional XIDD is applied to the XML document to create at least one additional set of index keys for the XML document stored in the XML database; andproviding a master table comprising, for each node in each of the XIDDs, an entry that points to the XIDD node.
  • 4. The method of claim 1 wherein one of the entries of the master table points to multiple XIDD nodes.
  • 5. The method of claim 1 wherein the performing a limited localized traversal of the XML document comprises: determining whether the XIDD includes a node corresponding to the update node; andresponsive to a determination that the XIDD includes a node corresponding to the update node, determining whether the update node is hierarchically related to other nodes of the XML document as defined by the XIDD.
  • 6. The method of claim 5 wherein the updating the first set of index keys as necessitated by the change further comprises: determining a before set of index keys for the XML document;determining an after set of index keys for the XML document;deleting from the first set of index keys the before set of index keys and adding to the first set of index keys the after set of index keys.
  • 7. The method of claim 6 further comprising, prior to the deleting and adding, eliminating from the before set of index keys and the after set of index keys keys that are included in both the before and the after sets of index keys.
  • 8. The method of claim 1 wherein the change to the XML document comprises an operation selected from a group consisting of updating a value of the update node, deleting the update node, or inserting the update node.
  • 9. A system for efficient management of indexes for XML documents comprising: an XML database for storing an XML document;a database engine for performing operations on and in connection with data stored in the XML database;a first XML index definition document (“XIDD”) for defining a first index for the XML document; anda first set of index keys for the XML document stored in the XML database, the first set of index keys corresponding to the first XIDD;wherein responsive to a change to the XML document affecting an update node thereof, a limited, localized traversal of the XML document is performed to determine whether the change affects the first set of index keys and to update the first set of index keys as necessitated by the change.
  • 10. The system of claim 9 further comprising a master table comprising, for each node in the XIDD, an entry that points to the XIDD node.
  • 11. The system of claim 9 further comprising: at least one additional XIDD for defining at least one additional index for the XML document;at least one additional set of index keys for the XML document stored in the XML database corresponding to the at least one additional XIDD; anda master table comprising, for each node in each of the XIDDs, an entry that points to the XIDD node.
  • 12. The system of claim 11 wherein one of the entries of the master table points to multiple XIDD nodes.
  • 13. The system of claim 9 wherein the XIDD defines at least one node of the XML document as a key component node.
  • 14. The system of claim 13 wherein the XIDD defines at least one node of the XML document as a context-only node, wherein the context-only node defines a context for the key component node within the XML document.
  • 15. The system of claim 9 wherein the XIDD defines at least one relationship among nodes in the XML document.
  • 16. The system of claim 9 wherein the change to the XML document comprises an operation selected from a group consisting of updating a value of the update node, deleting the update node, or inserting the update node.
  • 17. A system of efficiently managing indexes for XML documents comprising: means for storing an XML document;means for providing a first XML index definition document (“XIDD”) for defining a first index for the XML document, wherein the first XIDD is applied to the XML document to create a first set of index keys for the XML document stored in the XML database;means responsive to a change to the XML document affecting an update node thereof for performing a limited, localized traversal of the XML document around the update node to determine whether the change affects the first set of index keys; andmeans for updating the first set of index keys as necessitated by the change.
  • 18. The system of claim 17 further comprising a master table that includes, for each node in the XIDD, an entry that points to the XIDD node.
  • 19. The system of claim 17 wherein the means for performing a limited localized traversal of the XML document comprises: means for determining whether the XIDD includes a node corresponding to the update node; andmeans responsive to a determination that the XIDD includes a node corresponding to the update node for determining whether the update node is hierarchically related to other nodes of the XML document as defined by the XIDD.
  • 20. The system of claim 17 wherein the means for updating the first set of index keys as necessitated by the change further comprises: means for determining a before set of index keys for the XML document;means for determining an after set of index keys for the XML document; andmeans for deleting from the first set of index keys the before set of index keys and adding to the first set of index keys the after set of index keys.
  • 21. The system of claim 20 further comprising means for eliminating from the before set of index keys and the after set of index keys keys that are included in both the before and the after sets of index keys prior to the deleting and adding.