JP5100220B2 - XML document conversion apparatus, XML document restoration apparatus, and XML document processing apparatus - Google Patents
XML document conversion apparatus, XML document restoration apparatus, and XML document processing apparatus Download PDFInfo
- Publication number
- JP5100220B2 JP5100220B2 JP2007171430A JP2007171430A JP5100220B2 JP 5100220 B2 JP5100220 B2 JP 5100220B2 JP 2007171430 A JP2007171430 A JP 2007171430A JP 2007171430 A JP2007171430 A JP 2007171430A JP 5100220 B2 JP5100220 B2 JP 5100220B2
- Authority
- JP
- Japan
- Prior art keywords
- node
- xml document
- vertex
- unit
- path
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Document Processing Apparatus (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
本発明は、XML文書変換装置、XML文書復元装置及びXML文書処理装置に係る発明である。 The present invention is an invention relating XML document conversion equipment, the XML document rehabilitation equipment and XML document processing apparatus.
近年、インターネットの普及により、HTML(Hyper Text Markup Language)文書やXML(Extensible Markup Language)文書などの構造化文書が用いられる機会が増加している。特に、XML文書は、HTML文書を補う次世代の言語として注目を集めており、構造を圧縮する仕組みとしても、従来から様々な手法が用いられている。 In recent years, with the spread of the Internet, opportunities for using structured documents such as HTML (Hyper Text Markup Language) documents and XML (Extensible Markup Language) documents are increasing. In particular, XML documents are attracting attention as a next-generation language that supplements HTML documents, and various methods have conventionally been used as mechanisms for compressing structures.
代表的な圧縮手法としては、XML文書の構造のうち同じ構造が繰り返される部分を抽出し、当該部分に別名をつけて置換して圧縮する方法がある。例えば、特許文献1では、XML文書を検索して複数の箇所で共通する文書の構造をテンプレートとして作成し、当該テンプレートと同じ構造の箇所をテンプレート名に置換し、さらに置換後のXML文書に対しても再びテンプテートで再置換を行っている。
As a typical compression method, there is a method of extracting a portion where the same structure is repeated from the structure of the XML document, and substituting the portion with an alias for compression. For example, in
しかし、従来のXML文書の圧縮手法は、XML文書中に同じ構造がないと圧縮ができない。このため、従来のXML文書の圧縮手法は、XML文書で同じ構造が繰り返されているような特定のXML文書にしか適用できない課題があった。 However, the conventional XML document compression method cannot be compressed unless the same structure exists in the XML document. For this reason, there is a problem that the conventional XML document compression method can be applied only to a specific XML document in which the same structure is repeated in the XML document.
また、従来のXML文書の圧縮手法では、置換後のXML文書及びテンプレートの両方に木構造のデータが最終的に残る。そのため、従来のXML文書の圧縮手法を用いても、最終的に得られるXML文書の構造は複雑で、結果的に多くの情報量が必要になる課題があった。 Further, in the conventional XML document compression method, tree-structured data finally remains in both the replaced XML document and the template. Therefore, even if a conventional XML document compression method is used, the structure of the finally obtained XML document is complicated, and as a result, there is a problem that a large amount of information is required.
そこで、本発明は、上記のような課題を解決するためになされたもので、任意のXML文書に対して、文書構造を数値に変換できるXML文書変換装置、数値を文書構造に復元できるXML文書復元装置、さらに両装置を含むXML文書処理装置を提供することを目的とする。 The present invention has been made to solve the above problems, XML can be restored for any XML document, XML document conversion equipment that can convert a document structure to a number, a number in the document structure and to provide an XML document processing apparatus comprising a document rehabilitation equipment, further both devices.
本発明に係る解決手段は、XML(Extensible Markup Language)文書を保管するXML文書格納部からXML文書を取り出し、当該XML文書から各ノードのノード名称を抽出するノード名称抽出部と、n個のノードを持つXML文書から各ノードのノード種類を抽出し、当該各ノードのノード種類をノード名称抽出部で抽出した各ノードのノード名称を含む情報リストをリスト格納部に出力するノード種類抽出部と、XML文書の各ノードを木構造で表した場合のノード深さを測定し、測定したノード深さを順に並べた数列を求めるノード深さ測定部と、縦横n本ずつの格子に沿って左上端点から右上半分には決して入らないように右下端点に至る全ての最短経路を求め、該最短経路各々における各縦の経路には、左上は2から始まり、真下の縦の経路には1足した数字、右隣の縦の経路には1引いた数字が順に割り振られ、前記ノード深さ測定部により得られた前記数列から先頭の1を除いた数列における前記ノード深さ各々と前記各縦の経路に割り振られた数字とが等しくなる経路を順次選択することによって数列を最短経路に変換する折れ線変換部と、折れ線変換部により求められた全ての最短経路それぞれに構造番号を付し、折れ線変換部により変換された最短経路に対応する構造番号を数値格納部に出力する数値変換部とを備える。
According to the present invention, there is provided a node name extraction unit that extracts an XML document from an XML document storage unit that stores an XML (Extensible Markup Language) document, extracts a node name of each node from the XML document, and n nodes A node type extraction unit that extracts a node type of each node from an XML document having a node name and outputs the information list including the node name of each node extracted by the node name extraction unit to the list storage unit; A node depth measurement unit that measures a node depth when each node of the XML document is represented by a tree structure, and obtains a sequence of the measured node depths in order, and an upper left end point along n vertical and horizontal grids All the shortest paths from the right to the lower right end point are determined so that they never enter the upper right half, and each vertical path in each of the shortest paths starts with 2 at the upper left, Numbers added by 1 are sequentially assigned to the route, numbers subtracted by 1 are assigned to the vertical route adjacent to the right, and the node depth in the number sequence obtained by removing the leading one from the number sequence obtained by the node depth measurement unit. A structure number is assigned to each of the shortest paths obtained by the broken line conversion section, and a broken line conversion section that converts the number sequence to the shortest path by sequentially selecting the paths that are equal to each other and the numbers assigned to the respective vertical paths . And a numerical value conversion unit that outputs the structure number corresponding to the shortest path converted by the broken line conversion unit to the numerical value storage unit.
本発明に記載のXML文書変換装置は、ノード深さを順に並べて数列を縦横格子の最短経路に変換する折れ線変換部と、最短経路に対応する構造番号を数値格納部に出力する数値変換部とを備えので、任意のXML文書に対して、文書構造を数値に変換でき、情報量を少なくすることができる。 An XML document conversion apparatus according to the present invention includes a line conversion unit that arranges node depths in order and converts a number sequence into a shortest path of a vertical and horizontal lattice, and a numerical conversion unit that outputs a structure number corresponding to the shortest path to a numerical value storage unit Therefore, for any XML document, the document structure can be converted into a numerical value, and the amount of information can be reduced.
(実施の形態1)
まず、本発明で取り扱うXML文書の構成について説明する。XML文書は、構成する要素や属性としてノードを有している。本発明で取り扱うXML文書のノードでは、「空でない要素」,「空要素」,「属性」,「要素のテキスト」,「属性のテキスト」の5種類から構成されているものとする。「空でない要素」は、XML文書において最も基本となる情報単位である。「空要素」は、内容を持たない空の要素である。「属性」は、XML文書の中で要素に対して付加的な情報を付け加える。「要素のテキスト」は、要素の値である。「属性のテキスト」は、属性の値である。
(Embodiment 1)
First, the configuration of an XML document handled in the present invention will be described. An XML document has nodes as constituent elements and attributes. The XML document node handled in the present invention is assumed to be composed of five types: “non-empty element”, “empty element”, “attribute”, “element text”, and “attribute text”. “Non-empty element” is the most basic information unit in an XML document. “Empty element” is an empty element having no content. “Attribute” adds additional information to the element in the XML document. “Element text” is the value of the element. “Attribute text” is the value of the attribute.
なお、XML文書のノードとしては、他に「XML宣言」,「処理命令」,「CDATAセクション」,「コメント」,「文字参照」,「エンティティ参照」等があるが、XML文書中の主要なノードではないので、本発明で取り扱うXML文書ではノードとして考慮しない。ここで、「XML宣言」は、XML文書がXML文書であることを宣言する。「処理命令」は、アプリケーションへの処理命令を記述する。「CDATAセクション」は、XML文書要素として論理や意味構造を無視する文を記述する。「コメント」は、XML文書要素として解釈されない注釈文を記述する。「文字参照」は、文字コードによる文字の参照を記述する。「エンティティ参照」は、文字列やファイルを参照するエンティティを記述する。 There are other XML document nodes such as “XML declaration”, “processing instruction”, “CDATA section”, “comment”, “character reference”, “entity reference”, etc., which are the main nodes in the XML document. Since it is not a node, it is not considered as a node in the XML document handled in the present invention. Here, “XML declaration” declares that the XML document is an XML document. “Processing instruction” describes a processing instruction to the application. The “CDATA section” describes a sentence that ignores logic and semantic structure as an XML document element. “Comment” describes an annotation sentence that is not interpreted as an XML document element. “Character reference” describes the reference of a character by a character code. “Entity reference” describes an entity that refers to a character string or a file.
さらに、本発明で取り扱うXML文書では、ノード間の改行及び空白(いわゆるIgnorable White Space)をノードとして扱わず無視する。例えば、後述する図2に示すXML文書では、<aaa bbb="ccc">から<ddd>eee</ddd>まで、<ddd>eee</ddd>から</aaa>までのそれぞれに改行や空白を有しているが、本発明で取り扱うXML文書では、当該改行や空白をノードとして扱わず無視する。 Furthermore, in the XML document handled by the present invention, line breaks and white spaces (so-called Ignitable White Space) between nodes are not treated as nodes but are ignored. For example, in the XML document shown in FIG. 2, which will be described later, a line break or a line break from <aaa bbb = "ccc"> to <ddd> eee </ ddd>, <ddd> eee </ ddd> to </ aaa>. Although there is a blank, in the XML document handled in the present invention, the line feed or blank is not treated as a node and is ignored.
図1に、本実施の形態に係るXML文書処理装置の概略図を示す。図1に示すXML文書処理装置は、XML文書格納部10,リスト格納部20,XML文書変換装置30,XML文書復元装置40,数値格納部50を備えている。
FIG. 1 shows a schematic diagram of an XML document processing apparatus according to the present embodiment. The XML document processing apparatus shown in FIG. 1 includes an XML
ここで、XML文書格納部10は、XML文書変換装置30によってテーブル形式のデータに変換する前のXML文書や、XML文書復元装置40によってテーブル形式のデータから復元されたXML文書を格納するための格納部である。リスト格納部20は、XML文書のうちノード名称及びノード種類をリスト形式の情報リストに格納するための格納部である。
Here, the XML
XML文書変換装置30は、XML文書格納部10に格納されているXML文書からノード名称及びノード種類をリスト形式の情報リストに変換してリスト格納部20に送出し、ノードの構造を数値に変換して数値格納部50に送出する。XML文書変換装置30は、ノード名称抽出部31、ノード種類抽出部32、ノード深さ測定部33、折れ線変換部34,数値変換部35を備えている。
The XML
ノード名称抽出部31は、XML文書格納部10から取り出したXML文書から各ノードのノード名称を抽出する。ノード種類抽出部32は、XML文書からノード種類を表す情報(具体的には「空でない要素」「空要素」「属性」「要素のテキスト」「属性のテキスト」)を抽出する。抽出されたノード種類は、ノード名称抽出部31で抽出されたノード名称とともに情報リストとしてリスト格納部20へ出力される。
The node name extraction unit 31 extracts the node name of each node from the XML document extracted from the XML
ノード深さ測定部33は、XML文書の各ノードを木構造で表した場合に、当該各ノードのノード深さを測定する。折れ線変換部34は、ノード深さ測定部33で測定したノード深さを順に並べて数列として表し、当該数列を縦横格子の左上端点から右下端点までの最短経路に変換する。ここで、最短経路とは、縦横n本の格子の左上端点から、端点間を右に(n−1)回、下に(n−1)回だけそれぞれ移動することにより右下端点に到着できる経路である。数値変換部35は、縦横格子の左上端点から右下端点までの最短経路のそれぞれに構造番号を付し、折れ線変換部34で変換した最短経路に対応する構造番号を数値格納部50に出力する。
When each node of the XML document is represented by a tree structure, the node
なお、XML文書のノード名称,ノード種類及びノード深さ等をXML文書から抽出又は測定するには、DOM(Document Object Model)と呼ばれるAPIによって実現することができる。このDOMは、Webの標準化団体であるW3C(The World Wide Web Consortium)により規格化されたAPIであり、当該分野においてデファクトスタンダードである。 It should be noted that extracting or measuring the node name, node type, node depth, and the like of the XML document from the XML document can be realized by an API called DOM (Document Object Model). This DOM is an API standardized by the World Wide Web Consortium (W3C), which is a Web standardization organization, and is the de facto standard in this field.
但し、このDOMでは、「属性」を「要素」の子ノードとして扱わないが、本発明でXML文書を取り扱う場合には、「属性」を「要素」の子ノードとして扱う。 However, in this DOM, “attribute” is not handled as a child node of “element”. However, when an XML document is handled in the present invention, “attribute” is handled as a child node of “element”.
XML文書復元装置40は、リスト格納部20に格納されているノード名称及びノード種類のリスト形式の情報リストと、数値格納部50に格納されているノードの構造を表す数値(構造番号)とからXML文書を復元する。XML文書復元装置40は、ノード名称付与部41,ノード種類付与部42,木構造復元部43,数列復元部44,折れ線復元部45を備えている。これらノード名称付与部41〜折れ線復元部45のそれぞれは、ノード名称抽出部31〜数値変換部35におけるそれぞれの変換動作に対応した復元動作を行うものである。
The XML
折れ線復元部45は、数値格納部50から取り出した数値(構造番号)を、縦横格子に沿った左上端点から右下端点までの最短経路に復元する。数列復元部44は、折れ線復元部45で復元された最短経路を、XML文書の各ノードを木構造で表した場合に、当該各ノードのノード深さを並べた数列に復元する。木構造復元部43は、数列復元部44で復元された数列から、XML文書の各ノードの木構造を復元する。ノード種類復元部42は、情報リストとしてリスト格納部20に格納されたノード種類を取り出し、木構造復元部43で復元された各ノードに対して、ノード種類である「空でない要素」「空要素」「属性」「要素のテキスト」「属性のテキスト」を付与する。ノード名称付与部41は、木構造復元部43で復元された各ノードに対して、ノード名称を付与してXML文書を復元し、当該XML文書をXML文書格納部10に出力する。
The broken
数値格納部50は、縦横格子の左上端点から右下端点までの最短経路のそれぞれに構造番号を付し、XML文書の構造に対応する構造番号を格納するための格納部である。
The numerical
次に、本実施の形態に係るXML文書処理装置の動作について説明する。まず、XML文書からテーブル形式のデータへ変換するXML文書変換装置30の動作について説明する。
Next, the operation of the XML document processing apparatus according to this embodiment will be described. First, the operation of the XML
最初に、XML文書変換装置30は、XML文書格納部10から、テーブル形式のデータ(情報リスト及び構造番号)に変換したいXML文書を取り出す。そして、XML文書変換装置30は、XML文書を取り出した後、XML文書の各ノードに対して、ノード名称抽出部31、ノード種類抽出部32,ノード深さ測定部33がそれぞれ以下の操作を行う。
First, the XML
まず、(1)ノード名称抽出部31が、取り出したXML文書の各ノードからノード名称を取得する。(2)ノード種類抽出部32が、取り出したXML文書の各ノードからノード種類を取得する。(3)ノード深さ測定部33が、ルートノードの深さを1として、各ノードのノード深さを測定する。つまり、ルートノードの子ノードのノード深さは2、その子ノードの深さは3、というようになる。
First, (1) the node name extraction unit 31 acquires a node name from each node of the extracted XML document. (2) The node
さらに、(4)折れ線変換部34では、ノード深さ測定部33でノード深さを測定したノード数nのXML文書を、ルートノード以外の各ノードについてノード深さ順に並べた長さn−1の数列で表す。そして、折れ線変換部34では、当該数列を、縦横n本ずつの格子に沿って左上端点から右上半分に決して入らないような右下端点まで至る最短経路に対応させる。ここで、右上半分に決して入らないような右下端点まで至る最短経路とは、左上端点から右下端点に至る最短経路のうち、端子間を下に移動する回数を、端子間を右に移動する回数が常に上回らないように至る最短経路である。折れ線変換部34で用いる格子の縦経路には、所定の基準に基づき数字が順に割り振られており、当該数字とXML文書の長さn−1の数列とが同じになるように最短経路を選択する。
Further, (4) the broken
(5)数値変換部35は、格子の左上端点から右下端点までの最短経路のそれぞれに構造番号を付し、折れ線変換部34で変換した最短経路に対応する構造番号を数値格納部50に出力する。なお、最短経路のそれぞれに付す構造番号は、所定の基準に基づき格子の横経路のいくつかに割り当てられた数字を、最短経路に沿って足した値となる。
(5) The numerical
具体的に、図2に示すXML文書をXML文書格納部10から取り出した場合に、XML文書変換装置30が行う(1)〜(5)の操作について説明する。図3は、図2に示すXML文書の木構造を示す説明図である。図4は、図2に示すXML文書から抽出した情報リスト(ノード名称及びノード種類)の説明図である。
Specifically, the operations (1) to (5) performed by the XML
まず、図2に示すaaaのノードでは、ノード名称抽出部31がノード名称aaaを抽出する。そして、ノード種類抽出部32が当該ノード(aaa)のノード種類「空でない要素」を抽出する。aaaのノードは、ルートノードであり、ルートノードの深さを1としているので、ノード深さ測定部33ではノード深さ1を得ることになる。以上の操作により、XML文書変換装置30は、図4に示す情報リストの1行目の1番目にaaaを、2行目の1番目に「空でない要素」を格納する。
First, in the node aaa shown in FIG. 2, the node name extraction unit 31 extracts the node name aaa. Then, the node
次に、図2に示すbbbのノードでは、ノード名称抽出部31がノード名称bbbを抽出する。そして、ノード種類抽出部32が当該ノード(bbb)のノード種類「属性」を抽出する。上述したように本願では、「属性」が「要素」の子ノードという約束であるから、bbbのノードの深さは2となり、ノード深さ測定部33はノード深さ2を得る。以上の操作により、XML文書変換装置30は、図4に示す情報リストの1行目の2番目にbbbを、2行目の2番目に「属性」を格納する。
Next, in the node bbb shown in FIG. 2, the node name extraction unit 31 extracts the node name bbb. Then, the node
次に、図2に示すcccのノードでは、ノード名称抽出部31がノード名称cccを抽出する。そして、ノード種類抽出部32が当該ノード(ccc)のノード種類「属性のテキスト」を抽出する。cccのノードの深さは3であり、ノード深さ測定部33はノード深さ3を得る。以上の操作により、XML文書変換装置30は、図4に示す情報リストの1行目の3番目にcccを、2行目の1番目に「属性のテキスト」を格納する。
Next, in the node of ccc shown in FIG. 2, the node name extraction unit 31 extracts the node name ccc. Then, the node
次に、図2に示すdddのノードでは、ノード名称抽出部31がノード名称dddを抽出する。そして、ノード種類抽出部32が当該ノード(ddd)のノード種類「空でない要素」を抽出する。dddのノードの深さは2であり、ノード深さ測定部33はノード深さ2を得る。以上の操作により、XML文書変換装置30は、図4に示す情報リストの1行目の4番目にdddを、2行目の4番目に「空でない要素」を格納する。
Next, at the node ddd shown in FIG. 2, the node name extraction unit 31 extracts the node name ddd. Then, the node
次に、図2に示すeeeのノードでは、ノード名称抽出部31がノード名称eeeを抽出する。そしてノード種類抽出部32が当該ノード(eee)のノード種類「要素のテキスト」を抽出する。eeeのノードの深さは3であり、ノード深さ測定部33はノード深さ3を得る。以上の操作により、XML文書変換装置30は、図4に示す情報リストの1行目の5番目にeeeを、2行目の5番目に「要素のテキスト」を格納する。
Next, in the node of eee shown in FIG. 2, the node name extraction unit 31 extracts the node name eee. Then, the node
以上のように、ノード(aaa)は、ノード深さが「1」でルートノード(親ノード)であり、この親ノードに対する子ノードは、ノード深さが「2」であるノード(bbb)とノード(ddd)である。そのため、当該関係を図3の木構造で表せば、ノード(aaa)にノード(bbb)及びノード(ddd)がぶら下がる関係となる。さらに、ノード(bbb)に対する子ノード(ノード(aaa)に対する孫ノード)は、ノード深さが「3」であるノード(ccc)である。そのため、当該関係を図3の木構造で表せば、ノード(bbb)にノード(ccc)がぶら下がる関係となる。同様に、ノード(ddd)に対する子ノード(ノード(aaa)に対する孫ノード)は、ノード深さが「3」であるノード(eee)である。そのため、当該関係を図3の木構造で表せば、ノード(ddd)にノード(eee)がぶら下がる関係となる。 As described above, the node (aaa) is the root node (parent node) with the node depth “1”, and the child node for this parent node is the node (bbb) with the node depth “2”. Node (ddd). Therefore, if the relationship is represented by the tree structure in FIG. 3, the node (bbb) and the node (ddd) hang from the node (aaa). Furthermore, a child node (a grandchild node for the node (aaa)) for the node (bbb) is a node (ccc) having a node depth of “3”. Therefore, if the relationship is represented by the tree structure of FIG. 3, the node (ccc) hangs from the node (bbb). Similarly, a child node for the node (ddd) (a grandchild node for the node (aaa)) is a node (eee) having a node depth of “3”. Therefore, if the relationship is represented by the tree structure in FIG. 3, the node (eee) hangs from the node (ddd).
また、以上の操作により、図4に示すような情報リストが作成され、リスト格納部20に格納される。さらに、ノード深さ測定部33では、各ノードのノード深さについてノード深さ順に並べた数列12323を得る。
Further, the information list as shown in FIG. 4 is created by the above operation and stored in the
次に、折れ線変換部34では、数列12323のうち、ルートノードの深さ1を除いた数列2323(長さn−1)を、縦横5本(n本)ずつの格子に沿って左上端点から右上半分には決して入らないように右下端点に至る最短経路に変換する。そして、数値変換部35は、折れ線変換部34で変換した最短経路を、複数ある最短経路のうちから識別できるように番号(構造番号)を付して数値化する。なお、これらの処理には、以下に説明する数学的知見が必要となる。
Next, in the polygonal
まず、(ア)XML文書はラベル付き順序木(ordered tree)である。従って、XML文書の構造は順序木となる。(イ)n個のノードを持つ順序木とn個のノードを持つ2分木は1対1に対応することが数学的に知られている。(ウ)n個のノードを持つ2分木の場合の数は、カタラン数Cn−1であることが数学的に知られている。ここでカタラン数Cn(n≧0)の一般式は、Cn=(2n)!/((n+1)!n!)で与えられる。(エ)カタラン数Cnは、縦横n+1本ずつの格子に沿って左上端点から右上半分には決して入らないように右下端点に至る最短経路の数に等しいことが数学的に知られている。 First, (a) an XML document is a labeled ordered tree. Therefore, the structure of the XML document is an ordered tree. (A) It is mathematically known that an ordered tree having n nodes and a binary tree having n nodes have a one-to-one correspondence. (C) It is mathematically known that the number of binary trees having n nodes is the Catalan number Cn-1. Here, the general formula for the Catalan number Cn (n ≧ 0) is Cn = (2n)! / ((N + 1)! N!). (D) It is mathematically known that the Catalan number Cn is equal to the number of shortest paths from the upper left end point to the upper right half point along the grid of n + 1 vertical and horizontal lines so as to never enter the upper right half point.
以上の(ア)〜(エ)条件により、n個のノードを持つXML文書の取りうる構造の場合の数は、縦横n本ずつの格子に沿って左上端点から右上半分には決して入らないように右下端点に至る最短経路の数に等しいことが分かる。 According to the above conditions (a) to (d), the number of structures that can be taken by an XML document having n nodes is such that it never enters the upper right half from the upper left end point along n vertical and horizontal grids. It can be seen that it is equal to the number of shortest paths to the lower right end point.
上述した一般式でカタラン数Cn−1を計算することができるが、帰納的に求めることもできる。具体的に、n=5の場合のカタラン数C4は、図5に示す縦横5本ずつの格子の左上端点から右下端点までの最短距離の場合の数で求めることができる。 Although the Catalan number Cn−1 can be calculated by the general formula described above, it can also be obtained inductively. Specifically, the catalan number C4 in the case of n = 5 can be obtained by the number in the shortest distance from the upper left end point to the lower right end point of each of the five vertical and horizontal grids shown in FIG.
なお、左上端点から右下端点までの最短経路は、右下端点から左上端点までの最短経路に等しい。そのため、図5では、右下端点である頂点Aから左上端点である頂点Oに至る最短距離を説明する。まず、頂点Aから頂点Bまでの経路は1通りなので、図5に示すように頂点Bに1を記す。頂点Aから頂点Cまでの経路は、頂点Bを経由する場合しかなく1通りであり、図5に示すように頂点Cに1を記す。頂点Aから頂点Fまでの経路は、頂点Bを経由する場合しかなく1通りであり、図5に示すように頂点Fに1を記す。 The shortest path from the upper left end point to the lower right end point is equal to the shortest path from the lower right end point to the upper left end point. Therefore, in FIG. 5, the shortest distance from the vertex A that is the lower right end point to the vertex O that is the upper left end point will be described. First, since there are only one path from the vertex A to the vertex B, 1 is written in the vertex B as shown in FIG. The path from the vertex A to the vertex C is only one way through the vertex B, and 1 is written in the vertex C as shown in FIG. There is only one path from the vertex A to the vertex F when passing through the vertex B, and 1 is written in the vertex F as shown in FIG.
頂点Aから頂点Gまでの経路は、頂点Cを経由する場合と頂点Fを経由する場合で2通りある。よって、頂点Aから頂点Gまでの経路は、頂点Cに記されている値1と頂点Fに記されている値1を足した値になり、図5に示すように頂点Gに2を記す。以上の関係に基づき、頂点Aからある頂点までの経路は、頂点Aからある頂点のすぐ下の頂点までの経路と、頂点Aからある頂点のすぐ右の頂点までの経路の和に等しいことが分かる。
There are two paths from the vertex A to the vertex G, when passing through the vertex C and when passing through the vertex F. Therefore, the path from the vertex A to the vertex G is a value obtained by adding the
この法則に基づき、各頂点に値を順番に記していくと、図5に示すように頂点Nには14が記される。従って、頂点Aから頂点Oまでの経路は14通りとなる。 Based on this rule, when values are written in order at each vertex, 14 is written at the vertex N as shown in FIG. Accordingly, there are 14 paths from the vertex A to the vertex O.
以上の知見を踏まえ、折れ線変換部34の動作を説明する。図6に示す格子では、各縦の経路には数字が順に割り振られている。つまり、図6の左端の縦の経路には2,3,4,5が、次の縦の経路には2,3,4が割り振られている。そして、折れ線変換部34は、ノード深さ測定部33で得た数列2323と縦の経路に割り振られた数字とが等しくなるように最短経路を選択する。具体的には、左上端点から図6の左端の縦の経路に割り振られた数字を2,3と進み、横方向に2頂点分進み、さらに縦の経路に割り振られた数字を2,3と進み、そして横方向に進んで右下端点に至ることで、数列2323と等しくなる。図6の左上端点から右下端点に至る全ての最短経路及び当該経路で得られる数列を図7に示す。図7において実線で囲まれた最短経路が、数列2323の最短経路を表している。なお、図7に示す数列は、ルートノードの深さ1を付加した表記となっている。
Based on the above knowledge, the operation of the
次に、数値変換部35の動作について説明する。まず、数値変換部35は、格子の最短経路に番号(構造番号)付す。図5に示す格子に対しては、14通りある最短経路のそれぞれに0番目から13番目までの番号を付ける。具体的に説明すると、まず頂点Oから頂点Nに進むと、頂点Nから下に進み頂点Lを経由する選択肢と、頂点Nから右に進み頂点Mを経由する選択肢とがある。図5で説明したように、頂点Nから下に進み頂点Lを経由して頂点Aまで到達する経路は9通り、頂点Nから右に進み頂点Mを経由して頂点Aまで到達する経路は5通りある。ここで、右に進むより下に進む方ほど順番が早いという規則を設けると、頂点Nから右に進み頂点Mを経由する経路は、頂点Nから下に進み頂点Lを経由する経路より、少なくとも順番が9番遅いということになるので、頂点Nから頂点Mに向かう経路に図8に示すように9と記す。
Next, the operation of the numerical
さらに、頂点Nから下に進み頂点Lに進むと、頂点Lから下に進み頂点Iを経由する選択肢と、頂点Lから右に進み頂点Kを経由する選択肢とがある。図5で説明したように、頂点Lから下に進み頂点Iを経由して頂点Aまで到達する経路は4通り、頂点Lから右に進み頂点Kを経由して頂点Aまで到達する経路は5通りある。すると、頂点Lから右に進み頂点Kを経由する経路は、頂点Lから下に進み頂点Iを経由する経路より、少なくとも順番が4番遅いということになるので、LからKに向かう経路に図8に示すように4と記す。 Further, when proceeding downward from the vertex N and proceeding to the vertex L, there are an option proceeding downward from the vertex L via the vertex I and an option proceeding right from the vertex L via the vertex K. As described with reference to FIG. 5, there are four paths that go down from the vertex L and reach the vertex A via the vertex I, and go to the right from the vertex L and reach the vertex A via the vertex K. There are streets. Then, the route going from the vertex L to the right and passing through the vertex K is at least 4th order lower than the route going from the vertex L and going through the vertex I, so the route from L to K is shown in FIG. As shown in FIG.
さらに、頂点Lから右に進み頂点Kに進む、あるいは頂点Nから右に進み頂点Mを経由して頂点Kに進むと、頂点Kから下に進み頂点Hを経由する選択肢と、頂点Kから右に進み頂点Jを経由する選択肢とがある。図5で説明したように、頂点Kから下に行き頂点Hを経由して頂点Aまで到達する経路は3通り、頂点Kから右に行き頂点Jを経由して頂点Aまで到達する経路は2通りある。すると、頂点Kから右に行き頂点Jを経由する経路は、頂点Kから下に行き頂点Hを経由する経路より少なくとも順番が3番遅いということになるので、頂点Kから頂点Jまでの経路に図8に示すように3と記す。 Further, when going from the vertex L to the right and going to the vertex K, or going from the vertex N to the right and going to the vertex K via the vertex M, the option to go down from the vertex K and go through the vertex H, and from the vertex K to the right There is an option to go through the vertex J. As described with reference to FIG. 5, there are three paths that go down from the vertex K and reach the vertex A via the vertex H, and go to the right from the vertex K and reach the vertex A via the vertex J. There are streets. Then, the route going from the vertex K to the right and passing through the vertex J is at least 3 times slower than the route going from the vertex K and going through the vertex H, so the route from the vertex K to the vertex J As shown in FIG.
以下、同じように下に行く選択肢と右に行く選択肢が選べる場合、右に行くと少なくとも順番が何番遅いかを経路に全て記すと、図8のようになる。 Hereinafter, in the same way, when the option to go down and the option to go to the right can be selected, it is as shown in FIG.
そして、図8に示す横の経路に割り当てられた数値を用いて、図5に示す格子の各最短経路に番号(構造番号)を付す。つまり、各最短経路に番号(構造番号)は、最短経路で通った軌跡の横の経路に割り当てられた数値を足した値になる。具体的には、頂点Oから頂点Aに至る最短経路のうち、頂点N,L,I,E,D,C,Bを通過する最短経路は、図8に示す横の経路に割り振られた数値を足した値が0となるので、当該最短経路の番号(構造番号)は0となる。同様に、図2のXML文書に対応する数列2323の最短経路は、頂点N,L,K,J,G,C,Bを通過するので、図8に示す横の経路に割り振られた数値を足した値が7となり、当該最短経路の番号(構造番号)は7となる。なお、図7に示す全ての最短経路に対して番号を付した結果は、図9のようになる。 Then, using the numerical values assigned to the horizontal paths shown in FIG. 8, numbers (structure numbers) are assigned to the shortest paths of the lattice shown in FIG. That is, the number (structure number) for each shortest path is a value obtained by adding the numerical values assigned to the paths next to the trajectory passed through the shortest path. Specifically, among the shortest paths from the vertex O to the vertex A, the shortest path passing through the vertices N, L, I, E, D, C, and B is a numerical value assigned to the horizontal path shown in FIG. Since the value obtained by adding is 0, the number of the shortest path (structure number) is 0. Similarly, since the shortest path of the sequence 2323 corresponding to the XML document in FIG. 2 passes through the vertices N, L, K, J, G, C, and B, the numerical values assigned to the horizontal paths shown in FIG. The added value is 7, and the number of the shortest path (structure number) is 7. The result of assigning numbers to all the shortest paths shown in FIG. 7 is as shown in FIG.
数値変換部35は、上述のように図2のXML文書に対応する数列2323の最短経路の構造番号が7と得られた場合、当該番号を数値格納部50に格納する。以上の処理により、「空でない要素」「空要素」「要素のテキスト」「属性」「属性のテキスト」からなる任意のXML文書の構造を、情報リストや構造番号からなるテーブル形式のデータに変換することができる。
If the structure number of the shortest path in the sequence 2323 corresponding to the XML document in FIG. 2 is obtained as 7 as described above, the numerical
次に、テーブル形式のデータ(情報リスト及び構造番号)からXML文書へ復元するXML文書復元装置40の動作について説明する。まず、XML文書復元装置40は、数値格納部50から、復元したいXML文書の構造番号を取り出す。そして、折れ線復元部45は、取得した構造番号を格子の左上端点から右下端点に至る最短経路の番号と対応させて、取得した構造番号に対応する最短経路に変換する。ここで、数値格納部50から取得した構造番号は、図8で示したように格子の最短経路を通った軌跡上の横経路に割り当てられた数値を足した値で決められている。
Next, the operation of the XML
図8に示す格子を用いて、構造番号7の最短経路を復元する折れ線復元部45での処理例を説明する。まず、頂点Oから頂点Nに進むと、頂点Nから右に進み頂点Mを経由する経路は、頂点Nから下に進み頂点Lを経由する経路より少なくとも順番が9番遅い。これは、頂点Nから下に進み頂点Lを経由する経路は9番目より早く、頂点Nから右に進み頂点Mを経由する経路は9番目もしくはそれより遅いということになる。従って、構造番号7(7番目)の最短経路は、頂点Nから下に進み頂点Lを経由する経路となる。
A processing example in the polygonal
次に、頂点Nから頂点Lに進むと、頂点Lから右に進み頂点Kを経由する経路は、頂点Lから下に進み頂点Iを経由する経路より少なくとも順番が4番遅い。これは、頂点Lから下に進み頂点Iを経由する経路は4番目より早く、頂点Lから右に進み頂点Kを経由する経路は4番目もしくはそれより遅いということになる。従って、構造番号7(7番目)の最短経路は、頂点Nから右に進み頂点Kを経由する経路となる。 Next, when going from the vertex N to the vertex L, the route going from the vertex L to the right and passing through the vertex K is at least 4th order in turn lower than the route going from the vertex L and going through the vertex I. This means that the path going from the vertex L and going through the vertex I is earlier than the fourth path, and the path going from the vertex L to the right and going through the vertex K is the fourth or later. Therefore, the shortest path of structure number 7 (seventh) is a path that goes to the right from the vertex N and passes through the vertex K.
さらに、頂点Lから頂点Kへ進むと、頂点Kから右に進み頂点Jを経由する経路は、頂点Kから下に進み頂点Hを経由する経路より少なくとも順番が3番遅い。既に、頂点L,Kを通過する最短経路は、4番目もしくはそれ以降であるため、頂点Kから下に進み頂点Hを経由する経路は4+3=7番目より早く、頂点Kから右に進み頂点Jを経由する経路は4+3=7番目もしくはそれより遅いということになる。従って、構造番号7(7番目)の最短経路は、頂点Kから右に進み頂点Jを経由する経路となる。 Further, when going from the vertex L to the vertex K, the route going from the vertex K to the right and passing through the vertex J is at least the third slower than the route going down from the vertex K and going through the vertex H. Since the shortest path that passes through the vertices L and K is already the fourth or later, the path that goes down from the vertex K and passes through the vertex H is faster than the 4 + 3 = 7th, goes to the right from the vertex K, and reaches the vertex J The route via is 4 + 3 = 7th or slower. Therefore, the shortest path of structure number 7 (seventh) is a path that goes right from the vertex K and passes through the vertex J.
頂点Kから頂点Jを経由して頂点Gへ進むと、頂点Gから右に進み頂点Fを経由する経路は、頂点Gから下に進み頂点Cを経由する経路より少なくとも順番が1番遅い。既に、頂点L,K,J,Gを通過する最短経路は、7番目もしくはそれ以降であるため、頂点Gから下に進み頂点Cを経由する経路は7+1=8番目より早く、頂点Gから右に進み頂点Fを経由する経路は7+1=8番目もしくはそれより遅いということになる。従って、構造番号7(7番目)の最短経路は、頂点Kから下に進み頂点Cを経由する経路となる。 When going from the vertex K to the vertex G via the vertex J, the route going from the vertex G to the right and going through the vertex F is at least as late as the route going down from the vertex G and going through the vertex C. Since the shortest path that passes through the vertices L, K, J, and G is already the seventh or later, the path that goes down from the vertex G and passes through the vertex C is earlier than the 7 + 1 = 8th, and is right from the vertex G. The route passing through the vertex F is 7 + 1 = 8th or later. Accordingly, the shortest path of structure number 7 (seventh) is a path that goes down from the vertex K and passes through the vertex C.
頂点Gから下に進むと、最短経路の選択肢はなく、頂点C,Bを経由し頂点Aに到達する。以上のように、選択肢のある頂点で順番の計算することで、構造番号7(7番目)の最短経路は図9において実線で囲まれた経路であることが分かる。 When going down from the vertex G, there is no shortest path option, and the vertex A is reached via the vertices C and B. As described above, by calculating the order at the vertices with options, it can be seen that the shortest path of structure number 7 (seventh) is a path surrounded by a solid line in FIG.
折れ線復元部45で最短経路が復元された後に、数列復元部44では、復元された最短経路を、ノード数nのXML文書においてルートノード以外の各ノードについてノード深さ順に並べた長さn−1の数列に復元する。数列復元部44の処理を具体的に説明すると、構造番号7(7番目)の最短経路である図9において実線で囲まれた最短経路が、図7において実線で囲まれた最短経路に対応し、その数列が2323となる。さらに、ルートノードの深さは1であるから、復元すべきXML文書の構造の数列は12323となる。
After the shortest path is restored by the broken
数列復元後に、木構造復元部43が、復元した数列に対応するXML文書の木構造を復元する。数列12323は、XML文書の木構造で表すと図3のようになる。木構造を復元した後に、XML文書復元装置40は、リスト格納部20からXML文書の各ノードのノード名称とノード種類が格納された情報リストを取り出し、ノード種類付与部42が、当該情報リストに基づき、XML文書の各ノードに対してノード種類を付与する。
After the number sequence restoration, the tree
ノード種類付与部42の処理を、図4の例に基づいて説明する。まず、図4に示す情報リストの2行目の1番目の値が「空でない要素」であるから、XML文書の1番目のノードに「空でない要素」のノード種類が付与される。さらに、図4に示す情報リストの2行目の2〜6番目についても同様に、XML文書の2〜6番目の各ノードに対してノード種類がそれぞれ付与される。
The processing of the node
XML文書の各ノードにノード種類を付与した後、ノード名称付与部41は、当該情報リストに基づき、XML文書の各ノードにノード名称を付与する。ノード名称付与部41の処理を、の例に基づいて説明する。まず、図4に示す情報リストの1行目の1番目の値がaaaであるから、XML文書の1番目のノードにはaaaのノード名称が付与される。さらに、図4に示す情報リストの2行目の2〜6番目についても同様に、XML文書の2〜6番目の各ノードに対してノード名称がそれぞれ付与される。 After assigning a node type to each node of the XML document, the node name assigning unit 41 assigns a node name to each node of the XML document based on the information list. The process of the node name assigning unit 41 will be described based on an example. First, since the first value in the first line of the information list shown in FIG. 4 is aaa, the node name of aaa is given to the first node of the XML document. Further, similarly, the node names are assigned to the second to sixth nodes of the XML document for the second to sixth nodes in the second row of the information list shown in FIG.
そして、XML文書復元装置40は、ノード名称付与部41乃至折れ線復元部45の処理により得られたノードの木構造、各ノード種類、各ノード名称により、XML文書を復元することができる。なお、復元されたXML文書は、XML文書復元装置40から文書格納部10へ格納される。
Then, the XML
以上のように、本実施の形態に係るXML文書復元装置40は、情報リストと構造番号から、「空でない要素」「空要素」「属性」「要素のテキスト」「属性のテキスト」のノードからなる任意のXML文書を復元することができる。
As described above, the XML
本実施の形態のXML文書変換装置30は、上述したようにXML文書を情報リスト及び構造番号に変換することができる。また、本実施の形態に係るXML文書変換装置30は、格子の最短経路にXML文書の構造を対応させて数値(構造番号)に変換することができる。また、本実施の形態1に係るXML文書変換装置30は、ノード種類を、空でない要素、空要素、属性、要素のテキスト、属性のテキストとしたので、XML文書で最も基本となる情報単位でXML文書の構造を数値(構造番号)化できる。さらに、数値(構造番号)でXML文書の構造を保持できるので、XML文書の操作に必要となるメモリが少なくてすむ。
The XML
本実施の形態のXML文書復元装置40は、上述したように情報リスト及び構造番号からXML文書を復元することができる。また、本実施の形態に係るXML文書復元装置40は、格子の最短経路にXML文書の構造を対応させた数値(構造番号)から簡単な処理で元のXML文書の構造に復元することができる。さらに、本実施の形態に係るXML文書復元装置40は、ノード種類を、空でない要素、空要素、属性、要素のテキスト、属性のテキストとしたので、XML文書で最も基本となる情報単位で数値(構造番号)からXML文書の構造を復元できる。
As described above, the XML
(実施の形態2)
実施の形態1では、数値変換部35及び折れ線復元部45において、右に進むよりも下に進む方が最短経路の順番が早い規則を設定していた。しかし、本発明に係る数値変換部35及び折れ線復元部45は当該規則に限定されない。そこで、本実施の形態に係る数値変換部35及び折れ線復元部45では、下に進むよりも右に進む方が最短経路の順番が早い規則を設定している。この場合、格子の縦経路のいくつかに数字が割り当てられており、最短経路で通った軌跡上にある当該数字を足した値が最短経路の番号(構造番号)となる。なお、本実施の形態に係るXML文書処理装置は、上記規則以外実施の形態1と同じ構成であるため、同じ要素には同一符号を付し、詳細な説明は省略する。
(Embodiment 2)
In the first embodiment, in the numerical
本実施の形態において、図5に示す格子の最短経路に対して0番目から13番目までの番号(構造番号)を付与する方法を以下に説明する。まず、図5に示す頂点Oから頂点Nに進むと、頂点Nから下に進み頂点Lを経由する選択肢と、頂点Nから右に進み頂点Mを経由する選択肢とがある。頂点Nから下に進み頂点Lを経由して頂点Aまで到達する経路は9通り、頂点Nから右に進み頂点Mを経由して頂点Aまで到達する経路は5通りある。ここで、本実施の形態では、下に進むよりも右に進む方が最短経路の順番が早い規則を設定しているので、頂点Nから下に進み頂点Lを経由する経路は、頂点Nから右に進み頂点Mを経由する経路より、少なくとも順番が5番遅いということになり、頂点Nから頂点Lに向かう経路に図10に示すように5を記す。 In the present embodiment, a method for assigning 0th to 13th numbers (structure numbers) to the shortest path of the lattice shown in FIG. 5 will be described below. First, when going from the vertex O to the vertex N shown in FIG. 5, there are options that go down from the vertex N via the vertex L and options that go right from the vertex N and go through the vertex M. There are nine paths that go down from the vertex N and reach the vertex A via the vertex L, and there are five paths that go right from the vertex N and reach the vertex A via the vertex M. Here, in the present embodiment, a rule is set in which the order of the shortest path is faster in the right direction than in the downward direction. Therefore, the path that goes down from the vertex N and passes through the vertex L is from the vertex N. This means that the order is at least 5 slower than the route passing right and going through the vertex M, and 5 is written on the route from the vertex N to the vertex L as shown in FIG.
次に、頂点Nから下に進み頂点Lに進むと、頂点Lから下に進み頂点Iを経由する選択肢と、頂点Lから右に進み頂点Kを経由する選択肢とがある。図5において説明したように、頂点Lから下に進み頂点Iを経由して頂点Aまで到達する経路は4通り、頂点Lから右に進み頂点Kを経由して頂点Aまで到達する経路は5通りある。従って、頂点Lから下に進み頂点Iを経由する経路は、頂点Lから右に進み頂点Kを経由する経路より、少なくとも順番が5番遅いということになるので、頂点Lから頂点Iに向かう経路に図10に示すように5を記す。 Next, when proceeding downward from the vertex N and proceeding to the vertex L, there are an option proceeding downward from the vertex L via the vertex I and an option proceeding right from the vertex L via the vertex K. As described in FIG. 5, there are four paths that go down from the vertex L and reach the vertex A via the vertex I, and there are 5 paths that go from the vertex L to the right and reach the vertex A via the vertex K. There are streets. Therefore, the route going from the vertex L and going through the vertex I is at least 5th in order than the route going from the vertex L to the right and going through the vertex K, so the route going from the vertex L to the vertex I. As shown in FIG.
さらに、頂点Lから右に進み頂点Kに進む、あるいは頂点Nから頂点右に進み頂点Mを経由して頂点Kに進むと、頂点Kから下に進み頂点Hを経由する選択肢と、頂点Kから右に進み頂点Jを経由する選択肢とがある。図5において説明したように、頂点Kから下に行き頂点Hを経由して頂点Aまで到達する経路は3通り、頂点Kから右に行き頂点Jを経由して頂点Aまで到達する経路は2通りある。従って、頂点Kから下に行き頂点Hを経由する経路は、頂点Kから右に行き頂点Jを経由する経路より少なくとも順番が2番遅いということになるので、頂点Kから頂点Hに向かう経路に図10に示すように2を記す。 Further, when going from the vertex L to the right and going to the vertex K, or going from the vertex N to the right and going through the vertex M to the vertex K, the option to go down from the vertex K and go through the vertex H, and from the vertex K There is an option to go right and go through vertex J. As described in FIG. 5, there are three paths that go down from the vertex K and reach the vertex A via the vertex H, and go to the right from the vertex K and reach the vertex A via the vertex J. There are streets. Therefore, the path going from the vertex K and going through the vertex H is at least the second order in the order going from the vertex K to the right and going through the vertex J. As shown in FIG.
以下、同じように下に行く選択肢と右に行く選択肢とが選べる場合、下に行くと少なくとも順番が何番遅くなるのかを縦経路に全て記す。図5に示す格子に対して、上述の方法で縦経路に数字を割り当てた結果が図10のようになる。 In the same way, if the option to go down and the option to go to the right can be selected in the same way, at least how much the order is delayed when going down is written in the vertical path. FIG. 10 shows the result of assigning numbers to the vertical paths by the above-described method for the lattice shown in FIG.
そして、最短経路の番号(構造番号)は、最短経路で通った軌跡上の縦経路に割り当てられた数字を足した値となる。図2に示したXML文書では、最短経路が図7において実線で囲まれた経路のようになり、この経路(頂点O,N,L,K,J,G,C,B,A)上にある縦経路に割り当てられた数字の合計は6となる。従って、図2に示したXML文書の最短経路の番号(構造番号)は、6である。なお、なお、本実施の形態において、図7に示す全ての最短経路に対する番号は、図11に示すようになる。 The shortest path number (structure number) is a value obtained by adding the numbers assigned to the vertical paths on the trajectory passed through the shortest path. In the XML document shown in FIG. 2, the shortest route becomes a route surrounded by a solid line in FIG. 7, and on this route (vertices O, N, L, K, J, G, C, B, A) The sum of the numbers assigned to a certain vertical path is 6. Therefore, the shortest path number (structure number) of the XML document shown in FIG. In the present embodiment, the numbers for all the shortest paths shown in FIG. 7 are as shown in FIG.
次に、折れ線復元部45の処理において、番号(構造番号)6から図10に示す格子での最短経路を復元する場合を説明する。まず、頂点Oから頂点Nに進むと、頂点Nから下に進み頂点Lを経由する経路は、頂点Nから右に進み頂点Mを経由する経路より少なくとも順番が5番遅い。これは、頂点Nから右に進み頂点Mを経由する経路が5番目より早く、頂点Nから下に進み頂点Lを経由する経路が5番目もしくはそれより遅いということになる。従って、6番目の経路は、頂点Nから下に進み頂点Lを経由する経路となる。
Next, a case where the shortest path in the lattice shown in FIG. 10 is restored from the number (structure number) 6 in the processing of the broken
次に、頂点Nから頂点Lに進むと、頂点Lから下に進み頂点Iを経由する経路は、頂点Lから右に進み頂点Kを経由する経路より少なくとも順番が5番遅い。既に、頂点N,Lを通過する最短経路は5番目もしくはそれ以降であるため、頂点Lから右に進み頂点Kを経由する経路が5+5=10番目より早く、頂点Lから下に進み頂点Iを経由する経路が5+5=10番目もしくはそれより遅いということになる。従って、6番目の経路は、頂点Nから右に進み頂点Kを経由する経路となる。 Next, when going from the vertex N to the vertex L, the route going from the vertex L and going through the vertex I goes to the right from the vertex L and is at least 5th in turn in the order of going through the vertex K. Since the shortest path that passes through the vertices N and L is already the fifth or later, the path going to the right from the vertex L and going through the vertex K is faster than the 5 + 5 = 10th, going down from the vertex L and moving the vertex I. This means that the route that passes is 5 + 5 = 10th or slower. Therefore, the sixth route is a route that goes to the right from the vertex N and passes through the vertex K.
さらに、頂点Lから頂点Kへ進むと、頂点Kから下に進み頂点Hを経由する経路は、頂点Kから右に進み頂点Jを経由する経路より少なくとも順番が2番遅い。既に、頂点N,L,Kを通過する最短経路は5番目もしくはそれ以降であるため、頂点Kから右に進み頂点Jを経由する経路が5+2=7番目より早く、頂点Kから下に進み頂点Hを経由する経路が5+2=7番目もしくはそれより遅いということになる。従って、6番目の経路は、頂点Kから右に進み頂点Jを経由する経路となる。 Further, when going from the vertex L to the vertex K, the path going from the vertex K and passing through the vertex H is at least 2nd in turn in the order going from the vertex K to the right and going through the vertex J. Since the shortest path that passes through the vertices N, L, and K is already the fifth or later, the path that goes to the right from the vertex K and goes through the vertex J is earlier than the 5 + 2 = 7th and goes down from the vertex K to the vertex. This means that the route via H is 5 + 2 = 7th or slower. Accordingly, the sixth route is a route that goes to the right from the vertex K and passes through the vertex J.
さらに、頂点Kから頂点Jを経由して頂点Gへ進むと、頂点Gから下に進み頂点Cを経由する経路は、頂点Gから右に進み頂点Fを経由する経路より少なくとも順番が1番遅い。既に、頂点N,L,K,J,Gを通過する経路が5番目もしくはそれ以降であるため、頂点Gから右に進み頂点Fを経由する経路が5+1=6番目より早く、頂点Gから下に進み頂点Cを経由する経路が5+1=6番目もしくはそれより遅いということになる。従って、6番目の経路は、頂点Kから下に進み頂点Cを経由する経路となる。 Further, when going from the vertex K to the vertex G via the vertex J, the path going down from the vertex G and going through the vertex C is at least as late as the path going from the vertex G to the right and going through the vertex F. . Since the path that passes through the vertices N, L, K, J, and G is already the fifth or later, the path that goes to the right from the vertex G and passes through the vertex F is earlier than the 5 + 1 = 6th and descends from the vertex G. And the route passing through the vertex C is 5 + 1 = 6th or later. Therefore, the sixth path is a path that goes down from the vertex K and passes through the vertex C.
頂点Gから下に進むと、最短経路の選択肢はなく、頂点C及び頂点Bを経由して頂点Aに到達する。以上のように、選択肢のある頂点で順番の計算することで、構造番号6(6番目)の最短経路は図11において実線で囲まれた経路であることが分かる。 When going downward from the vertex G, there is no shortest path option, and the vertex A is reached via the vertex C and vertex B. As described above, it is understood that the shortest path having the structure number 6 (sixth) is a path surrounded by a solid line in FIG.
以上のように、本実施の形態に係るXML文書変換装置30及びXML文書復元装置40では、数値格納部35が最短経路の順番について下に進むより右に進むほど順番が早い規則に基づいており、折れ線復元部45が当該規則に基づいて最短経路を復元するので、実施の形態1と同様の効果を期待できる。
As described above, in the XML
10 XML文書格納部、20 リスト格納部、30 XML文書変換装置、31 ノード名称抽出部、32 ノード種類抽出部、33 ノード深さ測定部、34 折れ線変換部、35 数値変換部、40 XML文書復元装置、41 ノード名称付与部、42 ノード種類復元部、43 木構造復元部、44 数列復元部、45 折れ線復元部、50 数値格納部。 10 XML document storage unit, 20 list storage unit, 30 XML document conversion device, 31 node name extraction unit, 32 node type extraction unit, 33 node depth measurement unit, 34 polygonal line conversion unit, 35 numerical value conversion unit, 40 XML document restoration Device, 41 Node name assigning unit, 42 Node type restoring unit, 43 Tree structure restoring unit, 44 Number sequence restoring unit, 45 Polygonal line restoring unit, 50 Numerical value storing unit.
Claims (5)
n個のノードを持つ前記XML文書から各ノードのノード種類を抽出し、当該各ノードの前記ノード種類と前記ノード名称抽出部で抽出した各ノードの前記ノード名称とを含む情報リストをリスト格納部に出力するノード種類抽出部と、
前記XML文書の各ノードを木構造で表した場合のノード深さを測定し、測定した前記ノード深さを順に並べた数列を求めるノード深さ測定部と、
縦横n本ずつの格子に沿って左上端点から右上半分には決して入らないように右下端点に至る全ての最短経路を求め、該全ての最短経路各々における各縦の経路には、左上は2から始まり、真下の縦の経路には1足した数字、右隣の縦の経路には1引いた数字が順に割り振られ、前記ノード深さ測定部により得られた前記数列から先頭の1を除いた数列における前記ノード深さ各々と前記各縦の経路に割り振られた数字とが等しくなる経路を順次選択することによって前記数列を前記最短経路に変換する折れ線変換部と、
前記折れ線変換部により前記求められた前記全ての最短経路のそれぞれを識別する複数の構造番号のうち、前記折れ線変換部により前記変換された前記最短経路に対応する前記構造番号を数値格納部に出力する数値変換部と、を備えるXML文書変換装置。 A node name extraction unit that extracts the XML document from an XML document storage unit that stores an XML (Extensible Markup Language) document, and extracts a node name of each node from the XML document;
Extract the node type of each node from the XML document with n nodes, the said node type and the node name and list storage information list including for each node extracted by the node name extraction unit of each node Node type extraction unit to output to
A node depth measurement unit that measures a node depth when each node of the XML document is represented by a tree structure, and obtains a sequence in which the measured node depths are arranged in order ;
All shortest paths from the upper left end point to the upper right half along the vertical and horizontal n grids are obtained so that the upper left corner is 2 in each vertical path in each of the shortest paths. Starting from, a number added by 1 is assigned to the vertical path immediately below, and a number minus 1 is assigned to the vertical path immediately to the right, and the leading 1 is removed from the sequence obtained by the node depth measurement unit. A polygonal line conversion unit for converting the number sequence to the shortest path by sequentially selecting a path in which each of the node depths in the number sequence is equal to a number assigned to each vertical path ;
Of the plurality of structure numbers for identifying each of the shortest paths obtained by the broken line conversion unit, the structure number corresponding to the shortest path converted by the broken line conversion unit is output to the numerical value storage unit XML document conversion device comprising: a numerical value converter for the.
前記全ての最短経路それぞれを識別する複数の前記構造番号各々は、前記格子における縦横の経路が交差する点において下に行く選択肢と右に行く選択肢とが選べる場合に、前記選択肢の一方に行くよりも他方に行く方が順番が早いという規則の下で設定された数値を前記選択肢の一方の経路の全てに記した前記格子において、前記全ての最短経路各々内における前記選択肢の一方の経路に記された数値の和である、XML文書変換装置。 The XML document conversion device according to claim 1,
Each of the plurality of structure numbers identifying each of the shortest paths is less than one of the options when an option to go down and an option to go to the right can be selected at a point where the vertical and horizontal paths in the grid intersect. In the lattice in which the numerical values set under the rule that the order going to the other is earlier is written in all of the one path of the options, the numerical value is recorded in one path of the options in each of the shortest paths. XML document conversion device that is the sum of the numerical values obtained .
前記全ての最短経路各々における各縦の経路には、左上は2から始まり、真下の縦の経路には1足した数字、右隣の縦の経路には1引いた数字が順に割り振られ、前記折れ線復元部により選択された前記最短経路における前記縦の経路に割り振られた数字の列に対してさらに先頭に1を付与することにより、前記XML文書の各ノードを木構造で表した場合における当該各ノードのノード深さを並べた数列を復元する数列復元部と、
前記数列復元部により復元された前記数列に基づき、前記XML文書の木構造を復元する木構造復元部と、
前記XML文書の各ノードのノード名称及びノード種類を有する情報リストを格納したリスト格納部から前記情報リストを取り出し、当該前記情報リストに基づき、前記木構造復元部により復元された前記XML文書の木構造における各ノードに前記ノード種類を付与するノード種類付与部と、
当該前記情報リストに基づき、前記木構造復元部により復元された前記XML文書の前記木構造における各ノードにさらに前記ノード名称を付与することにより得られる前記XML文書をXML文書格納部に出力するノード名称付与部と、を備えるXML文書復元装置。 Any of the shortest paths from the upper left corner to the upper right half of the structure of an XML (Extensible Markup Language) document having n nodes along the vertical and horizontal grids. The structure number is extracted from the numerical value storage unit stored as the structure number corresponding to, and matches the structure number extracted from the numerical value storage unit among the plurality of structure numbers that identify each of the shortest paths. A polygonal line restoration unit that selects the shortest path corresponding to what to do;
Each vertical path in each of the shortest paths is assigned a number starting from 2 at the top left, a number added by 1 to the vertical path immediately below, and a number subtracted by 1 from the vertical path immediately to the right. In the case where each node of the XML document is represented by a tree structure by adding 1 to the head of the number sequence allocated to the vertical path in the shortest path selected by the broken line restoration unit A number sequence restoration unit for restoring a number sequence in which the node depth of each node is arranged;
A tree structure restoring unit for restoring the tree structure of the XML document based on the number sequence restored by the number sequence restoring unit;
The XML document tree retrieved from the list storage unit storing the information list having the node name and node type of each node of the XML document, and restored by the tree structure restoration unit based on the information list A node type assigning unit for assigning the node type to each node in the structure;
A node that outputs the XML document obtained by assigning the node name to each node in the tree structure of the XML document restored by the tree structure restoration unit to the XML document storage unit based on the information list An XML document restoration device comprising: a name assigning unit .
前記全ての最短経路それぞれを識別する複数の前記構造番号各々は、前記格子における縦横の経路が交差する点において下に行く選択肢と右に行く選択肢とが選べる場合に、前記選択肢の一方に行くよりも他方に行く方が順番が早いという規則の下で設定された数値を前記選択肢の一方の経路の全てに記した前記格子において、前記全ての最短経路各々内における前記選択肢の一方の経路に記された数値の和である、XML文書復元装置。 The XML document conversion device according to claim 3,
Each of the plurality of structure numbers identifying each of the shortest paths is less than one of the options when an option to go down and an option to go to the right can be selected at a point where the vertical and horizontal paths in the grid intersect. In the lattice in which the numerical values set under the rule that the order going to the other is earlier is written in all of the one path of the options, the numerical value is recorded in one path of the options in each of the shortest paths. XML document restoration device that is the sum of the numerical values obtained .
前記XML文書の各ノードのノード名称及びノード種類を有する情報リストを格納したリスト格納部と、 A list storage unit storing an information list having a node name and a node type of each node of the XML document;
n個のノードを持つ前記XML文書の構造を、縦横n本ずつの格子に沿って左上端点から右上半分には決して入らないように右下端点に至る最短経路に対応させた構造番号として格納している数値格納部と、 The structure of the XML document having n nodes is stored as a structure number corresponding to the shortest path from the upper left end point to the upper right half point so as to never enter the upper right half along the vertical and horizontal n grids. A numeric storage unit,
請求項1又は請求項2に記載のXML文書変換装置と、 The XML document conversion device according to claim 1 or 2,
請求項3に記載のXML文書復元装置とを備えるXML文書処理装置。 An XML document processing apparatus comprising the XML document restoration apparatus according to claim 3.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2007171430A JP5100220B2 (en) | 2007-06-29 | 2007-06-29 | XML document conversion apparatus, XML document restoration apparatus, and XML document processing apparatus |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2007171430A JP5100220B2 (en) | 2007-06-29 | 2007-06-29 | XML document conversion apparatus, XML document restoration apparatus, and XML document processing apparatus |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2009009439A JP2009009439A (en) | 2009-01-15 |
| JP5100220B2 true JP5100220B2 (en) | 2012-12-19 |
Family
ID=40324436
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2007171430A Expired - Fee Related JP5100220B2 (en) | 2007-06-29 | 2007-06-29 | XML document conversion apparatus, XML document restoration apparatus, and XML document processing apparatus |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5100220B2 (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP5412905B2 (en) * | 2009-03-18 | 2014-02-12 | 日本電気株式会社 | Life cycle information processing apparatus, life cycle information processing method, and life cycle information processing program |
| CN110765123A (en) * | 2018-07-09 | 2020-02-07 | 株式会社日立制作所 | Method, device and system for storing material data based on tree structure |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2005141650A (en) * | 2003-11-10 | 2005-06-02 | Seiko Epson Corp | Structured document encoding apparatus, structured document encoding method and program thereof |
| JP4675748B2 (en) * | 2005-10-27 | 2011-04-27 | 三菱電機株式会社 | XML data conversion device and XML data restoration device |
| JP4821287B2 (en) * | 2005-11-28 | 2011-11-24 | Kddi株式会社 | Structured document encoding method, encoding apparatus, encoding program, decoding apparatus, and encoded structured document data structure |
-
2007
- 2007-06-29 JP JP2007171430A patent/JP5100220B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2009009439A (en) | 2009-01-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP4377704B2 (en) | Flow data generation method and flow data generation apparatus | |
| AU2006213978B2 (en) | Document processing method, recording medium, and document processing system | |
| CN106970820A (en) | Code storage method and code storage | |
| CN102741811A (en) | Improving performance of template based JavaScript widgets | |
| CN104881448B (en) | A kind of map path labeling method and device | |
| JP5100220B2 (en) | XML document conversion apparatus, XML document restoration apparatus, and XML document processing apparatus | |
| JP5398213B2 (en) | Generating device, program, and generating method | |
| JP2010282327A (en) | Format conversion system, format conversion method, and program | |
| Biermann et al. | Parallel independence of amalgamated graph transformations applied to model transformation | |
| CN103218349A (en) | Reading and conversion method for PLC (Programmable Logic Controller) instruction storage rule in PMW-format file | |
| CN105793842A (en) | Conversion method and device between serialized messages | |
| JP6958417B2 (en) | Document summarizers, methods, and programs | |
| JP4675748B2 (en) | XML data conversion device and XML data restoration device | |
| JP4868733B2 (en) | Structured document processing apparatus, structured document processing method, and program | |
| JP2012104065A (en) | Language conversion apparatus and language conversion program | |
| CN109101503A (en) | A kind of method and device creating institutional framework hierarchical relationship tree | |
| JP2009128945A (en) | Data processing apparatus and method, and program | |
| JP2014006717A (en) | Data comparison device and data comparison method | |
| JP5929334B2 (en) | Software conversion device, software conversion system, software conversion method, and software conversion program | |
| JP2006011549A (en) | Structured document conversion apparatus and program | |
| JP2005148970A (en) | Method for converting data | |
| JP2005056363A (en) | Xml information transmitter | |
| JP4427307B2 (en) | Graphic processing device | |
| JP6157244B2 (en) | Content management system, content management method and program | |
| JP5820770B2 (en) | Text extracting apparatus, method and program |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20100108 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20120607 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20120612 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20120808 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20120828 |
|
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20120925 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20151005 Year of fee payment: 3 |
|
| R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| LAPS | Cancellation because of no payment of annual fees |