# Patent

## Title
Mapping of data from XML to SQL

## Abstract

A method, an apparatus and a computer program product for converting an XML encoded dataset into a minimal set of SQL tables and provided. In the method, a hierarchical structure in the XML encoded dataset is identified. A node element set for the XML encoded dataset is determined, wherein each node element in the node element set is a discrete level of the hierarchical structure of the dataset. One or more nodes of the XML encoded dataset are determined, each node being an instance of a node element. A unique node identifier is allocated to each node. Then, an SQL node table containing one or more records is generated, each record corresponding to a respective one of the allocated node identifiers. An SQL ancestry table is optionally generated to define the inter-relationships among nodes of the identified hierarchical structure of the XML encoded dataset.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application is a continuation of U.S. application Ser. No. 13/473,207, filed May 16, 2012, which is a continuation of U.S. application Ser. No. 12/073,511, filed Mar. 6, 2008, now U.S. Pat. No. 8,204,913 which is a continuation of U.S. application Ser. No. 10/233,991, filed on Sep. 3, 2002, now U.S. Pat. No. 7,363,310 which claims the benefit of U.S. Provisional Application No. 60/317,038, filed on Sep. 4, 2001. Each one of these applications is incorporated herein by reference in their entirety.


TECHNICAL FIELD OF THE INVENTION
The present invention relates generally to electronic documents and, in particular, to the storage, maintenance and publication of complex text-based datasets.
BACKGROUND
International Publication No. WO 98/34179 (PCT/AU98/00050) in the name of Time Base Pty Ltd and published on 6 Aug. 1998 and counterpart U.S. Pat. No. 6,233,592 issued on 15 May 2001 to Schnelle et al. are incorporated herein by cross reference. In these documents, an electronic publishing system is disclosed that provides a sparse multidimensional matrix of data using a set of flat file records. In particular, the computer-implemented system publishes an electronic publication using text-based data. Predefined portions of the text-based data are stored and used for the publication. At least one of the predefined portions is modified, and the modified version is stored as well. The predefined portion is typically a block of text, greater in size than a single word, but less than an entire document. Thus, for example, in the case of legislation, the predefined portion may be a section of the Act. Each predefined portion and the modified portion(s) are marked up with one or more links using a markup language, preferably SGML or XML, The system also has attributes, each being a point on an axis of a multidimensional space for organising the predefined portions and the modified portion(s) of the text-based data. This system is simply referred to as the Multi Access Layer Technology or “MALT” system hereinafter.
Australian Patent Application No. 65470/00 filed on 12 Oct. 2000 in the name of TimeBase Pty Ltd, Canadian Patent Application No. 2323245 filed on 12 Oct. 2000 in the name of TimeBase Pty Ltd, New Zealand Patent Application No. 507510 filed on 12 Oct. 2000 in the name of TimeBase Pty Ltd and U.S. patent application Ser. No. 09/689,927 filed on Oct. 12, 2000 in the names of Lessing et al. are incorporated herein by cross reference.
U.S. patent application entitled “Resilient Data Links” filed on 18 Jul. 2001 in the names of Schnelle and Nolan is also incorporated herein by cross reference. In this document, a method, an apparatus and a computer program product for providing one or more resilient links in an electronic document are described. The methodology disclosed is referred to as “MALTlink” hereinafter.
Large or complex text-based datasets are typically hierarchical in nature. In the storage, maintenance and publication of such data, it is common to use a markup language capable of describing such hierarchies. XML is one such markup language that is more commonly used, particularly in the print, electronic or online publishing industries, and for government or public records or technical documentation. XML data is stored typically either in “flat” text files encoded in ASCII, Unicode, or other standard text encoding, or in a “native” XML database.
The flat text files may be part of a document management system. Such a document management system may be based on a relational database. Document management systems deal with a document as a whole and are able to store relevant data about each document. However, document management systems are typically not designed to operate on data (XML elements) within such documents. Consequently, a document management system does not typically operate on all (or even a substantial number of the) XML elements contained in flat text files on which the document managing system is operating. An XML database, in contrast, operates on all XML elements of the XML data that the XML database is storing and, consequently, XML databases must manage large amounts of data and detail. As a result, document management systems have a limited usefulness resulting from a lack of precision and XML databases are overwhelmed by the multiplicity of XML elements that are to be managed.
Attempts have been made to transform XML data into a set of SQL relational database tables. SQL is a database technology that provides a user with powerful query functionality and powerful data management tools. SQL possesses the stability of a mature technology, whereas XML databases are still a relatively immature technology, and thus possess a degree of instability. SQL is a fast and efficient technology, and a wide choice of software and hardware manufacturers offer or support SQL databases.
Tree mapping techniques are typically used to convert XML data into relational databases. Conventional tree mapping techniques, however, often attempt to capture all of the document hierarchy. This is almost never necessary and can result in substantial size and performance penalties in the resulting SQL tables. Such tree mapping techniques typically result in a far larger number of SQL tables than is necessary.
As an example, consider the XML fragment shown in FIG. 1. A classical approach to conversion is to represent the element tree with one table per element type, possibly with an added table to store the tree structure. A correct, and possibly even reversible, outcome results. However, the performance and management advantages (which prompted the conversion in the first place) can be diminished or even lost entirely, because of the size and complexity of the resulting tables.
Thus, a need exists for providing an efficient method for converting an XML document to a set of SQL tables.
SUMMARY
According to a first aspect of the invention, there is provided a computer implemented method for converting an XML encoded dataset into a minimal set of SQL tables including the steps of:
identifying at least one hierarchical structure in said XML encoded dataset; and
converting an XML encoded dataset associated with each identified hierarchical structure, wherein for each identified hierarchical structure said converting step includes the further steps of:
determining a node element set for said identified hierarchical structure of said XML encoded dataset, wherein each node element in said node element set is a discrete level of said identified hierarchical structure of said dataset;
determining one or more nodes of said XML encoded dataset each node being an instance of a node element;
allocating to each node a unique node identifier; and
generating an SQL node table containing one or more records, each record corresponding to a respective one of said allocated node identifiers.
According to a second aspect of the invention, there is provided an apparatus for converting an XML encoded dataset into a minimal set of SQL tables, the apparatus including:
a device for identifying at least one hierarchical structure in the XML encoded dataset; and
a device for converting an XML encoded dataset associated with each identified hierarchical structure, the device including:

    
    
        a device for determining a node element set for the identified hierarchical structure of the XhML encoded dataset, wherein each node element in the node element set is a discrete level of the identified hierarchical structure of the dataset;
        a device for determining one or more nodes of the XML encoded dataset, each node being an instance of a node element;
        a device for allocating to each node a unique node identifier; and
        a device for generating an SQL node table containing one or more records,
    
    


each record corresponding to a respective one of the allocated node identifiers
According to another aspect of the invention there is provided a computer program product including a computer readable medium having recorded thereon a computer program for implementing the method described above.



BRIEF DESCRIPTION OF THE DRAWINGS
One or more embodiments of the present invention are described hereinafter with reference to the drawings, in which;
FIG. 1 shows a sample XML document fragment;
FIG. 2 shows a corresponding SQL node table for the XML fragment of FIG. 1;
FIG. 3 shows a corresponding SQL content table for the XIML fragment of FIG. 1;
FIG. 4 shows a corresponding SQL ancestry table for the XML fragment of FIG. 1;
FIG. 5 shows a corresponding SQL table of complex properties for the XML fragment of FIG. 1; and
FIG. 6 is a schematic block diagram representation of a general-purpose computer system on which a method for converting ML data into SQL tables may be practised.



DETAILED DESCRIPTION
A method, an apparatus and a computer program product for converting an XML document into a set of SQL tables are described. In the following description, numerous details are set forth. It will be apparent to one skilled in the art, however, that the present invention may be practised without these specific details. In other instances, well-known features are not described in detail so as not to obscure the present invention.
Where reference is made in any one or more of the accompanying drawings to steps and/or features, which have the same reference numerals, those steps and/or features have for the purposes of this description the same function(s) or operation(s), unless the contrary intention appears.
A method of conversion should preferably produce an SQL rendition of an XML dataset that preserves document order, hierarchy, and other links and relationships which are deemed necessary. The required links and relationships may be all of the links and relationships inherent in the XML data, or only a subset of these required to support a particular application, such as Web publishing. Such a method of conversion should also limit the number of tables and records, and the amount of real time processing required by downstream applications, to the minimum consistent with the required functionality.
In the embodiments of the invention, the granularity of the conversion of an XML document to an SQL table is matched to the requirements of those applications that access the SQL output. To this end, the large scale structure of the data is mapped into a set of nodes and properties. Structure below this level is simply pre-processed into a form suitable for direct use by end applications, including:

    
    
        the back end of a Web site, for online publication of the data; and
        an XML editor, for ongoing maintenance of the data, in which case there may be no pre-processing apart from dividing the data into appropriate segments, one segment being the marked-up content of one node.
    
    


The actual pre-processing that is performed is dependent upon the accessing application. If an accessing application performs all the processing, such as may occur with an XML editor, no pre-processing is required. Alternatively, the data may be rendered into HTML or XHTML for web publishing or the data may be converted into MS Word for word processing. The data may even be converted into multiple formats: XML, XHTML, Word, Adobe Acrobat, Postscript for printing etc.
The conversion process consists of determining all hierarchical structures present in the dataset under consideration, and for each identified hierarchical structure the following steps are performed:

    
    
        1. Ascertain the optimal node element set;
        2. Assign a unique ID to each node;
        3. Convert content, dependent upon an accessing application;
        4. Construct node, block content, and ancestry tables; and
        5. Create complex property tables where required.
    
    


The fundamental underlying principle of the conversion strategy, and what sets the strategy apart from other XML to SQL conversion systems, is the concept of operating at a node level, rather than operating on a base element level of the dataset to be converted. A node is a distinguished structural unit of the dataset. A dataset is a set of data possessing complex structure that may be rendered in a number of various formats. Such formats may include an XML document or SQL tables. A node is a discrete unit of data, within which an internal structure may be pre-processed to maximize performance of downstream applications. Typically, a node is introduced by one of a set of specified XML tags (the node element set).
A node may be associated with a predefined portion described in the aforementioned MALT system. Dividing a dataset into a number of nodes removes the need for downstream applications to assemble the required data (usually a node) from various elements. The conversion of data to an appropriate format, such as XHTML or HTML for web applications, means the webserver (if that is the downstream application) does not need to convert the XML data for browser clients that cannot accept XML directly or where the publisher decides not to provide a browser (even if it is XML capable) with XML data for security reasons. Such a situation may result as XML data may incorporate more features than HTML and a publisher may not want a customer to be able to recreate the XML dataset.
The levels within the structure of the information that are regarded as functionally significant by the creators and end users of the dataset must be identified. Inspection of the example indicates that:

    
    
        {chapter, part, section}

is a likely candidate for a node element set. In general, the node tags are preferably supplied to the conversion software, but a (possibly sub-optimal) node element set can be generated automatically. The lowest level of the hierarchy that is selected in the node element set is known as a terminal node element. The remaining nodes are referred to as non-terminal (or higher level) nodes.

    
    


The selection of a suitable terminal node element is significant, as documented in the International Publication No. WO 98/34179 (PCT/AU98/00050) and U.S. Pat. No. 6,233,592 pertaining to the MALT system. A good rule of thumb is to take the element that is most often cited by users when referring to a single atom of information within the dataset. In the example of legislation, the most often cited element is usually a section. For multiple document types in a single dataset, the definition of nodes may be more or less complex, depending on the degree to which the document types are comparable.
A principal determinant of the complexity of the nodes is the record structure adopted for each record associated with a predefined portion. For example, consider a dataset consisting of multiple document type definitions (DTDs) for legislation: a first DTD for old style textual legislation and a second DTD for new style legislation that incorporates examples and graphics. The document types are sufficiently similar to allow the application of a common node element set, for example {chapter, part, section}. A further example is a dataset consisting of multiple DTDs for case law: a first DTD for reports and a second DTD for practice notes. The documents need only be sufficiently similar to allow the application of the same node element set and conversion strategy for all documents in the dataset. In the case law example, a suitable node element set might be {jurisdiction, year, court, casereport, pracnote, judgment}. The common elements shared by the different document types enable a relatively simple definition of node elements to be applied to disparate sets of data. In such situations, the definition of nodes may not be too complex as the document types share common features. A principal determinant is the choice of a terminal node element. The levels of the hierarchy that constitute the remainder of the node element set are also associated with predefined portions. Thus, there may be multiple predefined portions in a single XML dataset.
When dealing with multiple predefined portions in a single dataset, each terminal portion is duplicated when it changes in any degree. Non-terminal (higher level) portions typically contain no variable content except for a title, any other variable content being delegated to terminal sub-portions. While the title itself may be regarded as a degenerate sub-portion, it is usually more efficient to add special handling of titles to the conversion process (e.g. by reserving a separate table for title fields).
With no variable content, and title changes handled separately, the only substantive change which can apply to a non-terminal portion (apart from creation and deletion) is a structural change. For example, a legislative part may be converted into a chapter, or moved from one chapter to another. In this case the entire portion, including all contained sub-portions, must be duplicated at the new location in the hierarchy.
One table of nodes may possibly be used for two or more document types in the following circumstances:

    (a) if the terminal nodes in each document type can be regarded as functionally equivalent, regardless of whether the element names are identical and regardless of the terminal nodes' respective positions in the hierarchy of the document type; and
    (b) if the record structure for each node is equivalent (e.g. each node, however named, has an ID, dates when the node was applicable, a label and title). An example is Commonwealth Acts and Commonwealth Regulations, where the node can be for both sections of Acts and regulations of Regulations.


In certain cases, multiple document types may preferably, or even desirably, be represented in multiple node tables. Such situations might include:

    
    
        where the production cycle of each document type cannot be sufficiently synchronized to permit the simultaneous output of all nodes from all document types; or
        where end users typically access material from different document types using different methods for each, An example is Commonwealth Acts and Commonwealth case law (judgments).

If, for example, legislation and case law are incorporated in a single dataset, there may be two different hierarchical structures. It may be preferable, or even necessary, to define a node element set and a corresponding node table for each of tie hierarchical structures involved.

    
    


Each node consists of the following components:

    
    
        node ID,
        properties (order independent metadata represented by specified attributes or sub-elements);
        sub-nodes (subordinate nodes);
        initial content (any non-property content prior to the first sub-node); and
        block content (content after the first sub-node).

A node ID is a value that uniquely identifies a node and specifies the node's position in a dataset. A property is a descriptive attribute of a node that may be derived (in XML) from a node tag (name or attributes) or nominated sub-elements. A simple property is a property that can take at most one value per node. A complex property is a property that may have multiple values for the same node. A sub-node is a node that forms part of the content of an enclosing node. A terminal node is a node that cannot contain sub-nodes. A node element set is the set of XML elements that introduce a new node. Content is defined to be the information associated with a node other than the node's properties. Initial content is the content of a node prior to any sub-nodes. Block content is the content of a node between sub-nodes or after the last sub-node.

    
    


An optimal node definition produces a set of nodes with comparable internal structure. For example, the nodes defined for FIG. 1 all have a label property. The nodes are desirably defined so that the number of non-initial content blocks is kept to a minimum.
The dataset in the example of FIG. 1 has only one content block, namely the note at the end of Part A. While belonging to the part, the note follows sections 56 and 56A, which are (sub-)nodes in their own right. The note in section 56 is not a content block, because the note is not preceded by a sub-node. Rather, the note forms part of the initial content of that section.
Once a node set is established, each data node (and non-initial content block) is assigned an arbitrary node ID. This ID is typically an integer with the following properties:

    
    
        each node or content block has exactly one, unique ID; and
        a node (or block) with a lower ID always precedes a node with a higher ID in document order.

The node IDs need not form an unbroken sequence. It is sufficient that the node IDs be unique and reflect document order. When SQL conversion is complete, the node ID can act as a unique key to each node and content block. Initial content always inherits the ID of the initial content's containing node, and so does not require a separate ID.

    
    


Simple properties are those which can take at most one value per node. These properties can be derived from three sources:

    
    
        the name of the node element (see the level property in the example);
        the attributes of the node element (the shortref property); and
        the attributes or content of a unique sub-element (the label property).

To maximize performance of the resulting SQL dataset, all XML data except node tags and properties are converted into content fields. These content fields are typically text strings and may be marked in XML, HTML, or any other format required by the end application. Because content (which usually comprises the overwhelming bulk of the dataset) is pre-processed once, only operations relating to nodes as a whole need to be performed “on the fly”.

    
    


Thus, in the example, all of the <p> paragraph and <note> elements (and any internal markup) are pre-processed into content blocks, and so do not have to be dealt with in real time. Note that initial content and other block content undergoes identical conversion, but must be appropriately flagged in the content SQL table (see below).
For each document type, or group of equivalent document types, a corresponding node table has one record per node, and the following fields:

    
    
        node_id—the unique node ID assigned to the current node; and
        one field for each simple property of the current node (e.g. label in the example).
    
    


FIG. 2 illustrates a node table corresponding to the FIG. 1 dataset. Each node has a corresponding record in the node table 200. Each record in the node table 20 contains a first field 22 for the node_id, a second field 24 designating the type of node element, designated “level”, a third field 26 for a label and a fourth field 28 for a short reference, designated “shortref”. In the example, Chapter 3 is defined to be a node of level “chapter” having a node_id 300, a label “3” and a shortref “Ch 3”. Similarly, Section 56 is defined to be a node of level “section” having a node_id 311, a label “56” and a shortref “s 56”.
The minimum number of SQL tables required to represent an XML encoded dataset is one. However, utilising a single table would require a large number of columns, many of which would be sparsely populated. It is known that relational databases perform sub-optimally in such situations. Accordingly, it is preferable to convert an XML dataset into a single SQL node table and a minimum set of ancillary SQL tables. Presenting the data in multiple tables allows the data to be accessed in multiple ways, often resulting in improved performance. Presenting the data in a minimum set of compact tables simplifies the management of the data. A single, sparsely populated table can be unwieldy and cumbersome. For this reason, an exemplary embodiment typically utilises content and ancestry tables.
Converting each element in a dataset to a corresponding table (as it is currently done by IBM, Oracle, Microsoft and Sybase) results in an overly complex product,
The pre-processed content (both initial and block) is stored in a content table with the following fields:

    
    
        node_id—the ID of the containing node;
        block_id—the ID of the content block (or 0 for initial content); and
        content—the pre-converted content string.

A content block inherits properties from the containing node. FIG. 3 illustrates a content table 30 corresponding to the FIG. 1 dataset. Each record in the content table 30 contains a node_id field 32 that allows the content table 30 to be correlated with the node table 20. Each record in the content table 30 also contains a block_id field 34 and a content field 36. It can be seen from the content table 30 that the Chapter 3 node, having a node_id of 300, also has a block_id of 0 and a content field “chapter 3 intro”.

    
    


A node may have more than one associated record in the content table 30. For example, node_id 310 is associated with Part A of the legislation XML fragment of FIG. 1. There are two records in the content table 30 having a node_id of 310. The first record indicates that the node_id 310 has a first associated block_id 0 with content “part A intro”. The second record indicates that node_id 310 contains a second associated block_id 313 with content “note at end of part A”.
The node IDs specify document order, but do not preserve the document hierarchy. This function is performed by the ancestry table. While in theory only parent information need be saved, it is usually more efficient to explicitly generate all ancestry relationships (including self). In this manner, SQL queries that drive data retrieval are simpler and more efficient. There are only two fields in the ancestry table:

    
    
        desc_id—the node ID of a descendant node; and
        anc_id—the node ID of an ancestor node.

FIG. 4 illustrates an ancestry table 40 corresponding to the FIG. 1 dataset. Each record in the ancestry table 40 contains a desc_id field 42 and an anc_id field 44. The first record in the ancestry table 40 contains a desc_id field containing node_id 300 and an anc_id field containing node_id 300. This record defines the ancestral relationship that node_id 300 has with itself. The second record in the ancestry table 40 contains a desc_id field containing node_id 310 and an anc_id field containing node_id 300. Thus, the second record indicates that node_id 310 is a descendant of node_id 300. The ancestry table 40 preserves the hierarchical structure of the XML fragment from FIG. 1 using SQL tables.

    
    


While simple properties can be stored in the node table, complex properties have to be handled separately. Complex properties can occur more than once per node (e.g. a set of see also links), and can possess sub-properties (e.g. a set of chapter titles which have corresponding start and end dates). There is typically one table per complex property with the following fields:

    
    
        node_id—the unique ID of the node to which the property applies;
        value—the value of the property; and
        other fields if required for sub-properties.

FIG. 5 illustrates how dated higher level titles can be set up as a SQL table. FIG. 5 shows a complex property table 50. A node_id field 52 allows records in the complex property table 50 to be reconciled with entries in the node table 20 of FIG. 2. Each record in the complex property table 50 contains a start_date field 54, an end_date field 56 and a value field 58. The first record has a node_id of 300, which corresponds to Chapter 3 from the legislation XML fragment of FIG. 1. The first record of the complex property table 50 indicates that a value “Directors' Responsibilities” is associated with node_id 300 and has a start_date of 1996-07-15. The absence of a corresponding end_date indicates that the value is currently applicable.

    
    


While the conversion can be driven entirely automatically, the best results are achieved when the mapping is matched to the needs of specific applications. To this end, the user can supply the following:

    
    
        the node element set;
        simple properties (derived from element names, attributes or content);
        complex properties and sub-properties; and
        content conversion algorithm.

The above information is quite simple to produce and sufficient to drive the mapping process to completion.

    
    


A strategy and software, to be known as “MALTmap”, have been described for converting arbitrary XML data into SQL tables. Unlike conventional tree mapping techniques, MALTmap is designed to produce an optimal SQL table set with a minimum of tables and records. In this way, the performance and management benefits of using SQL are maximized.
The method of converting XML data into SQL tables is preferably practised using a general-purpose computer system 600, such as that shown in FIG. 6 wherein the processes described above with respect to FIGS. 2 to 5 may be implemented as software, such as an application program executing within the computer system 600. In particular, the steps of a method of converting XML data into SQL tables are effected by instructions in the software that are carried out by the computer. The instructions may be formed as one or more code modules, each for performing one or more particular tasks. The software may also be divided into two separate parts, in which a first part performs the processes described above with respect FIGS. 2 to 5 and a second part manages a user interface between the first part and the user. The software may be stored in a computer readable medium, including the storage devices described below, for example. The software is loaded into the computer from the computer readable medium, and then executed by the computer. A computer readable medium having such software or computer program recorded on it is a computer program product. The use of the computer program product in the computer preferably effects an advantageous apparatus for the processes described above with respect to FIGS. 2 to 5.
The computer system 600 comprises a computer module 601, input devices such as a keyboard 602 and mouse 603, output devices including a printer 615 and a display device 614. A Modulator-Demodulator (Modern) transceiver device 616 is used by the computer module 601 for communicating to and from a communications network 620, for example connectable via a telephone line 621 or other functional medium. The modem 616 can be used to obtain access to the Internet, and other network systems, such as a Local Area Network (LAN) or a Wide Area Network (WAN).
The computer module 601 typically includes at least one processor unit 605, a memory unit 606, for example formed from semiconductor random access memory (RAM) and read only memory (ROM), input/output (I/O) interfaces including a video interface 607, and an I/O interface 613 for the keyboard 602 and mouse 603 and optionally a joystick (not illustrated), and an interface 608 for the modem 616. A storage device 609 is provided and typically includes a hard disk drive 610 and a floppy disk drive 611. A magnetic tape drive (not illustrated) may also be used. A CD-ROM drive 612 is typically provided as a non-volatile source of data. The components 605 to 613 of the computer module 601 typically communicate via an interconnected bus 604 and in a manner which results in a conventional mode of operation of the computer system 600 known to those in the relevant art. Examples of computers on which the described arrangements can be practised include IBM-PC's and compatibles, Sun Sparcstations or alike computer systems evolved therefrom.
Typically, the application program is resident on the hard disk drive 610 and read and controlled in its execution by the processor 605. Intermediate storage of the program and any data fetched from the network 620 may be accomplished using the semiconductor memory 606, possibly in concert with the hard disk drive 610. In some instances, the application program may be supplied to the user encoded on a CD-ROM or floppy disk and read via the corresponding drive 612 or 611, or alternatively may be read by the user from the network 620 via the modem device 616. Still further, the software can also be loaded into the computer system 600 from other computer readable media. The term “computer readable medium” as used herein refers to any storage or transmission medium that participates in providing instructions and/or data to the computer system 600 for execution and/or processing. Examples of storage media include floppy disks, magnetic tape, CD-ROM, a hard disk drive, a ROM or integrated circuit, a magneto-optical disk, or a computer readable card such as a PCMCIA card and the like, whether or not such devices are internal or external of the computer module 601. Examples of transmission media include radio or infra-red transmission channels as well as a network connection to another computer or networked device, and the Internet or Intranets including email transmissions and information recorded on websites and the like.
The method of converting XML data into SQL tables may alternatively be implemented in dedicated hardware such as one or more integrated circuits performing the processes or sub-processes described above with reference to FIGS. 2 to 5. Such dedicated hardware may include one or more microprocessors and associated memories.
INDUSTRIAL APPLICABILITY
It is apparent from the above that the arrangements described are applicable to any industry that has a need for XML encoded text-based data. Examples are the electronic publishing industry, document management, requirements engineering documents, journal articles, manuals, software and other online help.
The foregoing describes only some embodiments of the present invention, and modifications and/or changes can be made thereto without departing from the scope and spirit of the invention, the embodiments being illustrative and not restrictive.

## Claims

1. A method for mapping a dataset at least partially encoded with a markup language into one or more relational database tables, the method comprising:
identifying at least one hierarchical structure associated with said encoded dataset;
determining a node element set for said hierarchical structure, wherein said node element set comprises one or more nodes that are one or more levels of said hierarchical structure;
identifying at least one node of said encoded dataset, which node is part of said node element set;
allocating to said node of said encoded dataset a unique node identifier; and
generating a relational database table containing one or more records, said one or more records corresponding to a respective one or more of said allocated node identifiers;
wherein said encoded dataset includes one or more predefined portions of text-based data, said one or more predefined portions being at least partially encoded using a markup language, and being associated with one or more of a plurality of attributes for organizing said one or more predefined portions;
wherein said one or more predefined portions include at least one modified and stored predefined portion, said at least one modified predefined portion being associated with one or more attributes for organizing said one or more predefined portions and said modified predefined portion.

2. The method according to claim 1, wherein said encoded dataset further comprises at least one link of a markup language, at least one of said predefined portions of said text-based data and said at least one modified predefined portion being encoded with at least one link.

3. The method according to claim 1, wherein said record of said node table contains said node identifier.

4. The method according to claim 3, wherein said record of said node table further comprises a field for a property of the corresponding node.

5. The method according to claim 1, wherein said node includes at least one of a property, sub-node, initial content, and block content.

6. The method according to claim 1, further comprising:
converting the encoded dataset into one or more pre-processed content fields.

7. The method according to claim 6, further comprising:
storing said one or more pre-processed content fields in one or more content tables, said record in said content table having a node identifier field containing the corresponding node identifier, a block identifier field and a content field.

8. The method according to claim 1, further comprising:
generating an ancestry table to define the inter-relationships among said nodes of said identified hierarchical structure of said encoded dataset.

9. The method according to claim 8, wherein said ancestry table includes a descendant node identifier field and an ancestor node identifier field.

10. The method according to claim 1, further comprising:
generating a complex properties table having a node identifier field and a value field.

11. The method according to claim 10, wherein said complex properties table further includes a sub-property field.

12. A computer program product having a non-transitory computer readable medium, said non-transitory computer readable medium having a computer program recorded therein for mapping a dataset at least partially encoded with a markup language into one or more relational database tables, said computer program product comprising:
computer program code for identifying at least one hierarchical structure associated with said encoded dataset;
computer program code for determining a node element set for said hierarchical structure, wherein said node element set comprises one or more nodes that are one or more levels of said hierarchical structure;
computer program code for identifying at least one node of said encoded dataset, which node is part of said node element set;
computer program code for allocating to said node of said encoded dataset a unique node identifier; and
computer program code for generating a relational database table containing one or more records, said one or more records corresponding to a respective one or more of said allocated node identifiers;
wherein said encoded dataset includes one or more predefined portions of text-based data, said one or more predefined portions being at least partially encoded using a markup language, and being associated with one or more of a plurality of attributes for organizing said one or more predefined portions;
wherein said one or more predefined portions include at least one modified and stored predefined portion, said at least one modified predefined portion being associated with one or more attributes for organizing said one or more predefined portions and said modified predefined portion.

13. The computer program product according to claim 12, wherein said encoded dataset further comprises at least one link of a markup language, at least one of said predefined portions of said text-based data and said at least one modified predefined portion being encoded with at least one link.

14. The computer program product according to claim 12, wherein said record of said node table contains said node identifier.

15. The computer program product according to claim 14, wherein said record of said node table further comprises a field for a property of the corresponding node.

16. The computer program product according to claim 12, wherein said node includes at least one of a property, sub-node, initial content, and block content.

17. The computer program product according to claim 12, further comprising:
computer program code for converting the encoded dataset into one or more pre-processed content fields.

18. The computer program product according to claim 17, further comprising:
computer program code for storing said one or more pre-processed content fields in one or more content tables, said record in said content table having a node identifier field containing the corresponding node identifier, a block identifier field and a content field.

19. The computer program product according to claim 12, further comprising:
computer program code for generating an ancestry table to define the inter-relationships among said nodes of said identified hierarchical structure of said encoded dataset.

20. The computer program product according to claim 19, wherein said ancestry table includes a descendant node identifier field and an ancestor node identifier field.

21. The computer program product according to claim 12, further comprising:
computer program code for generating a complex properties table having a node identifier field and a value field.

22. The computer program product according to claim 21, wherein said complex properties table further includes a sub-property field.