Maintenance of a markup language document in a database
Abstract
A method, an apparatus and a computer program product for converting an XML encoded document into an equivalent SQL table are provided. An arbitrary XML DTD may be converted into an equivalent form by means of which individual node documents stored in the SQL table may be directly accessed. The SQL table is able to be converted back into an XML document of similar structure to the original document from which the table was derived. A set of operations which can be performed on the SQL table is also disclosed. An arbitrarily complex XML document may be broken into suitably sized portions, each of which can be managed independently as a standalone XML document without compromising the validity of the document as a whole. The management of these portions takes advantage of the speed, robustness and maturity of RDBMS systems, while maintaining the hierarchical structure inherent in all XML documents.
Claims
exact text as granted — not AI-modified1 . A method for converting a document encoded in a markup language into a format for mapping to a database table, the method including the steps of:
replacing the content of at least one node in said document stored in a first storage unit with a placeholder and storing said replaced content in a separate data storage unit associated with the corresponding node, the node being an instance of a node element selected from a node element set; and modifying a formal definition of markup rules associated with said document to recognise said placeholder.
2 . The method according to claim 1 , further including the step of:
ascertaining said node element set corresponding to levels of a hierarchical structure of said document, wherein each node element in said node element set is a discrete level of said hierarchical structure of said document.
3 . The method according to claim 1 , wherein said placeholder consists of:
a modified node element name from said node element set; and an identifier that indicates a position of a respective node relative to any other children of a parent node of said respective node.
4 . The method according to claim 1 , wherein said placeholder includes:
a modified node element name from said node element set; and an identifier that indicates a position of a respective node relative to any other children of a patent node of said respective node.
5 . The method according to claim 1 , wherein said step of modifying includes the step of:
replacing each reference to a node in said formal definition of markup rules associated with said document with a combination of said node reference and a reference to a corresponding placeholder associated with a respective node.
6 . The method according to claim 1 , wherein said markup language is eXtensible Markup Language (XML).
7 . The method according to claim 1 , wherein said markup language is Standard Generalized Markup Language (SGML).
8 . The method according to claim 6 , wherein said formal definition of markup rules is a Document Type Definition (DTD).
9 . The method according to claim 6 , wherein said formal definition of markup rules is an XML Schema.
10 . The method according to claim 1 , wherein said markup language is a hierarchical markup language.
11 . The method according to claim 1 , wherein said placeholder is a markup language tag.
12 . The method according to claim 11 , wherein storing said content includes the steps of:
providing said separate storage unit for said at least one node; inserting as a prefix to said storage unit a standard processing instruction to identify version information of said markup language; inserting a command for identifying the associated rules for the markup language having an element corresponding to said node element of which said respective node is an instance, and a public identifier that is distinct and derived from that of said formal definition of markup rules associated with said document to create a new formal definition of markup rules; adding a markup language namespace attribute to ensure that placeholders are unique and do not clash with existing markup language tags; and replacing any sub-node elements with equivalent empty elements in which said namespace attribute has been inserted as a prefix to a tag name, wherein the only attribute is a child identifier, being the identifier of said respective sub-node relative to children of a parent node of said respective sub-node.
13 . The method according to claim 12 , further including the step of:
creating a database table having a record for each respective node, wherein each said record includes fields corresponding to an identifier of said node, an identifier of a parent node of said respective node and content associated with said respective node.
14 . The method according to claim 13 , further including the steps of:
locating a node to be edited; activating an edit function that locks said node for writing and establishes an edit session in which an editing tool manages content of said node; and writing the updated content back into the node record, when the edit session is finished.
15 . The method according to claim 14 , wherein said edit function is chosen from the group consisting of: modifying an existing node; deleting an existing node (or sub-tree); copying an existing node (or sub-tree) to a new location; creating a new node (or sub-tree); and relocating an existing node (or sub-tree) within a node.
16 . The method according to claim 14 , including the further step of:
saving a modified node, said saving step including the steps of:
generating a list of placeholders in a principal node;
generating a list of existing sub-nodes from a database;
pairing off placeholders and sub-nodes;
deleting from said database any sub-node and any descendants of said sub-node, if that sub-node is not matched against a placeholder;
creating duplicate nodes;
assigning a provisional identifier to each duplicate node, wherein each identifier consists of an identifier associated with said principal node, a provisional child identifier within said principal node, and a trailing portion, if said modified node is a descendant of a node being copied;
scanning the list of matched placeholders in document order;
assigning a provisional child identifier to any placeholder that has a lower child identifier than any one of the siblings of said respective placeholder that have already been scanned;
performing a markup language-to-database conversion on each sub-node element present;
creating new database records for each of said sub-node elements;
assigning a provisional identifier to each new node;
assigning a provisional child identifier within said principal node;
replacing the text of each sub-node element in said principal node with a now placeholder; and
assigning permanent child identifiers to said placeholders to replace the provisional child identifier in each corresponding sub-node.
17 . An apparatus for converting a document encoded in a markup language into a format for mapping to a database table, said apparatus including:
means for replacing the content of at least one node in said document stored in a first storage unit with a placeholder and storing said replaced content in a separate data storage unit associated with the corresponding node, the node being an instance of a node element selected from a node element set; and means for modifying a formal definition of markup rules associated with said document to recognise said placeholder.
18 . The apparatus according to claim 17 , further including:
means for ascertaining said node element set corresponding to levels of a hierarchical structure of said document, wherein each node element in said node element set is a discrete level of said hierarchical structure of said document.
19 . The apparatus according to claim 17 , wherein said placeholder consists of:
a modified node element name from said node element set; and an identifier that indicates a position of a respective node relative to any other to children of a parent node of said respective node.
20 . The apparatus according to claim 17 , wherein said placeholder includes:
a modified node element name from said node element set; and an identifier that indicates a position of a respective node relative to any other is children of a parent node of said respective node.
21 . The apparatus according to claim 17 , wherein said modifying means includes:
means for replacing each reference to a node in said formal definition of markup rules associated with said document with a combination of said node reference and a reference to a corresponding placeholder associated with a respective node.
22 . The apparatus according to claim 17 , wherein said markup language is eXtensible Markup Language (XML).
23 . The apparatus according to claim 17 , wherein said markup language is Standard Generalized Markup Language (SGML).
24 . The apparatus according to claim 22 , wherein said formal definition of markup rules is a Document Type Definition (DTD).
25 . The apparatus according to claim 22 , wherein said formal definition of markup rules is an XML Schema.
26 . The method according to claim 17 , wherein said markup language is a hierarchical markup language.
27 . The apparatus according to claim 17 , wherein said placeholder is a markup language tag.
28 . The apparatus according to claim 27 , wherein said content storing means includes:
means for providing said separate storage unit for said at least one node; means for inserting as a prefix to said storage unit a standard processing instruction to identify version information of said markup language; means for inserting a command for identifying the associated rules for the markup language having an element corresponding to said node element of which said respective node is an instance, and a public identifier that is distinct and derived from that of said formal definition of markup rules associated with said document to create a new formal definition of markup rules; means for adding a markup language namespace attribute to ensure that placeholders are unique and do not clash with existing markup language tags; and means for replacing any sub-node elements with equivalent empty elements in which said namespace attribute has been inserted as a prefix to a tag name, wherein the only attribute is a child identifier, being the identifier of said respective sub-node relative to children of a parent node of said respective sub-node.
29 . The apparatus according to claim 28 , further including:
means for creating a database table having a record for each respective node, wherein each said record includes fields corresponding to an identifier of said node, an identifier of a parent node of said respective node and content associated with said respective node.
30 . The apparatus according to claim 29 , further including:
means for locating a node to be edited; means for activating an edit function that locks said node for writing and establishes an edit session in which an editing tool manages content of said node; and means for writing the updated content back into the node record, when the edit session is finished.
31 . The apparatus according to claim 30 , wherein said edit function is chosen from the group consisting of: modifying an existing node; deleting an existing node (or sub-tree); copying an existing node (or sub-tree) to a new location; creating a new node (or sub-tree); and relocating an existing node (or sub-tree) within a node.
32 . The apparatus according to claim 30 , further including:
means for saving a modified node, said saving means including:
means for generating a list of placeholders in a principal node;
means for generating a list of existing sub-nodes from a database;
means for pairing off placeholders and sub-nodes;
means for deleting from said database any sub-node and any descendants of said sub-node, if that sub-node is not matched against a placeholder;
means for creating duplicate nodes;
means for assigning a provisional identifier to each duplicate node, wherein each identifier consists of an identifier associated with said principal is node, a provisional child identifier within said principal node, and a trailing portion, if said modified node is a descendant of a node being copied;
means for scanning the list of matched placeholders in document order;
means for assigning a provisional child identifier to any placeholder that has a lower child identifier than any one of the siblings of said respective placeholder that have already been scanned;
means for performing a markup language-to-database conversion on each sub-node element present;
means for creating new database records for each of said sub-node elements;
means for assigning a provisional identifier to each new node;
means for assigning a provisional child identifier within said principal node;
means for replacing the text of each sub-node element in said principal node with a now placeholder; and
means for assigning permanent child identifiers to said placeholders to replace the provisional child identifier in each corresponding sub-node.
33 . A computer program product having a computer readable medium having a computer program recorded therein for converting a document encoded in a markup language into a format for mapping to a database table, said computer program product including:
computer program code means for replacing the content of at least one node in said document stored in a first storage unit with a placeholder and storing said replaced content in a separate data storage unit associated with the corresponding node, the node being an instance of a node element selected from a node element set; and computer program code means for modifying a formal definition of markup rules associated with said document to recognise said placeholder.
34 . The computer program product according to claim 33 , further including:
computer program code means for ascertaining said node element set corresponding to levels of a hierarchical structure of said document, wherein each node element in said node element set is a discrete level of said hierarchical structure of said document.
35 . The computer program product according to claim 33 , wherein said placeholder consists of:
a modified node element name from said node element set; and an identifier that indicates a position of a respective node relative to any other children of a parent node of said respective node.
36 . The computer program product according to claim 33 , wherein said placeholder includes:
a modified node element name from said node element set; and an identifier that indicates a position of a respective node relative to any other children of a parent node of said respective node.
37 . The computer program product according to claim 33 , wherein said modifying means includes:
computer program code means for replacing each reference to a node in said formal definition of markup rules associated with said document with a combination of said node reference and a reference to a corresponding placeholder associated with a respective node.
38 . The computer program product according to claim 33 , wherein said markup language is eXtensible Markup Language (XML).
39 . The computer program product according to claim 33 , wherein said markup language is Standard Generalized Markup Language (SGML).
40 . The computer program product according to claim 38 , wherein said formal definition of markup rules is a Document Type Definition (DTD).
41 . The computer program product according to claim 38 , wherein said formal definition of markup rules is an XML Schema.
42 . The computer program product according to claim 33 , wherein said markup language is a hierarchical markup language.
43 . The computer program product according to claim 33 , wherein said placeholder is a markup language tag.
44 . The computer program product according to claim 43 , wherein said computer program code means for storing said content includes:
computer program code means for providing said separate storage unit for said at least one node; computer program code means for inserting as a prefix to said storage unit a standard processing instruction to identify version information of said markup language; computer program code means for inserting a command for identifying the associated rules for the markup language having an element corresponding to said node element of which said respective node is an stance, and a public identifier that is distinct and derived from that of said formal definition of markup rules associated with said document to create a new formal definition of markup rules; computer program code means for adding a markup language namespace attribute to ensure that placeholders are unique and do not clash with existing markup language tags; and computer program code means for replacing any sub-node elements with equivalent empty elements in which said namespace attribute has been inserted as a prefix to a tag name, wherein the only attribute is a child identifier, being the identifier of said respective sub-node relative to children of a parent node of said respective sub-node.
45 . The computer program product according to claim 44 , further including:
computer program code means for creating a database table having a record for each respective node, wherein each said record includes fields corresponding to an identifier of said node, an identifier of a parent node of said respective node and content associated with said respective node.
46 . The computer program product according to claim 45 , further including:
computer program code means for locating a node to be edited; computer program code means for activating an edit function that locks said node for writing and establishes an edit session in which an editing tool manages content of said node; and computer program code means for writing the updated content back into the node record, when the edit session is finished.
47 . The computer program product according to claim 46 , wherein said edit function is chosen from the group consisting of: modifying an existing node; deleting an existing node (or sub-tree); copying an existing node (or sub-tree) to a new location; creating a new node (or sub-tree); and relocating an existing node (or sub-tree) within a node.
48 . The computer program product according to claim 46 , further including:
computer program code means for saving a modified node, said computer program product for saving including:
computer program code means for generating a list of placeholders in a principal node;
computer program code means for generating a list of existing sub-nodes from a database;
computer program code means for pairing off placeholders and sub-nodes;
computer program code means for deleting from said database any sub-node and any descendants of said sub-node, if that sub-node is not matched against a placeholder;
computer program code means for creating duplicate nodes;
computer program code means for assigning a provisional identifier to each duplicate node, wherein each identifier consists of an identifier associated with said principal node, a provisional child identifier within said principal node, and a trailing portion, if said modified node is a descendant of a node being copied;
computer program code means for scanning the list of matched placeholders in document order;
computer program code means for assigning a provisional child identifier to any placeholder that has a lower child identifier than any one of the siblings of said respective placeholder that have already been scanned;
computer program code means for performing a markup language-to-database conversion on each sub-node element present;
computer program code means for creating new database records for each of said sub-node elements;
computer program code means for assigning a provisional identifier to each new node;
computer program code means for assigning a provisional child identifier within said principal node;
computer program code means for replacing the text of each sub-node element in said principal node with a new placeholder; and
computer program code means for assigning permanent child identifiers to said placeholders to replace the provisional child identifier in each corresponding sub-node.
49 . A method for converting an eXtensible Markup Language (XML) encoded document into an equivalent Structured Query Language (SQL) table structure, the method including the steps of:
determining a node element set for said XML encoded document, wherein each node element in said node element set is a discrete level of said document; determining one or more nodes of said XML encoded document, each node being an instance of a node element; allocating to each node a unique node identifier; and assembling the XML content of each node by performing the flyer steps of:
assembling XML content of the corresponding node element;
creating a separate sub-document for each node by inserting as a prefix a standard XML processing instruction, plus a DOCTYPE declaration, where the DOCTYPE element is the node element, and the public ID is the same as that of the original DTD, except that the word MALTbase is inserted as a prefix to the descriptor;
replacing any sub-node elements with equivalent empty placeholder elements in which the namespace MALTbase: has been inserted as a prefix to a element name, wherein the only non-fixed attribute is a child ID, being the ID of the sub-node relative to all other sub-nodes within the sub-node's parent; end
constructing a node table record to hold the content.
50 . A method for converting an eXtensible Markup Language (XML) Document Type Definition (DTD) into a form suitable for accessing preprocessed node content, said method comprising the steps of:
declaring a new MALTbase empty placeholder element for each node element in the node element set; modifying each content model referring to a node element to refer in addition to an equivalent MALTbase placeholder element; inserting the word MALTbase as a prefix to a descriptor of a public identifier to produce a modified public identifier; and allocating said modified public identifier to the new DTD.
51 . A method for converting an eXtensible Markup Language (XML) Document Type Definition (DTD) into a form suitable for accessing pre-processed node content, said method comprising the steps of:
duplicating the XML DTD to create a new DTD; assigning the new DTD a public identifier that is the same as the public ID of the XML DTD except that the word MALTbase is inserted as a prefix to the descriptor; creating a new placeholder element for every element in the node element set, each said placeholder element having MALTbase: inserted as a prefix to the name; an empty content model; and an ATTLIST containing the two attributes: child-id CDATA #REQUIRED xmlns:MALTbase CDATA #FIXED “http://www.malt.com/xmlns/MALTbase”; and replacing every occurrence of a node element in any content model with a group consisting of two alternatives, the original element and its MALTbase equivalent.
52 . The method according to claim 49 whereby any change to a sub-document that preserves the validity of that sub-document with respect to a new DTD is equivalent to a change in said XML encoded document which preserves that document's validity with respect to the original DTD.
53 . A method for reconverting a MALTbase Structured Query Language (SQL) table back into an equivalent eXtensible Markup Language (XML) document, said method including the steps of:
creating an XML document from root node content in which the MALTbase prefixes are removed from DTD public ID and the DOCTYPE; replacing each placeholder element in the resulting document with the equivalent element from the corresponding sub-document; repeating the above step until no further placeholders remain.
54 . A method for maintaining an eXtensible Markup Language (XML) document in MALTbase Structured Query Language (SQL) form, without the need for reconverting the document to XML, said method comprising the steps of:
locating the node to be edited; activating an edit function that locks the node for writing and establishes an edit session in which an editing tool manages content of a node; and writing the updated content back into the node record, when the edit session is finished.
55 . The method according to claim 54 wherein said edit function is chosen from the group consisting of: modifying an existing node; deleting an existing node (or sub-tree); copying an existing node (or sub-tree) to a new location; creating a new node (or sub-tree); reordering child nodes within a single parent; or any combination of the preceding actions.
56 . The method according to claim 55 , wherein said modifying does not affect a DOCTYPE element or any placeholder.
57 . A method for saving a modified node (principal node), said method comprising the steps of:
generating a list of placeholders in the principal node; generating a list of existing sub-nodes from a database; pairing off placeholders and sub-nodes; deleting from the database any sub-node and the sub-node's descendants, if that sub-node is not matched against a placeholder; creating a duplicate node for each placeholder not currently a sub-node of the principal node; assigning a provisional ID to each duplicate node, wherein each ID consists of the ID of the principal node, a provisional child ID within the principal node, and a trailing portion of the ID, if the new node is a descendant of the node being copied. scanning the list of matched placeholders in document order; assigning a provisional child ID to any placeholder that has a lower child ID than any one of the placeholder's siblings that have already been scanned; performing a standard MALTbase XML-to-SQL conversion on each sub-node element (not being a placeholder) present; creating new SQL records for each of said sub-node elements; assigning a provisional ED to each new node; assigning a provisional child ID within the principal node; replacing the text of each sub-node element in the principal node with a new placeholder; and assigning permanent child IDs to the placeholders to replace the provisional segment in the ID of each corresponding sub-node (or descendant).Join the waitlist — get patent alerts
Track US2008021916A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.