JP2012073706A - Structured document storage device, structured document storage method and structured document storage program - Google Patents

Structured document storage device, structured document storage method and structured document storage program Download PDF

Info

Publication number
JP2012073706A
JP2012073706A JP2010216420A JP2010216420A JP2012073706A JP 2012073706 A JP2012073706 A JP 2012073706A JP 2010216420 A JP2010216420 A JP 2010216420A JP 2010216420 A JP2010216420 A JP 2010216420A JP 2012073706 A JP2012073706 A JP 2012073706A
Authority
JP
Japan
Prior art keywords
node
search
structured document
order
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2010216420A
Other languages
Japanese (ja)
Inventor
Tomohiro Asami
知弘 浅見
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
JVCKenwood Corp
Original Assignee
JVCKenwood Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by JVCKenwood Corp filed Critical JVCKenwood Corp
Priority to JP2010216420A priority Critical patent/JP2012073706A/en
Publication of JP2012073706A publication Critical patent/JP2012073706A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Machine Translation (AREA)
  • Document Processing Apparatus (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

PROBLEM TO BE SOLVED: To quickly determine an ancestor-descendant relationship between nodes forming a structured document.SOLUTION: An XML analysis part 101 analyzes an XML document and outputs information about nodes of the XML document. A storage part 102 determines at least an order number showing an appearance order of a processing object node within the information about the nodes of the XML document and a second order number which is an order number of a first node among the nodes in the information appearing after the processing object node except descendant nodes of the processing object node, and stores them in a node table 2 together with a node type etc. of the processing object node. A retrieval part 105 has a descendant node retrieval means 105g determining that a comparison source node is a descendant node of a comparison destination node when the order number of the comparison source node in the stored information is larger than the order number of the comparison destination node and the order number of the comparison source node is smaller than the second order number of the comparison destination node.

Description

本発明は構造化文書格納装置、構造化文書格納方法及び構造化文書格納プログラムに係り、特にXML(拡張可能なマーク付け言語;Extensible Markup Language)に代表される構造化文書を格納する構造化文書格納装置、構造化文書格納方法及び構造化文書格納プログラムに関する。   The present invention relates to a structured document storage device, a structured document storage method, and a structured document storage program, and more particularly to a structured document that stores a structured document represented by XML (Extensible Markup Language). The present invention relates to a storage device, a structured document storage method, and a structured document storage program.

XMLに代表される構造化文書を格納し、格納した構造化文書を構成する要素を高速に検索する方法として、構造化文書を表形式のテーブルから成るリレーショナルデータベースに格納する方法がある。   As a method of storing a structured document represented by XML and searching for elements constituting the stored structured document at high speed, there is a method of storing the structured document in a relational database composed of tabular tables.

例えば、特許文献1には、XMLデータの各エレメントの内容及び属性値の項目と、データ間のリンク関係をテーブルに格納するとともに、データの出現順に順番号を割り当て、データの順番号と親エレメントの順番号をテーブルに格納するXMLデータの格納方法が開示されている。この特許文献1記載のXMLデータ、すなわち構造化文書の格納方法では、テーブルに格納されているエレメントの順番号及びそのエレメントの親エレメントの順番号により、エレメント間の親子関係を高速に判別できるとともに、データ間の階層関係についても判別可能である。   For example, in Patent Document 1, the contents of each element of XML data and the attribute value items and the link relationship between the data are stored in a table, and a sequential number is assigned in the order of appearance of the data. A method for storing XML data for storing the sequence numbers in a table is disclosed. In the XML data described in Patent Document 1, that is, the structured document storage method, the parent-child relationship between elements can be determined at high speed based on the order number of the element stored in the table and the order number of the parent element of the element. It is also possible to determine the hierarchical relationship between data.

特許第3560043号公報Japanese Patent No. 3560043

しかしながら、特許文献1に記載の構造化文書の格納方法では、エレメント間の先祖・子孫関係を即座に判別することができない。あるいは、エレメント間の親子関係を順次判別しながらエレメントを辿ることにより先祖・子孫関係を判別する方法も考えられるが、その方法では高速に判別することはできないことが課題である。   However, the structured document storage method described in Patent Document 1 cannot immediately determine the ancestor-descendant relationship between elements. Alternatively, a method of determining the ancestor-descendant relationship by tracing the elements while sequentially determining the parent-child relationship between the elements is conceivable, but it is a problem that the method cannot be determined at high speed.

本発明は上記の点に鑑みなされたもので、構造化文書を構成するノード間の先祖・子孫関係を高速に判別することを可能とする構造化文書格納装置、構造化文書格納方法及び構造化文書格納プログラムを提供することを目的とする。   The present invention has been made in view of the above points, and provides a structured document storage device, a structured document storage method, and a structured document that can quickly determine an ancestor-descendant relationship between nodes constituting a structured document. An object is to provide a document storage program.

上記目的を達成するため、第1の発明の構造化文書格納装置は、構造化文書を解析して、その構造化文書に含まれるノードに関する情報を出力する構造化文書解析手段と、構造化文書のノードに関する情報が格納されるノードテーブルを有する記憶手段と、構造化文書解析手段から出力された構造化文書のノードに関する情報中の対象ノードの出現順を表す順番号を決定すると共に、対象ノードより後に情報中に出現するノードのうち対象ノードの子孫ノードを除いて最も先に出現するノードの順番号を対象ノードに付す次番号として決定し、対象ノードに関する情報と共に順番号と次番号とをノードテーブルに格納する格納手段と、供給される検索手順リストに従い、ノードテーブルの格納情報を参照して検索結果を出力する検索手段とを備え、検索手段は、格納情報中の比較元ノードの順番号が比較先ノードの順番号より大きく、かつ、比較元ノードの順番号が比較先ノードの次番号より小さいときに、比較元ノードが比較先ノードの子孫ノードであると判断する子孫ノード検索手段を有することを特徴とする。   In order to achieve the above object, a structured document storage device according to a first aspect of the invention comprises a structured document analyzing means for analyzing a structured document and outputting information about nodes included in the structured document, and a structured document. A storage means having a node table for storing information relating to the nodes of the node, a sequence number representing the order of appearance of the target nodes in the information relating to the nodes of the structured document output from the structured document analyzing means, and a target node The order number of the node that appears first in the information excluding the descendant node of the target node is determined as the next number to be assigned to the target node, and the order number and the next number together with the information about the target node are determined. Storage means for storing in the node table and search means for outputting the search result by referring to the storage information of the node table according to the supplied search procedure list When the order number of the comparison source node in the stored information is larger than the order number of the comparison destination node and the order number of the comparison source node is smaller than the next number of the comparison destination node, the search means It is characterized by having descendant node search means for judging that it is a descendant node of the comparison destination node.

また、上記の目的を達成するため、第2の発明の構造化文書格納装置は、第1の発明における上記構造化文書が、出現順が定義される第1のノードと、出現順が定義されない第2のノードとを含み、格納手段が、第1のノードの順番号に、その第1のノードの出現順に2ずつ増加する0以上の整数を割り当て、第2のノードの順番号に、その第2のノードの一つ上位のノードである親ノードの順番号に1を加算した値を割り当て、子孫ノード検索手段が、比較元ノードの順番号が比較先ノードの順番号に1を加算した値より大きく、かつ、比較元ノードの順番号が比較先ノードの次番号より小さいときに、比較元ノードが比較先ノードの子孫ノードであると判断することを特徴とする。   In order to achieve the above object, the structured document storage device according to the second aspect of the invention is characterized in that the structured document in the first aspect is not defined with the first node in which the order of appearance is defined and the order of appearance. And the storage means assigns an integer greater than or equal to 0 that increases by 2 in the order of appearance of the first node to the order number of the first node, and the order number of the second node A value obtained by adding 1 to the order number of the parent node that is one node above the second node is assigned, and the descendant node search means adds the order number of the comparison source node to the order number of the comparison destination node. The comparison source node is determined to be a descendant node of the comparison destination node when the value is larger than the value and the order number of the comparison source node is smaller than the next number of the comparison destination node.

また、上記の目的を達成するため、第3の発明の構造化文書格納方法は、構造化文書を解析して、その構造化文書に含まれるノードに関する情報を出力する構造化文書解析ステップと、構造化文書解析ステップにより解析して得られた構造化文書のノードに関する情報中の対象ノードの出現順を表す順番号を決定すると共に、対象ノードより後に情報中に出現するノードのうち対象ノードの子孫ノードを除いて最も先に出現するノードの順番号を対象ノードに付す次番号として決定し、対象ノードに関する情報と共に順番号と次番号とを、構造化文書のノードに関する情報が格納されるノードテーブルに格納する格納ステップと、供給される検索手順リストに従い、ノードテーブルの格納情報を参照して検索結果を出力する検索ステップとを備え、検索ステップは、格納情報中の比較元ノードの順番号が比較先ノードの順番号より大きく、かつ、比較元ノードの順番号が比較先ノードの次番号より小さいときに、比較元ノードが比較先ノードの子孫ノードであると判断する子孫ノード検索ステップを含むことを特徴とする。   In order to achieve the above object, a structured document storage method according to a third aspect of the invention comprises a structured document analysis step of analyzing a structured document and outputting information on nodes included in the structured document; A sequence number representing the appearance order of the target node in the information related to the node of the structured document obtained by the structured document analysis step is determined, and the target node among the nodes appearing in the information after the target node is determined. A node in which the order number of the node that appears first except for the descendant node is determined as the next number to be assigned to the target node, and the order number and the next number are stored together with the information about the target node, and the information about the node of the structured document is stored. A storage step for storing in the table, and a search step for outputting the search result by referring to the storage information of the node table according to the supplied search procedure list. In the search step, when the sequence number of the comparison source node in the stored information is larger than the sequence number of the comparison destination node and the sequence number of the comparison source node is smaller than the next number of the comparison destination node, the comparison source node The method includes a descendant node search step for determining that the node is a descendant node of the comparison destination node.

また、上記の目的を達成するため、第4の発明の構造化文書格納方法は、第3の発明における構造化文書が、出現順が定義される第1のノードと、出現順が定義されない第2のノードとを含み、格納ステップが、第1のノードの順番号に、その第1のノードの出現順に2ずつ増加する0以上の整数を割り当て、第2のノードの順番号に、その第2のノードの一つ上位のノードである親ノードの順番号に1を加算した値を割り当て、子孫ノード検索ステップが、比較元ノードの順番号が比較先ノードの順番号に1を加算した値より大きく、かつ、比較元ノードの順番号が比較先ノードの次番号より小さいときに、比較元ノードが比較先ノードの子孫ノードであると判断することを特徴とする。   In order to achieve the above object, the structured document storage method according to the fourth aspect of the present invention is the structured document according to the third aspect, in which the first node in which the order of appearance is defined and the order in which the order of appearance is not defined. And the storing step assigns an integer greater than or equal to 0 increasing in order of appearance of the first node to the sequence number of the first node, and assigns the sequence number of the second node to the sequence number of the first node. A value obtained by adding 1 to the order number of the parent node that is one node higher than the node 2 and the descendant node search step is obtained by adding 1 to the order number of the comparison destination node. The comparison source node is determined to be a descendant node of the comparison destination node when the comparison source node is larger and the order number of the comparison source node is smaller than the next number of the comparison destination node.

また、上記の目的を達成するため、第5の発明の構造化文書格納プログラムは、コンピュータに、第3の発明の構造化文書格納方法における構造化文書解析ステップ、格納ステップ、及び子孫ノード検索ステップを含む検索ステップを実行させることを特徴とする。   In order to achieve the above object, a structured document storage program according to a fifth aspect of the present invention provides a computer with a structured document analysis step, a storage step, and a descendant node search step in the structured document storage method of the third aspect of the invention. A search step including: is executed.

更に、上記の目的を達成するため、第6の発明の構造化文書格納プログラムは、第5の発明における構造化文書が、出現順が定義される第1のノードと、出現順が定義されない第2のノードとを含み、格納ステップが、第1のノードの順番号に、その第1のノードの出現順に2ずつ増加する0以上の整数を割り当て、第2のノードの順番号に、その第2のノードの一つ上位のノードである親ノードの順番号に1を加算した値を割り当て、上記子孫ノード検索手段が、比較元ノードの順番号が比較先ノードの順番号に1を加算した値より大きく、かつ、比較元ノードの順番号が比較先ノードの次番号より小さいときに、比較元ノードが比較先ノードの子孫ノードであると判断する構成である。   Furthermore, to achieve the above object, the structured document storage program according to the sixth aspect of the invention is the structured document according to the fifth aspect, in which the appearance order is not defined in the first node in which the order of appearance is defined. And the storing step assigns an integer greater than or equal to 0 increasing in order of appearance of the first node to the sequence number of the first node, and assigns the sequence number of the second node to the sequence number of the first node. A value obtained by adding 1 to the order number of the parent node that is one node higher than the node 2 is assigned, and the descendant node search means adds 1 to the order number of the comparison destination node. In this configuration, the comparison source node is determined to be a descendant node of the comparison destination node when the comparison number is larger than the value and the order number of the comparison source node is smaller than the next number of the comparison destination node.

本発明によれば、格納された構造化文書のノード間の先祖・子孫関係を検索する手順を従来に比べて短時間で行うことができ、その結果、従来に比べて構造化文書の検索を高速に行うことができる。   According to the present invention, the procedure for searching the ancestor-descendant relationship between the nodes of the stored structured document can be performed in a short time compared to the conventional method. As a result, the structured document can be searched compared with the conventional method. It can be done at high speed.

本発明の構造化文書格納装置の一実施の形態のブロック図である。It is a block diagram of one embodiment of a structured document storage device of the present invention. 図1中のリレーショナルデータベースにおけるノードテーブルの構成の一例を示す図である。It is a figure which shows an example of a structure of the node table in the relational database in FIG. 図2のノードテーブル中のノード型の一覧の一例を示す図である。FIG. 3 is a diagram illustrating an example of a node type list in the node table of FIG. 2. 図1の構造化文書格納装置の格納部における文書格納処理を説明するフローチャートである。3 is a flowchart for explaining document storage processing in a storage unit of the structured document storage device in FIG. 1. 図4中のノード格納処理の詳細を説明するフローチャートである。It is a flowchart explaining the detail of the node storing process in FIG. 図5中の属性格納処理の詳細を説明するフローチャートである。It is a flowchart explaining the detail of the attribute storage process in FIG. XML文書の一例を示す図である。It is a figure which shows an example of an XML document. 図7のXML文書を格納したノードテーブル例を示す図である。It is a figure which shows the example of the node table which stored the XML document of FIG. 図1中のXQuery解析部が生成する検索手順の種別の一覧を示す図である。It is a figure which shows the list of the classification of the search procedure which the XQuery analysis part in FIG. 1 produces | generates. 図1中の検索部における検索処理を説明するフローチャートである。It is a flowchart explaining the search process in the search part in FIG. 図10中の検索手順実行処理の詳細を説明するフローチャートである。It is a flowchart explaining the detail of the search procedure execution process in FIG. 図11中の子孫ノード検索処理の詳細を説明するフローチャートである。12 is a flowchart illustrating details of a descendant node search process in FIG. 11. 図11中の先祖ノード検索処理の詳細を説明するフローチャートである。12 is a flowchart illustrating details of an ancestor node search process in FIG. 11. 図10中のサブツリーデータ抽出処理の詳細を説明するフローチャートである。It is a flowchart explaining the detail of the subtree data extraction process in FIG. 図1中のXQuery解析部に入力される検索クエリの一例を示す図である。It is a figure which shows an example of the search query input into the XQuery analysis part in FIG. 図1中のXQuery解析部により生成される検索手順リストの一例を示す図である。It is a figure which shows an example of the search procedure list | wrist produced | generated by the XQuery analysis part in FIG. 図1中の検索部が図16の検索手順リストを用いて行う検索処理によるコンテクストノードリストの遷移を示す図である。FIG. 17 is a diagram showing transition of a context node list by a search process performed by the search unit in FIG. 1 using the search procedure list in FIG. 16. 図1中のXML成形部から出力される検索結果の一例を示す図である。It is a figure which shows an example of the search result output from the XML shaping | molding part in FIG.

以下、発明を実施するための形態について図面と共に詳細に説明する。   DESCRIPTION OF EMBODIMENTS Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.

図1は、本発明になる構造化文書格納装置の一実施の形態のブロック図を示す。   FIG. 1 shows a block diagram of an embodiment of a structured document storage apparatus according to the present invention.

図1に示すように、本実施の形態の構造化文書格納装置1は、XML解析部101と、格納部102と、リレーショナルデータベース103と、クエリ(XQuery)解析部104と、検索部105と、XML成形部106とから構成されている。この構造化文書格納装置1は、入力された構造化文書であるXML文書をリレーショナルデータベース103に格納するとともに、入力された検索クエリに従ってXML文書内を検索部105で検索し、検索クエリに合致するノードのリストを検索結果として出力する構造化文書格納装置である。   As shown in FIG. 1, the structured document storage device 1 of the present embodiment includes an XML analysis unit 101, a storage unit 102, a relational database 103, a query (XQuery) analysis unit 104, a search unit 105, An XML molding unit 106 is included. The structured document storage device 1 stores an XML document that is an input structured document in the relational database 103 and searches the XML document in the search unit 105 according to the input search query, and matches the search query. A structured document storage device that outputs a list of nodes as a search result.

XML解析部101は、テキストデータとして入力されたXML文書を解析し、XML文書を構成する各ノードに対応するオブジェクトを木構造に配置したDOM(文書オブジェクトモデル;Document Object Model)データを生成して格納部102へ供給する。   The XML analysis unit 101 analyzes an XML document input as text data, and generates DOM (Document Object Model) data in which objects corresponding to each node constituting the XML document are arranged in a tree structure. The data is supplied to the storage unit 102.

ここで、XML文書の概要について説明する。周知のように、XML文書では、「<要素名>」で表される開始タグと「</要素名>」で表される終了タグとの間にテキストや要素の集合を記述する。また、1つのタグで完結する要素は、空要素と呼ばれる。また、開始タグ、または空要素タグの中に「<要素名 属性名=“属性値”>」のように属性を記述することができる。また、構造化文書であるXML文書は、XMLの論理構造に基づいて木構造に変換できる。XML文書の各要素、属性やテキストは、木構造においてノードと呼ばれる。   Here, an outline of the XML document will be described. As is well known, in an XML document, a set of text and elements is described between a start tag represented by “<element name>” and an end tag represented by “</ element name>”. An element completed with one tag is called an empty element. In addition, an attribute can be described as “<element name attribute name =“ attribute value ”>” in the start tag or empty element tag. An XML document that is a structured document can be converted into a tree structure based on the XML logical structure. Each element, attribute, and text of the XML document is called a node in the tree structure.

このノードにおいて、「親ノード」、「子ノード」、「子孫ノード」、「先祖ノード」という表現が用いられることがある。「親ノード」は、処理対象ノードの一つ上位のノードであり、「子ノード」は、処理対象ノードの一つ下位のノードであり、「子孫ノード」は、処理対象ノードの全下位ノードを示し、「先祖ノード」は、処理対象ノードの全上位ノードを示す。なお、要素はノードの一種であるので、開始タグは「<ノード名>」、終了タグは「</ノード名>」で表されると表現することもできる。   In this node, the expressions “parent node”, “child node”, “descendant node”, and “ancestor node” may be used. The “parent node” is a node one level higher than the processing target node, the “child node” is a node one level lower than the processing target node, and the “descendant node” is all the lower level nodes of the processing target node. “Ancestor node” indicates all upper nodes of the processing target node. Since the element is a kind of node, the start tag can be expressed as “<node name>” and the end tag can be expressed as “</ node name>”.

格納部102は、XML解析部101からDOMデータが供給されると、供給されたDOMデータによって表わされるXML文書をリレーショナルデータベース103に格納するものであり、その機能上、ノードID決定手段102aと、順番号決定手段102bと、ノードデータ挿入手段102cと、属性データ挿入手段102dと、属性格納手段102eと、子ノード格納手段102fとを備える。   When the DOM data is supplied from the XML analysis unit 101, the storage unit 102 stores an XML document represented by the supplied DOM data in the relational database 103. In terms of its function, the storage unit 102 includes a node ID determination unit 102a, A sequence number determining unit 102b, a node data inserting unit 102c, an attribute data inserting unit 102d, an attribute storing unit 102e, and a child node storing unit 102f are provided.

ノードID決定手段102aは、処理対象ノードを一意に識別するノードIDを決定する。具体的には、ノードID決定手段102aは、リレーショナルデータベース103内のノードテーブル2に格納されている、いずれのノードIDとも一致しない0以外の正の整数を選択し、それを処理対象ノードのノードIDとする。   The node ID determination unit 102a determines a node ID that uniquely identifies the processing target node. Specifically, the node ID determination unit 102a selects a positive integer other than 0 that does not match any of the node IDs stored in the node table 2 in the relational database 103, and selects it as the node of the processing target node. ID.

順番号決定手段102bは、処理対象ノードに対し、ノードの出現順を表す順番号を決定する。さらに、順番号決定手段102bは、処理対象ノードに対し、処理対象ノードより後に出現するノードのうち処理対象ノードの子孫ノードを除いて最も先に出現するノードの順番号である次番号を決定する。ただし、処理対象ノードより後に出現するノードが全て処理対象ノードの子孫ノードである場合、次番号は、処理対象ノードより後に処理対象ノードの子孫ノードではない仮想ノードが存在すると仮定した場合の仮想ノードの順番号となる。   The order number determination unit 102b determines the order number representing the order of appearance of the nodes for the processing target node. Further, the sequence number determination unit 102b determines the next number, which is the sequence number of the node that appears first, excluding the descendant nodes of the node to be processed among the nodes that appear after the node to be processed. . However, if all nodes that appear after the processing target node are descendant nodes of the processing target node, the next number is a virtual node when it is assumed that there is a virtual node that is not a descendant node of the processing target node after the processing target node It becomes order number.

ノードデータ挿入手段102cは、処理対象ノードのノードデータをリレーショナルデータベース103内のノードテーブル2に挿入する。属性データ挿入手段102dは、処理対象ノードがノードの一種である属性である場合に、処理対象属性の属性データをリレーショナルデータベース103内のノードテーブル2に挿入する。   The node data insertion unit 102 c inserts the node data of the processing target node into the node table 2 in the relational database 103. The attribute data insertion unit 102 d inserts the attribute data of the processing target attribute into the node table 2 in the relational database 103 when the processing target node is an attribute that is a kind of node.

属性データ挿入手段102eは、処理対象ノードが保持する属性、すなわち処理対象ノードの子ノードである属性を格納する処理を行う。子ノード格納手段102fは、処理対象ノードの属性以外の子ノードを格納する処理を行う。   The attribute data insertion unit 102e performs processing for storing an attribute held by the processing target node, that is, an attribute that is a child node of the processing target node. The child node storage unit 102f performs processing for storing child nodes other than the attribute of the processing target node.

リレーショナルデータベース103は、例えばハードディスク等の記憶装置と、記憶装置を読み書きしてリレーショナルデータベースとしての機能を提供する処理部とにより構成され、表形式のノードテーブル2を有し、ノードテーブル2に格納されたデータを検索する機能を備える。   The relational database 103 is configured by a storage device such as a hard disk and a processing unit that reads and writes the storage device and provides a function as a relational database. The relational database 103 has a tabular node table 2 and is stored in the node table 2. It has a function to search data.

XQuery解析部104は、XQuery(XMLクエリ言語;XML Query Language)の形式で記述された検索クエリが入力されると、入力された検索クエリを解析し、検索処理を実行するための検索手順リストを生成して検索部105へ供給する。XQueryは、XMLデータを検索する問い合わせ言語として策定されている。   When a search query described in the XQuery (XML Query Language) format is input, the XQuery analysis unit 104 analyzes the input search query and generates a search procedure list for executing search processing. Generated and supplied to the search unit 105. XQuery is formulated as an inquiry language for searching XML data.

検索部105は、XQuery解析部104から検索手順リストが供給されると、供給された検索手順リストに従ってリレーショナルデータベース103に格納されているXML文書に対する検索を実行し、検索結果であるサブツリーデータのリストをXML成形部106へ供給するものであり、その機能上、検索制御手段105aと、ノード型検索手段105bと、ノード名検索手段105cと、ノード値検索手段105dと、子ノード検索手段105eと、親ノード検索手段105fと、子孫ノード検索手段105gと、先祖ノード検索手段105hと、サブツリーデータ抽出手段105iとを備える。   When the search procedure list is supplied from the XQuery analysis unit 104, the search unit 105 executes a search on the XML document stored in the relational database 103 in accordance with the supplied search procedure list, and a list of subtree data as search results To the XML forming unit 106. In terms of its function, the search control unit 105a, the node type search unit 105b, the node name search unit 105c, the node value search unit 105d, the child node search unit 105e, A parent node search unit 105f, a descendant node search unit 105g, an ancestor node search unit 105h, and a subtree data extraction unit 105i are provided.

検索制御手段105aは、検索部105における検索処理の全体を制御する。ノード型検索手段105bは、検索手順がノード型検索である場合に、ノード型による検索を実行する。ノード名検索手段105cは、検索手順がノード名検索である場合に、ノード名による検索を実行する。ノード値検索手段105dは、検索手順がノード値検索である場合に、ノード値による検索を実行する。   The search control unit 105 a controls the entire search process in the search unit 105. The node type search means 105b executes a node type search when the search procedure is a node type search. The node name search means 105c executes a search by node name when the search procedure is a node name search. The node value search unit 105d executes a search based on the node value when the search procedure is a node value search.

子ノード検索手段105eは、検索手順が子ノード検索である場合に、子ノードの検索を実行する。親ノード検索手段105fは、検索手順が親ノード検索である場合に、親ノードの検索を実行する。子孫ノード検索手段105gは、検索手順が子孫ノード検索である場合に、子孫ノードの検索を実行する。先祖ノード検索手段105hは、検索手順が先祖ノード検索である場合に、先祖ノードの検索を実行する。   The child node search means 105e executes a child node search when the search procedure is a child node search. When the search procedure is a parent node search, the parent node search unit 105f executes a parent node search. The descendant node search means 105g executes a search for a descendant node when the search procedure is a descendant node search. The ancestor node search means 105h executes ancestor node search when the search procedure is ancestor node search.

サブツリーデータ抽出手段105iは、検索結果のノードリストの各ノードのサブツリーデータをリレーショナルデータベース103から読み出し、読み出したサブツリーデータをノードデータに含まれる順番号の順に並び替えてXML成形部106へ供給する。「ノードのサブツリーデータ」とは、XML文書の木構造において、対象ノードと、対象ノードの下位となる全てのノード(子孫ノード)を含むサブツリーの各ノードのノードデータである。   The subtree data extraction unit 105i reads the subtree data of each node in the node list of the search result from the relational database 103, rearranges the read subtree data in the order of the order numbers included in the node data, and supplies the rearranged data to the XML forming unit 106. The “node subtree data” is node data of each node of the subtree including the target node and all nodes (descendant nodes) that are subordinate to the target node in the tree structure of the XML document.

なお、検索部105は、XQueryによって記述できる検索手順のうち、本発明に直接関係する検索手順、及び代表的な検索手順を実行するための各検索手段105b乃至105hを備える構成となっているが、XQueryによって記述できるその他の検索手順を実行するための検索手段をも備える構成とするのが望ましい。   The search unit 105 includes a search procedure directly related to the present invention among search procedures that can be described by XQuery, and search units 105b to 105h for executing a representative search procedure. It is desirable to have a configuration including a search means for executing other search procedures that can be described by XQuery.

XML成形部106は、検索部105からサブツリーデータのリストが供給されると、供給されたサブツリーデータをテキストデータとして記述されたXML文書の形式に成形し、検索結果として出力する。   When the subtree data list is supplied from the search unit 105, the XML forming unit 106 forms the supplied subtree data into an XML document format described as text data, and outputs the result as a search result.

次に、構造化文書格納装置1のリレーショナルデータベース103におけるノードデータを格納するための表形式のノードテーブルの構成について説明する。   Next, the configuration of a tabular node table for storing node data in the relational database 103 of the structured document storage device 1 will be described.

図2は、リレーショナルデータベース103におけるノードテーブルの構成を示す。図2において、ノードテーブル2の「列名」の欄はテーブルの各列の名前を示し、「内容」の欄は各列に格納するデータの内容を示す。   FIG. 2 shows the configuration of the node table in the relational database 103. In FIG. 2, the “column name” column of the node table 2 indicates the name of each column of the table, and the “content” column indicates the content of data stored in each column.

ノードテーブル2は、id列201と、type列202と、parent列203と、order列204と、next列205と、name列206と、value列207とにより構成される。   The node table 2 includes an id column 201, a type column 202, a parent column 203, an order column 204, a next column 205, a name column 206, and a value column 207.

id列201は、対象ノードを一意に識別するノードIDである0以外の正の整数を格納する列である。type列202は、対象ノードのノード型(type)を表す数値を格納する列である。parent列203は、対象ノードの親ノードのノードIDである「0」以外の整数、または親ノードが存在しないことを示す数値「0」を格納する列である。   The id column 201 is a column that stores a positive integer other than 0, which is a node ID that uniquely identifies the target node. The type column 202 is a column for storing numerical values representing the node type (type) of the target node. The parent column 203 is a column that stores an integer other than “0” that is the node ID of the parent node of the target node, or a numerical value “0” indicating that the parent node does not exist.

order列204は、対象ノードの順番号を格納する列である。なお、XMLではノードの種別によって出現順が定義されるノードと定義されないノードがあるが、order列204に格納される順番号は、出現順が定義されるノードに対してはその出現順に「0」から始まる2つおきの整数を割り振った偶数の値となり、出現順が定義されないノードに対してはその親ノードの出現順に「1」を加えた奇数の値となる。   The order column 204 is a column that stores the order numbers of the target nodes. In XML, there are nodes that are not defined as nodes in which the appearance order is defined depending on the type of node, but the order number stored in the order column 204 is “0” in the order of appearance for the nodes in which the order of appearance is defined. The number is an even number obtained by allocating every second integer starting from “,” and for a node whose appearance order is not defined, an odd value obtained by adding “1” in the order of appearance of the parent node.

next列205は、対象ノードの次番号を格納する列である。ただし、対象ノードが出現順が定義されないノードである場合は順番号と同じ値を格納する。name列206は、対象ノードのノード名(name)を格納する列である。ただし、対象ノードのノード種別がノード名を持たないものである場合、name列206は空(ヌル)となる。value列207は、対象ノードのノード値(value)を格納する列である。ただし、対象ノードのノード種別がノード値を持たないものである場合、value列207は空(ヌル)となる。   The next column 205 is a column for storing the next number of the target node. However, if the target node is a node whose appearance order is not defined, the same value as the order number is stored. The name column 206 is a column for storing the node name (name) of the target node. However, if the node type of the target node does not have a node name, the name column 206 is empty (null). The value column 207 is a column for storing the node value (value) of the target node. However, when the node type of the target node does not have a node value, the value column 207 is empty (null).

次に、図2の本発明の一実施形態である構造化文書格納装置1のノードテーブル2におけるtype列202に格納されるノード型を表す数値について説明する。   Next, numerical values representing the node types stored in the type column 202 in the node table 2 of the structured document storage device 1 according to the embodiment of the present invention shown in FIG. 2 will be described.

図3は、ノードテーブル2におけるtype列202に格納されるノード型の一覧を示す。図3の「type値」の欄はノードテーブル2におけるtype列202に格納されるノード型を表す数値を示し、「ノード型」の欄は「type値」に対応するノード型を示すものである。   FIG. 3 shows a list of node types stored in the type column 202 in the node table 2. The column “type value” in FIG. 3 indicates a numerical value indicating the node type stored in the type column 202 in the node table 2, and the column “node type” indicates a node type corresponding to the “type value”. .

ノード型には、要素(Element)301と、属性(Attribute)302と、テキストノード(Text Node)303と、CDATAセクション(CDATA Section)304と、エンティティ参照(Entity Reference)305と、エンティティ(Entity)306と、処理命令(Processing Instruction)307と、コメント(Comment)308と、文書(Document)309と、文書型(Document Type)310と、文書断片(Document Fragment)311と、表記法(Notation)312とがある。これらの各ノード型に対して、「type値」欄に示す数値が割り振られる。   The node type includes an element 301, an attribute 302, a text node 303, a CDATA section 304, an entity reference 305, and an entity. 306, Processing Instruction 307, Comment 308, Document 309, Document Type 310, Document Fragment 311, and Notation 312 There is. A numerical value shown in the “type value” column is assigned to each of these node types.

なお、XMLにおいて、属性302以外のノード型はノードの出現順が定義されるが、属性302は出現順が定義されないものである。すなわち、同一のノードで構成される2つのXML文書において、属性302以外のノードの出現順が異なる場合は異なるXML文書となるが、属性302の見かけ上の出現順が異なる場合は同一のXML文書となる。   In XML, a node type other than the attribute 302 defines a node appearance order, but the attribute 302 does not define an appearance order. That is, in two XML documents composed of the same node, if the appearance order of nodes other than the attribute 302 is different, the XML documents are different. However, if the apparent appearance order of the attribute 302 is different, the same XML document is used. It becomes.

また、XMLにおいて、属性302を含む一部のノード型は子ノードを持たないものである。また、XMLにおいて、処理対象ノードの子孫ノードには、処理対象ノードの保持する属性、すなわち処理対象ノードの子ノードとなる属性は含まれない。   Also, in XML, some node types including the attribute 302 have no child nodes. In XML, a descendant node of a processing target node does not include an attribute held by the processing target node, that is, an attribute that becomes a child node of the processing target node.

次に、本発明の一実施形態である構造化文書格納装置1の格納部102における文書格納処理の詳細について説明する。   Next, details of document storage processing in the storage unit 102 of the structured document storage device 1 according to the embodiment of the present invention will be described.

図4は、本実施の形態の構造化文書格納装置1の格納部102における文書格納処理を説明するフローチャートを示す。   FIG. 4 is a flowchart for explaining document storage processing in the storage unit 102 of the structured document storage device 1 of this embodiment.

格納部102のノードID決定手段102aは、XML解析部101からDOMデータが供給されると、文書格納処理を開始し、変数pに「0」を代入する(ステップS401)。なお、変数pは親ノードのノードIDを記憶しておくための変数である。次に、格納部102の順番号決定手段102bは、変数oに「0」を代入する(ステップS402)。なお、変数oは順番号を記憶しておくための変数である。   When the DOM data is supplied from the XML analysis unit 101, the node ID determination unit 102a of the storage unit 102 starts document storage processing and substitutes “0” for the variable p (step S401). The variable p is a variable for storing the node ID of the parent node. Next, the sequence number determination unit 102b of the storage unit 102 substitutes “0” for the variable o (step S402). The variable o is a variable for storing a sequential number.

次に、格納部102の子ノード格納手段102fは、ルートノードを処理対象ノードとする(ステップS403)。なお、ルートノードは親ノードを持たないノードであり、ノードテーブル2におけるparent列203の値が「0」となるものである。そして、格納部102は、後述するノード格納処理を実行する(ステップS404)。なお、ステップS401で値を代入した変数p、ステップS402で値を代入した変数o、及びステップS403で決定した処理対象ノードはノード格納処理に引き継ぐ。   Next, the child node storage unit 102f of the storage unit 102 sets the root node as a processing target node (step S403). The root node is a node that does not have a parent node, and the value of the parent column 203 in the node table 2 is “0”. Then, the storage unit 102 executes a node storage process described later (step S404). Note that the variable p assigned the value in step S401, the variable o assigned the value in step S402, and the processing target node determined in step S403 are taken over by the node storing process.

次に、図4の構造化文書格納装置1の格納部102における文書格納処理のステップS404のノード格納処理の詳細について説明する。   Next, details of the node storage process in step S404 of the document storage process in the storage unit 102 of the structured document storage apparatus 1 in FIG. 4 will be described.

図5は、本実施の形態の構造化文書格納装置1の格納部102におけるノード格納処理を説明するフローチャートを示す。   FIG. 5 is a flowchart for explaining node storage processing in the storage unit 102 of the structured document storage device 1 of this embodiment.

格納部102のノードID決定手段102aは、ノード格納処理を開始すると、ステップS403またはステップS515で決定した処理対象ノードのノードIDを決定し、決定したノードIDを変数iに代入する(ステップS501)。具体的には、ノードテーブル2のid列201に格納されているいずれのノードIDとも一致しない「0」以外の正の整数を選択し、ノードIDとする。   When the node ID determination unit 102a of the storage unit 102 starts the node storage process, the node ID determination unit 102a determines the node ID of the processing target node determined in step S403 or step S515, and substitutes the determined node ID into the variable i (step S501). . Specifically, a positive integer other than “0” that does not match any node ID stored in the id column 201 of the node table 2 is selected as a node ID.

次に、格納部102のノードID決定手段102aは、変数pの値を処理対象ノードの親ノードID、すなわちノードテーブル2のparent列203に挿入すべき値とする(ステップS502)。次に、格納部102の順番号決定手段102bは、変数oの値を処理対象ノードの順番号、すなわちノードテーブル2のorder列204に挿入すべき値とする(ステップS503)。   Next, the node ID determination unit 102a of the storage unit 102 sets the value of the variable p as a parent node ID of the processing target node, that is, a value to be inserted into the parent column 203 of the node table 2 (step S502). Next, the sequence number determination unit 102b of the storage unit 102 sets the value of the variable o as the sequence number of the processing target node, that is, a value to be inserted into the order column 204 of the node table 2 (step S503).

次に、格納部102のノードデータ挿入手段102cは、処理対象ノードの次番号以外のノードデータをノードテーブル2に挿入する(ステップS504)。具体的には、ステップS501で変数iに代入したノードIDをid列201のノードIDの値とし、処理対象ノードのDOMオブジェクトからノード型を取得して、ノード型一覧3におけるそのノード型に対応するtype値をtype列202の値とする。また、ステップS502で決定した親ノードIDをparent列203の値とし、ステップS503で決定した順番号をorder列204の値とする。更に、処理対象ノードのDOMオブジェクトからノード名を取得して、そのノード名をname列206の値とし、処理対象ノードのDOMオブジェクトからノード値を取得して、その値をvalue列207の値として、ノードテーブル2に新たな行を追加する。なお、追加する行のnext列205は空(ヌル)にしておく。   Next, the node data insertion unit 102c of the storage unit 102 inserts node data other than the next number of the processing target node into the node table 2 (step S504). Specifically, the node ID assigned to the variable i in step S501 is used as the value of the node ID in the id column 201, the node type is acquired from the DOM object of the processing target node, and the node type in the node type list 3 is supported. The type value to be used is the value in the type column 202. Further, the parent node ID determined in step S502 is set as the value in the parent column 203, and the order number determined in step S503 is set as the value in the order column 204. Further, the node name is acquired from the DOM object of the processing target node, the node name is set as the value of the name column 206, the node value is acquired from the DOM object of the processing target node, and the value is set as the value of the value column 207. , A new row is added to the node table 2. The next column 205 of the row to be added is left empty (null).

次に、格納部102のノードID決定手段102aは、変数iの値を変数pに代入する(ステップS505)。次に、格納部102の順番号決定手段102bは、変数oの値に「1」を加算して変数oに代入する(ステップS506)。次に、格納部102の属性格納手段102eは、処理対象ノードが持つ属性、すなわち処理対象ノードの子ノードである属性の数を変数Naに代入し、変数aに「0」を代入する(ステップS507)。続いて、格納部102の属性格納手段102eは、変数aの値が変数Naの値より小さいか否かを判定する(ステップS508)。変数aの値が変数Naの値より小さいと判定された場合、ステップS509へ処理を移行し、変数Naの値より小さくない、すなわち変数Naの値以上であると判定された場合、ステップS511へ処理を移行する。   Next, the node ID determination unit 102a of the storage unit 102 substitutes the value of the variable i for the variable p (step S505). Next, the sequence number determination unit 102b of the storage unit 102 adds “1” to the value of the variable o and substitutes it into the variable o (step S506). Next, the attribute storage unit 102e of the storage unit 102 substitutes the attribute of the processing target node, that is, the number of attributes that are child nodes of the processing target node, into the variable Na, and substitutes “0” into the variable a (step) S507). Subsequently, the attribute storage unit 102e of the storage unit 102 determines whether or not the value of the variable a is smaller than the value of the variable Na (step S508). If it is determined that the value of the variable a is smaller than the value of the variable Na, the process proceeds to step S509. If it is determined that the value of the variable a is not smaller than the value of the variable Na, that is, greater than or equal to the value of the variable Na, the process proceeds to step S511. Migrate processing.

ステップS508において、変数aの値が変数Naの値より小さいと判定された場合、格納部102の属性格納手段102eは、変数aの値に「1」を加算して変数aに代入する(ステップS509)。続いて、格納部102の属性格納手段102eは、加算後の変数a番目の属性を処理対象とし、後述する属性格納処理を実行する(ステップS510)。なお、あるノードの持つ属性の間には順番が定義されていないので、例えば属性をノード名の辞書順に並べ、それを属性の順番とすればよい。また、変数pと変数o、及びこのステップで決定した処理対象属性は属性格納処理に引き継ぐ。   If it is determined in step S508 that the value of the variable a is smaller than the value of the variable Na, the attribute storage unit 102e of the storage unit 102 adds “1” to the value of the variable a and substitutes it for the variable a (step S508). S509). Subsequently, the attribute storage unit 102e of the storage unit 102 sets a variable a-th attribute after the addition as a processing target and executes an attribute storage process to be described later (step S510). In addition, since the order is not defined between the attributes of a certain node, for example, the attributes may be arranged in the order of the dictionary of the node names and set as the order of the attributes. In addition, the variable p and the variable o and the processing target attribute determined in this step are taken over by the attribute storing process.

一方、ステップS508において、変数aの値が変数Naの値より小さくない、すなわち変数Na以上であると判定された場合、格納部102の順番号決定手段102bは、変数oの値に「1」を加算して変数oに代入する(ステップS511)。   On the other hand, if it is determined in step S508 that the value of the variable a is not smaller than the value of the variable Na, that is, greater than or equal to the variable Na, the sequence number determination unit 102b of the storage unit 102 sets “1” to the value of the variable o. Are added to variable o (step S511).

次に、格納部102の子ノード格納手段102fは、処理対象ノードの属性以外の子ノードの数を変数Ncに代入して、変数cに「0」を代入する(ステップS512)。続いて、子ノード格納手段102fは、変数cの値が変数Naの値より小さいか否かを判定する(ステップS513)。変数cの値が変数Ncの値より小さいと判定された場合、ステップS514へ処理を移行し、変数Ncの値より小さくない、すなわち変数Ncの値以上であると判定された場合、ステップS516へ処理を移行する。   Next, the child node storage unit 102f of the storage unit 102 substitutes the number of child nodes other than the attribute of the processing target node into the variable Nc, and substitutes “0” into the variable c (step S512). Subsequently, the child node storage unit 102f determines whether or not the value of the variable c is smaller than the value of the variable Na (step S513). If it is determined that the value of the variable c is smaller than the value of the variable Nc, the process proceeds to step S514. If it is determined that the value of the variable c is not smaller than the value of the variable Nc, that is, greater than or equal to the value of the variable Nc, the process proceeds to step S516. Migrate processing.

ステップS513において、変数cの値が変数Ncの値より小さいと判定された場合、格納部102の子ノード格納手段102fは、変数cの値に「1」を加算して変数cに代入する(ステップS514)。続いて、子ノード格納手段102fは、加算後の変数c番目の子ノードを処理対象とし、ノード格納処理を再帰的に実行する(ステップS515)。このとき、処理対象ノードの子ノードを出現順に並べて子ノードの順番とする。また、変数pと変数o、及びこのステップS515で決定した処理対象ノードを再帰的に実行するノード格納処理に引き継ぐ。   When it is determined in step S513 that the value of the variable c is smaller than the value of the variable Nc, the child node storage unit 102f of the storage unit 102 adds “1” to the value of the variable c and substitutes it into the variable c ( Step S514). Subsequently, the child node storage unit 102f sets the variable c-th child node after the addition as a processing target, and executes node storage processing recursively (step S515). At this time, the child nodes of the processing target node are arranged in the order of appearance to obtain the child node order. In addition, the variable p and the variable o and the node to be processed determined in step S515 are succeeded to the node storing process that is recursively executed.

一方、ステップS513において、変数cの値が変数Ncの値より小さくない、すなわち変数Ncの値以上であると判定された場合、格納部102の順番号決定手段102bは、変数oの値を処理対象ノードの次番号とする(ステップS516)。なお、このステップS516における処理対象ノードはノード格納処理開始時の処理対象ノードであり、ステップS515で決定した処理対象ノードではない。   On the other hand, if it is determined in step S513 that the value of the variable c is not smaller than the value of the variable Nc, that is, greater than or equal to the value of the variable Nc, the sequential number determination unit 102b of the storage unit 102 processes the value of the variable o. The next number of the target node is set (step S516). Note that the processing target node in step S516 is the processing target node at the start of the node storing process, and is not the processing target node determined in step S515.

次に、格納部102のノードデータ挿入手段102cは、ノードテーブル2における処理対象ノードの次番号を設定する(ステップS517)。具体的には、ノードテーブル2のid列201に対して変数iに格納されている処理対象ノードのノードIDを用いて検索を行い、id列201のノードIDの値が変数iの値に一致する行のnext列205の値をステップS516で決定した次番号の値に設定する。   Next, the node data insertion unit 102c of the storage unit 102 sets the next number of the processing target node in the node table 2 (step S517). Specifically, the id column 201 of the node table 2 is searched using the node ID of the processing target node stored in the variable i, and the value of the node ID in the id column 201 matches the value of the variable i. The value of the next column 205 of the row to be set is set to the value of the next number determined in step S516.

次に、図5の本実施の形態の構造化文書格納装置1の格納部102におけるノード格納処理のステップS510の属性格納処理の詳細について、図6のフローチャートを参照して説明する。   Next, details of the attribute storage processing in step S510 of the node storage processing in the storage unit 102 of the structured document storage device 1 of the present embodiment in FIG. 5 will be described with reference to the flowchart in FIG.

格納部102のノードID決定手段102aは、ステップS510の属性格納処理を開始すると、処理対象属性のノードIDを決定する(ステップS601)。具体的な決定方法はステップS501と同様である。続いて、ノードID決定手段102aは、変数pの値を処理対象属性の親ノードID、すなわちノードテーブル2のparent列203に挿入すべき値とする(ステップS602)
次に、格納部102の順番号決定手段102bは、変数oの値を処理対象属性の順番号、すなわちノードテーブル2のorder列204に挿入すべき値とするとともに、同じ値を処理対象属性の次番号、すなわちノードテーブル2のnext列205に挿入すべき値とする(ステップS603)。
The node ID determination unit 102a of the storage unit 102 determines the node ID of the processing target attribute when the attribute storage process of step S510 is started (step S601). A specific determination method is the same as that in step S501. Subsequently, the node ID determination unit 102a sets the value of the variable p as a parent node ID of the processing target attribute, that is, a value to be inserted into the parent column 203 of the node table 2 (step S602).
Next, the sequence number determination unit 102b of the storage unit 102 sets the value of the variable o as the sequence number of the processing target attribute, that is, the value to be inserted into the order column 204 of the node table 2, and sets the same value as the processing target attribute. The next number, that is, a value to be inserted into the next column 205 of the node table 2 is set (step S603).

次に、格納部102の属性データ挿入手段102dは、処理対象属性のノードデータをノードテーブル2に挿入する(ステップS604)。具体的には、ステップS601で決定したノードIDをid列201のノードIDの値とし、ノード型一覧3における属性302に対応するtype値をtype列202の値とし、ステップS602で決定した親ノードIDをparent列203の値とし、ステップS603で決定した順番号をorder列204の値とし、ステップS603で決定した次番号をnext列205の値とし、処理対象属性のDOMオブジェクトからノード名を取得して、そのノード名をname列206の値とし、処理対象属性のDOMオブジェクトからノード値を取得して、そのノード値をvalue列207の値として、ノードテーブル2に新たな行を追加する。   Next, the attribute data insertion unit 102d of the storage unit 102 inserts the node data of the processing target attribute into the node table 2 (step S604). Specifically, the node ID determined in step S601 is the value of the node ID in the id column 201, the type value corresponding to the attribute 302 in the node type list 3 is the value of the type column 202, and the parent node determined in step S602 The ID is the value of the parent column 203, the order number determined in step S603 is the value of the order column 204, the next number determined in step S603 is the value of the next column 205, and the node name is acquired from the DOM object of the processing target attribute Then, the node name is set as the value of the name column 206, the node value is acquired from the DOM object of the processing target attribute, and the node value is set as the value of the value column 207 to add a new row to the node table 2.

次に、本発明の一実施形態である構造化文書格納装置1におけるノードテーブル2へ格納されるXML文書の具体例について説明する。   Next, a specific example of the XML document stored in the node table 2 in the structured document storage device 1 according to the embodiment of the present invention will be described.

図7は、構造化文書格納装置1におけるノードテーブル2へ格納されるXML文書の一具体例を示す。同図に示すXML文書7全体を示す文書がルートノードである。ルートノードの子ノードとして、要素名が「library」である要素が存在する。また、要素名が「book」や「title」等の山括弧で囲まれた部分も要素である。また、要素名が「book」である要素はノード名が「id」である属性を持っている。また、開始タグ「<title>」と終了タグ「</title>」で挟まれた「Title 1」や、開始タグ「<author>」と終了タグ「</author>」で挟まれた「Author 1」等の文字列の部分は、それらの文字列がノード値であるテキストノードである。   FIG. 7 shows a specific example of an XML document stored in the node table 2 in the structured document storage device 1. A document showing the entire XML document 7 shown in FIG. As a child node of the root node, there is an element whose element name is “library”. A part surrounded by angle brackets such as “book” or “title” is also an element. An element whose element name is “book” has an attribute whose node name is “id”. Also, “Title 1” sandwiched between the start tag “<title>” and the end tag “</ title>”, and “Author” sandwiched between the start tag “<author>” and the end tag “</ author>”. The part of the character string such as “1” is a text node whose character string is a node value.

図8は、本実施の形態の構造化文書格納装置1におけるノードテーブル2の一具体例を示す。この図8に示すノードテーブル例8は、図7に示したXML文書7を格納した状態を示す。すなわち、図8において、id列には「1」を初期値として「1」ずつ増加するノードID値が格納されている。また、図8において、図2に示したようにtype列にはノード型一覧3におけるtype値(すなわち、ノード型を識別する値)が格納されている。また、parent列には親ノードIDの値が、order列には順番号が、next列には次番号が、name列にはノード名(要素名)が、value列にはノード値がそれぞれ格納されている。   FIG. 8 shows a specific example of the node table 2 in the structured document storage device 1 of the present embodiment. A node table example 8 shown in FIG. 8 shows a state in which the XML document 7 shown in FIG. 7 is stored. That is, in FIG. 8, the id column stores a node ID value that increases by “1” with “1” as an initial value. In FIG. 8, as shown in FIG. 2, the type column stores type values in the node type list 3 (that is, values for identifying node types). The parent column ID value is stored in the parent column, the order number is stored in the order column, the next number is stored in the next column, the node name (element name) is stored in the name column, and the node value is stored in the value column. Has been.

例えば、XML文書7の1行目の開始タグ「<library>」については、id列のノードIDの値が「2」、type列のtype値がノード型が要素であることを示す「1」、parent列の親ノードIDの値が「1」が格納される。また、このノードID値「2」の「<library>」は出現順が定義されるノードであり、出現順に偶数の値「2」の順番号がparent列に格納され、次番号としてノードID値「1」と同じ「34」が格納され、ノード名「library」がname列に格納される。   For example, for the start tag “<library>” on the first line of the XML document 7, the value of the node ID in the id column is “2”, and the type value in the type column is “1” indicating that the node type is an element. , “1” is stored as the value of the parent node ID in the parent column. Further, “<library>” of the node ID value “2” is a node in which the order of appearance is defined, and the order number of the even value “2” is stored in the parent column in the order of appearance, and the node ID value as the next number The same “34” as “1” is stored, and the node name “library” is stored in the name column.

XML文書7の2行目の「<book id=“1”>」は、出現が定義されるノード「book」と出現が定義されないノード「id=“1”」からなるので、ノードIDの値が「3」の欄に、type値が「1」、親ノードIDの値が「2」、次の出現順の値「4」の順番号、値「14」の次番号、ノード名「book」が対応して格納される。続くノードIDの値が「4」の欄に、type値が属性を示す「2」、親ノードIDの値が「3」、ノード名「id」、value列のノード値として「1」が格納される。また、この「id=“1”」は出現が定義されていないので順番号はその親ノード「book」の順番号に「1」を加算した「5」となり、また、次番号は「5」となる。   Since “<book id =“ 1 ”>” in the second line of the XML document 7 includes a node “book” in which the occurrence is defined and a node “id =“ 1 ”” in which the occurrence is not defined, the value of the node ID In the column “3”, the type value is “1”, the parent node ID value is “2”, the next number “4” in the order of appearance, the next number “14”, the node name “book” "Is stored correspondingly. The subsequent node ID value is “4”, the type value is “2” indicating the attribute, the parent node ID value is “3”, the node name “id”, and “1” is stored as the node value in the value column. Is done. Further, since the occurrence of “id =“ 1 ”” is not defined, the sequential number is “5” obtained by adding “1” to the sequential number of the parent node “book”, and the next number is “5”. It becomes.

なお、図8のノードテーブル例8は、便宜上、各行を対応するノードの出現順に並べて示しているが、リレーショナルデータベース103においてノードテーブル2の行の並び順は不定である。   In the node table example 8 in FIG. 8, for convenience, the rows are arranged in the order in which the corresponding nodes appear, but the order of the rows of the node table 2 in the relational database 103 is indefinite.

次に、本発明の一実施の形態である構造化文書格納装置1のXQuery解析部104が生成する検索手順の詳細について説明する。なお、クエリ(XQuery)を解析して検索手順を生成する処理の詳細については、本発明と直接関係がないため、説明を省略する。   Next, details of a search procedure generated by the XQuery analysis unit 104 of the structured document storage device 1 according to the embodiment of the present invention will be described. Note that details of the process of generating a search procedure by analyzing a query (XQuery) are not directly related to the present invention, and thus the description thereof is omitted.

図9は、本実施の形態の構造化文書格納装置1のXQuery解析部104が生成する検索手順の種別の一覧を示す。図9において、「検索種別」の欄は検索手順の種別を示し、「引数」の欄は検索手順に付随する引数を示し、「処理内容」の欄は検索処理の内容を示す。   FIG. 9 shows a list of types of search procedures generated by the XQuery analysis unit 104 of the structured document storage device 1 of this embodiment. In FIG. 9, the “search type” column indicates the type of search procedure, the “argument” column indicates an argument associated with the search procedure, and the “processing content” column indicates the content of the search process.

検索手順の種別には、ノード型検索901と、ノード名検索902と、ノード値検索903と、子ノード検索904と、親ノード検索905と、子孫ノード検索906と、先祖ノード検索907とがある。   The types of search procedures include a node type search 901, a node name search 902, a node value search 903, a child node search 904, a parent node search 905, a descendant node search 906, and an ancestor node search 907. .

ノード型検索901は、ノード型一覧3のtype値を引数にとり、ノード型を表す数値が引数のtype値に一致するノードを検索する手順である。ノード名検索902は、文字列を引数にとり、ノード名が引数の文字列に一致するノードを検索する手順である。ノード値検索903は、文字列を引数にとり、ノード値が引数の文字列に一致するノードを検索する手順である。   The node type search 901 is a procedure for taking a type value of the node type list 3 as an argument and searching for a node whose numerical value representing the node type matches the type value of the argument. Node name search 902 is a procedure for taking a character string as an argument and searching for a node whose node name matches the argument character string. The node value search 903 is a procedure for taking a character string as an argument and searching for a node whose node value matches the argument character string.

子ノード検索904は、引数をとらず、コンテクストノードの子ノードを検索する手順である。なお、「コンテクストノード」とは、検索手順のリストを実行する過程において、これから実行する検索手順の直前の検索手順を実行することによって検索されたノードである。   The child node search 904 is a procedure for searching a child node of a context node without taking an argument. The “context node” is a node searched by executing a search procedure immediately before a search procedure to be executed in the process of executing a list of search procedures.

親ノード検索905は、引数をとらず、コンテクストノードの親ノードを検索する手順である。子孫ノード検索906は、引数をとらず、コンテクストノードの子孫ノードを検索する手順である。先祖ノード検索907は、引数をとらず、コンテクストノードの先祖ノードを検索する手順である。   The parent node search 905 is a procedure for searching for a parent node of a context node without taking an argument. The descendant node search 906 is a procedure for searching for a descendant node of a context node without taking an argument. An ancestor node search 907 is a procedure for searching an ancestor node of a context node without taking an argument.

なお、検索手順一覧9には、クエリ(XQuery)によって記述できる検索手順のうち、本発明に直接関係する検索手順、及び代表的な検索手順を実行するための検索手順901乃至907が含まれているが、クエリ(XQuery)によって記述できるその他の検索手順を実行するための検索手段をも含めるのが望ましい。   The search procedure list 9 includes search procedures 901 to 907 for executing a search procedure directly related to the present invention and a typical search procedure among search procedures that can be described by a query (XQuery). However, it is desirable to include a search means for executing other search procedures that can be described by a query (XQuery).

次に、本実施の形態の構造化文書格納装置1の検索部105における検索処理の詳細について説明する。   Next, details of the search processing in the search unit 105 of the structured document storage device 1 of the present embodiment will be described.

図10は、検索部105における検索処理を説明するフローチャートである。図1に示した検索部105内の検索制御手段105aは、XQuery解析部104から検索手順リストが供給されると、検索処理を開始し、ルートノードのノードIDを取得し、コンテクストノードリストに追加する(ステップS1001)。具体的には、リレーショナルデータベース103内のノードテーブル2におけるparent列203の値が「0」である行を検索し、その行のid列201のノードIDの値をルートノードのノードIDとして取得し、取得したルートノードのノードIDのみからなるコンテクストノードリストを生成する。   FIG. 10 is a flowchart for explaining search processing in the search unit 105. When the search procedure list is supplied from the XQuery analysis unit 104, the search control unit 105a in the search unit 105 shown in FIG. 1 starts the search process, acquires the node ID of the root node, and adds it to the context node list (Step S1001). Specifically, a row in which the value of the parent column 203 in the node table 2 in the relational database 103 is “0” is retrieved, and the value of the node ID in the id column 201 of that row is acquired as the node ID of the root node. Then, a context node list including only the node ID of the acquired root node is generated.

次に、検索部105内の検索制御手段105aは、XQuery解析部104から供給された検索手順リストに含まれる検索手順の数を変数Nに代入し、変数iに「0」を代入する(ステップS1002)。   Next, the search control means 105a in the search unit 105 substitutes the number of search procedures included in the search procedure list supplied from the XQuery analysis unit 104 into a variable N, and substitutes “0” into a variable i (step) S1002).

次に、検索部105内の検索制御手段105aは、変数iの値が変数Nの値(すなわち、検索手順リストに含まれる検索手順の数)より小さいか否かを判定する(ステップS1003)。検索制御手段105aは、変数iの値が変数Nの値より小さいと判定された場合、変数iの値に「1」を加算して変数iに代入する(ステップS1004)。続いて、検索制御手段105aは、XQuery解析部104から供給された検索手順リストに含まれる変数i番目の検索手順を実行する(ステップS1005)。ステップS1005の処理後はステップS1003に戻り、再び変数iの値が変数Nの値より小さいか否かを判定する。   Next, the search control means 105a in the search unit 105 determines whether or not the value of the variable i is smaller than the value of the variable N (that is, the number of search procedures included in the search procedure list) (step S1003). When it is determined that the value of the variable i is smaller than the value of the variable N, the search control unit 105a adds “1” to the value of the variable i and substitutes it into the variable i (step S1004). Subsequently, the search control unit 105a executes a variable i-th search procedure included in the search procedure list supplied from the XQuery analysis unit 104 (step S1005). After the process of step S1005, the process returns to step S1003, and it is determined again whether or not the value of the variable i is smaller than the value of the variable N.

一方、検索制御手段105aは、ステップS1002において、変数iの値が変数Nの値より小さくない、すなわち変数Nの値以上であると判定された場合、検索手順リストに含まれるすべての検索手順について検索手順を実行したと判断し、続いて、コンテクストノードリストに含まれるノード数を変数Mに代入すると共に、変数jに「0」を代入する(ステップS1006)。   On the other hand, when it is determined in step S1002 that the value of the variable i is not smaller than the value of the variable N, that is, the value of the variable N is greater than or equal to the value of the variable N, the search control unit 105a It is determined that the search procedure has been executed. Subsequently, the number of nodes included in the context node list is substituted into the variable M, and “0” is substituted into the variable j (step S1006).

次に、検索制御手段105aは、変数jの値が変数Mの値(すなわち、コンテクストノードリストに含まれるノード数)より小さいか否かを判定する(ステップS1007)。変数Mの値より小さいと判定された場合、検索制御手段105aは、変数jの値に「1」を加算して変数jに代入する(ステップS1008)。続いて、検索制御手段105aは、コンテクストノードリストに含まれる変数j番目のノードのサブツリーデータ抽出処理を後述するように実行する(ステップS1009)。ステップS1009の処理後は、ステップS1007に戻り、変数jの値が変数Mの値より小さいか否かを判定する。   Next, the search control unit 105a determines whether or not the value of the variable j is smaller than the value of the variable M (that is, the number of nodes included in the context node list) (step S1007). When it is determined that the value is smaller than the value of the variable M, the search control unit 105a adds “1” to the value of the variable j and substitutes it for the variable j (step S1008). Subsequently, the search control unit 105a executes a subtree data extraction process of the variable j-th node included in the context node list as described later (step S1009). After the process of step S1009, the process returns to step S1007 to determine whether or not the value of the variable j is smaller than the value of the variable M.

一方、検索制御手段105aは、ステップS1007において、変数jの値が変数Mの値より小さくない、すなわち変数Mの値以上であると判定された場合、コンテクストノードリストに含まれるノード数のすべてについてサブツリーデータ抽出処理を実行したと判断し、ステップS1009で抽出したサブツリーデータをノードの順番号で並び替える(ステップS1010)。具体的には、ステップS1009で抽出した各コンテクストノードに対応する各サブツリーデータに含まれる各コンテクストノードの順番号を用いて、順番号の昇順にサブツリーデータを並び替える。これにより、検索結果のサブツリーデータがXML文書における出現順に並ぶこととなる。   On the other hand, if it is determined in step S1007 that the value of the variable j is not smaller than the value of the variable M, that is, the search control unit 105a determines that the value of the variable M is greater than or equal to the value of the variable M, It is determined that the subtree data extraction processing has been executed, and the subtree data extracted in step S1009 is rearranged by node order number (step S1010). Specifically, the subtree data is rearranged in ascending order of the order numbers using the order numbers of the context nodes included in the subtree data corresponding to the context nodes extracted in step S1009. As a result, the subtree data of the search results are arranged in the order of appearance in the XML document.

次に、図10に示した検索部105によるステップS1005の検索手順実行処理の詳細について、図11のフローチャートを参照して説明する。   Next, details of the search procedure execution processing in step S1005 by the search unit 105 shown in FIG. 10 will be described with reference to the flowchart of FIG.

検索部105の検索制御手段105aは、検索手順実行処理を開始すると、実行する検索手順がノード型検索901か否かを判定する(ステップS1101)。ノード型検索901であると判定された場合、図1に示した検索部105のノード型検索手段105bは、コンテクストノードリストからノード型が条件に合致するノードを選択する(ステップS1102)。具体的には、ノード型検索手段105bは、ノードテーブル2に対して、id列201のノードIDの値がコンテクストノードリストに含まれる各ノードIDに一致し、かつ、type列202のノード型を示す値が検索手順の引数であるtype値に一致する行を検索し、検索に合致した各行のid列201のノードIDの値をノードIDとして読み出し、読み出したノードIDのリストでコンテクストノードリストを置き換える。   When starting the search procedure execution process, the search control unit 105a of the search unit 105 determines whether or not the search procedure to be executed is a node type search 901 (step S1101). When it is determined that the node type search 901 is performed, the node type search unit 105b of the search unit 105 illustrated in FIG. 1 selects a node whose node type matches the condition from the context node list (step S1102). Specifically, the node type search means 105b matches the node ID of the id column 201 with each node ID included in the context node list and the node type of the type column 202 with respect to the node table 2. A row whose value matches the type value that is an argument of the search procedure is searched, the value of the node ID in the id column 201 of each row that matches the search is read as the node ID, and the context node list is obtained from the list of read node IDs. replace.

一方、ステップS1101において、実行する検索手順がノード型検索901ではないと判断された場合、検索制御手段105aは、実行する検索手順がノード名検索902か否かを判定する(ステップS1103)。   On the other hand, if it is determined in step S1101 that the search procedure to be executed is not the node type search 901, the search control unit 105a determines whether or not the search procedure to be executed is the node name search 902 (step S1103).

ステップS1103において、実行する検索手順がノード名検索902であると判断された場合、図1に示した検索部105のノード名検索手段105cは、コンテクストノードリストからノード名が条件に合致するノードを選択する(ステップS1104)。具体的には、ノード名検索手段105cは、ノードテーブル2に対して、id列201のノードIDの値がコンテクストノードリストに含まれる各ノードIDに一致し、かつ、name列206のノード名が検索手順の引数である文字列に一致する行を検索し、検索に合致した各行のid列201のノードIDの値をノードIDとして読み出し、読み出したノードIDのリストでコンテクストノードリストを置き換える。   If it is determined in step S1103 that the search procedure to be executed is the node name search 902, the node name search unit 105c of the search unit 105 illustrated in FIG. 1 selects a node whose node name matches the condition from the context node list. Select (step S1104). Specifically, the node name search unit 105c matches the node ID in the id column 201 with each node ID included in the context node list and the node name in the name column 206 is the same as the node table 2. A line that matches the character string that is an argument of the search procedure is searched, the value of the node ID in the id column 201 of each line that matches the search is read as the node ID, and the context node list is replaced with the read list of node IDs.

一方、ステップS1103において、実行する検索手順がノード名検索902ではないと判断された場合、検索部105の検索制御手段105aは、実行する検索手順がノード値検索903か否かを判定する(ステップS1105)。   On the other hand, if it is determined in step S1103 that the search procedure to be executed is not the node name search 902, the search control unit 105a of the search unit 105 determines whether or not the search procedure to be executed is the node value search 903 (step S1103). S1105).

ステップS1105において、実行する検索手順がノード値検索903であると判断された場合、図1に示した検索部105のノード値検索手段105dは、コンテクストノードリストからノード値が条件に合致するノードを選択する(ステップS1106)。具体的には、ノード値検索手段105dは、ノードテーブル2に対して、id列201のノードIDの値がコンテクストノードリストに含まれる各ノードIDに一致し、かつ、value列207のノード値が検索手順の引数である文字列に一致する行を検索し、検索に合致した各行のid列201のノードIDの値をノードIDとして読み出し、読み出したノードIDのリストでコンテクストノードリストを置き換える。   If it is determined in step S1105 that the search procedure to be executed is the node value search 903, the node value search unit 105d of the search unit 105 illustrated in FIG. 1 selects a node whose node value matches the condition from the context node list. Select (step S1106). Specifically, the node value search unit 105d determines that the node ID value in the id column 201 matches each node ID included in the context node list and the node value in the value column 207 matches the node table 2. A line that matches the character string that is an argument of the search procedure is searched, the value of the node ID in the id column 201 of each line that matches the search is read as the node ID, and the context node list is replaced with the read list of node IDs.

一方、ステップS1105において、実行する検索手順がノード値検索903ではないと判断された場合、検索部105の検索制御手段105aは、実行する検索手順が子ノード検索904か否かを判定する(ステップS1107)。   On the other hand, if it is determined in step S1105 that the search procedure to be executed is not the node value search 903, the search control unit 105a of the search unit 105 determines whether or not the search procedure to be executed is a child node search 904 (step S1105). S1107).

ステップS1107において、実行する検索手順が子ノード検索904であると判断された場合、図1に示した検索部105の子ノード検索手段105eは、コンテクストノードリストの各ノードの子ノードを検索する(ステップS1108)。具体的には、子ノード検索手段105eは、ノードテーブル2に対して、parent列203の親ノードIDの値がコンテクストノードリストに含まれる各ノードIDに一致する行を検索し、検索に合致した各行のid列201のノードIDの値をノードIDとして読み出し、読み出したノードIDのリストでコンテクストノードリストを置き換える。   If it is determined in step S1107 that the search procedure to be executed is the child node search 904, the child node search unit 105e of the search unit 105 illustrated in FIG. 1 searches for a child node of each node in the context node list ( Step S1108). Specifically, the child node search unit 105e searches the node table 2 for a row in which the value of the parent node ID in the parent column 203 matches each node ID included in the context node list, and matches the search. The node ID value in the id column 201 of each row is read as the node ID, and the context node list is replaced with the read node ID list.

一方、ステップS1107において、実行する検索手順が子ノード検索904ではないと判断された場合、検索部105の検索制御手段105aは、実行する検索手順が親ノード検索905か否かを判定する(ステップS1109)。   On the other hand, if it is determined in step S1107 that the search procedure to be executed is not the child node search 904, the search control unit 105a of the search unit 105 determines whether or not the search procedure to be executed is the parent node search 905 (step S1107). S1109).

ステップS1109において、実行する検索手順が親ノード検索905であると判断された場合、図1に示した検索部105の親ノード検索手段105fは、コンテクストノードリストの各ノードの親ノードを検索する(ステップS1110)。具体的には、親ノード検索手段105fは、ノードテーブル2に対して、id列201のノードIDの値がコンテクストノードリストに含まれる各ノードIDに一致する行を検索し、検索に合致した各行のparent列203の親ノードIDの値をノードIDとして読み出し、読み出したノードIDのリストでコンテクストノードリストを置き換える。   If it is determined in step S1109 that the search procedure to be executed is the parent node search 905, the parent node search means 105f of the search unit 105 shown in FIG. 1 searches for the parent node of each node in the context node list ( Step S1110). Specifically, the parent node search unit 105f searches the node table 2 for a row in which the value of the node ID in the id column 201 matches each node ID included in the context node list, and each row that matches the search. The parent node ID value in the parent column 203 is read as a node ID, and the context node list is replaced with the read node ID list.

一方、ステップS1109において、実行する検索手順が親ノード検索905ではないと判断された場合、検索部105の検索制御手段105aは、実行する検索手段が子孫ノード検索906か否かを判定する(ステップS1111)。   On the other hand, if it is determined in step S1109 that the search procedure to be executed is not the parent node search 905, the search control means 105a of the search unit 105 determines whether or not the search means to be executed is a descendant node search 906 (step S1109). S1111).

ステップS1111において、実行する検索手順が子孫ノード検索906であると判断された場合、図1に示した検索部105の子孫ノード検索手段105gは、後述する子孫ノード検索処理を実行する(ステップS1112)。一方、ステップS1111において、実行する検索手順が子孫ノード検索906ではないと判断された場合、検索部105の検索制御手段105aは、実行する検索手順が先祖ノード検索907か否かを判定する(ステップS1113)。   If it is determined in step S1111 that the search procedure to be executed is the descendant node search 906, the descendant node search unit 105g of the search unit 105 illustrated in FIG. 1 executes a later-described descendant node search process (step S1112). . On the other hand, if it is determined in step S1111 that the search procedure to be executed is not the descendant node search 906, the search control unit 105a of the search unit 105 determines whether the search procedure to be executed is the ancestor node search 907 (step S1111). S1113).

ステップS1113において、実行する検索手順が先祖ノード検索907であると判断された場合、図1に示した検索部105の先祖ノード検索手段105hは、後述する先祖ノード検索処理を実行する(ステップS1114)。一方、ステップS1113において、実行する検索手順が先祖ノード検索907ではないと判断された場合、検索部105の検索制御手段105aは、検索手順一覧9に記載しないその他の検索手順を実行する(ステップS1115)。その他の検索手順実行処理の詳細については説明を省略する。   If it is determined in step S1113 that the search procedure to be executed is the ancestor node search 907, the ancestor node search means 105h of the search unit 105 shown in FIG. 1 executes an ancestor node search process to be described later (step S1114). . On the other hand, if it is determined in step S1113 that the search procedure to be executed is not the ancestor node search 907, the search control unit 105a of the search unit 105 executes other search procedures not listed in the search procedure list 9 (step S1115). ). The details of the other search procedure execution processing will be omitted.

次に、図11に示した検索部105によるステップS1112の子孫ノード検索処理の詳細について図12のフローチャートを参照して説明する。   Next, details of the descendant node search processing in step S1112 by the search unit 105 shown in FIG. 11 will be described with reference to the flowchart of FIG.

検索部105の子孫ノード検索手段105gは、子孫ノード検索処理を開始すると、ノードテーブル2に対して、id列201のノードIDの値がコンテクストノードリストに含まれるノードIDに一致する行を検索する(ステップS1201)。   When the descendant node search unit 105g of the search unit 105 starts the descendant node search process, the node table 2 searches the node table 2 for a row where the value of the node ID in the id column 201 matches the node ID included in the context node list. (Step S1201).

次に、検索部105の子孫ノード検索手段105gは、ノードテーブル2に対して、order列204の順番号の値がステップS1201で検索された各行のorder列204の順番号の値に「1」を加算した値より大きく、ステップS1201で検索された各行のnext列205の次番号の値より小さい行を子孫ノードとして検索する(ステップS1202)。   Next, the descendant node search unit 105g of the search unit 105 sets the order number value of the order column 204 to “1” for the order number of the order column 204 of each row searched in step S1201 for the node table 2. A row that is larger than the value obtained by adding and less than the next number value in the next column 205 of each row retrieved in step S1201 is retrieved as a descendant node (step S1202).

次に、検索部105の子孫ノード検索手段105gは、ステップS1202で検索された子孫ノードと検索された各行のid列201のノードIDの値を読み出し、読み出したノードIDのリストでコンテクストノードリストを置き換える(ステップS1203)。   Next, the descendant node search unit 105g of the search unit 105 reads the descendant node searched in step S1202 and the node ID value of the id column 201 of each searched row, and displays the context node list in the read node ID list. Replace (step S1203).

なお、ステップS1202において、order列204の順番号の値に「1」を加算して検索を行うことにより、コンテクストノードの属性を子孫ノードの検索から除外できる効果がある。   In step S1202, by adding “1” to the order number value in the order column 204 and performing the search, there is an effect that the attribute of the context node can be excluded from the search for the descendant nodes.

次に、図11に示した検索部105によるステップS1114の先祖ノード検索処理の詳細について、図13のフローチャートを参照して説明する。   Next, details of the ancestor node search processing in step S1114 by the search unit 105 shown in FIG. 11 will be described with reference to the flowchart of FIG.

検索部105の先祖ノード検索手段105hは、先祖ノード検索処理を開始すると、ノードテーブル2に対して、id列201のノードIDの値がコンテクストノードリストに含まれるノードIDに一致する行を検索する(ステップS1301)。   When the ancestor node search unit 105h of the search unit 105 starts the ancestor node search process, the node table 2 searches the node table 2 for a row whose node ID value in the id column 201 matches the node ID included in the context node list. (Step S1301).

次に、検索部105の先祖ノード検索手段105hは、ノードテーブル2に対して、order列204の順番号の値がステップS1301で検索された各行のorder列204の順番号の値より小さく、next列205の次番号の値がステップS1301で検索された各行のorder列204の順番号の値より大きい行を検索する(ステップS1302)。   Next, the ancestor node search unit 105h of the search unit 105 sets the order number value in the order column 204 to the node table 2 to be smaller than the order number value in the order column 204 of each row searched in step S1301. A row whose value of the next number in the column 205 is larger than the value of the order number in the order column 204 of each row searched in step S1301 is searched (step S1302).

次に、検索部105の先祖ノード検索手段105hは、ステップS1302で検索された各行のid列201のノードIDの値を読み出し、読み出したノードIDのリストでコンテクストノードリストを置き換える(S1303)。   Next, the ancestor node search unit 105h of the search unit 105 reads the value of the node ID in the id column 201 of each row searched in step S1302, and replaces the context node list with the list of read node IDs (S1303).

次に、図10に示した検索部105によるステップS1009のサブツリーデータ抽出処理の詳細について、図14のフローチャートを参照して説明する。   Next, details of the subtree data extraction processing in step S1009 by the search unit 105 shown in FIG. 10 will be described with reference to the flowchart of FIG.

図1に示した検索部105のサブツリーデータ抽出手段105iは、サブツリーデータ抽出処理を開始すると、ノードテーブル2に対して、id列201のノードIDの値が処理対象ノードのノードIDに一致する行を検索する(ステップS1401)。   When the subtree data extraction unit 105i of the search unit 105 illustrated in FIG. 1 starts the subtree data extraction process, a row in which the value of the node ID in the id column 201 matches the node ID of the processing target node with respect to the node table 2. Is searched (step S1401).

次に、検索部105のサブツリーデータ抽出手段105iは、ノードテーブル2に対して、order列204の順番号の値がステップS1401で検索された行のorder列204の順番号の値以上であり、ステップS1401で検索された行のnext列205の次番号の値より小さい行を検索する(ステップS1402)。そして、検索部105のサブツリーデータ抽出手段105iは、ステップS1402で検索された各行のid列の値を読み出す(ステップS1403)。   Next, the subtree data extraction unit 105i of the search unit 105 determines that the order number value in the order column 204 is greater than or equal to the order number value in the order column 204 of the row searched in step S1401 for the node table 2. A line smaller than the value of the next number in the next column 205 of the line searched in step S1401 is searched (step S1402). Then, the subtree data extraction unit 105i of the search unit 105 reads the value of the id column of each row searched in step S1402 (step S1403).

次に、本発明の一実施の形態の構造化文書格納装置1における検索の具体例について説明する。   Next, a specific example of search in the structured document storage device 1 according to the embodiment of the present invention will be described.

図15は、本発明の一実施の形態の構造化文書格納装置1内のXQuery解析部104に入力される検索クエリの一例を示す。図15に示す検索クエリ15は、XML文書例7が格納されていることを前提としており、ノード値が「Author 1」に一致するテキストノードを子孫に含む「book」要素を検索するときのものである。   FIG. 15 shows an example of a search query input to the XQuery analysis unit 104 in the structured document storage device 1 according to the embodiment of this invention. The search query 15 shown in FIG. 15 is based on the assumption that the XML document example 7 is stored, and is used when searching for a “book” element that includes a text node whose node value matches “Author 1” as a descendant. It is.

図16は、XQuery解析部104により生成される検索手順リストの一例を示す。この検索手順リスト16は、検索クエリ15を解析して生成されたものであり、子孫ノード検索、ノード型検索、ノード値検索、先祖ノード検索、ノード型検索、ノード名検索の順からなる6つの検索手順を示す。   FIG. 16 shows an example of a search procedure list generated by the XQuery analysis unit 104. This search procedure list 16 is generated by analyzing the search query 15 and includes six descending node search, node type search, node value search, ancestor node search, node type search, and node name search. The search procedure is shown.

図17は、本発明の一実施の形態の構造化文書格納装置1の検索部105の検索処理におけるコンテクストノードリストの遷移の例を示す。この例は、図16に示した検索手順リスト16を用いてテキストノードの検索処理を行ったときのコンテクストノードリストの遷移を示したものである。   FIG. 17 shows an example of transition of the context node list in the search process of the search unit 105 of the structured document storage device 1 according to the embodiment of the present invention. This example shows the transition of the context node list when the text node search process is performed using the search procedure list 16 shown in FIG.

すなわち、図17に170で示すように、コンテクストノードリストは、最初は図8に示したノードテーブル例8のid列の欄の一行目に示されるルートノードのノードID=1のみを含む。   That is, as indicated by 170 in FIG. 17, the context node list initially includes only the node ID = 1 of the root node shown in the first row of the column of the id column of the node table example 8 shown in FIG.

次に、検索部105は図16に示した検索手順1の子孫ノード検索を実行する。これにより、図17に170で示すように、コンテクストノードリストには、図8に示したノードテーブル例8における子孫ノードのノードIDである「2」、「3」、「4」、「5」、「6」、「7」、「8」、「9」、「10」、「11」、「12」、「13」、「14」、「15」、「16」、「17」、「18」、「19」、「20」が記述される。   Next, the search unit 105 executes a descendant node search of the search procedure 1 shown in FIG. Accordingly, as indicated by 170 in FIG. 17, the context node list includes “2”, “3”, “4”, “5” which are node IDs of descendant nodes in the node table example 8 shown in FIG. , “6”, “7”, “8”, “9”, “10”, “11”, “12”, “13”, “14”, “15”, “16”, “17”, “ “18”, “19”, and “20” are described.

続いて、検索部105は図16に示した検索手順2の引数3のノード型検索を実行する。これにより、図17に171で示すように、コンテクストノードリストには、図8に示したノードテーブル例8において、引数3からtype値が「3」のテキストノードのノード型を示すノードIDである「6」、「8」、「12」、「14」、「18」、「20」が記述される。   Subsequently, the search unit 105 executes a node type search of the argument 3 in the search procedure 2 shown in FIG. Accordingly, as indicated by reference numeral 171 in FIG. 17, the context node list includes a node ID indicating the node type of the text node whose type value is “3” from the argument 3 in the node table example 8 illustrated in FIG. “6”, “8”, “12”, “14”, “18”, “20” are described.

続いて、検索部105は図16に示した検索手順3の引数「Author1」のノード値検索を実行する。これにより、図17に173で示すように、コンテクストノードリストには、図8に示したノードテーブル例8において、引数「Author1」からノード値を示す「value」が「Author1」である「8」、「20」が記述される。   Subsequently, the search unit 105 executes a node value search for the argument “Author1” in the search procedure 3 shown in FIG. Accordingly, as indicated by 173 in FIG. 17, the context node list includes “8” in which “value” indicating the node value from the argument “Author1” is “Author1” in the node table example 8 illustrated in FIG. 8. , “20” is described.

続いて、検索部105は図16に示した検索手順4の先祖ノード検索を実行する。これにより、図17に174で示すように、コンテクストノードリストには、検索手順3の検索結果であるノードID「8」、「20」のうちノードID「8」の先祖ノードである「1」、「2」、「3」、「7」と、ノードD「20」の先祖ノードである「15」、「19」とが記述される。   Subsequently, the search unit 105 executes an ancestor node search of the search procedure 4 shown in FIG. Accordingly, as indicated by 174 in FIG. 17, the context node list includes “1”, which is the ancestor node of the node ID “8” among the node IDs “8” and “20” as the search results of the search procedure 3. , “2”, “3”, and “7”, and “15” and “19” that are ancestor nodes of the node D “20” are described.

続いて、検索部105は図16に示した検索手順5の引数1のノード型検索を実行する。これにより、図17に175で示すように、コンテクストノードリストには、検索手順4の検索結果のうち、図8に示す引数1(type値が「1」)のテキストノードのノード型を示すノードIDである「2」、「3」、「7」、「15」、「19」が記述される。   Subsequently, the search unit 105 executes a node type search of argument 1 in the search procedure 5 shown in FIG. Accordingly, as indicated by 175 in FIG. 17, the context node list includes a node indicating the node type of the text node of the argument 1 (type value is “1”) shown in FIG. IDs “2”, “3”, “7”, “15”, and “19” are described.

そして、検索部105は図16に示した最後の検索手順6の引数「book」のノード名検索を実行する。これにより、図17に176で示すように、コンテクストノードリストには、検索手順5の検索結果のうち、図8のname列の欄に示されるノード名が「book」である検索結果のノードID「3」、「15」が記述される。このように、検索部105が検索手順を1つずつ実行する毎に、コンテクストノードリストに含まれるノードIDが変化していき、最終的に検索クエリによる所望の検索結果が得られる。   Then, the search unit 105 executes a node name search for the argument “book” in the last search procedure 6 shown in FIG. Accordingly, as indicated by 176 in FIG. 17, the node ID of the search result whose node name shown in the column of the name column in FIG. 8 is “book” in the search result of the search procedure 5 is displayed in the context node list. “3” and “15” are described. Thus, each time the search unit 105 executes the search procedure one by one, the node ID included in the context node list changes, and finally a desired search result based on the search query is obtained.

図18は、本発明の一実施の形態の構造化文書格納装置1のXML成形部106から出力される検索結果の一例を示す。この検索結果は、図15に示した検索クエリ15に基づいて得られる図17に示す検索結果を示したものである。   FIG. 18 shows an example of a search result output from the XML forming unit 106 of the structured document storage device 1 according to the embodiment of this invention. This search result shows the search result shown in FIG. 17 obtained based on the search query 15 shown in FIG.

すなわち、図18の1行目から4行目は、図7に示したXML文書例7において図17の検索結果のノードID「3」が示すノード名「book」を開始タグとし、その後の最初の「/book」を終了タグとするノード値が「Author 1」に一致するテキストノードを示す。また、図18の5行目から8行目は、図7に示したXML文書例7において図17の検索結果のノードID「15」が示すノード名「book」を開始タグとし、その後の最初の「/book」を終了タグとするノード値が「Author 1」に一致するテキストノードを示す。   That is, the first to fourth lines in FIG. 18 use the node name “book” indicated by the node ID “3” in the search result of FIG. 17 in the XML document example 7 shown in FIG. Indicates a text node whose node value whose end tag is “/ book” matches “Author 1”. Also, the 5th to 8th lines in FIG. 18 use the node name “book” indicated by the node ID “15” in the search result of FIG. 17 in the XML document example 7 shown in FIG. Indicates a text node whose node value whose end tag is “/ book” matches “Author 1”.

このように、本実施の形態の構造化文書格納装置1によれば、構造化文書の対象ノードの出現順を示す順番号と、対象ノードより後に出現するノードのうち、対象ノードの子孫ノードを除くノードのうちで最も先に出現するノードの順番号を示す次番号とをノードテーブル2に格納し、検索部105において、ノードテーブル2を参照して構造化文書の比較元ノードの順番号を比較先ノードの順番号及び次番号と比較して比較元ノードが比較先ノードの子孫ノードであるか否かを判定するようにしたため、検索手順の数は従来と同じであるが、従来に比べて構造化文書のノード間の先祖・子孫関係を検索する手順を短時間で行うことができ、その結果、従来に比べて構造化文書の検索を高速に行うことができる。   As described above, according to the structured document storage device 1 of the present embodiment, the sequence number indicating the appearance order of the target node of the structured document and the descendant node of the target node among the nodes appearing after the target node are displayed. The next number indicating the sequence number of the node that appears first among the excluded nodes is stored in the node table 2, and the search unit 105 refers to the node table 2 to determine the sequence number of the comparison source node of the structured document. Since the comparison source node is compared with the order number and next number of the comparison destination node to determine whether or not the comparison source node is a descendant node of the comparison destination node, the number of search procedures is the same as before, but compared with the conventional case Thus, the procedure for searching for the ancestor-descendant relationship between the nodes of the structured document can be performed in a short time, and as a result, the retrieval of the structured document can be performed at a higher speed than in the past.

なお、本発明は以上の実施の形態に限定されるものではなく、例えば本実施の形態の構造化文書格納装置1において、XML文書をテキストデータとして入力し格納しているが、XML文書の入力方法はテキストデータによるものに限定されない。XML文書の入力方法を、DOMデータによるものや、その他の方法によるものとしてもよい。また、本実施の形態の構造化文書格納装置1において、検索結果をテキストデータとして出力しているが、検索結果の出力方法はテキストデータによるものに限定されない。検索結果の出力方法を、DOMデータによるものや、その他の方法によるものとしてもよい。   The present invention is not limited to the above embodiment. For example, in the structured document storage device 1 of the present embodiment, an XML document is input and stored as text data. The method is not limited to text data. An XML document input method may be based on DOM data or other methods. In the structured document storage device 1 of the present embodiment, the search result is output as text data. However, the output method of the search result is not limited to text data. The search result output method may be based on DOM data or other methods.

また、本実施の形態の構造化文書格納装置1は、出現順が定義されない属性を含むXML文書を格納するものであるが、全てのノードの出現順が定義される構造化文書を格納するものとしてもよい。この場合、格納部102には、属性データ挿入手段102dと属性格納手段102eとが不要となる。   The structured document storage apparatus 1 according to the present embodiment stores an XML document including an attribute whose appearance order is not defined, but stores a structured document in which the appearance order of all nodes is defined. It is good. In this case, the storage unit 102 does not need the attribute data insertion unit 102d and the attribute storage unit 102e.

また、ノードテーブル2におけるorder列204に格納される順番号は、ノードの出現順に「0」から始まり「1」ずつ増加する整数を割り振った値としてもよい。また、ノードに属性がない場合は図5のノード格納処理におけるステップS506乃至ステップS510が不要となる。また、図12の子孫ノード検索処理のステップS1202において、order列204の値に「1」を加算する処理が不要となる。   The order number stored in the order column 204 in the node table 2 may be a value assigned with an integer starting from “0” and increasing by “1” in the order of appearance of the nodes. If the node does not have an attribute, steps S506 to S510 in the node storing process in FIG. 5 are not necessary. Also, in step S1202 of the descendant node search process of FIG. 12, the process of adding “1” to the value of the order column 204 is not necessary.

更に、本発明は上述した構造化文書格納装置1の動作を実現する構造化文書格納方法、及びコンピュータにより構造化文書格納装置1の動作を実行させるための構造化文書格納プログラムも包含する。この構造化文書格納プログラムは、例えば、構造化文書格納プログラムが記憶された記録媒体から読み出され、コンピュータに取り込まれて実行されることにより構造化文書格納装置を構成するようにしてもよいし、通信ネットワークを介して配信されてコンピュータにインストールされて実行されることにより構造化文書格納装置を構成するようにしてもよい。   Furthermore, the present invention also includes a structured document storage method for realizing the operation of the structured document storage device 1 described above, and a structured document storage program for causing the computer to execute the operation of the structured document storage device 1. For example, the structured document storage program may be read from a recording medium in which the structured document storage program is stored, loaded into a computer, and executed to configure the structured document storage device. The structured document storage device may be configured by being distributed via a communication network, installed in a computer, and executed.

1 構造化文書格納装置
2 ノードテーブル
3 ノード型一覧
7 XML文書例
8 ノードテーブル例
9 検索手順一覧
101 XML解析部
102 格納部
102a ノードID決定手段
102b 順番号決定手段
102c ノードデータ挿入手段
102d 属性データ挿入手段
102e 属性格納手段
102f 子ノード格納手段
103 リレーショナルデータベース
104 XQuery解析部
105 検索部
105a 検索制御手段
105b ノード型検索手段
105c ノード名検索手段
105d ノード値検索手段
105e 子ノード検索手段
105f 親ノード検索手段
105g 子孫ノード検索手段
105h 先祖ノード検索手段
105i サブツリーデータ抽出手段
106 XML成形部
DESCRIPTION OF SYMBOLS 1 Structured document storage apparatus 2 Node table 3 Node type list 7 XML document example 8 Node table example 9 Search procedure list 101 XML analysis part 102 Storage part 102a Node ID determination means 102b Sequence number determination means 102c Node data insertion means 102d Attribute data Insertion unit 102e Attribute storage unit 102f Child node storage unit 103 Relational database 104 XQuery analysis unit 105 Search unit 105a Search control unit 105b Node type search unit 105c Node name search unit 105d Node value search unit 105e Child node search unit 105f Parent node search unit 105g Descendant node search means 105h Ancestor node search means 105i Subtree data extraction means 106 XML forming unit

Claims (6)

構造化文書を解析して、その構造化文書に含まれるノードに関する情報を出力する構造化文書解析手段と、
前記構造化文書のノードに関する情報が格納されるノードテーブルを有する記憶手段と、
前記構造化文書解析手段から出力された前記構造化文書のノードに関する情報中の対象ノードの出現順を表す順番号を決定すると共に、前記対象ノードより後に前記情報中に出現するノードのうち前記対象ノードの子孫ノードを除いて最も先に出現するノードの前記順番号を前記対象ノードに付す次番号として決定し、前記対象ノードに関する情報と共に前記順番号と前記次番号とを前記ノードテーブルに格納する格納手段と、
供給される検索手順リストに従い、前記ノードテーブルの格納情報を参照して検索結果を出力する検索手段と
を備え、前記検索手段は、前記格納情報中の比較元ノードの前記順番号が比較先ノードの前記順番号より大きく、かつ、前記比較元ノードの前記順番号が前記比較先ノードの前記次番号より小さいときに、前記比較元ノードが前記比較先ノードの子孫ノードであると判断する子孫ノード検索手段を有することを特徴とする構造化文書格納装置。
A structured document analyzing means for analyzing the structured document and outputting information about nodes included in the structured document;
Storage means having a node table in which information about nodes of the structured document is stored;
Determining a sequence number representing the order of appearance of the target node in the information related to the node of the structured document output from the structured document analyzing means, and the target among the nodes appearing in the information after the target node The order number of the node that appears first except for the descendant nodes of the node is determined as a next number to be assigned to the target node, and the order number and the next number are stored in the node table together with information on the target node. Storage means;
Search means for referring to the stored information in the node table according to the supplied search procedure list and outputting a search result, wherein the search means is configured such that the sequence number of the comparison source node in the storage information is a comparison destination node. A descendant node that determines that the comparison source node is a descendant node of the comparison destination node when the order number of the comparison source node is less than the next number of the comparison destination node. A structured document storage device comprising a search means.
前記構造化文書は、出現順が定義される第1のノードと、出現順が定義されない第2のノードとを含み、
前記格納手段は、前記第1のノードの前記順番号に、その第1のノードの出現順に2ずつ増加する0以上の整数を割り当て、前記第2のノードの前記順番号に、その第2のノードの一つ上位のノードである親ノードの前記順番号に1を加算した値を割り当て、
前記子孫ノード検索手段は、前記比較元ノードの前記順番号が前記比較先ノードの前記順番号に1を加算した値より大きく、かつ、前記比較元ノードの前記順番号が前記比較先ノードの前記次番号より小さいときに、前記比較元ノードが前記比較先ノードの子孫ノードであると判断する
ことを特徴とする請求項1記載の構造化文書格納装置。
The structured document includes a first node whose appearance order is defined and a second node whose appearance order is not defined,
The storage means assigns an integer of 0 or more that increases by 2 in the order of appearance of the first node to the order number of the first node, and assigns the second number to the order number of the second node. Assign a value obtained by adding 1 to the order number of the parent node that is one node higher than the node,
The descendant node search means is configured such that the order number of the comparison source node is larger than a value obtained by adding 1 to the order number of the comparison destination node, and the order number of the comparison source node is the value of the comparison destination node. 2. The structured document storage device according to claim 1, wherein when the number is smaller than a next number, the comparison source node is determined to be a descendant node of the comparison destination node.
構造化文書を解析して、その構造化文書に含まれるノードに関する情報を出力する構造化文書解析ステップと、
前記構造化文書解析ステップにより解析して得られた前記構造化文書のノードに関する情報中の対象ノードの出現順を表す順番号を決定すると共に、前記対象ノードより後に前記情報中に出現するノードのうち前記対象ノードの子孫ノードを除いて最も先に出現するノードの前記順番号を前記対象ノードに付す次番号として決定し、前記対象ノードに関する情報と共に前記順番号と前記次番号とを、前記構造化文書のノードに関する情報が格納されるノードテーブルに格納する格納ステップと、
供給される検索手順リストに従い、前記ノードテーブルの格納情報を参照して検索結果を出力する検索ステップと
を備え、前記検索ステップは、前記格納情報中の比較元ノードの前記順番号が比較先ノードの前記順番号より大きく、かつ、前記比較元ノードの前記順番号が前記比較先ノードの前記次番号より小さいときに、前記比較元ノードが前記比較先ノードの子孫ノードであると判断する子孫ノード検索ステップを含むことを特徴とする構造化文書格納方法。
A structured document analysis step of analyzing the structured document and outputting information about nodes included in the structured document;
Determining a sequence number representing the order of appearance of the target node in the information related to the node of the structured document obtained by analysis in the structured document analyzing step, and determining a node number that appears in the information after the target node; The order number of the node that appears first except for the descendant nodes of the target node is determined as the next number to be assigned to the target node, and the order number and the next number together with information on the target node are determined as the structure A storage step of storing in a node table in which information on nodes of the document is stored;
A search step of outputting a search result by referring to the stored information in the node table according to the supplied search procedure list, wherein the search step includes the sequence number of the comparison source node in the storage information as a comparison destination node A descendant node that determines that the comparison source node is a descendant node of the comparison destination node when the order number of the comparison source node is less than the next number of the comparison destination node. A structured document storage method comprising a retrieval step.
前記構造化文書は、出現順が定義される第1のノードと、出現順が定義されない第2のノードとを含み、
前記格納ステップは、前記第1のノードの前記順番号に、その第1のノードの出現順に2ずつ増加する0以上の整数を割り当て、前記第2のノードの前記順番号に、その第2のノードの一つ上位のノードである親ノードの前記順番号に1を加算した値を割り当て、
前記子孫ノード検索ステップは、前記比較元ノードの前記順番号が前記比較先ノードの前記順番号に1を加算した値より大きく、かつ、前記比較元ノードの前記順番号が前記比較先ノードの前記次番号より小さいときに、前記比較元ノードが前記比較先ノードの子孫ノードであると判断する
ことを特徴とする請求項3記載の構造化文書格納方法。
The structured document includes a first node whose appearance order is defined and a second node whose appearance order is not defined,
The storing step assigns an integer of 0 or more that increases by 2 in the order of appearance of the first node to the order number of the first node, and assigns the second number to the order number of the second node. Assign a value obtained by adding 1 to the order number of the parent node that is one node higher than the node,
In the descendant node search step, the order number of the comparison source node is larger than a value obtained by adding 1 to the order number of the comparison destination node, and the order number of the comparison source node is the value of the comparison destination node. 4. The structured document storage method according to claim 3, wherein when the number is smaller than a next number, it is determined that the comparison source node is a descendant node of the comparison destination node.
コンピュータに、
構造化文書を解析して、その構造化文書に含まれるノードに関する情報を出力する構造化文書解析ステップと、
前記構造化文書解析ステップにより解析して得られた前記構造化文書のノードに関する情報中の対象ノードの出現順を表す順番号を決定すると共に、前記対象ノードより後に前記情報中に出現するノードのうち前記対象ノードの子孫ノードを除いて最も先に出現するノードの前記順番号を前記対象ノードに付す次番号として決定し、前記対象ノードに関する情報と共に前記順番号と前記次番号とを、前記構造化文書のノードに関する情報が格納されるノードテーブルに格納させる格納ステップと、
供給される検索手順リストに従い、前記ノードテーブルの格納情報を参照して検索結果を出力する検索ステップと
を実行させ、前記検索ステップは、前記格納情報中の比較元ノードの前記順番号が比較先ノードの前記順番号より大きく、かつ、前記比較元ノードの前記順番号が前記比較先ノードの前記次番号より小さいときに、前記比較元ノードが前記比較先ノードの子孫ノードであると判断する子孫ノード検索ステップを含むことを特徴とする構造化文書格納プログラム。
On the computer,
A structured document analysis step of analyzing the structured document and outputting information about nodes included in the structured document;
Determining a sequence number representing the order of appearance of the target node in the information related to the node of the structured document obtained by analysis in the structured document analyzing step, and determining a node number that appears in the information after the target node; The order number of the node that appears first except for the descendant nodes of the target node is determined as the next number to be assigned to the target node, and the order number and the next number together with information on the target node are determined as the structure A storage step for storing in a node table in which information on nodes of the document is stored;
A search step of referring to the stored information of the node table and outputting a search result according to the supplied search procedure list, wherein the search step includes a comparison destination node in which the order number of the comparison source node is compared A descendant that determines that the comparison source node is a descendant node of the comparison destination node when the order number of the comparison source node is greater than the sequence number of the node and the comparison source node is less than the next number of the comparison destination node A structured document storage program comprising a node search step.
前記構造化文書は、出現順が定義される第1のノードと、出現順が定義されない第2のノードとを含み、
前記格納ステップは、前記第1のノードの前記順番号に、その第1のノードの出現順に2ずつ増加する0以上の整数を割り当て、前記第2のノードの前記順番号に、その第2のノードの一つ上位のノードである親ノードの前記順番号に1を加算した値を割り当て、
前記子孫ノード検索ステップは、前記比較元ノードの前記順番号が前記比較先ノードの前記順番号に1を加算した値より大きく、かつ、前記比較元ノードの前記順番号が前記比較先ノードの前記次番号より小さいときに、前記比較元ノードが前記比較先ノードの子孫ノードであると判断する
ことを特徴とする請求項5記載の構造化文書格納プログラム。
The structured document includes a first node whose appearance order is defined and a second node whose appearance order is not defined,
The storing step assigns an integer of 0 or more that increases by 2 in the order of appearance of the first node to the order number of the first node, and assigns the second number to the order number of the second node. Assign a value obtained by adding 1 to the order number of the parent node that is one node higher than the node,
In the descendant node search step, the order number of the comparison source node is larger than a value obtained by adding 1 to the order number of the comparison destination node, and the order number of the comparison source node is the value of the comparison destination node. 6. The structured document storage program according to claim 5, wherein when it is smaller than a next number, it is determined that the comparison source node is a descendant node of the comparison destination node.
JP2010216420A 2010-09-28 2010-09-28 Structured document storage device, structured document storage method and structured document storage program Pending JP2012073706A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010216420A JP2012073706A (en) 2010-09-28 2010-09-28 Structured document storage device, structured document storage method and structured document storage program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010216420A JP2012073706A (en) 2010-09-28 2010-09-28 Structured document storage device, structured document storage method and structured document storage program

Publications (1)

Publication Number Publication Date
JP2012073706A true JP2012073706A (en) 2012-04-12

Family

ID=46169833

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010216420A Pending JP2012073706A (en) 2010-09-28 2010-09-28 Structured document storage device, structured document storage method and structured document storage program

Country Status (1)

Country Link
JP (1) JP2012073706A (en)

Similar Documents

Publication Publication Date Title
JP4886693B2 (en) Information processing method, information processing apparatus, and information processing program
JP4124261B2 (en) Document analysis system, document analysis method, and program thereof
JP4997749B2 (en) Document processing method, program, and system
US20020178184A1 (en) Software system for biological storytelling
JP2004086782A (en) Apparatus for supporting integration of heterogeneous database
JP6132698B2 (en) Tabular multidimensional data conversion method and apparatus
JP5241738B2 (en) Method and apparatus for building tree structure data from tables
US20220164526A1 (en) Method And Apparatus For Structured Documents
JP2006185408A (en) Database construction device, database retrieval device, and database device
JPWO2006038498A1 (en) Array generation method and array generation program
JP2012059041A (en) Document management system, retrieval designation method, and program
JP2015162004A (en) Inter-development document trace link generation support device and method and program
JP2016031567A (en) Personal information anonymity apparatus
JPWO2007052680A1 (en) Document processing apparatus and document processing method
JP5273884B1 (en) Structure analysis apparatus and program
JP2012059212A (en) Extraction apparatus, extraction method and extraction program
JP6710881B1 (en) Document creation support system
JP2012073706A (en) Structured document storage device, structured document storage method and structured document storage program
JPWO2006137564A1 (en) Document processing device
JPH09282218A (en) Html document book form shaping method and device therefor
JP6638053B1 (en) Document creation support system
JP6753190B2 (en) Document retrieval device and program
JP4411994B2 (en) Information processing device
JP2008084128A (en) Device, method and program for designating element of structured document
JP2006155593A (en) Document analysis system and document adaptation system