[go: up one dir, main page]

JP5387092B2 - Storage medium and trie tree generation method - Google Patents

Storage medium and trie tree generation method Download PDF

Info

Publication number
JP5387092B2
JP5387092B2 JP2009080245A JP2009080245A JP5387092B2 JP 5387092 B2 JP5387092 B2 JP 5387092B2 JP 2009080245 A JP2009080245 A JP 2009080245A JP 2009080245 A JP2009080245 A JP 2009080245A JP 5387092 B2 JP5387092 B2 JP 5387092B2
Authority
JP
Japan
Prior art keywords
node
key
trie tree
aaa
character
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.)
Active
Application number
JP2009080245A
Other languages
Japanese (ja)
Other versions
JP2010231643A (en
Inventor
真一郎 多湖
達哉 浅井
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2009080245A priority Critical patent/JP5387092B2/en
Publication of JP2010231643A publication Critical patent/JP2010231643A/en
Application granted granted Critical
Publication of JP5387092B2 publication Critical patent/JP5387092B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

本発明は、トライ木を用いて各種の処理を行うトライ木生成装置等に関する。   The present invention relates to a trie tree generation device that performs various processes using a trie tree.

文書検索システムにおいて、キーから所望の文書、値等を高速に検索するべく、トライ木が用いられている(例えば、特許文献1、2参照)。図90は、従来のトライ木の一例を示す図である。このトライ木は、ルートノードを除くノードに対して、1文字あたり1ノードを割当てることにより、木構造を構築している。また、図90に示すトライ木は、キー「black、green、blue、grey、black、grey、greenyellow」にそれぞれ値「1、3、4、5、3、2、1」が割当てられたトライ木を示している。   In a document search system, a trie tree is used to search a desired document, value, and the like from a key at high speed (see, for example, Patent Documents 1 and 2). FIG. 90 is a diagram illustrating an example of a conventional trie tree. In this trie tree, a tree structure is constructed by assigning one node per character to nodes other than the root node. 90 is a trie tree in which the values “1, 3, 4, 5, 3, 2, 1” are assigned to the keys “black, green, blue, grey, black, grey, greenyellow”, respectively. Is shown.

従来の検索装置が、トライ木の検索処理を実行する場合には、入力キーを1文字ずつ取り出し、トライ木上の同じキーのノードを辿る。例えば、検索装置は、入力キー「blue」が指定された場合には、トライ木のノードをノードb、l、u、eの順に辿ることで、「blue」に割当てられた「4」を検出する。   When a conventional search device executes a trie tree search process, the input key is extracted character by character, and the node of the same key on the trie tree is traced. For example, when the input key “blue” is specified, the search device detects “4” assigned to “blue” by tracing the nodes of the trie tree in the order of nodes b, l, u, and e. To do.

ところで、図90に示したトライ木では、トライ木を構築するキーが長い場合に、ノード数が増えてしまい、使用メモリ量が増大してしまうという問題があった。また、キーが長い場合に、検索処理時に比較するノード数が増えてしまい、検索処理等が完了するまでの時間が長くなってしまうという問題が発生する。   Incidentally, the trie tree shown in FIG. 90 has a problem that the number of nodes increases and the amount of used memory increases when the key for constructing the trie tree is long. Further, when the key is long, the number of nodes to be compared at the time of the search process increases, and there is a problem that the time until the search process is completed becomes long.

そこで、かかるトライ木の問題点を解消するべく、パトリシア木(Patricia Tree)と呼ばれるトライ木が考案されている(例えば、非特許文献1参照)。図91は、パトリシア木の一例を示す図である。このパトリシア木は、ノードから他のノードへ遷移するエッジ部を、文字ではなく文字列で表現することで、使用メモリ量を削減している。なお、図91に示すパトリシア木は、キー「black、green、blue、grey、black、grey、greenyellow」にそれぞれ値「1、3、4、5、3、2、1」が割当てられたパトリシア木を示している。   Therefore, a trie tree called a Patricia tree has been devised to solve the problem of the trie tree (see, for example, Non-Patent Document 1). FIG. 91 is a diagram illustrating an example of a Patricia tree. In this Patricia tree, the amount of memory used is reduced by expressing an edge portion that transitions from one node to another by a character string instead of a character. The Patricia tree shown in FIG. 91 is a Patricia tree in which the values “1, 3, 4, 5, 3, 2, 1” are assigned to the keys “black, green, blue, grey, black, grey, greenyellow”, respectively. Is shown.

従来の検索装置が、トライ木の検索処理を実行する場合には、入力キーとエッジ部の文字列とを順次比較し、パトリシア木を辿る。例えば、検索装置は、入力キー「blue」が指定された場合には、パトリシア木のエッジ部をbl、ueの順に辿ることで、「blue」に割当てられた「4」を検出する。   When a conventional search apparatus executes a trie tree search process, the input key and the character string at the edge portion are sequentially compared, and the Patricia tree is traced. For example, when the input key “blue” is designated, the search device detects “4” assigned to “blue” by tracing the edge of the Patricia tree in the order of bl and ue.

特開昭59−47669号公報JP 59-47669 A 特開平11−7451号公報Japanese Patent Laid-Open No. 11-7451

“基数木”、[online]、[平成21年2月25日検索]、インターネット<http://ja.wikipedia.org/wiki/%E5%9F%BA%E6%95%B0%E6%9C%A8>“Radix Tree”, [online], [Search February 25, 2009], Internet <http://en.wikipedia.org/wiki/%E5%9F%BA%E6%95%B0%E6%9C % A8>

しかしながら、上述したパトリシア木は、通常のトライ木と比較してメモリ使用量の問題等を解消することができるものの、所定の文字列毎にノードを作成する必要があるため、キーの文字数が多い場合には、メモリ使用量が増大してしまうという問題があった。   However, although the Patricia tree described above can solve the memory usage problem and the like as compared with a normal trie tree, it requires a node to be created for each predetermined character string, so the number of characters in the key is large. In this case, there is a problem that the amount of memory used increases.

そこで、この発明は、上述した従来技術の課題を解決するためになされたものであり、メモリ使用量を削減することができる記憶媒体およびトライ木生成方法を提供することを目的とする。   Accordingly, the present invention has been made to solve the above-described problems of the prior art, and an object thereof is to provide a storage medium and a trie tree generation method capable of reducing the memory usage.

上述した課題を解決し、目的を達成するため、この記憶媒体は、コンピュータに、所定の文字に対応するノードが木構造にて接続されるトライ木を記憶装置に記憶し、当該トライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木に含まれるノードを当該ノードに対応する文字に応じて辿り、単一のノードに対して単一の文字列が登録されるように、辿ったノードの何れかに新規の文字列を登録する場合に、登録対象のノードの子ノードに登録された文字列と新規の文字列とを比較して一致する文字を判定し、新規の文字列から一致する文字を除いた残りの文字列と一致文字数を、登録対象のノードに登録する文字列登録機能を実現させるためのプログラムを格納することを要件とする。   In order to solve the above-described problems and achieve the object, this storage medium stores a trie tree in which a node corresponding to a predetermined character is connected in a tree structure in a computer and stores the trie tree in a new state. When registering a character string, the characters of the new character string are read in order from the top and the nodes included in the trie tree are traced according to the characters corresponding to the node, When registering a new character string in one of the traced nodes, the character string registered in the child node of the registration target node is compared with the new character string. It is necessary to store a program that realizes the character string registration function that determines the matching character and registers the remaining character string obtained by removing the matching character from the new character string and the number of matching characters in the registration target node. And

この記憶媒体が記憶するプログラムを実行することで、コンピュータは、1ノードにタグキーを1つ対応付け、タグキーを有さないノードを無くすので、メモリ使用効率を向上させることが出来る。   By executing the program stored in the storage medium, the computer associates one tag key with one node and eliminates the node having no tag key, so that the memory use efficiency can be improved.

図1は、木構造に含まれるノードの用語を説明するための図である。FIG. 1 is a diagram for explaining the terms of nodes included in a tree structure. 図2は、本実施例にかかる検索装置の概要を説明するための図(1)である。FIG. 2 is a diagram (1) for explaining an overview of the search device according to the present embodiment. 図3は、本実施例にかかる検索装置の概要を説明するための図(2)である。FIG. 3 is a diagram (2) for explaining the outline of the search device according to the present embodiment. 図4は、比較対象ノードを説明するための図である。FIG. 4 is a diagram for explaining the comparison target node. 図5は、新規のキーをトライ木に登録する処理を説明するための図である。FIG. 5 is a diagram for explaining processing for registering a new key in the trie tree. 図6は、タグキーをトライ部分のキーを削除した形で保持するトライ木の一例を示す図である。FIG. 6 is a diagram illustrating an example of a trie tree that holds tag keys in a form in which the key of the trie portion is deleted. 図7は、従来のパトリシア木のデータ構造による使用メモリ量と、本願発明にかかるトライ木の使用メモリ量とを示す図(1)である。FIG. 7 is a diagram (1) showing the used memory amount by the data structure of the conventional Patricia tree and the used memory amount of the trie tree according to the present invention. 図8は、リーフノードからポインタ配列を削除した場合のトライ木を示す図である。FIG. 8 is a diagram illustrating a trie tree when a pointer array is deleted from a leaf node. 図9は、図8および図6に示した手法を用いてメモリ量を削減した場合の、従来のパトリシア木のデータ構造による使用メモリ量と、本実施例にかかるトライ木の使用メモリ量とを示す図である。FIG. 9 shows the amount of memory used by the data structure of the conventional Patricia tree and the amount of memory used by the trie tree according to this embodiment when the amount of memory is reduced using the method shown in FIGS. FIG. 図10は、本実施例1にかかる検索装置の構成を示す図である。FIG. 10 is a diagram illustrating the configuration of the search device according to the first embodiment. 図11は、本実施例1にかかる登録データ管理テーブルのデータ構造の一例を示す図である。FIG. 11 is a diagram illustrating an example of the data structure of the registration data management table according to the first embodiment. 図12は、本実施例2にかかるトライ木のデータ構造の一例を示す図である。FIG. 12 is a diagram illustrating an example of the data structure of the trie tree according to the second embodiment. 図13−1は、図12に示したトライ木を実データで表した場合のデータ構造の一例を示す図である。FIG. 13A is a diagram illustrating an example of a data structure when the trie tree illustrated in FIG. 12 is represented by real data. 図13−2は、トライ木のその他のデータ構造の一例を示す図である。FIG. 13B is a diagram of an example of another data structure of the trie tree. 図14は、トライ木生成部がトライ木を生成する処理の概要を説明するための図である。FIG. 14 is a diagram for explaining an overview of a process in which the trie tree generation unit generates a trie tree. 図15は、トライ木を生成する処理を説明するための図(1)である。FIG. 15 is a diagram (1) for explaining the process of generating the trie tree. 図16は、トライ木を生成する処理を説明するための図(2)である。FIG. 16 is a diagram (2) for explaining the process of generating the trie tree. 図17は、トライ木を生成する処理を説明するための図(3)である。FIG. 17 is a diagram (3) for explaining the process of generating the trie tree. 図18は、トライ木を生成する処理を説明するための図(4)である。FIG. 18 is a diagram (4) for explaining the process of generating the trie tree. 図19は、トライ木を生成する処理を説明するための図(5)である。FIG. 19 is a diagram (5) for explaining the process of generating the trie tree. 図20は、トライ木を生成する処理を説明するための図(6)である。FIG. 20 is a diagram (6) for explaining the process of generating the trie tree. 図21は、トライ木を生成する処理を説明するための図(7)である。FIG. 21 is a diagram (7) for explaining the process of generating the trie tree. 図22は、トライ木を生成する処理を説明するための図(8)である。FIG. 22 is a diagram (8) for explaining the process of generating the trie tree. 図23は、トライ木を生成する処理を説明するための図(9)である。FIG. 23 is a diagram (9) for explaining the process of generating the trie tree. 図24は、トライ木を生成する処理を説明するための図(10)である。FIG. 24 is a diagram (10) for explaining the process of generating the trie tree. 図25は、集計値を抽出する処理を説明するための図(1)である。FIG. 25 is a diagram (1) for explaining the process of extracting the total value. 図26は、集計値を抽出する処理を説明するための図(2)である。FIG. 26 is a diagram (2) for explaining the process of extracting the total value. 図27は、集計値を抽出する処理を説明するための図(3)である。FIG. 27 is a diagram (3) for explaining the process of extracting the total value. 図28は、二分探索法を用いた場合の検索処理を説明するための図(1)である。FIG. 28 is a diagram (1) for explaining the search processing when the binary search method is used. 図29は、二分探索法を用いた場合の検索処理を説明するための図(2)である。FIG. 29 is a diagram (2) for explaining the search processing when the binary search method is used. 図30は、二分探索法を用いた場合の検索処理を説明するための図(3)である。FIG. 30 is a diagram (3) for explaining the search processing when the binary search method is used. 図31は、二分探索法を用いた場合の検索処理を説明するための図(4)である。FIG. 31 is a diagram (4) for explaining the search processing when the binary search method is used. 図32は、二分探索法を用いた場合の検索処理を説明するための図(5)である。FIG. 32 is a diagram (5) for explaining the search processing when the binary search method is used. 図33は、二分探索法を用いた場合の検索処理を説明するための図(6)である。FIG. 33 is a diagram (6) for explaining the search processing when the binary search method is used. 図34は、二分探索法を用いた場合の検索処理を説明するための図(7)である。FIG. 34 is a diagram (7) for explaining the search processing when the binary search method is used. 図35は、二分探索法を用いた場合の検索処理を説明するための図(8)である。FIG. 35 is a diagram (8) for explaining the search processing when the binary search method is used. 図36は、二分探索法を用いない場合の探索処理を説明するための図(1)である。FIG. 36 is a diagram (1) for explaining search processing when the binary search method is not used. 図37は、二分探索法を用いない場合の探索処理を説明するための図(2)である。FIG. 37 is a diagram (2) for explaining the search processing when the binary search method is not used. 図38は、二分探索法を用いない場合の探索処理を説明するための図(3)である。FIG. 38 is a diagram (3) for explaining the search processing when the binary search method is not used. 図39は、二分探索法を用いない場合の探索処理を説明するための図(4)である。FIG. 39 is a diagram (4) for explaining the search processing when the binary search method is not used. 図40は、二分探索法を用いない場合の探索処理を説明するための図(5)である。FIG. 40 is a diagram (5) for explaining the search processing when the binary search method is not used. 図41は、削除処理を説明するための図である。FIG. 41 is a diagram for explaining the deletion process. 図42は、本実施例1にかかるトライ木生成処理の処理手順を示すフローチャートである。FIG. 42 is a flowchart of the process procedure of the trie tree generation process according to the first embodiment. 図43は、二分探索法を用いないデータ追加処理の処理手順を示すフローチャート(1)である。FIG. 43 is a flowchart (1) illustrating the processing procedure of the data addition processing that does not use the binary search method. 図44は、二分探索法を用いないデータ追加処理の処理手順を示すフローチャート(2)である。FIG. 44 is a flowchart (2) illustrating the processing procedure of the data addition processing that does not use the binary search method. 図45は、二分探索法を用いるデータ追加処理の処理手順を示すフローチャート(1)である。FIG. 45 is a flowchart (1) illustrating a processing procedure of data addition processing using the binary search method. 図46は、二分探索法を用いるデータ追加処理の処理手順を示すフローチャート(2)である。FIG. 46 is a flowchart (2) illustrating the processing procedure of the data addition processing using the binary search method. 図47は、二分探索法を用いるデータ追加処理の処理手順を示すフローチャート(3)である。FIG. 47 is a flowchart (3) illustrating the processing procedure of the data addition processing using the binary search method. 図48は、二分探索法を用いない検索処理の処理手順を示すフローチャートである。FIG. 48 is a flowchart showing a processing procedure of search processing that does not use the binary search method. 図49は、二分探索法を用いる検索処理の処理手順を示すフローチャート(1)である。FIG. 49 is a flowchart (1) showing a processing procedure of search processing using the binary search method. 図50は、二分探索法を用いる検索処理の処理手順を示すフローチャート(2)である。FIG. 50 is a flowchart (2) showing the processing procedure of the search processing using the binary search method. 図51は、集計値の抽出処理の処理手順を示すフローチャートである。FIG. 51 is a flowchart illustrating the processing procedure of the total value extraction processing. 図52は、削除処理の処理手順を示すフローチャート(1)である。FIG. 52 is a flowchart (1) showing the processing procedure of the deletion processing. 図53は、削除処理の処理手順を示すフローチャート(2)である。FIG. 53 is a flowchart (2) showing the processing procedure of the deletion processing. 図54は、実施例1にかかる検索装置の課題を説明するための図である。FIG. 54 is a diagram for explaining the problem of the search device according to the first embodiment. 図55は、本実施例2にかかる検索装置の概要を説明するための図である。FIG. 55 is a diagram for explaining the outline of the search device according to the second embodiment. 図56は、本実施例2にかかる検索装置の構成を示す図である。FIG. 56 is a diagram illustrating the configuration of the search device according to the second embodiment. 図57は、本実施例2にかかる登録データ管理テーブルのデータ構造の一例を示す図である。FIG. 57 is a diagram illustrating an example of the data structure of the registration data management table according to the second embodiment. 図58は、本実施例2にかかるトライ木のデータ構造の一例を示す図である。FIG. 58 is a diagram illustrating an example of the data structure of the trie tree according to the second embodiment. 図59は、図58に示したトライ木を実データで表した場合のデータ構造の一例を示す図である。FIG. 59 is a diagram showing an example of a data structure when the trie tree shown in FIG. 58 is represented by real data. 図60は、本実施例2にかかるトライ木を生成する処理を説明するための図(1)である。FIG. 60 is a diagram (1) for explaining the process of generating the trie tree according to the second embodiment. 図61は、本実施例2にかかるトライ木を生成する処理を説明するための図(2)である。FIG. 61 is a diagram (2) for explaining the process of generating the trie tree according to the second embodiment. 図62は、本実施例2にかかるトライ木を生成する処理を説明するための図(3)である。FIG. 62 is a diagram (3) illustrating the process of generating the trie tree according to the second embodiment. 図63は、本実施例2にかかるトライ木を生成する処理を説明するための図(4)である。FIG. 63 is a diagram (4) illustrating the process of generating the trie tree according to the second embodiment. 図64は、本実施例2にかかるトライ木を生成する処理を説明するための図(5)である。FIG. 64 is a diagram (5) for explaining the process of generating the trie tree according to the second embodiment. 図65は、本実施例2にかかるトライ木を生成する処理を説明するための図(6)である。FIG. 65 is a diagram (6) illustrating the process for generating the trie tree according to the second embodiment. 図66は、本実施例2にかかるトライ木を生成する処理を説明するための図(7)である。FIG. 66 is a diagram (7) illustrating the process of generating the trie tree according to the second embodiment. 図67は、本実施例2にかかるトライ木を生成する処理を説明するための図(8)である。FIG. 67 is a diagram (8) illustrating the process for generating the trie tree according to the second embodiment. 図68は、本実施例2にかかるトライ木を生成する処理を説明するための図(9)である。FIG. 68 is a diagram (9) illustrating the process of generating the trie tree according to the second embodiment. 図69は、本実施例2にかかるトライ木を生成する処理を説明するための図(10)である。FIG. 69 is a diagram (10) for explaining the process of generating the trie according to the second embodiment. 図70は、本実施例2における集計値を抽出する処理を説明するための図(1)である。FIG. 70 is a diagram (1) for explaining the process of extracting the total value in the second embodiment. 図71は、本実施例2における集計値を抽出する処理を説明するための図(2)である。FIG. 71 is a diagram (2) for explaining the process of extracting the total value in the second embodiment. 図72は、本実施例2における集計値を抽出する処理を説明するための図(3)である。FIG. 72 is a diagram (3) for explaining the process of extracting the total value in the second embodiment. 図73は、本実施例2にかかる探索処理を説明するための図(1)である。FIG. 73 is a diagram (1) illustrating the search process according to the second embodiment. 図74は、本実施例2にかかる探索処理を説明するための図(2)である。FIG. 74 is a diagram (2) for explaining the search process according to the second embodiment. 図75は、本実施例2にかかる探索処理を説明するための図(3)である。FIG. 75 is a diagram (3) for explaining the search processing according to the second embodiment. 図76は、本実施例2にかかる探索処理を説明するための図(4)である。FIG. 76 is a diagram (4) for explaining the search processing according to the second embodiment. 図77は、本実施例2にかかる探索処理を説明するための図(5)である。FIG. 77 is a diagram (5) for explaining the search processing according to the second embodiment. 図78は、本実施例2にかかるトライ木生成処理の処理手順を示すフローチャートである。FIG. 78 is a flowchart of the process procedure of the trie tree generation process according to the second embodiment. 図79は、本実施例2にかかるデータ追加処理の処理手順を示すフローチャート(1)である。FIG. 79 is a flowchart (1) illustrating the processing procedure of the data addition processing according to the second embodiment. 図80は、本実施例2にかかるデータ追加処理の処理手順を示すフローチャート(2)である。FIG. 80 is a flowchart (2) illustrating the processing procedure of the data addition processing according to the second embodiment. 図81は、本実施例2にかかるデータ追加処理の処理手順を示すフローチャート(3)である。FIG. 81 is a flowchart (3) illustrating the processing procedure of the data addition processing according to the second embodiment. 図82は、本実施例2にかかる検索処理の処理手順を示すフローチャート(1)である。FIG. 82 is a flowchart (1) illustrating the processing procedure of the search processing according to the second embodiment. 図83は、本実施例2にかかる検索処理の処理手順を示すフローチャート(2)である。FIG. 83 is a flowchart (2) illustrating the processing procedure of the search processing according to the second embodiment. 図84は、本実施例2にかかる集計値の抽出処理の処理手順を示すフローチャートである。FIG. 84 is a flowchart of a process procedure of a total value extraction process according to the second embodiment. 図85は、本実施例2にかかる削除処理の処理手順を示すフローチャート(1)である。FIG. 85 is a flowchart (1) illustrating the processing procedure of the deletion processing according to the second embodiment. 図86は、本実施例2にかかる削除処理の処理手順を示すフローチャート(2)である。FIG. 86 is a flowchart (2) illustrating the processing procedure of the deletion processing according to the second embodiment. 図87は、本実施例2にかかる削除処理の処理手順を示すフローチャート(3)である。FIG. 87 is a flowchart (3) illustrating the processing procedure of the deletion processing according to the second embodiment. 図88は、本実施例2にかかる削除処理の処理手順を示すフローチャート(4)である。FIG. 88 is a flowchart (4) illustrating the processing procedure of the deletion processing according to the second embodiment. 図89は、実施例2に示した検索装置に対応するコンピュータのハードウェア構成を示す図である。FIG. 89 is a diagram illustrating a hardware configuration of a computer corresponding to the search device illustrated in the second embodiment. 図90は、従来のトライ木の一例を示す図である。FIG. 90 is a diagram illustrating an example of a conventional trie tree. 図91は、パトリシア木の一例を示す図である。FIG. 91 is a diagram illustrating an example of a Patricia tree.

以下に、本願の開示する記憶媒体およびトライ木生成方法の実施例を図面に基づいて詳細に説明する。なお、この実施例によりこの発明が限定されるものではない。   Hereinafter, embodiments of a storage medium and a trie tree generation method disclosed in the present application will be described in detail with reference to the drawings. Note that the present invention is not limited to the embodiments.

まず、本実施例にかかる検索装置の説明を行う前に、木構造に含まれるノードの用語について説明する。図1は、木構造に含まれるノードの用語を説明するための図である。図1に示すように、トライ木を構成する各ノードのうち、最上層に位置するノードをルートノードと定義する。また、基準ノードのひとつ上の層に存在し、基準ノードに接続されたノードを、基準ノードに対する親ノード(以下、単に親ノード)と定義する。また、基準ノードのひとつ下の層に存在し、基準ノードに接続されたノードを基準ノードに対する子供ノード(以下、単に子供ノード)と定義する。   First, before describing the search apparatus according to the present embodiment, terms of nodes included in the tree structure will be described. FIG. 1 is a diagram for explaining the terms of nodes included in a tree structure. As shown in FIG. 1, among the nodes constituting the trie tree, the node located at the uppermost layer is defined as the root node. In addition, a node that exists in the layer one level above the reference node and is connected to the reference node is defined as a parent node for the reference node (hereinafter simply referred to as a parent node). Further, a node that exists in a layer below the reference node and is connected to the reference node is defined as a child node (hereinafter simply referred to as a child node) with respect to the reference node.

また、基準ノードと同じ層に存在し、基準ノードと同じ親ノードに接続され、基準ノードの上側に存在するノードを、基準ノードに対する兄ノード(以下、単に兄ノード)と定義する。また、基準ノードと同じ層に存在し、基準ノードと同じ親ノードに接続され、基準ノードの下側に存在するノードを、基準ノードに対する弟ノード(以下、単に弟ノード)と定義する。また、根ノードから親ノードに至る各ノードをまとめて先祖ノードと定義する。また、基準ノードの配下に接続された各ノードをまとめて子孫ノードと定義する。   Further, a node that exists in the same layer as the reference node, is connected to the same parent node as the reference node, and exists above the reference node is defined as an older brother node (hereinafter simply referred to as an older brother node) with respect to the reference node. Further, a node that exists in the same layer as the reference node, is connected to the same parent node as the reference node, and exists below the reference node is defined as a brother node (hereinafter simply referred to as a brother node) with respect to the reference node. Each node from the root node to the parent node is collectively defined as an ancestor node. Also, each node connected under the reference node is collectively defined as a descendant node.

次に、本実施例にかかる検索装置の概要について説明する。図2、図3は、本実施例にかかる検索装置の概要を説明するための図である。まず、図2に示すように、本実施例にかかる検索装置は、指定されたキーに基づいてトライ木を生成する場合に、1つのノードに1つのキーを割当てる。以下の説明において、ノードに割当てられたキーをタグキーと表記する。図2において、ノードb、l、g、r、eには、それぞれタグキー「black、blue、green、grey、greenyellow」が1つずつ割当てられている。また、ノードb、l、g、r、eには、値「1、3」、「4」、「3」、「5、2」、「1」がそれぞれ割当てられている。   Next, an outline of the search device according to the present embodiment will be described. 2 and 3 are diagrams for explaining the outline of the search device according to the present embodiment. First, as illustrated in FIG. 2, the search device according to the present embodiment assigns one key to one node when generating a trie tree based on a designated key. In the following description, a key assigned to a node is referred to as a tag key. In FIG. 2, one tag key “black, blue, green, grey, greenyellow” is assigned to each of the nodes b, l, g, r, and e. Further, the values “1, 3”, “4”, “3”, “5, 2”, and “1” are assigned to the nodes b, l, g, r, and e, respectively.

図2に示したトライ木は、図90に示したトライ木あるいは図91に示したパトリシア木と同じように、タグキー「black、green、blue、grey、black、grey、greenyellow」にそれぞれ値「1、3、4、5、3、2、1」を割当てている。しかし、本実施例にかかるトライ木は、図90、91に示したトライ木、パトリシア木と異なり、1ノードにタグキーを一つ対応付けているため、データを持っていないノードが存在せず、メモリ利用効率を高めることができる。また、本実施例にかかるトライ木は、ノードに含まれる文字数が多い場合であっても、トライ木のノード数を増加させる必要がないため、メモリ使用量を抑えることが出来る。   The trie tree shown in FIG. 2 has a value “1” for each of the tag keys “black, green, blue, grey, black, grey, greenyellow” in the same manner as the trie tree shown in FIG. 90 or the Patricia tree shown in FIG. 3, 4, 5, 3, 2, 1 ". However, unlike the trie and patricia trees shown in FIGS. 90 and 91, the trie tree according to the present embodiment associates one tag key with one node, so there is no node that does not have data, Memory utilization efficiency can be increased. In addition, the trie tree according to the present embodiment does not require an increase in the number of nodes in the trie tree even when the number of characters included in the node is large, so that the memory usage can be suppressed.

ただし、本実施例にかかるトライ木は、1つのノードに1つのタグキーを割当てた代償として、実際にノードに登録されたタグキーを参照しなければ、入力キーがタグキーにヒットしたか否かを判定できない。例えば、図2に示したトライ木では、入力キー「blue」の1文字目「b」により、ノードを遷移すると、まず、ルートノードからノードbに移行する。ノードbに移行した時点では、入力キーにヒットしたか否かを判定できない。実際に、ノードbのタグキー「black」と比較して初めて、ヒットしていないと判定できる。   However, the trie tree according to the present embodiment determines whether or not the input key hits the tag key unless the tag key actually registered in the node is referred to as a price for assigning one tag key to one node. Can not. For example, in the trie tree shown in FIG. 2, when a node is transitioned by the first character “b” of the input key “blue”, the root node is first transitioned to the node b. When moving to node b, it cannot be determined whether or not the input key is hit. Actually, it can be determined that there is no hit until the tag key “black” of node b is compared.

そして、2文字目「l」によりノードlに遷移し、ノードlのタグキー「blue」と入力キー「blue」とを比較すると、入力キーとタグキーが一致したと判定できるので、ノードlに付加された値「4」が検出結果として検出される。したがって、ただ闇雲に、各ノードにタグキーを割当ててしまうと、各入力キーにより遷移する各ノードのタグキーと順次比較処理を行うこととなり、処理効率の向上が図れない。   Then, transition to node l by the second character “l”, and comparing the tag key “blue” of node l with the input key “blue”, it can be determined that the input key and tag key match, so it is added to node l The value “4” is detected as a detection result. Therefore, if a tag key is assigned to each node in the dark cloud, the comparison is performed sequentially with the tag key of each node transitioned by each input key, and the processing efficiency cannot be improved.

かかる課題を解消するため、図3に示すように、本実施例にかかる検索装置は、深さ優先探索順でタグキーが並ぶようにトライ木を構築する。このように、深さ優先探索順でタグキーを並べると、データの検索時に入力キーと比較対象となるタグキーを有するノードを絞り込むことができ、処理の効率化を図ることができる。検索装置は、深さ優先探索順でキーが並ぶようにトライ木を構築する際に、各キーの優先度を判定し、優先度が小さいキーほどルートノードに近いノードに割当てる。   In order to solve this problem, as shown in FIG. 3, the search device according to the present embodiment constructs a trie tree so that tag keys are arranged in the depth-first search order. In this way, when tag keys are arranged in the depth-first search order, nodes having tag keys to be compared with the input keys can be narrowed down when searching for data, and processing efficiency can be improved. When constructing a trie tree so that keys are arranged in the depth-first search order, the search device determines the priority of each key, and assigns a key with a lower priority to a node closer to the root node.

検索装置は、優先度を判定する場合に、異なる文字が検出されるまで各キーの文字を先頭から順に抽出する。そして、抽出した文字において、アルファベット順で、aに近い文字ほど優先度を小さくし、zに近い文字ほど優先度を大きくする。すなわち、優先度は、「a<b<c<d<e<f<g<h<i<j<k<l<m<n<o<p<q<r<s<t<u<v<w<x<y<z」となる。なお、優先度が同じ文字列は、等しい文字列であるといえる。   When determining the priority, the search device extracts the characters of each key in order from the top until a different character is detected. In the extracted characters, in the alphabetical order, the closer to a, the lower the priority, and the closer to z, the higher the priority. That is, the priority is “a <b <c <d <e <f <g <h <i <j <k <l <m <n <o <p <q <r <s <t <u <v <W <x <y <z ”. Note that character strings having the same priority can be said to be equal character strings.

例えば、タグキー「black」と「blue」を比較すると、3文字目で異なる文字が抽出される。具体的には、「black」から「a」が抽出され、「blue」から「u」が抽出される。そして、「a」と「u」とを比較すると、「u」の方が「a」よりも優先度が大きくなる。したがって、優先度の小さい「black」を「blue」よりもルートノード側のノードに割り当てる。   For example, when the tag keys “black” and “blue” are compared, different characters are extracted at the third character. Specifically, “a” is extracted from “black”, and “u” is extracted from “blue”. When “a” is compared with “u”, “u” has a higher priority than “a”. Therefore, “black” having a lower priority is assigned to a node closer to the root node than “blue”.

また、「green」と「greenyellow」を比較すると、6文字目で異なる文字が抽出される。具体的には、「green」には6文字目が存在しないので「空」が抽出され、「greenyellow」から「y」が抽出される。このような場合には、検索装置は、空白が抽出されなかったキー「greenyellow」の方が「green」よりも優先度が大きいと判定する。したがって、優先度の小さい「green」を「greenyellow」よりもルートノード側のノードに割り当てる。   Further, when “green” and “greenyellow” are compared, different characters are extracted at the sixth character. Specifically, since there is no sixth character in “green”, “sky” is extracted, and “y” is extracted from “greenyellow”. In such a case, the search device determines that the key “greenyellow” from which no blank has been extracted has a higher priority than “green”. Therefore, “green” having a lower priority is assigned to a node closer to the root node than “greenyellow”.

なお、本実施例では、同一の親ノードに直接接続された子(子供)ノードが複数存在する場合には、優先度の小さいキーを兄ノード側に配置し、優先度の大きいキーを弟ノード側に配置する。例えば、「black」と「green」とを比較すると、1文字目で異なる文字が抽出される。具体的には、「black」から「b」が抽出され、「green」から「g」が抽出される。そして、「b」と「g」を比較すると、「g」の方が「b」よりも優先度が大きくなる。したがって、優先度の小さい「black」を「green」よりも兄側のノードに配置する。なお、図2のように、各タグキーを割当てると、複数の子ノードを有する親ノードのタグキーと兄弟ノードのタグキーとの優先度の大小関係は、親ノードのキー<長男ノードのキー<次男ノードのキー<三男ノード<・・・となる。また、配下に接続されるノードほど優先度が大きくなる。例えば、図3において、ノードeのキーの優先度は、ノードr、gの優先度よりも大きい。   In this embodiment, when there are a plurality of child (child) nodes directly connected to the same parent node, a key having a low priority is arranged on the brother node side, and a key having a high priority is assigned to the brother node. Place on the side. For example, when “black” and “green” are compared, different characters are extracted at the first character. Specifically, “b” is extracted from “black”, and “g” is extracted from “green”. When “b” and “g” are compared, “g” has a higher priority than “b”. Therefore, “black” having a lower priority is placed on the brother node than “green”. As shown in FIG. 2, when each tag key is assigned, the priority relationship between the tag key of the parent node having a plurality of child nodes and the tag key of the sibling node is expressed as follows: the key of the parent node <the key of the eldest son node <the second son node The key is <the third son node <... Further, the priority is higher as the node is connected to the subordinate. For example, in FIG. 3, the priority of the key of the node e is higher than the priority of the nodes r and g.

図3に示すように、各ノードにタグキーが配置されると、入力キーの優先度と、タグキーの優先度の関係から、検索対象となる入力キーの位置を絞り込むことが出来る。これは、入力キーと優先度が等しいタグキーを捜せばよいので、入力キーの文字により遷移する各ノードの内、入力キーよりも優先度が大きいノード以降のノード(子孫ノード)のタグキーと比較する必要は無く、入力キーよりも優先度が小さいノード以前のノード(先祖ノード)のタグキーと比較する必要が無くなるためである。   As shown in FIG. 3, when a tag key is arranged at each node, the position of the input key to be searched can be narrowed down from the relationship between the priority of the input key and the priority of the tag key. Since it is only necessary to search for a tag key having the same priority as the input key, it is compared with the tag key of the node (descendant node) after the node having a higher priority than the input key among the nodes that are transitioned by the character of the input key. This is not necessary, and it is not necessary to compare with the tag key of the node (ancestor node) before the node having a lower priority than the input key.

ここで、入力キーの文字を先頭から1文字ずつ読み出して、トライ木の各ノードを遷移し、最後に到達するノードを到達ノードと定義する。また、ルートノードから到達ノードに至る各ノードに含まれ、かつ、兄ノードを有するノードの内、優先度が最も大きいキーを有するノードを特定ノードと定義する。なお、兄ノードを有するノードが存在しない場合には、ルートノードの子ノードを特定ノードと定義する。   Here, the characters of the input key are read one by one from the top, each node of the trie tree is transitioned, and the node that reaches the end is defined as the reaching node. Further, a node having a key with the highest priority among nodes having an older brother node included in each node from the root node to the reaching node is defined as a specific node. If there is no node having an older brother node, a child node of the root node is defined as a specific node.

本実施例にかかる検索装置は、入力キーに一致するタグキーを検索する場合に、到達ノードから特定ノードに至る各ノードの内、いずれかを検索対象とすればよい。検索対象となるノードの中に、入力キーと一致するタグキーが存在しない場合には、その他のタグキーを参照しなくても、入力キーと一致するタグキーは存在しないと判定可能である。   When searching for a tag key that matches the input key, the search device according to the present embodiment may search for any one of the nodes from the reaching node to the specific node. If there is no tag key that matches the input key in the search target node, it can be determined that there is no tag key that matches the input key without referring to other tag keys.

なぜなら、特定ノードの親ノードのキーの優先度は、兄ノードのキーの優先度よりも小さく、兄ノードのキーの優先度は、弟ノード(特定ノード)のキー文字列に属する登録対象の入力キーの優先度よりも小さいからであり、入力キーが弟ノードを辿っている時点で、兄ノード側のタグキーの優先度よりも、入力キーの優先度の方が大きいことが確定するからである。   Because the priority of the key of the parent node of the specific node is lower than the priority of the key of the brother node, the priority of the key of the brother node is the input of the registration target belonging to the key character string of the brother node (specific node) This is because the priority of the input key is larger than the priority of the tag key on the brother node when the input key follows the younger brother node. .

以下の説明において、到達ノードから特定ノードに至る各ノードを、比較対象ノードと表記する。検索装置は、入力キーと一致するキーを検索する場合には、かかる比較対象ノードのタグキーを対象として比較処理を実行すればよい。   In the following description, each node from the reaching node to the specific node is referred to as a comparison target node. When searching for a key that matches the input key, the search device may perform a comparison process for the tag key of the comparison target node.

図4は、比較対象ノードを説明するための図である。入力キーを先頭から1文字ずつ読みだし、最後にノード6に到達した場合には、比較対象ノードAに含まれるノード5,6のタグキーと入力キーとを比較すればよい。   FIG. 4 is a diagram for explaining the comparison target node. When the input key is read character by character from the beginning and finally reaches the node 6, the tag keys of the nodes 5 and 6 included in the comparison target node A may be compared with the input key.

続いて、本実施例にかかる検索装置が、新規のキーをトライ木に登録する場合について説明する。図5は、新規のキーをトライ木に登録する処理を説明するための図である。新規のキーをトライ木に構築する場合にも、比較対象ノードのタグキーと比較処理を行い、優先度に応じて、新規のキーをトライ木に登録すればよい。   Next, a case where the search device according to the present embodiment registers a new key in the trie tree will be described. FIG. 5 is a diagram for explaining processing for registering a new key in the trie tree. Even when a new key is constructed in the trie tree, a comparison process is performed with the tag key of the comparison target node, and the new key may be registered in the trie tree according to the priority.

図5を用いて具体的に説明する。図5の左側に示すトライ木は、ノードb、i、l、uに、それぞれキー「beige、bisque、black、blueviolet」が1つずつ割当てられている。また、ノードb、i、l、uには、値「2」、「4」、「1、3」、「3」がそれぞれ割当てられている。   This will be specifically described with reference to FIG. In the trie tree shown on the left side of FIG. 5, one key “beige, bisque, black, blueviolet” is assigned to each of the nodes b, i, l, u. Also, the values “2”, “4”, “1, 3”, and “3” are assigned to the nodes b, i, l, and u, respectively.

検索装置は、図5の左側に示すトライ木に、キー「blue」、値「4」を追加する場合、到達ノードは「ノードu」、特定ノードは「ノードl」となる。したがって、比較対象ノードは、ノードl、ノードu、(ノードuの配下に接続されるノード)となる。   When the search device adds the key “blue” and the value “4” to the trie tree shown on the left side of FIG. 5, the reaching node is “node u” and the specific node is “node l”. Accordingly, the comparison target nodes are node l, node u (nodes connected under node u).

登録対象ノードに接続されたキー「blueviolet」、「black」をそれぞれ「blue」と比較すると、キー「blue」の優先度は、「blueviolet」よりも小さく、「black」よりも大きいので、「blueviolet」を有するノードと、「black」を有するノードの間に「blue」を登録すればよい。この場合には、図5の右側に示すように、ノードuにキー「blue」、値「4」を割り当て、ノードuの配下にノードeを作成して、かかるノードuに「blueviolet」、値「3」を割当てる。   When comparing the keys "blueviolet" and "black" connected to the registration target node with "blue", the priority of the key "blue" is lower than "blueviolet" and higher than "black". "Blue" may be registered between a node having "" and a node having "black". In this case, as shown on the right side of FIG. 5, the key “blue” and the value “4” are assigned to the node u, the node e is created under the node u, and “blueviolet” and the value are assigned to the node u. Assign “3”.

ところで、本実施例にかかる検索装置は、トライ木のメモリ使用量を更に削減するべく、ノードにタグとして付加するタグキーを、トライ部分のキーを削除した形で保持するものとする。図6は、トライ部分のキーを削除した形でタグキーを保持するトライ木の一例を示す図である。   By the way, in order to further reduce the memory usage of the trie tree, the search device according to the present embodiment holds the tag key added as a tag to the node in a form in which the key of the trie part is deleted. FIG. 6 is a diagram illustrating an example of a trie tree that holds tag keys in a form in which the key of the trie portion is deleted.

例えば、ノードlにタグキー「ack」が登録されているが、これは、ノードlにタグキー「black」を登録していることと同じ意味である。ルートノードからノードlに至るトライ部分のキーが「b、l」であるため、トライ部とタグキーとをあわせると「black」となる。   For example, the tag key “ack” is registered in the node l, which has the same meaning as that in which the tag key “black” is registered in the node l. Since the key of the trie part from the root node to the node l is “b, l”, the black part is “black” when the trie part and the tag key are combined.

図6のようなデータ構造を取ることで、タグキーの文字列が減るので、入力キーと比較するタグキーの数を減らすことが出来る。また、図6のように、トライ木上にはタグキーのデータを持たずに、各ノードはタグキーへのポインタのみを保持しても良い。また、タグキーのデータを全て保持しておき、比較を開始する文字位置を変えても良い。   By adopting the data structure as shown in FIG. 6, the number of tag keys is reduced, and the number of tag keys to be compared with the input keys can be reduced. Further, as shown in FIG. 6, each node may hold only a pointer to the tag key without having tag key data on the trie tree. Alternatively, all the tag key data may be held and the character position at which the comparison is started may be changed.

図7は、従来のパトリシア木のデータ構造による使用メモリ量と、本願発明にかかるトライ木の使用メモリ量とを示す図である。パトリシア木およびトライ木は、共に、キー「aaaaa、aacab、ababc、abacb、abcab」にそれぞれ「1、2、3、4、5」が割当てられている。   FIG. 7 is a diagram showing the used memory amount according to the data structure of the conventional Patricia tree and the used memory amount of the trie tree according to the present invention. In both the Patricia tree and the trie tree, “1, 2, 3, 4, 5” are assigned to the keys “aaaaa, aacab, ababc, aabac, abcab”, respectively.

ここで、ノードメモリを1KB、タグキーメモリを1Byte、値メモリを4Byteとすると、パトリシア木は、ノードを10個、タグキーを17文字、値を5個有しているので、合計で約10KBとなる。一方、本発明にかかるトライ木は、ノードを6ノード、タグキーを16文字、値を4個有しているので、合計で約6KBとなる。したがって、本発明にかかるトライ木は、従来のパトリシア木と比較して、使用メモリ量を削減できる。   Here, assuming that the node memory is 1 KB, the tag key memory is 1 byte, and the value memory is 4 bytes, the Patricia tree has 10 nodes, 17 tag keys, and 5 values, so the total is about 10 KB. . On the other hand, the trie tree according to the present invention has 6 nodes, 16 characters of tag keys, and 4 values, so the total is about 6 KB. Therefore, the trie tree according to the present invention can reduce the amount of memory used compared to the conventional Patricia tree.

また、本実施例にかかる検索装置は、トライ木の末端ノードに対応するリーフノードからポインタ配列を削除しても構わない。ここで、ポインタ配列は、接続先のノードを示すポインタの配列である。図8は、リーフノードからポインタ配列を削除した場合のトライ木を示す図である。このように、リーフノードからポインタ配列を削除することにより、リーフノードの使用メモリ量を削減することができる。   In addition, the search device according to the present embodiment may delete the pointer array from the leaf node corresponding to the end node of the trie tree. Here, the pointer array is an array of pointers indicating connection destination nodes. FIG. 8 is a diagram illustrating a trie tree when a pointer array is deleted from a leaf node. In this way, by deleting the pointer array from the leaf node, the amount of memory used by the leaf node can be reduced.

図9は、図8および図6に示した手法を用いてメモリ量を削減した場合の、従来のパトリシア木のデータ構造による使用メモリ量と、本実施例にかかるトライ木の使用メモリ量とを示す図である。   FIG. 9 shows the amount of memory used by the data structure of the conventional Patricia tree and the amount of memory used by the trie tree according to this embodiment when the amount of memory is reduced using the method shown in FIGS. FIG.

ここで、内部ノードメモリを1KB、リーフノードメモリを12Byte、キー1文字当たりのメモリを1Byte、値メモリを4Byteとすると、パトリシア木は、内部ノードを5個、リーフノードを5個、キーを17文字、値を5個有しているので、合計で約5KBとなる。一方、本実施例のトライ木は、内部メモリを3個、リーフノードを3個、キーを19文字、値を5個有しているので、合計で約3KBとなる。このように、図8および図9の手法を用いて使用メモリ使用量を削減した場合であっても、本実施例にかかるトライ木の方がパトリシア木と比較して、メモリ使用量をより多く削減することが出来る。   Here, if the internal node memory is 1 KB, the leaf node memory is 12 bytes, the memory per key character is 1 byte, and the value memory is 4 bytes, the Patricia tree has 5 internal nodes, 5 leaf nodes, and 17 keys. Since it has 5 characters and values, the total is about 5 KB. On the other hand, the trie tree of this embodiment has three internal memories, three leaf nodes, 19 keys, and five values, so the total is about 3 KB. Thus, even when the used memory usage is reduced by using the methods of FIGS. 8 and 9, the memory usage of the trie tree according to the present embodiment is larger than that of the Patricia tree. It can be reduced.

次に、本実施例にかかる検索装置の構成について説明する。図10は、本実施例1にかかる検索装置の構成を示す図である。図10に示すように、この検索装置100は、入力部110と、出力部120と、入出力制御部130と、記憶部140と、制御部150を有する。   Next, the configuration of the search device according to the present embodiment will be described. FIG. 10 is a diagram illustrating the configuration of the search device according to the first embodiment. As illustrated in FIG. 10, the search device 100 includes an input unit 110, an output unit 120, an input / output control unit 130, a storage unit 140, and a control unit 150.

このうち、入力部110は、入力キー等の情報を入力する入力部であり、キーボードやマウス等に該当する。出力部120は、トライ木を用いた検索結果などの情報を出力する出力部であり、モニタ、若しくはディスプレイ、タッチパネル等に該当する。入出力制御部130は、入力部110、出力部120、記憶部140、制御部150によるデータの入出力を制御する処理部である。   Among these, the input unit 110 is an input unit for inputting information such as input keys, and corresponds to a keyboard, a mouse, or the like. The output unit 120 is an output unit that outputs information such as search results using a trie tree, and corresponds to a monitor, a display, a touch panel, or the like. The input / output control unit 130 is a processing unit that controls input / output of data by the input unit 110, the output unit 120, the storage unit 140, and the control unit 150.

記憶部140は、制御部150による各種処理に必要なデータおよびプログラムを記憶する記憶部である。この記憶部140は、登録データ管理テーブル140aとトライ木140bを有する。   The storage unit 140 is a storage unit that stores data and programs necessary for various processes performed by the control unit 150. The storage unit 140 includes a registered data management table 140a and a trie tree 140b.

ここで、登録データ管理テーブル140aは、トライ木に登録するキーと値とを対応付けて記憶するテーブルである。図11は、本実施例1にかかる登録データ管理テーブル140aのデータ構造の一例を示す図である。図11に示すように、この登録データ管理テーブル140aは、キーと値を対応付けて記憶している。   Here, the registration data management table 140a is a table that stores keys and values registered in the trie tree in association with each other. FIG. 11 is a diagram illustrating an example of the data structure of the registered data management table 140a according to the first embodiment. As shown in FIG. 11, the registered data management table 140a stores keys and values in association with each other.

トライ木140bは、登録データ管理テーブル140aを基にして生成されるトライ木である。図12は、本実施例1にかかるトライ木のデータ構造の一例を示す図である。図12では一例として、図11に示した登録データ管理テーブル140aに対応したトライ木を示す。図12に示すように、ルートノードにノードb、ノードgが接続されており、ノードbにノードlが接続されている。   The trie tree 140b is a trie tree generated based on the registered data management table 140a. FIG. 12 is a diagram illustrating an example of the data structure of the trie tree according to the first embodiment. FIG. 12 shows a trie tree corresponding to the registered data management table 140a shown in FIG. 11 as an example. As shown in FIG. 12, node b and node g are connected to the root node, and node l is connected to node b.

また、ノードbは、タグキー「eige」と値「2」が接続されている。ノードlは、タグキー「ack」と値「1、3」が接続されている。ノードgは、タグキー「reen」と値「4」が接続されている。   The node b is connected to the tag key “eige” and the value “2”. The node l is connected with the tag key “ack” and the values “1, 3”. The node g is connected with the tag key “reen” and the value “4”.

図12に示したトライ木を実データで表すと図13−1に示すデータ構造となる。図13−1は、図12に示したトライ木を実データで表した場合のデータ構造の一例を示す図である。図13−1に示すように、このトライ木140bは、ポインタ配列10〜13、テキスト表14を有している。   When the trie tree shown in FIG. 12 is represented by real data, the data structure shown in FIG. FIG. 13A is a diagram illustrating an example of a data structure when the trie tree illustrated in FIG. 12 is represented by real data. As illustrated in FIG. 13A, the trie tree 140 b includes pointer arrays 10 to 13 and a text table 14.

ここで、ルートノードポインタに接続されたポインタ配列10は、図12のルートノードに対応し、ポインタ配列11は、図12のノードbに対応し、ポインタ配列12は、図12のノードlに対応する。また、ポインタ配列13は、図12のノードgに対応する。   Here, the pointer array 10 connected to the root node pointer corresponds to the root node in FIG. 12, the pointer array 11 corresponds to the node b in FIG. 12, and the pointer array 12 corresponds to the node l in FIG. To do. The pointer array 13 corresponds to the node g in FIG.

ポインタ配列10〜13は、「TAG」領域と「Data」領域を有しており、「TAG」は、テキスト表14の文字と対応付けることで、ノードに接続されたタグキーを表現する。例えば、ポインタ配列11は、テキスト表14の「e」に接続されているので、「e」から次の空白前までの文字列「eige」をタグキーとして指定している。また、「Data」は、値と対応付けることで、ノードに接続された値を表現する。例えば、ポインタ配列11は、値「2」に接続されている。   The pointer arrays 10 to 13 have a “TAG” area and a “Data” area, and “TAG” represents a tag key connected to a node by associating with a character in the text table 14. For example, since the pointer array 11 is connected to “e” in the text table 14, the character string “eige” from “e” to the next space is designated as a tag key. “Data” expresses a value connected to a node by associating it with a value. For example, the pointer array 11 is connected to the value “2”.

また、各ポインタ配列10〜13は、配下に接続されたポインタ配列を判定するためのキー番号(ポインタ)「0×00〜0×FF」を有している。例えば、ポインタ配列10のキー番号「0×62」が、ポインタ配列11に接続され、ポインタ配列10のキー番号「0×67」が、ポインタ配列13に接続されている。   Each of the pointer arrays 10 to 13 has a key number (pointer) “0 × 00 to 0 × FF” for determining a pointer array connected thereunder. For example, the key number “0 × 62” of the pointer array 10 is connected to the pointer array 11, and the key number “0 × 67” of the pointer array 10 is connected to the pointer array 13.

なお、図13−1等に示したトライ木140bの実データのデータ構造は、1ノードあたりASCIIコードの1文字にあたる8ビットの場合を示しているが、これに限定されるものではない。例えば、ASCIIコード1文字を4ビット単位の2つに分割して、1ノードあたり4ビットとしてもよい。その場合、ポインタ配列のもつキー番号は8ビットの場合に「0x00〜0xFF」の256個であったのに対し、4ビットの場合には「0x0〜0xF」の16個に減らすことができ、メモリ使用量を削減することが可能である。図13−2は、トライ木140bのその他のデータ構造の一例を示す図である。   Note that the data structure of the real data of the trie tree 140b shown in FIG. 13A and the like shows a case of 8 bits corresponding to one character of ASCII code per node, but is not limited to this. For example, one character of ASCII code may be divided into two in 4-bit units, and 4 bits per node may be used. In this case, the key number of the pointer array is 256 “0x00-0xFF” in the case of 8 bits, whereas it can be reduced to 16 “0x0-0xF” in the case of 4 bits, Memory usage can be reduced. FIG. 13-2 is a diagram illustrating an example of another data structure of the trie tree 140b.

例えば、「beige」の場合、1ノードあたり8ビットの場合には先頭キー番号「0x62」で、ポインタ配列11に接続されているが、1ノードあたり4ビットの場合には先頭キー番号として「0x62」の前半部分の「0x6」で、図13−2のポインタ配列XXに接続される。また、「beige」に加え「black」を続けて追加する場合、1ノードあたり8ビットの場合には2番目のキー番号「0x6c」でポインタ配列12に接続されているが、1ノードあたり4ビットの場合には2番目のキー番号として「0x62」の後半部分の「0x2」で、図13−2のポインタ配列YYに接続される。なお、ポインタ配列YYはポインタ配列XXへの接続のキー番号「0x6」とポインタ配列YYへの接続のキー番号「0x2」とをあわせた「0x62」、すなわち「b」を表すノードである。またさらに「blue」を続けて追加する場合、1ノードあたり8ビットの場合には3番目の文字「u]のキー番号「0x75」で次のポインタ配列に接続するが、1ノードあたり4ビットの場合には3番目のキー番号として2文字目「l」のキー番号「0x6c」の前半部分の「0x6」で次のポインタ配列に接続する。   For example, in the case of “beige”, in the case of 8 bits per node, the head key number “0x62” is connected to the pointer array 11, but in the case of 4 bits per node, “0x62” is set as the top key number. "0x6" in the first half of "" is connected to the pointer array XX in FIG. 13-2. When “black” is continuously added in addition to “beige”, in the case of 8 bits per node, the second key number “0x6c” is connected to the pointer array 12, but 4 bits per node. In this case, the second key number “0x2” in the latter half of “0x62” is connected to the pointer array YY in FIG. The pointer array YY is a node representing “0x62”, that is, “b”, which is a combination of the key number “0x6” for connection to the pointer array XX and the key number “0x2” for connection to the pointer array YY. In addition, when “blue” is continuously added, in the case of 8 bits per node, the key number “0x75” of the third character “u” is connected to the next pointer array, but 4 bits per node. In this case, “0x6” in the first half of the key number “0x6c” of the second character “l” is connected to the next pointer array as the third key number.

また、日本語コードのようにマルチバイト文字に関しても、複数バイトを1文字として扱い、1ノードあたり16ビットとするのではなく、1文字を複数に分割して、1ノードあたり8ビットとしたり、4ビットとしてもよい。   Also, with regard to multibyte characters such as Japanese codes, multiple bytes are treated as one character, instead of 16 bits per node, each character is divided into multiples to 8 bits per node, It may be 4 bits.

なお、現在のコンピュータにおいては直接ビット位置を指定してビット列を取り出すことはできないが、ビット位置から所望のビット列を含むバイト位置を特定し、1バイトを取り出した後、ビット処理演算を用いて所望のビット列を取り出すことで処理できる。タグキーを表す文字列を取り出すときも同様に行うことができる。   Although it is not possible to directly extract a bit string by designating a bit position in the current computer, a byte position including a desired bit string is specified from the bit position, and after extracting one byte, a desired bit processing operation is used. Can be processed by extracting the bit string. The same can be done when extracting a character string representing a tag key.

また別に、リーフノードに該当するポインタ配列はすべてのキー番号領域がNULLであるので、ポインタ配列の一部(キー番号領域)を省くなどして簡略化しても良い。なお、この場合には、各ポインタ配列に、自身のポインタ配列がリーフノードであるか否かを示すフラグを設定する。   In addition, since all the key number areas of the pointer array corresponding to the leaf node are NULL, the pointer array may be simplified by omitting a part (key number area) of the pointer array. In this case, a flag indicating whether or not its own pointer array is a leaf node is set in each pointer array.

図10の説明に戻ると、制御部150は、各種の処理手順を規定したプログラムや制御データを格納するための内部メモリを有し、これらによって種々の処理を実行する制御部である。図10に示すように、この制御部150は、トライ木生成部150aと、トライ木探索部150bを有する。   Returning to the description of FIG. 10, the control unit 150 is a control unit that has an internal memory for storing programs and control data that define various processing procedures, and executes various processes. As illustrated in FIG. 10, the control unit 150 includes a trie tree generation unit 150a and a trie tree search unit 150b.

トライ木生成部150aは、登録データ管理テーブル140aに登録されたキーに基づいて、トライ木140bを生成する処理である。なお、トライ木生成部150aは、図2、図3等で説明したように、1つのノードに1つのキーを割当てることでトライ木140を構築する。また、トライ木生成部150aは、ノードにタグキーを登録する場合に、深さ優先探索順でタグキーが並ぶようにトライ木を生成する。   The trie tree generation unit 150a is a process of generating the trie tree 140b based on the key registered in the registration data management table 140a. Note that the trie tree generation unit 150a constructs the trie tree 140 by assigning one key to one node, as described with reference to FIGS. In addition, when registering tag keys in a node, the trie tree generation unit 150a generates a trie tree so that the tag keys are arranged in the depth-first search order.

図14は、トライ木生成部150aが、トライ木140bを生成する処理の概要を説明するための図である。なお、ここでは説明の便宜上、図14の左側に示すトライ木に入力キー「blue」、値「4」を登録する場合について説明する。また、図14の左側に示すトライ木は、図6において説明したトライ木と同様にして、トライ部分のキーを削除した状態で、各ノードにタグキーを割当てている。   FIG. 14 is a diagram for explaining an outline of processing in which the trie tree generation unit 150a generates the trie tree 140b. Here, for convenience of explanation, a case where the input key “blue” and the value “4” are registered in the trie tree shown on the left side of FIG. 14 will be described. Further, the trie tree shown on the left side of FIG. 14 assigns a tag key to each node in a state in which the key of the trie part is deleted in the same manner as the trie tree described in FIG.

まず、トライ木生成部150aは、入力キーから文字を1文字ずつ取り出し、トライ木上のノードを辿る。辿る途中において、トライ木生成部150aは、入力キーとタグキーとの比較を実行しない。入力キーが「blue」の場合には、「blue」の先頭から1文字ずつ文字を取り出し、トライ木上のノードを辿ると、ルートノード、ノードb、l、uの順に遷移する。   First, the trie tree generation unit 150a extracts characters one by one from the input key and traces the nodes on the trie tree. In the middle of tracing, the trie tree generation unit 150a does not compare the input key with the tag key. When the input key is “blue”, characters are extracted one by one from the head of “blue”, and when a node on the trie tree is traced, transition is made in the order of the root node, nodes b, l, and u.

次に、トライ木生成部150aは、辿る先にノードが存在しない場合や、入力キーを全て辿った後に、兄ノードを持つノード、あるいは、ルートノードの子ノードまでノードを戻りながら、入力キーよりも小さいキーを検索する。つまり、比較対象ノード内で、入力キーよりも優先度の小さいタグキーを検索する。なお、入力キーとタグキーの優先度を比較する場合には、入力キーからトライ部のキーを除いた残りのキーとタグキーとを比較する。   Next, the trie tree generation unit 150a uses the input key to return to the node having the brother node or the child node of the root node after tracing all input keys when there is no node to be traced. Search for even smaller keys. That is, a tag key having a lower priority than the input key is searched for in the comparison target node. In addition, when comparing the priority of the input key and the tag key, the remaining keys excluding the trie key from the input key are compared with the tag key.

入力キーが「blue」の場合には、比較対象ノードがノードu、ノードlとなるので、ノードu、ノードlの順に比較を行う。入力キー「blue」は、ノードlのタグキー「violet」よりも優先度が小さく、「ack」よりも優先度が大きい。なお、入力キー「blue」とタグキー「violet」との優先度を比較する場合には、ルートノードからノードuに至るトライ部のキー「blue」を入力キー「blue」から取り除いた後に比較する。また、入力キー「blue」とタグキー「ack」との優先度を比較する場合には、ルートノードからノードlに至るトライ部のキー「bl」を入力キー「blue」から取り除いた後に比較する。   When the input key is “blue”, since the comparison target nodes are the node u and the node l, the comparison is performed in the order of the node u and the node l. The input key “blue” has a lower priority than the tag key “violet” of the node l and a higher priority than the “ack”. When comparing the priority between the input key “blue” and the tag key “violet”, the key “blue” of the trie section from the root node to the node u is removed from the input key “blue” and then compared. When comparing the priority of the input key “blue” with the tag key “ack”, the key “bl” of the trie section from the root node to the node l is removed from the input key “blue” and then compared.

トライ木生成部150aは、入力キーよりも優先度の大きいタグキーの中で、優先度が最小となるタグキーを有するノードに、入力キーおよび入力キーに対応する値を登録し、既に登録されてあったタグキーをシフトさせる。   The trie tree generation unit 150a registers the input key and the value corresponding to the input key in the node having the tag key with the lowest priority among the tag keys having a higher priority than the input key. Shift the tag key.

入力キーが「blue」の場合には、トライ木生成部150aは、ノードuに入力キー「blue」、値「4」を登録する。ルートノードからノードuに至るトライ部分のキーが「blu」であるため、実際には、タグキー「e」をノードuに登録する。また、トライ木生成部150aは、ノードuに登録してあったタグキー「blueviolet」をシフトさせるべく、新規のノードeをノードuの配下に作成し、タグキー「blueviolet」を登録する。ノードeに至るトライ部分のキーが「blue」であるため、実際には、タグキー「violet」をノードeに登録する。上記のような登録処理を実行することで、図14の右側に示すトライ木が生成される。なお、トライ木生成部150aは、兄ノードを有するノードを識別するために、識別情報を登録しておいても良い。例えば、図14の右側では、ノードlが兄ノードiを有しているので、ノードlに識別情報を登録する。   When the input key is “blue”, the trie tree generating unit 150a registers the input key “blue” and the value “4” in the node u. Since the key of the trie portion from the root node to the node u is “blu”, the tag key “e” is actually registered in the node u. Also, the trie tree generation unit 150a creates a new node e under the node u and registers the tag key “blueviolet” in order to shift the tag key “blueviolet” registered in the node u. Since the key of the trie part leading to the node e is “blue”, the tag key “violet” is actually registered in the node e. By executing the registration process as described above, the trie tree shown on the right side of FIG. 14 is generated. The trie tree generation unit 150a may register identification information in order to identify a node having an older brother node. For example, on the right side of FIG. 14, since node l has brother node i, identification information is registered in node l.

以下において、トライ木生成部150aがトライ木を生成する処理について具体的に説明する。図15〜図24は、トライ木を生成する処理を説明するための図である。ここでは説明の便宜上、キー「http://aaa.aaa/e/」、値「1」と、キー「http://aaa.aaa/e/c/」、値「2」と、キー「http://aaa.aaa/e/c/」、値「3」と、キー「http://aaa.aaa/e/」、値「4」の順で、トライ木を生成する場合について説明する。   Hereinafter, a process in which the trie tree generation unit 150a generates a trie tree will be described in detail. 15 to 24 are diagrams for explaining processing for generating a trie tree. Here, for convenience of explanation, the key “http://aaa.aaa/e/”, the value “1”, the key “http://aaa.aaa/e/c/”, the value “2”, and the key “ Explains how to create a trie tree in the order of "http://aaa.aaa/e/c/", value "3", key "http://aaa.aaa/e/", value "4" To do.

図15に示すように、まず、ノードが存在しない状態で、キー「http://aaa.aaa/e/」、値「1」を追加する場合について説明する。トライ木生成部150aは、ルートノードを生成する(ステップS10a)。実データ上において、トライ木生成部150aは、ルートノードに対応するポインタ配列20を生成し、ルートノードポインタとポインタ配列20を接続する。また、ポインタ配列20はルートノードに対応するので、「TAG」を空に接続する(ステップS10b)。   As shown in FIG. 15, first, a case where a key “http://aaa.aaa/e/” and a value “1” are added in a state where no node exists will be described. The trie tree generation unit 150a generates a root node (step S10a). On the actual data, the trie tree generation unit 150 a generates a pointer array 20 corresponding to the root node, and connects the root node pointer and the pointer array 20. Further, since the pointer array 20 corresponds to the root node, “TAG” is connected to the empty (step S10b).

トライ木生成部150aは、入力キー「http://aaa.aaa/e/」を用意する(ステップS11a)。実データ上において、トライ木生成部150aは、テキスト表14に入力キー「http://aaa.aaa/e/」を格納し、入力キーのポインタを、テキスト表14の1列目の「h」に接続する(ステップS11b)。   The trie tree generation unit 150a prepares an input key “http://aaa.aaa/e/” (step S11a). On the actual data, the trie tree generation unit 150a stores the input key “http://aaa.aaa/e/” in the text table 14, and sets the pointer of the input key to “h” in the first column of the text table 14. (Step S11b).

トライ木生成部150aは、入力キー「http://aaa.aaa/e/」の先頭文字「h」をキーとする子ノードが存在しないので、ルートノードを参照する。ここで、ルートノードにタグキーは存在しないので、ルートノードのタグキーの優先度よりも、入力キー「http://aaa.aaa/e/」の優先度が大きくなる。   The trie tree generation unit 150a refers to the root node because there is no child node whose key is the first character “h” of the input key “http://aaa.aaa/e/”. Here, since the tag key does not exist in the root node, the priority of the input key “http://aaa.aaa/e/” becomes higher than the priority of the tag key of the root node.

トライ木生成部150aは、ルートノードの配下に「h」をキーとするノードを作成し、入力キー「http://aaa.aaa/e/」から文字「h」を除いた残りのキーをタグキーとして、ノードhに接続する。また、入力キー「http://aaa.aaa/e/」の値「1」もノードhに接続する(ステップS12a)。   The trie tree generation unit 150a creates a node with “h” as a key under the root node, and uses the remaining keys obtained by removing the character “h” from the input key “http://aaa.aaa/e/”. Connect to node h as tag key. The value “1” of the input key “http://aaa.aaa/e/” is also connected to the node h (step S12a).

実データ上において、トライ木生成部150aは、ノードhに対応するポインタ配列21を生成し、ポインタ配列20のキー番号「0×68」で、ポインタ配列20とポインタ配列21を接続する。また、トライ木生成部150aは、ポインタ配列21の「TAG」をテキスト表14の2列目の「t」に接続し、ポインタ配列21の「Data」と値「1」を接続する(ステップS12b)。   On the actual data, the trie tree generation unit 150 a generates the pointer array 21 corresponding to the node h, and connects the pointer array 20 and the pointer array 21 with the key number “0 × 68” of the pointer array 20. The trie tree generation unit 150a connects “TAG” of the pointer array 21 to “t” in the second column of the text table 14, and connects “Data” of the pointer array 21 and the value “1” (step S12b). ).

続いて、図16に移行し、ステップS12a、12bにおいて作成したトライ木に、キー「http://aaa.aaa/e/c/」、値「2」を追加する場合について説明する。トライ木生成部150aは、入力キー「http://aaa.aaa/e/c/」の先頭文字hでルートノードからノードhに遷移する。そして、トライ木生成部150aは、入力キー「http://aaa.aaa/e/c/」のポインタを1つ進め、2文字目の「t」に設定する(ステップS13a)。   Subsequently, the case where the key “http://aaa.aaa/e/c/” and the value “2” are added to the trie tree created in steps S12a and 12b will be described with reference to FIG. The trie tree generation unit 150a transitions from the root node to the node h at the first character h of the input key “http://aaa.aaa/e/c/”. Then, the trie tree generation unit 150a advances the pointer of the input key “http://aaa.aaa/e/c/” by one and sets it to “t” of the second character (step S13a).

実データ上において、トライ木生成部150aは、テキスト表14に最後に登録されたキー「http://aaa.aaa/e/」との間を1つ空けて、キー「http://aaa.aaa/e/c」を登録する。そして、トライ木生成部150aは、テキスト表14の2行目2列目の文字「t」に入力キーのポインタを接続する(ステップS13b)。   On the actual data, the trie tree generation unit 150a leaves one key “http://aaa.aaa/e/” registered last in the text table 14 and then generates the key “http: // aaa .aaa / e / c ”. Then, the trie tree generating unit 150a connects the pointer of the input key to the character “t” in the second row and second column of the text table 14 (step S13b).

トライ木生成部150aは、ノードhにおいて、「t」をキーとする子ノードが存在しないので、ノードhのタグキー「ttp://aaa.aaa/e/」の優先度と、トライ部分の「h」を取り除いた入力キー「ttp://aaa.aaa/e/c/」の優先度を比較する。すると、入力キーの17文字目がcであり、タグキーの17文字目が空であるため、入力キーの優先度が、タグキーの優先度よりも大きい(ステップS14)。したがって、入力キー「ttp://aaa.aaa/e/c/」は、ノードh以降のノードに登録する。   Since there is no child node having “t” as a key in the node h, the trie tree generating unit 150a determines the priority of the tag key “ttp: //aaa.aaa/e/” of the node h and “ The priority of the input key “ttp: //aaa.aaa/e/c/” from which “h” is removed is compared. Then, since the 17th character of the input key is c and the 17th character of the tag key is empty, the priority of the input key is higher than the priority of the tag key (step S14). Therefore, the input key “ttp: //aaa.aaa/e/c/” is registered in the node after the node h.

続いて、図17に移行し、トライ木生成部150aは、入力キー「http://aaa.aaa/e/c/」の2文字目の「t」をキーとして新しいノードtを生成し、入力キーのポインタを3文字目の「t」に進める(ステップS15a)。   Subsequently, the process proceeds to FIG. 17, the trie tree generation unit 150 a generates a new node t using the second character “t” of the input key “http://aaa.aaa/e/c/” as a key, The pointer of the input key is advanced to “t” of the third character (step S15a).

実データ上において、トライ木生成部150aは、ノードtに対応するポインタ配列22を生成し、ポインタ配列21のキー番号「0×74」で、ポインタ配列21とポインタ配列22を接続する。また、入力キーのポインタを1つ進め、テキスト表14の2行目3列目の「t」に入力キーのポインタを接続する(ステップS15b)。   On the actual data, the trie tree generation unit 150 a generates the pointer array 22 corresponding to the node t, and connects the pointer array 21 and the pointer array 22 with the key number “0 × 74” of the pointer array 21. Further, the input key pointer is advanced by one, and the input key pointer is connected to “t” in the second row and third column of the text table 14 (step S15b).

トライ木生成部150aは、ステップS15aで作成したノードtに入力キー「http://aaa.aaa/e/c/」からトライ部分の「ht」を除いた残りのキー「tp://aaa.aaa/e/c/」をタグキーとして登録する(ステップS16a)。   The trie tree generation unit 150a adds the remaining key “tp: // aaa” obtained by removing the “ht” of the trie part from the input key “http://aaa.aaa/e/c/” to the node t created in step S15a. .aaa / e / c / "is registered as a tag key (step S16a).

実データ上において、トライ木生成部150aは、ポインタ配列22の「TAG」をテキスト表14の2行目3列目の「t」に接続し、ポインタ配列22の「Data」と値「2」を接続する(ステップS16b)。   On the actual data, the trie tree generating unit 150a connects “TAG” in the pointer array 22 to “t” in the second row and third column of the text table 14, and “Data” and the value “2” in the pointer array 22 are connected. Are connected (step S16b).

続いて、図18に移行し、ステップS16a、16bにおいて作成したトライ木に、入力キー「http://aaa.aaa/d/」、値「3」を追加する場合について説明する。トライ木生成部150aは、入力キー「http://aaa.aaa/d/」の先頭文字から1文字ずつ取り出して、トライ木上をノードh、tの順に遷移する。そして、トライ木生成部150aは、遷移したノードの数に応じて、入力キー「http://aaa.aaa/d/」のポインタを2つ進め、3文字目の「t」に設定する。   Subsequently, the case where the input key “http://aaa.aaa/d/” and the value “3” are added to the trie tree created in steps S16a and 16b will be described with reference to FIG. The trie tree generation unit 150a extracts characters one by one from the first character of the input key “http://aaa.aaa/d/”, and transitions on the trie tree in the order of nodes h and t. Then, the trie tree generation unit 150a advances the pointer of the input key “http://aaa.aaa/d/” by two according to the number of transitioned nodes, and sets the third character “t”.

そして、トライ木生成部150aは、ノードtにおいて、「t」をキーとする子ノードが存在しないので、ノードtのタグキー「tp://aaa.aaa/e/c/」の優先度と、トライ部分の「ht」を取り除いた入力キー「tp://aaa.aaa/d/」の優先度を比較する。すると、タグキーの14文字目が「e」であり、入力キーの14文字目が「d」であるため、タグキーの優先度の方が、入力キーの優先度よりも大きくなる(ステップS17a)。   The trie tree generation unit 150a does not have a child node having “t” as a key in the node t, and therefore the priority of the tag key “tp: //aaa.aaa/e/c/” of the node t, Compare the priority of the input key “tp: //aaa.aaa/d/” without the “ht” in the trial part. Then, since the 14th character of the tag key is “e” and the 14th character of the input key is “d”, the priority of the tag key is higher than the priority of the input key (step S17a).

実データ上において、トライ木生成部150aは、テキスト表14に最後に登録されたキー「http://aaa.aaa/e/c/」との間を1つ空けて、キー「http://aaa.aaa/d/」を登録する。そして、トライ木生成部150aは、テキスト表14の3行目5文字目の文字「t」に入力キーのポインタを接続する。また、ポインタ配列22の「TAG」に接続された文字を先頭とする文字列と、入力キーのポインタに接続された文字を先頭とする文字列とを順次比較すると、タグキーの14文字目が「e」であり、入力キーの14文字目が「d」であるため、タグキーの優先度の方が、入力キーの優先度よりも大きくなる(ステップS17b)。   On the actual data, the trie tree generation unit 150a leaves one key “http://aaa.aaa/e/c/” registered last in the text table 14 and the key “http: / /aaa.aaa/d/ ”. Then, the trie tree generating unit 150a connects the pointer of the input key to the character “t” in the third line and the fifth character of the text table 14. When the character string starting with the character connected to “TAG” in the pointer array 22 and the character string starting with the character connected to the pointer of the input key are sequentially compared, the 14th character of the tag key is “ e ”and the 14th character of the input key is“ d ”, the priority of the tag key is greater than the priority of the input key (step S17b).

トライ木生成部150aは、入力キー「http://aaa.aaa/d/」のポインタを一つ戻して、2文字目の「t」に設定し、ノードtの親ノードとなるノードhに遷移する。そして、トライ木生成部150aは、ノードhのタグキー「ttp://aaa.aaa/e/c」の優先度と、トライ部分の「h」を取り除いた入力キー「ttp://aaa.aaa/d/」の優先度を比較する。すると、タグキーの15文字目が「e」であり、入力キーの14文字目が「d」であるため、タグキーの優先度の方が、入力キーの優先度よりも大きくなる(ステップS18a)。   The trie tree generation unit 150a returns one pointer of the input key “http://aaa.aaa/d/”, sets it to “t” of the second character, and sets it to the node h that is the parent node of the node t. Transition. Then, the trie tree generation unit 150a uses the priority of the tag key “ttp: //aaa.aaa/e/c” of the node h and the input key “ttp: //aaa.aaa” from which the “h” of the trie part is removed. / d / "is compared. Then, since the 15th character of the tag key is “e” and the 14th character of the input key is “d”, the priority of the tag key is higher than the priority of the input key (step S18a).

実データ上において、トライ木生成部150aは、現在のノードのポインタをポインタ配列21に接続し、テキスト表14の3行目4文字目の文字「t」に入力キーのポインタを接続する。また、ポインタ配列22の「TAG」に接続された文字を先頭とする文字列と、入力キーのポインタに接続された文字を先頭とする文字列とを順次比較すると、タグキーの15文字目が「e」であり、入力キーの15文字目が「d」であるため、タグキーの優先度の方が、入力キーの優先度よりも大きくなる(ステップS18b)。   On the actual data, the trie tree generation unit 150 a connects the pointer of the current node to the pointer array 21 and connects the pointer of the input key to the character “t” in the third row and the fourth character of the text table 14. When the character string starting with the character connected to “TAG” in the pointer array 22 and the character string starting with the character connected to the pointer of the input key are sequentially compared, the 15th character of the tag key is “ e ”and the 15th character of the input key is“ d ”, the priority of the tag key is greater than the priority of the input key (step S18b).

続いて、図19に移行する。トライ木生成部150aは、ノードhの親ノードがルートノードであるため、ノードhのデータ(タグキー、値)と、入力データ(入力キー、値)を交換する。すなわち、トライ木生成部150aは、入力キー「http://aaa.aaa/d/」からトライ部分「h」を取り除いた残りのキー「ttp://aaa.aaa/d/」をノードhのタグキーに登録する。また、入力キー「http://aaa.aaa/d/」に対応する値「3」もノードhに登録する。また、トライ木生成部150aは、ノードhに登録されていたタグキー「ttp://aaa.aaa/e/」の先頭にトライ部分「h」を追加して、入力キーとして取り出す。また、タグキー「ttp://aaa.aaa/e/」に対応付けられていた値「1」も取り出す(ステップS19a)。   Subsequently, the process proceeds to FIG. Since the parent node of the node h is the root node, the trie tree generation unit 150a exchanges the data (tag key, value) of the node h and the input data (input key, value). That is, the trie tree generation unit 150a uses the remaining key “ttp: //aaa.aaa/d/” obtained by removing the trie part “h” from the input key “http://aaa.aaa/d/” as the node h. Register with the tag key. Also, the value “3” corresponding to the input key “http://aaa.aaa/d/” is also registered in the node h. In addition, the trie tree generation unit 150a adds a trie part “h” to the head of the tag key “ttp: //aaa.aaa/e/” registered in the node h, and takes it out as an input key. Further, the value “1” associated with the tag key “ttp: //aaa.aaa/e/” is also extracted (step S19a).

実データ上において、トライ木生成部150aは、ノードhのデータ(タグキー、値)と、入力データ(入力キー、値)を交換する。すなわち、トライ木生成部150aは、ノードhに対応するポインタ配列21の「TAG」をテキスト表14の3行目4列目の文字「t」に接続する。また、ポインタ配列21の「Data」と値「3」を接続する。そして、トライ木生成部150aは、入力キーのポインタを、テキスト表14の1行目2列目の「t」に接続する。また、ポインタ配列21の「Data」に接続されていた値「1」を入力値に保持する(ステップS19b)。   On the actual data, the trie tree generation unit 150a exchanges the data (tag key, value) of the node h and the input data (input key, value). That is, the trie tree generation unit 150 a connects “TAG” of the pointer array 21 corresponding to the node h to the character “t” in the third row and fourth column of the text table 14. Further, “Data” of the pointer array 21 and the value “3” are connected. Then, the trie tree generation unit 150 a connects the input key pointer to “t” in the first row and second column of the text table 14. Further, the value “1” connected to “Data” of the pointer array 21 is held as the input value (step S19b).

トライ木生成部150aは、ノードhから、入力キー「http://aaa.aaa/e/」の2文字目のtでノードtに遷移し、ノードtのデータ(タグキー、値)と入力データ(入力キー、値)を交換する。すなわち、トライ木生成部150aは、入力キー「http://aaa.aaa/e/」からトライ部分「ht」を取り除いた残りのキー「tp://aaa.aaa/e/」をノードtのタグキーに登録する。また、入力キー「http://aaa.aaa/e/」に対応する値「1」もノードtに登録する。また、トライ木生成部150aは、ノードtに登録されていたタグキー「tp://aaa.aaa/e/c/」の先頭にトライ部分「h」を追加して、入力キーとして取り出す。また、タグキー「ttp://aaa.aaa/e/c/」に対応付けられていた値「2」も取り出す(ステップS20a)。   The trie tree generation unit 150a transitions from the node h to the node t with the second character t of the input key “http://aaa.aaa/e/”, and the data (tag key, value) and input data of the node t Exchange (input key, value). That is, the trie tree generating unit 150a uses the remaining key “tp: //aaa.aaa/e/” obtained by removing the trie part “ht” from the input key “http://aaa.aaa/e/” as a node t. Register with the tag key. Further, the value “1” corresponding to the input key “http://aaa.aaa/e/” is also registered in the node t. In addition, the trie tree generation unit 150a adds a trie part “h” to the head of the tag key “tp: //aaa.aaa/e/c/” registered in the node t, and takes it out as an input key. Further, the value “2” associated with the tag key “ttp: //aaa.aaa/e/c/” is also extracted (step S20a).

実データ上において、トライ木生成部150aは、ノードtのデータ(タグキー、値)と、入力データ(入力キー、値)を交換する。すなわち、トライ木生成部150aは、ノードtに対応するポインタ配列22の「TAG」をテキスト表14の1列目3列目の文字「t」に接続する。また、ポインタ配列22の「Data」と値「1」を接続する。そして、トライ木生成部150aは、入力キーのポインタを、テキスト表14の2行目3列目の「t」に接続する。また、ポインタ配列21の「Data」に接続されていた値「2」を入力値に保持する(ステップS20b)。   On the actual data, the trie tree generation unit 150a exchanges the data (tag key, value) of the node t and the input data (input key, value). That is, the trie tree generation unit 150 a connects “TAG” of the pointer array 22 corresponding to the node t to the character “t” in the first column and the third column of the text table 14. Further, “Data” of the pointer array 22 and the value “1” are connected. Then, the trie tree generation unit 150 a connects the pointer of the input key to “t” in the second row and third column of the text table 14. Further, the value “2” connected to “Data” of the pointer array 21 is held as the input value (step S20b).

続いて、図20に移行する。トライ木生成部150aは、入力キー「http://aaa.aaa/e/c/」の3文字目に対応するノードtが、ノードtの配下に存在しないので、ノードtの配下に新たなノードtを生成する。ここで、各ノードtを区別するために以下の説明では、親側のノードtをノードt(親)と表記し、子側のノードtをノードt(子)と表記する。また、トライ木生成部150aは、入力キーのポインタを3文字目の「p」に設定する(ステップS21a)。   Subsequently, the process proceeds to FIG. Since the node t corresponding to the third character of the input key “http://aaa.aaa/e/c/” does not exist under the node t, the trie tree generation unit 150a adds a new node under the node t. Create node t. Here, in order to distinguish each node t, in the following description, the node t on the parent side is expressed as node t (parent), and the node t on the child side is expressed as node t (child). Further, the trie tree generation unit 150a sets the pointer of the input key to “p” of the third character (step S21a).

実データ上において、トライ木生成部150aは、ノードt(子)に対応するポインタ配列23を生成し、ポインタ配列22のキー番号「0×74」で、ポインタ配列22とポインタ配列23を接続する。また、トライ木生成部150aは、入力キーのポインタを、テキスト表14の2行目4列目の「p」に接続する(ステップS21b)。   On the actual data, the trie tree generation unit 150 a generates the pointer array 23 corresponding to the node t (child), and connects the pointer array 22 and the pointer array 23 with the key number “0 × 74” of the pointer array 22. . Further, the trie tree generation unit 150a connects the pointer of the input key to “p” in the second row and the fourth column of the text table 14 (step S21b).

続いて、図21に移行する。トライ木生成部150aは、入力キー「http://aaa.aaa/e/c/」からトライ部分「htt」を取り除いた残りのキー「p://aaa.aaa/e/c/」をノードt(子)に接続する。また、トライ木生成部150aは、入力キー「http://aaa.aaa/e/c/」に対応する値「2」をノードt(子)に接続する(ステップS22a)。   Then, it transfers to FIG. The trie tree generation unit 150a uses the remaining key “p: //aaa.aaa/e/c/” obtained by removing the trie part “htt” from the input key “http://aaa.aaa/e/c/”. Connect to node t (child). Further, the trie tree generating unit 150a connects the value “2” corresponding to the input key “http://aaa.aaa/e/c/” to the node t (child) (step S22a).

実データ上において、トライ木生成部150aは、ポインタ配列23の「TAG」をテキスト表14の2行目4列目の「p」に接続し、入力キーのポインタを開放する。また、トライ木生成部150aは、ポインタ配列23の「Data」に値「2」を接続する(ステップS22b)。   On the actual data, the trie tree generation unit 150a connects “TAG” in the pointer array 23 to “p” in the second row and fourth column of the text table 14 and releases the pointer of the input key. In addition, the trie tree generation unit 150a connects the value “2” to “Data” of the pointer array 23 (step S22b).

続いて、図22に移行し、ステップS22a、22bにおいて作成したトライ木に、キー「http://aaa.aaa/e/」、値「4」を追加する場合について説明する。トライ木生成部150aは、入力キー「http://aaa.aaa/e/」の先頭から文字を順次読み出し、ノードh、t(親)、t(子)に遷移する。そして、トライ木生成部150aは、入力キー「http://aaa.aaa/e/」のポインタを4文字目の「p」に設定する(ステップS23a)。   Subsequently, the case where the key “http://aaa.aaa/e/” and the value “4” are added to the trie tree created in steps S22a and 22b will be described with reference to FIG. The trie tree generation unit 150a sequentially reads characters from the head of the input key “http://aaa.aaa/e/”, and transitions to nodes h, t (parent), and t (child). Then, the trie tree generation unit 150a sets the pointer of the input key “http://aaa.aaa/e/” to “p” of the fourth character (step S23a).

実データ上において、トライ木生成部150aは、テキスト表14に最後に登録されたキー「http://aaa.aaa/e/d/」との間を1つ空けて、キー「http://aaa.aaa/e/」を登録する。そして、トライ木生成部150aは、テキスト表14の4行目6列目の文字「p」に入力キーのポインタを接続する(ステップS23b)。   On the actual data, the trie tree generation unit 150a leaves one key “http://aaa.aaa/e/d/” registered last in the text table 14 and then presses the key “http: / /aaa.aaa/e/ ”. Then, the trie tree generating unit 150a connects the pointer of the input key to the character “p” in the fourth row and the sixth column of the text table 14 (step S23b).

続いて、図23に移行する。トライ木生成部150aは、ノードt(子)において、「p」をキーとする子ノードが存在しないので、ノードt(子)のタグキー「p://aaa.aaa/e/c/」の優先度と、トライ部分の「htt」を取り除いた入力キー「p://aaa.aaa/e/」の優先度を比較する。すると、入力キーの15文字目が「空」であり、タグキーの15文字目が「c」であるため、タグキーの優先度が入力キーよりも大きい。   Subsequently, the process proceeds to FIG. The trie tree generation unit 150a does not have a child node having “p” as a key in the node t (child), and therefore the tag key “p: //aaa.aaa/e/c/” of the node t (child). The priority is compared with the priority of the input key “p: //aaa.aaa/e/” from which “htt” in the trial part is removed. Then, since the 15th character of the input key is “empty” and the 15th character of the tag key is “c”, the priority of the tag key is higher than that of the input key.

したがって、トライ木生成部150aは、ノードt(子)のデータと、入力データとの交換を行わずに、ノードt(子)からノードt(親)に戻り、入力キー「http://aaa.aaa/e/」のポインタを3文字目の「t」に設定する(ステップS24a)。   Therefore, the trie tree generation unit 150a returns from the node t (child) to the node t (parent) without exchanging the data of the node t (child) with the input data, and enters the input key “http: // aaa The pointer of “.aaa / e /” is set to “t” as the third character (step S24a).

実データ上において、トライ木生成部150aは、テキスト表14の4行目6列目の文字「p」に入力キーのポインタを接続する。また、トライ木生成部150aは、ポインタ配列23の「TAG」に接続された文字を先頭とする文字列と、入力キーのポインタに接続された文字を先頭とする文字列とを順次比較すると、入力キーの15文字目が「空」であり、タグキーの15文字目が「c」であるため、タグキーの優先度が入力キーよりも大きいと判定する。そして、トライ木生成部150aは、入力キーのポインタを、4行目5列目の「t」に設定する(ステップS24b)。   On the actual data, the trie tree generation unit 150a connects the pointer of the input key to the character “p” in the fourth row and sixth column of the text table 14. Further, the trie tree generation unit 150a sequentially compares the character string starting with the character connected to “TAG” of the pointer array 23 and the character string starting with the character connected to the pointer of the input key. Since the 15th character of the input key is “empty” and the 15th character of the tag key is “c”, it is determined that the priority of the tag key is higher than that of the input key. Then, the trie tree generating unit 150a sets the pointer of the input key to “t” in the fourth row and the fifth column (step S24b).

続いて、図24に移行する。トライ木生成部150aは、ノードt(親)のタグキー「tp://aaa.aaa/e/」の優先度と、トライ部分の「ht」を取り除いた入力キー「tp://aaa.aaa/e/」の優先度とを比較する。すると、入力キーとタグキーの優先度が等しい(入力キーとタグキーが同じ)である。この場合、トライ木生成部150aは、入力キー「http://aaa.aaa/e/」に対応する値「4」を、ノードtに追加する(ステップS25a)。   Subsequently, the process proceeds to FIG. The trie tree generation unit 150a uses the priority of the tag key “tp: //aaa.aaa/e/” of the node t (parent) and the input key “tp: //aaa.aaa” from which “ht” of the trie part is removed. / e / ”priority. Then, the input key and the tag key have the same priority (the input key and the tag key are the same). In this case, the trie tree generation unit 150a adds the value “4” corresponding to the input key “http://aaa.aaa/e/” to the node t (step S25a).

実データ上において、トライ木生成部150aは、テキスト表14の4行目5列目の文字「t」に入力キーのポインタを接続する。また、トライ木生成部150aは、ポインタ配列22の「TAG」に接続された文字を先頭とする文字列と、入力キーのポインタに接続された文字を先頭とする文字列とを順次比較すると、空に至るまでの各文字列が等しいため、タグキーの優先度と入力キーの優先度は等しい(タグキーと入力キーは同じ)と判定する。そして、トライ木生成部150aは、ポインタ配列22に「Data」に値「4」を追加する(ステップS25b)。   On the actual data, the trie tree generation unit 150a connects the pointer of the input key to the character “t” in the fourth row and the fifth column of the text table 14. Further, the trie tree generation unit 150a sequentially compares the character string starting with the character connected to “TAG” in the pointer array 22 and the character string starting with the character connected to the pointer of the input key. Since each character string leading up to the sky is equal, the priority of the tag key and the priority of the input key are determined to be equal (the tag key and the input key are the same). Then, the trie tree generation unit 150a adds the value “4” to “Data” to the pointer array 22 (step S25b).

図15〜図24に示したように、トライ木生成部150aは、トライ木140bを生成する場合に、1つのノードに1つのキーを割当てるので、トライ木140bのメモリ使用量を削減することが出来る。また、トライ木生成部150aは、新規の入力キーをトライ木140bに割当てる場合に、全てのタグキーと入力キーを比較することはせず、比較対象ノードのタグキーのみと比較して、タグキーを新規に登録するので、処理負荷を軽減させつつ、深さ優先探索順でタグキーが並ぶようにトライ木140bを生成することが出来る。   As shown in FIGS. 15 to 24, when the trie tree generation unit 150a generates a trie tree 140b, one key is assigned to one node, so that the memory usage of the trie tree 140b can be reduced. I can do it. In addition, when assigning a new input key to the trie tree 140b, the trie tree generation unit 150a does not compare all the tag keys with the input key, but compares only the tag key of the comparison target node with a new tag key. Therefore, the trie tree 140b can be generated so that the tag keys are arranged in the depth-first search order while reducing the processing load.

なお、図15〜図24に示した実データに対応する各種データ(ポインタ配列、テキスト表等)は、記憶部140に記憶されているものとする。   It is assumed that various data (pointer array, text table, etc.) corresponding to the actual data shown in FIGS. 15 to 24 are stored in the storage unit 140.

図10の説明に戻ると、トライ木探索部150bは、トライ木140bに登録された値の集計値を抽出する処理、所定のキーに対応する値をトライ木140bから検索する処理を実行する処理部である。   Returning to the description of FIG. 10, the trie tree searching unit 150b executes a process of extracting a total value of values registered in the trie tree 140b and a process of searching the trie tree 140b for a value corresponding to a predetermined key. Part.

まず、トライ木探索部150bが、トライ木140bに登録された値の集計値を抽出する処理について説明する。トライ木探索部150bは、指定された入力キーの文字を先頭から1文字ずつ読み出して、各ノードを辿り、ノードに登録されたタグキーおよび値を対応付けて順次出力することで、集計値を抽出する。ノードに複数の値が登録されている場合には、トライ木探索部150bは、各値を合計しても良いし、別々に出力しても良い。本実施例にかかるトライ木探索部150bは、一例として、各値を合計して出力する。   First, a process in which the trie tree searching unit 150b extracts a total value of values registered in the trie tree 140b will be described. The trie tree search unit 150b reads out the characters of the specified input key one by one from the beginning, traces each node, and sequentially outputs the tag key and value registered in the node in association with each other, thereby extracting the aggregate value To do. When a plurality of values are registered in the node, the trie tree search unit 150b may sum the values or may output them separately. As an example, the trie tree search unit 150b according to the present embodiment sums and outputs each value.

図25〜図27は、集計値を抽出する処理を説明するための図である。図25に示すように、トライ木140bは、ルートノードの配下に、ノードh、ノードt(親)、ノードt(子)が順に接続されている。ノードhは、タグキー「ttp://aaa.aaa/d/」、値「3」を登録し、ノードt(親)は、タグキー「tp://aaa.aaa/e/」、値「1、4」を登録し、ノードt(子)は、タグキー「p://aaa.aaa/e/c/」、値「2」を登録しているものとする。   FIGS. 25 to 27 are diagrams for explaining the process of extracting the total value. As shown in FIG. 25, in the trie tree 140b, a node h, a node t (parent), and a node t (child) are sequentially connected under the root node. Node h registers tag key “ttp: //aaa.aaa/d/” and value “3”, and node t (parent) has tag key “tp: //aaa.aaa/e/” and value “1”. 4 ”is registered, and the node t (child) has registered the tag key“ p: //aaa.aaa/e/c/ ”and the value“ 2 ”.

また、図25〜図27における説明では、入力キー「http://aaa.aaa/e/」が指定された場合の集計値の抽出処理について説明する。図25において、トライ木探索部150bは、入力キー「http://aaa.aaa/e/」の1文字目をポインタに設定し、ポインタの文字にしたがって、ノードhに移行する。   In addition, in the description in FIGS. 25 to 27, the total value extraction process when the input key “http://aaa.aaa/e/” is designated will be described. In FIG. 25, the trie tree search unit 150b sets the first character of the input key “http://aaa.aaa/e/” as a pointer, and proceeds to the node h according to the character of the pointer.

ノードhは、タグキー「ttp://aaa.aaa/d/」、値「3」が登録されているので、トライ木探索部150bは、トライ部分「h」をタグキー「ttp://aaa.aaa/d/」の先頭に追加したキー「http://aaa.aaa/d/」と、値(合計値)「3」を出力する(ステップS30a)。   Since the node h is registered with the tag key “ttp: //aaa.aaa/d/” and the value “3”, the trie tree search unit 150b uses the trie part “h” as the tag key “ttp: // aaa. The key “http://aaa.aaa/d/” added to the head of “aaa / d /” and the value (total value) “3” are output (step S30a).

実データ上において、トライ木探索部150bは、テキスト表14の4行目3列目に入力キー「http://aaa.aaa/d/」を登録し、入力キーのポインタを4行目3列目に接続する。また、トライ木探索部150bは、現在のノードのポインタをポインタ配列21に接続する。また、トライ木探索部150bは、ノードhに対応するポインタ配列21の「TAG」に接続された文字の前後空までの文字列「http://aaa.aaa/d/」と、「Data」に接続された値「3」を出力する(ステップS30b)。   On the actual data, the trie tree search unit 150b registers the input key “http://aaa.aaa/d/” in the fourth row and third column of the text table 14, and sets the input key pointer in the fourth row and third column. Connect to the row. The trie tree search unit 150 b connects the pointer of the current node to the pointer array 21. Further, the trie tree search unit 150b includes a character string “http://aaa.aaa/d/” up to the empty space before and after the character connected to “TAG” of the pointer array 21 corresponding to the node h, and “Data”. The value “3” connected to is output (step S30b).

図26の説明に移行する。トライ木探索部150bは、入力キー「http://aaa.aaa/e/」の2文字目をポインタに設定し、ポインタの文字にしたがって、ノードhからノードt(親)に移行する。ノードt(親)は、タグキー「tp://aaa.aaa/e/」、値「1、4」が登録されているので、トライ木探索部150bは、トライ部分「ht」をタグキー「tp://aaa.aaa/e/」の先頭に追加したキーと、値「1、4」を合計した値「5」を出力する(ステップS31a)。   The description shifts to the description of FIG. The trie tree searching unit 150b sets the second character of the input key “http://aaa.aaa/e/” as a pointer, and moves from the node h to the node t (parent) according to the character of the pointer. Since the node t (parent) is registered with the tag key “tp: //aaa.aaa/e/” and the values “1, 4”, the trie tree searching unit 150b uses the trie part “ht” as the tag key “tp”. A value “5” obtained by adding the key added to the head of “: //aaa.aaa/e/” and the values “1, 4” is output (step S31a).

実データ上において、トライ木探索部150bは、入力キーのポインタ接続先を1文字ずらし、テキスト表14の4行目4列目の文字「t」に接続する。また、トライ木探索部150bは、現在のノードのポインタをポインタ配列22に接続する。また、トライ木探索部150bは、ノードt(親)に対応するポインタ配列22の「TAG」に接続された文字の前後空までの文字列「http://aaa.aaa/e/」と、「Data」に接続された値「1、4」の合計値「5」を出力する(ステップS31b)。   On the actual data, the trie tree search unit 150b shifts the pointer connection destination of the input key by one character and connects to the character “t” in the fourth row and fourth column of the text table 14. The trie tree searching unit 150 b connects the pointer of the current node to the pointer array 22. Further, the trie tree search unit 150b includes a character string “http://aaa.aaa/e/” up to an empty space before and after the character connected to “TAG” of the pointer array 22 corresponding to the node t (parent), The total value “5” of the values “1, 4” connected to “Data” is output (step S31b).

図27の説明に移行する。トライ木探索部150bは、入力キー「http://aaa.aaa/e/」の3文字目をポインタに設定し、ポインタの文字にしたがって、ノードt(親)からノードt(子)に移行する。ノードt(子)は、タグキー「p://aaa.aaa/e/c/」、値「2」が登録されているので、トライ木探索部150bは、トライ部分「htt」をタグキー「p://aaa.aaa/e/c/」の先頭に追加したキーと、値(合計値)「2」を出力する(ステップS32a)。   The description shifts to the description of FIG. The trie tree searching unit 150b sets the third character of the input key “http://aaa.aaa/e/” as a pointer, and moves from the node t (parent) to the node t (child) according to the pointer character. To do. Since the node t (child) is registered with the tag key “p: //aaa.aaa/e/c/” and the value “2”, the trie tree search unit 150b uses the trie part “htt” as the tag key “p”. The key added to the head of “: //aaa.aaa/e/c/” and the value (total value) “2” are output (step S32a).

実データ上において、トライ木探索部150bは、入力キーのポインタ接続先を1文字ずらし、テキスト表14の4行目5列目の文字「t」に接続する。また、トライ木探索部150bは、現在のノードのポインタをポインタ配列23に接続する。また、トライ木探索部150bは、ノードt(子)に対応するポインタ配列23の「TAG」に接続された文字の前後空までの文字列「http://aaa.aaa/e/c/」と、「Data」に接続された値(合計値)「2」を出力する(ステップS32b)。   On the actual data, the trie tree search unit 150b shifts the pointer connection destination of the input key by one character and connects it to the character “t” in the fourth row and fifth column of the text table 14. Further, the trie tree search unit 150 b connects the pointer of the current node to the pointer array 23. Further, the trie tree search unit 150b uses the character string “http://aaa.aaa/e/c/” up to the character before and after the character connected to “TAG” of the pointer array 23 corresponding to the node t (child). Then, the value (total value) “2” connected to “Data” is output (step S32b).

図25〜図27に示したように、入力キーを順次読み出し、トライ木140bを辿ることで、入力キーに対応する集計値を出力することが出来る。   As shown in FIGS. 25 to 27, by sequentially reading the input keys and tracing the trie tree 140b, the total value corresponding to the input keys can be output.

次に、トライ木探索部150bが、指定された入力キーに対応する値をトライ木140bから検索する処理について説明する。トライ木探索部150bは、トライ木140bが、深さ優先探索順でタグキーが並ぶように生成されているので、比較対象ノードに登録されたタグキーと入力キーを比較すればよい。また、比較対象ノードに含まれる各ノードと入力キーを比較する場合に、二分探索法を用いることで、更に処理負荷を軽減させることが出来る。   Next, a process in which the trie tree search unit 150b searches the trie tree 140b for a value corresponding to the designated input key will be described. Since the trie tree 140b is generated so that the tag keys are arranged in the depth-first search order, the trie tree search unit 150b may compare the tag key registered in the comparison target node with the input key. In addition, when comparing each node included in the comparison target node with the input key, the processing load can be further reduced by using the binary search method.

以下において、二分探索法を用いた場合の検索処理について説明する。図28〜図31は、二分探索法を用いた場合の検索処理を説明するための図である。図28に示すように、トライ木140bは、ルートノードの配下に、ノードh、ノードt(親)、ノードt(子)が順に接続されている。ノードhは、タグキー「ttp://aaa.aaa/d/」、値「3」を登録し、ノードt(親)は、タグキー「tp://aaa.aaa/e」、値「1、4」を登録し、ノードt(子)は、タグキー「p://aaa.aaa/e/c」、値「2」を登録しているものとする。   In the following, a search process when the binary search method is used will be described. 28 to 31 are diagrams for explaining search processing when the binary search method is used. As shown in FIG. 28, in the trie tree 140b, a node h, a node t (parent), and a node t (child) are sequentially connected under the root node. Node h registers tag key “ttp: //aaa.aaa/d/” and value “3”, and node t (parent) has tag key “tp: //aaa.aaa/e”, value “1, 4 ”is registered, and the node t (child) has registered the tag key“ p: //aaa.aaa/e/c ”and the value“ 2 ”.

また、図28〜図31における説明では、入力キー「http://aaa.aaa/d」が指定された場合の検索処理について説明する。図28において、トライ木探索部150bは、入力キー「http://aaa.aaa/d」の先頭文字から順に文字を読み出し、ルートノードからノードh、ノードt(親)、ノードt(子)の順に遷移する。そして、トライ木探索部150bは、入力キー「http://aaa.aaa/d」のポインタを初期位置の「h」から3文字ずらした「p」に設定する。また、遷移した各ノードにスタックを追加する(ステップS40a)。   In the description of FIGS. 28 to 31, search processing when the input key “http://aaa.aaa/d” is designated will be described. In FIG. 28, the trie tree search unit 150b reads characters sequentially from the first character of the input key “http://aaa.aaa/d”, and starts from the root node to node h, node t (parent), and node t (child). Transition in the order. Then, the trie tree searching unit 150b sets the pointer of the input key “http://aaa.aaa/d” to “p” which is shifted by three characters from the initial position “h”. Further, a stack is added to each transitioned node (step S40a).

実データ上では、トライ木探索部150bは、ノードh、ノードt(親)、ノードt(子)に対応するポインタ配列21、22、23にそれぞれスタックを追加する。また、トライ木探索部150bは、現在のノードのポインタをポインタ配列23に接続する(ステップS40b)。なお、ここでは、説明の便宜上、入力キー「http://aaa.aaa/d」の記載を省略するが、テキスト表14に入力キー「http://aaa.aaa/d」の情報が格納されているものとする。   On the actual data, the trie tree search unit 150b adds stacks to the pointer arrays 21, 22, and 23 corresponding to the node h, the node t (parent), and the node t (child), respectively. In addition, the trie tree search unit 150b connects the pointer of the current node to the pointer array 23 (step S40b). Here, for convenience of explanation, the description of the input key “http://aaa.aaa/d” is omitted, but the information of the input key “http://aaa.aaa/d” is stored in the text table 14. It is assumed that

続いて、図29の説明に移行する。トライ木探索部150bは、スタックの真ん中のノードt(親)に遷移し、入力キーのポインタを戻った分だけ戻す。ここでは、ノードt(子)からノードt(親)に戻っているので、入力キー「http://aaa.aaa/d」のポインタを「p」から1つ戻した「t(3文字目のt)」に設定する。   Subsequently, the description proceeds to FIG. The trie tree search unit 150b transitions to the node t (parent) in the middle of the stack, and returns the pointer of the input key by the amount returned. Here, since the node t (child) has returned to the node t (parent), the pointer of the input key “http://aaa.aaa/d” is returned from “p” by “t (third character) T) ”.

そして、トライ木探索部150bは、ノードtのタグキー「tp://aaa.aaa/e」の優先度と、トライ部分「ht」を取り除いた入力キー「tp://aaa.aaa/d」の優先度とを比較する。すると、入力キーの14文字目が「d」であり、タグキーの14文字目が「e」であるため、トライ木探索部150bは、タグキーの優先度が入力キーの優先度よりも大きいと判定する(ステップS41a)。ノードt(親)タグキーの優先度が入力キーの優先度よりも大きい場合には、ノードt(親)以降のノードには、検索対象となるタグキーが存在しない。   Then, the trie tree search unit 150b receives the priority of the tag key “tp: //aaa.aaa/e” of the node t and the input key “tp: //aaa.aaa/d” obtained by removing the trie part “ht”. Compare with the priority of. Then, since the 14th character of the input key is “d” and the 14th character of the tag key is “e”, the trie tree searching unit 150b determines that the priority of the tag key is higher than the priority of the input key. (Step S41a). When the priority of the node t (parent) tag key is higher than the priority of the input key, the node after the node t (parent) has no tag key to be searched.

実データ上において、トライ木探索部150bは、スタックの真ん中に接続されたポインタ配列22に現在のノードのポインタを移動させる。そして、トライ木探索部150bは、ポインタ配列22の「TAG」に接続された文字以降の文字列「tp://aaa.aaa/e」と、トライ部分「ht」を除いた残りの入力キー「tp://aaa.aaa/d」とを比較する。すると、入力キーの14文字目が「d」であり、タグキーの14文字目が「e」であるため、トライ木探索部150bは、タグキーの優先度が入力キーの優先度よりも大きいと判定する(ステップS41b)。   On the actual data, the trie tree search unit 150b moves the pointer of the current node to the pointer array 22 connected in the middle of the stack. Then, the trie tree search unit 150b leaves the character string “tp: //aaa.aaa/e” after the character connected to “TAG” in the pointer array 22 and the remaining input keys excluding the trie part “ht”. Compare with "tp: //aaa.aaa/d". Then, since the 14th character of the input key is “d” and the 14th character of the tag key is “e”, the trie tree searching unit 150b determines that the priority of the tag key is higher than the priority of the input key. (Step S41b).

続いて、図30の説明に移行する。図29で説明したように、ノードt(親)タグキーの優先度が入力キーの優先度よりも大きい場合には、ノードt(親)以降のノードには、検索対象となるタグキーが存在しない。したがって、トライ木探索部150bは、スタックの後半となる、ノードt(親)、ノードt(子)に追加されたスタックを削除する。   Subsequently, the description proceeds to FIG. 30. As described with reference to FIG. 29, when the priority of the node t (parent) tag key is higher than the priority of the input key, the node after the node t (parent) has no tag key to be searched. Therefore, the trie tree searching unit 150b deletes the stack added to the node t (parent) and the node t (child), which is the second half of the stack.

また、トライ木探索部150bは、スタックの真ん中のノードhに遷移し、入力キーのポインタを戻った分だけ戻す。ここでは、ノードt(親)からノードhに戻っているので、入力キー「http://aaa.aaa/d/」のポインタを「t(3文字目)」から1つ戻した「t(2文字目)」に設定する(ステップS42a)。   The trie tree search unit 150b transitions to the node h in the middle of the stack, and returns the input key pointer by the amount returned. Here, since the node t (parent) has returned to the node h, the pointer of the input key “http://aaa.aaa/d/” is returned by one from “t (third character)” “t ( 2nd character) ”(step S42a).

実データ上において、トライ木生成部150aは、スタックの真ん中に接続されたポインタ配列21に現在のノードのポインタを移動させる(ステップS41b)。   On the actual data, the trie tree generation unit 150a moves the pointer of the current node to the pointer array 21 connected in the middle of the stack (step S41b).

図31の説明に移行する。トライ木探索部150bは、ノードhのタグキー「ttp://aaa.aaa/d/」の優先度と、トライ部分「h」を取り除いた入力キー「ttp://aaa.aaa/d/」の優先度を比較する。すると、タグキーと入力キーの優先度が等しい(タグキーと入力キーが同じ)ため、トライ木探索部150bは、ノードhに接続されたタグキー「ttp://aaa.aaa/d/」の先頭にトライ部分「h」を追加したキー「http://aaa.aaa/d/」と、値「3」を検索結果として出力する(ステップS43a)。   The description shifts to the description of FIG. The trie tree searching unit 150b determines the priority of the tag key “ttp: //aaa.aaa/d/” of the node h and the input key “ttp: //aaa.aaa/d/” from which the trie part “h” is removed. Compare the priorities of. Then, since the priority of the tag key and the input key is equal (the tag key and the input key are the same), the trie tree search unit 150b is placed at the head of the tag key “ttp: //aaa.aaa/d/” connected to the node h. The key “http://aaa.aaa/d/” to which the trial part “h” is added and the value “3” are output as search results (step S43a).

実データ上において、トライ木探索部150bは、ポインタ配列21の「TAG」に接続された文字以降の文字列「ttp://aaa.aaa/d/」の優先度と、トライ部分「h」を取り除いた残りの入力キー「tp://aaa.aaa/d/」の優先度を比較する。すると、タグキーと入力キーの優先度が等しい(タグキーと入力キーが同じ)ため、トライ木探索部150bは、ポインタ配列21の「TAG」に接続された文字の前後空までの文字列「http://aaa.aaa/d/」と、「Data」に接続された値「3」を出力する(ステップS43b)。   On the actual data, the trie tree search unit 150b determines the priority of the character string “ttp: //aaa.aaa/d/” after the character connected to “TAG” in the pointer array 21 and the trie part “h”. Compare the priorities of the remaining input keys “tp: //aaa.aaa/d/” with the key removed. Then, since the priority of the tag key and the input key is the same (the tag key and the input key are the same), the trie tree search unit 150b causes the character string “http: up to the space before and after the character connected to“ TAG ”of the pointer array 21 //aaa.aaa/d/ ”and the value“ 3 ”connected to“ Data ”are output (step S43b).

次に、図32〜図35において、その他の例を用いて、二分探索法を用いた場合の検索処理について説明する。図32に示すように、トライ木140bは、ルートノードの配下に、ノードa、ノードb、ノードcを接続している。ノードaは、タグキー「aa」、値「3」を登録し、ノードbは、タグキー「c」、値「1」を登録し、ノードcは、タグキー「b」、値「2」を登録しているものとする。なお、ノードbとノードcの関係は、ノードbが兄ノードであり、ノードcが弟ノードである。   Next, in FIG. 32 to FIG. 35, the search processing when the binary search method is used will be described using other examples. As illustrated in FIG. 32, the trie tree 140b connects the node a, the node b, and the node c under the root node. Node a registers tag key “aa” and value “3”, node b registers tag key “c” and value “1”, node c registers tag key “b” and value “2” It shall be. The relationship between node b and node c is that node b is an older brother node and node c is a younger brother node.

また、図32〜図35における説明では、入力キー「ac」が指定された場合の検索処理について説明する。図32において、トライ木探索部150bは、入力キー「ac」から「a」を読み出し、入力キーのポインタを「a」から「c」にずらす。また、トライ木探索部150bは、ノードaにスタックを追加する(ステップS50a)。   In the description of FIGS. 32 to 35, search processing when the input key “ac” is designated will be described. In FIG. 32, the trie tree search unit 150b reads “a” from the input key “ac” and shifts the pointer of the input key from “a” to “c”. Further, the trie tree searching unit 150b adds a stack to the node a (step S50a).

実データ上では、トライ木探索部150bは、ノードaに対応するポインタ配列21にスタックを追加する。また、トライ木探索部150bは、現在のノードのポインタをポインタ配列21に接続する。トライ木探索部150bは、入力キーのポインタを、テキスト表14の1行目14列目の文字「c」に設定する(ステップS50b)。   On the actual data, the trie tree search unit 150b adds a stack to the pointer array 21 corresponding to the node a. The trie tree search unit 150 b connects the pointer of the current node to the pointer array 21. The trie tree searching unit 150b sets the pointer of the input key to the character “c” in the first row and the 14th column of the text table 14 (step S50b).

続いて、図33の説明に移行する。トライ木探索部150bは、入力キー「ac」からポインタが指定する「c」を読み出し、ノードcに遷移する。ノードcに遷移した時点で、ノードaの先祖ノードに登録されたタグキーの優先度は、入力キー「ac」の優先度よりもすべて小さいものとなるため、検索対象から外す必要がある。したがって、トライ木探索部150bは、一旦スタックを空にし、スタックに新しくノードcを追加する。また、入力キーのポインタを「c」から1文字ずらし、ポインタを「空」に設定する(ステップS51a)。   Subsequently, the description proceeds to FIG. The trie tree search unit 150b reads “c” specified by the pointer from the input key “ac”, and transitions to the node c. At the time of transition to the node c, the priority of the tag key registered in the ancestor node of the node a is all lower than the priority of the input key “ac”, so it is necessary to exclude it from the search target. Therefore, the trie tree searching unit 150b empties the stack once and adds a new node c to the stack. Also, the pointer of the input key is shifted by one character from “c”, and the pointer is set to “empty” (step S51a).

実データ上では、トライ木探索部150bは、現在のノードをポインタ配列23に指定する。トライ木探索部150bは、ポインタ配列21に接続されたスタックを削除し、ポインタ配列23にスタックを追加する。また、トライ木探索部150bは、入力キーのポインタをテキスト表14の1行目15文字目の「空」に設定する(ステップS51b)。   On the actual data, the trie tree search unit 150 b designates the current node in the pointer array 23. The trie tree search unit 150 b deletes the stack connected to the pointer array 21 and adds the stack to the pointer array 23. In addition, the trie tree search unit 150b sets the pointer of the input key to “empty” on the 15th character in the first line of the text table 14 (step S51b).

続いて、図34の説明に移行する。トライ木探索部150bは、ポインタが指定する文字が「空」なので、スタックの真ん中のノードcを現在のノードに設定し、ノードcのタグキー「b」の優先度と、トライ部分「ac」を除いた「空」の優先度を比較する。トライ木探索部150bは、比較した結果、タグキーの優先度の方が入力キーの優先度よりも大きいと判定する(ステップS52a)。   Subsequently, the description proceeds to FIG. Since the character designated by the pointer is “empty”, the trie tree search unit 150b sets the node c in the middle of the stack as the current node, and sets the priority of the tag key “b” of the node c and the trie part “ac”. Compare the priority of "empty" except. As a result of the comparison, the trie tree searching unit 150b determines that the priority of the tag key is higher than the priority of the input key (step S52a).

実データ上では、トライ木探索部150bは、スタックの真ん中に対応するポインタ配列23に現在のノードを設定し、ポインタ配列23の「TAG」に接続された文字を先頭とする文字列と、入力キーのポインタに接続された「空」とを比較する。トライ木探索部150bは、比較した結果、タグキーの優先度の方が入力キーの優先度よりも大きいと判定する(ステップS52b)。   On the actual data, the trie tree searching unit 150b sets the current node in the pointer array 23 corresponding to the middle of the stack, the character string starting with the character connected to “TAG” in the pointer array 23, and the input Compare "empty" connected to key pointer. As a result of the comparison, the trie tree searching unit 150b determines that the priority of the tag key is higher than the priority of the input key (step S52b).

続いて、図35の説明に移行する。トライ木探索部150bは、タグキーの優先度の方が入力キーの優先度よりも大きいので、タグキーを登録するノードcのスタックを削除する。全てのスタックが無くなり、入力キー「ac」と一致するタグキーが存在しないので、トライ木探索部150bは、一致データが存在しない旨を出力する(ステップS53a)。   Subsequently, the description proceeds to FIG. Since the priority of the tag key is higher than the priority of the input key, the trie tree searching unit 150b deletes the stack of the node c that registers the tag key. Since all stacks are lost and there is no tag key that matches the input key “ac”, the trie tree search unit 150b outputs that no matching data exists (step S53a).

実データ上では、トライ木探索部150bは、タグキーの優先度の方が入力キーの優先度よりも大きいので、ノードcに対応するポインタ配列28に接続されたスタックを削除する。全てのスタックが無くなり、入力キー「ac」と一致するタグキーが存在しないので、トライ木探索部150bは、一致データが存在しない旨を出力する(ステップS53b)。   On the actual data, the trie tree search unit 150b deletes the stack connected to the pointer array 28 corresponding to the node c because the priority of the tag key is higher than the priority of the input key. Since all the stacks are lost and there is no tag key that matches the input key “ac”, the trie tree search unit 150b outputs that no matching data exists (step S53b).

上述した図28〜図35では、トライ木探索部150bが、二分探索法を用いて検索処理を実行する場合について説明したが、トライ木探索部150bは、必ずしも二分探索法を用いなくてもよい。図36〜図40は、二分探索法を用いない場合の探索処理を説明するための図である。図36に示すように、トライ木140bは、ルートノードの配下にノードb、ノードa、ノードb、ノードcが接続されている。ここで、各ノードbを区別するために、ルートノードの子ノードに対応するノードbをノードb(1)と表記し、もう一方のノードbをノードb(2)と表記する。   In FIG. 28 to FIG. 35 described above, the trie tree search unit 150b executes the search process using the binary search method. However, the trie tree search unit 150b does not necessarily need to use the binary search method. . 36 to 40 are diagrams for describing search processing when the binary search method is not used. As shown in FIG. 36, in the trie tree 140b, node b, node a, node b, and node c are connected under the root node. Here, in order to distinguish each node b, the node b corresponding to the child node of the root node is expressed as node b (1), and the other node b is expressed as node b (2).

ノードb(1)は、タグキー「a」、値「1」を登録し、ノードaは、タグキー「aa」、値「3」を登録し、ノードb(2)は、タグキー「c」、値「1」を登録し、ノードcは、タグキー「b」、値「2」を登録しているものとする。   Node b (1) registers tag key “a” and value “1”, node a registers tag key “aa” and value “3”, and node b (2) registers tag key “c” and value It is assumed that “1” is registered and the node c has registered the tag key “b” and the value “2”.

また、図36〜図40における説明では、入力キー「baca」が指定された場合の検索処理について説明する。図36において、トライ木探索部150bは、入力キーのポインタを先頭文字「b」に設定し、ポインタの指定する「b」により、ルートノードからノードb(1)に遷移する。そして、トライ木探索部150bは、入力キーのポインタを「b」から1文字ずらした「a」に設定する(ステップS60a)。   36 to 40, search processing when the input key “baca” is designated will be described. In FIG. 36, the trie tree search unit 150b sets the pointer of the input key to the first character “b”, and transitions from the root node to the node b (1) by “b” designated by the pointer. Then, the trie tree search unit 150b sets the input key pointer to “a”, which is shifted by one character from “b” (step S60a).

実データ上では、トライ木探索部150bは、テキスト表14に入力キー「baca」を登録し、入力キーのポインタをテキスト表14の2行目1列目の「b」に接続する。トライ木探索部150bは、入力キーのポインタに接続された「b」により、ポインタ配列20からポインタ配列21に現在のノードのポインタを遷移させ、入力キーのポインタを1文字ずらした「a」に設定する(ステップS60b)。   On the actual data, the trie tree search unit 150 b registers the input key “baca” in the text table 14 and connects the pointer of the input key to “b” in the second row and first column of the text table 14. The trie tree search unit 150b causes the pointer of the current node to transition from the pointer array 20 to the pointer array 21 by “b” connected to the pointer of the input key, and changes the pointer of the input key to “a” shifted by one character. Set (step S60b).

続いて、図37の説明に移行する。トライ木探索部150bは、ポインタの指定する「a」により、ノードb(1)からノードaに遷移し、入力キーのポインタを「a」から1文字ずらした「c」に設定する(ステップS61a)。   Subsequently, the description proceeds to FIG. The trie tree search unit 150b transitions from the node b (1) to the node a by “a” designated by the pointer, and sets the pointer of the input key to “c” shifted by one character from “a” (step S61a). ).

実データ上では、トライ木探索部150bは、入力キーのポインタに接続された「a」により、ポインタ配列21からポインタ配列22に現在のノードのポインタを遷移させ、入力キーのポインタを1文字ずらした「c」に設定する(ステップS61b)。   On the actual data, the trie tree search unit 150b shifts the pointer of the current node from the pointer array 21 to the pointer array 22 by “a” connected to the input key pointer, and shifts the input key pointer by one character. “C” is set (step S61b).

続いて、図38の説明に移行する。トライ木探索部150bは、ポインタの指定する「c」により、ノードaからノードcに遷移し、入力キーのポインタを「c」から1文字ずらした「a」に設定する(ステップS62a)。   Subsequently, the description proceeds to FIG. The trie tree search unit 150b transitions from the node a to the node c by “c” designated by the pointer, and sets the pointer of the input key to “a” shifted by one character from “c” (step S62a).

実データ上では、トライ木探索部150bは、入力キーのポインタに接続された「c」により、ポインタ配列22からポインタ配列24に現在のノードのポインタを遷移させ、入力キーのポインタを1文字ずらした「a」に設定する(ステップS62b)。   On the actual data, the trie tree search unit 150b shifts the pointer of the current node from the pointer array 22 to the pointer array 24 by “c” connected to the input key pointer, and shifts the input key pointer by one character. “A” is set (step S62b).

図39の説明に移行する。トライ木探索部150bは、ポインタの指定する「a」に対応した子ノードが、ノードcに存在しないので、ノードcに登録されたタグキー「b」の優先度と、トライ部分「bac」を取り除いた入力キー「a」の優先度とを比較する。トライ木探索部150bは、比較した結果、入力キーの優先度よりもタグキーの優先度の方が大きいと判定する(ステップS63a)。   The description shifts to the description of FIG. The trie tree search unit 150b removes the priority of the tag key “b” registered in the node c and the trie part “bac” because the child node corresponding to “a” designated by the pointer does not exist in the node c. The priority of the input key “a” is compared. As a result of the comparison, the trie tree search unit 150b determines that the priority of the tag key is higher than the priority of the input key (step S63a).

実データ上では、トライ木探索部150bは、ポインタ配列24の「TAG」に接続された文字「b」の優先度と、入力キーのポインタに接続された文字「a」の優先度を比較する。トライ木探索部150bは、比較した結果、入力キーの優先度よりもタグキーの優先度の方が大きいと判定する(ステップS63b)。   On the actual data, the trie tree search unit 150b compares the priority of the character “b” connected to “TAG” in the pointer array 24 with the priority of the character “a” connected to the pointer of the input key. . As a result of the comparison, the trie tree searching unit 150b determines that the priority of the tag key is higher than the priority of the input key (step S63b).

図40の説明に移行する。トライ木探索部150bは、ノードcが兄ノード(ノードb(2))を有するので、ノードcより前のノード(ノードa、ノードb(1))に、入力キーと一致するタグキーを有するノードは存在しないと判定する。トライ木探索部150bは、該当データが無い旨を出力する(ステップS64)。   The description shifts to the description of FIG. Since the node c has an older brother node (node b (2)), the trie tree search unit 150b has a node having a tag key that matches the input key at a node before the node c (node a, node b (1)). Is determined not to exist. The trie tree search unit 150b outputs that there is no corresponding data (step S64).

ところで、トライ木探索部150bは、トライ木140bに対して削除するキーを指定された場合に、指定された入力キーをトライ木140bから削除する。図41は、削除処理を説明するための図である。ここでは、図41の左側に示すトライ木からタグキー「black」、値「1」を削除する場合について説明する。   By the way, when the key to be deleted is designated for the trie tree 140b, the trie tree search unit 150b deletes the designated input key from the trie tree 140b. FIG. 41 is a diagram for explaining the deletion process. Here, a case where the tag key “black” and the value “1” are deleted from the trie tree shown on the left side of FIG. 41 will be described.

まず、トライ木探索部150bは、上述した探索処理と同様にして、入力キー「black」と同じタグキーを有するノードlを探索し、ノードlに登録されたタグキー「ack」と値「1」を削除する。   First, the trie tree searching unit 150b searches for the node l having the same tag key as the input key “black” in the same manner as the search process described above, and uses the tag key “ack” and the value “1” registered in the node l. delete.

そして、トライ木探索部150bは、ノードlの長男ノードとなるノードuのタグキー「e(blue)」、値「4」をノードlに登録する。また、トライ木探索部150bは、ノードuの長男ノードとなるノードeのタグキー「blueviolet」、値「3」をノードuに登録し、ノードeをトライ木から削除する。トライ木探索部150bが、図41の左側に示すトライ木からキー「black」、値「1」を削除することで、図41の右側に示すトライ木が生成される。   Then, the trie tree searching unit 150b registers the tag key “e (blue)” and the value “4” of the node u that becomes the eldest node of the node l in the node l. In addition, the trie tree search unit 150b registers the tag key “blueviolet” and the value “3” of the node e that is the eldest node of the node u in the node u, and deletes the node e from the trie tree. The trie tree searching unit 150b deletes the key “black” and the value “1” from the trie tree shown on the left side of FIG. 41, thereby generating the trie tree shown on the right side of FIG.

次に、本実施例1にかかる検索装置100の各種の処理手順について説明する。まず、本実施例1にかかる検索装置100がトライ木140bを生成する処理について説明する。図42は、本実施例2にかかるトライ木生成処理の処理手順を示すフローチャートである。   Next, various processing procedures of the search device 100 according to the first embodiment will be described. First, the process in which the search device 100 according to the first embodiment generates the trie tree 140b will be described. FIG. 42 is a flowchart of the process procedure of the trie tree generation process according to the second embodiment.

図42に示すように、トライ木生成部150aは、ルートノードを生成し(ステップS101)、次の入力データ(キー、値)が登録データ管理テーブル140aに存在するか否かを判定する(ステップS102)。   As shown in FIG. 42, the trie tree generation unit 150a generates a root node (step S101), and determines whether or not the next input data (key, value) exists in the registered data management table 140a (step S101). S102).

トライ木生成部150aは、次の入力データが登録データ管理テーブル140aに存在しないと判定した場合には(ステップS103、No)、処理を終了する。一方、トライ木生成部150aは、次の入力データが登録データ管理テーブル140aに登録されている場合には(ステップS103,Yes)、未読の入力データを読み出し(ステップS104)、データ追加処理を実行し(ステップS105)、ステップS102に移行する。   If the trie tree generation unit 150a determines that the next input data does not exist in the registered data management table 140a (No in step S103), the trie tree generation unit 150a ends the process. On the other hand, if the next input data is registered in the registered data management table 140a (Yes in step S103), the trie tree generation unit 150a reads out unread input data (step S104) and executes data addition processing. (Step S105), the process proceeds to Step S102.

次に、図42のステップS105に示したデータ追加処理の処理手順について説明する。ここでは、二分探索法を用いないでデータ追加処理を実行する場合と、二分探索法を用いてデータ追加処理を実行する場合に分けて説明する。   Next, the procedure of the data addition process shown in step S105 of FIG. 42 will be described. Here, a case where the data addition process is executed without using the binary search method and a case where the data addition process is executed using the binary search method will be described separately.

図43および図44は、二分探索法を用いないデータ追加処理の処理手順を示すフローチャートである。図43に示すように、トライ木生成部150aは、現在のノードをルートノードに設定し(ステップS150)、入力キーが空であるか否かを判定する(ステップS151)。   FIG. 43 and FIG. 44 are flowcharts showing a processing procedure of data addition processing that does not use the binary search method. As shown in FIG. 43, the trie tree generation unit 150a sets the current node as the root node (step S150), and determines whether or not the input key is empty (step S151).

トライ木生成部150aは、入力キーが空ではない場合には(ステップS152,No)、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS153)。トライ木生成部150aは、子ノードが存在する場合には(ステップS154,Yes)、入力キーの先頭の1文字を読取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードに遷移し(ステップS155)、ステップS151に移行する。   When the input key is not empty (No in step S152), the trie tree generation unit 150a refers to the child node with the key of the first character of the input key, and determines whether or not the child node exists (step S152). S153). If there is a child node (step S154, Yes), the trie tree generation unit 150a reads the first character of the input key, advances the pointer of the input key by one character, and sets the read character as a key to the child node. A transition is made (step S155), and the process proceeds to step S151.

一方、トライ木生成部150aは、子ノードが存在しない場合には(ステップS154,No)、ステップS156に移行する。   On the other hand, if there is no child node (No at Step S154), the trie tree generation unit 150a proceeds to Step S156.

ところで、ステップS152において、入力キーが空の場合には(ステップS152,Yes)、ノードの情報を参照し(ステップS156)、タグキーの優先度が入力キーの優先度と等しい(タグキーが入力キーと等しい)か否かを判定する(ステップS157)。タグキーの優先度と入力キーの優先度が等しい場合には(ステップS158,Yes)、トライ木生成部150aは、現在のノードに入力値(入力キーに対応する値)を追加し(ステップS159)、データ追加処理を終了する。   In step S152, if the input key is empty (step S152, Yes), the node information is referred to (step S156), and the priority of the tag key is equal to the priority of the input key (the tag key is the input key). It is determined whether or not (step S157). When the priority of the tag key and the priority of the input key are equal (step S158, Yes), the trie tree generation unit 150a adds an input value (value corresponding to the input key) to the current node (step S159). The data addition process is terminated.

一方、タグキーの優先度と入力キーの優先度が異なる場合には(ステップS158,No)、トライ木生成部150aは、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS160)。タグキーの優先度が入力キーの優先度よりも小さい場合には(ステップS161,No)、ステップS164に移行する。   On the other hand, when the priority of the tag key is different from the priority of the input key (No in step S158), the trie tree generating unit 150a determines whether the priority of the tag key is higher than the priority of the input key. (Step S160). When the priority of the tag key is lower than the priority of the input key (step S161, No), the process proceeds to step S164.

タグキーの優先度が入力キーの優先度よりも大きい場合には(ステップS161,Yes)、兄ノードが存在する、または、親ノードがルートノードであるか否かを判定する(ステップS162)。兄ノードが存在せず、かつ、親ノードがルートノードではない場合には(条件を満たさない場合には)(ステップS163,No)、入力キーのポインタを1文字戻し、親ノードへ遷移し(ステップS164)、ステップS160に遷移する。   If the priority of the tag key is higher than the priority of the input key (step S161, Yes), it is determined whether there is an older brother node or whether the parent node is a root node (step S162). When there is no brother node and the parent node is not the root node (when the condition is not satisfied) (step S163, No), the input key pointer is returned by one character, and the transition is made to the parent node ( Step S164) and the process proceeds to Step S160.

一方、兄ノードが存在する、または、親ノードがルートノードの場合(条件を満たす場合)には(ステップS163,Yes)、現在のノードのタグキー、値と入力キー、入力値をそれぞれ交換し(ステップS168)、ステップS165に移行する。   On the other hand, if the older brother node exists or the parent node is the root node (when the condition is satisfied) (step S163, Yes), the tag key, the value and the input key, and the input value of the current node are respectively exchanged ( Step S168) and the process proceeds to Step S165.

ところで、トライ木生成部150aは、ステップS161において、タグキーの優先度が入力キーの優先度よりも小さい場合には(ステップS161,No)、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS165)。   By the way, if the priority of the tag key is lower than the priority of the input key in step S161 (step S161, No), the trie tree generation unit 150a refers to the child node with the key of the first character of the input key, It is determined whether or not a child node exists (step S165).

子ノードが存在する場合には(ステップS166,Yes)、トライ木生成部150aは、入力キーの先頭1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードへ遷移し(ステップS167)、ステップS168に移行する。   When there is a child node (step S166, Yes), the trie tree generation unit 150a reads the first character of the input key, advances the pointer of the input key by one character, and transitions to the child node using the read character as a key. (Step S167), the process proceeds to Step S168.

一方、子ノードが存在しない場合には(ステップS166,No)、トライ木生成部150aは、新しいノードを生成し(ステップS169)、入力キーの先頭1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして、現在のノードから新しいノードへ接続する(ステップS170)。   On the other hand, if no child node exists (step S166, No), the trie tree generation unit 150a generates a new node (step S169), reads the first character of the input key, and sets the input key pointer to one character. Then, using the read character as a key, the current node is connected to the new node (step S170).

トライ木生成部150aは、入力キーをタグキーとして新しいノードに付加し(ステップS171)、入力値を新しいノードに付加し(ステップS172)、データ追加処理を終了する。   The trie tree generation unit 150a adds the input key as a tag key to the new node (step S171), adds the input value to the new node (step S172), and ends the data addition process.

図45〜図47は、二分探索法を用いるデータ追加処理の処理手順を示すフローチャートである。トライ木生成部150aは、現在のノードをルートノードに設定し(ステップS180)、入力キーが空であるか否かを判定する(ステップS181)。   45 to 47 are flowcharts showing a processing procedure of data addition processing using the binary search method. The trie tree generation unit 150a sets the current node as the root node (step S180), and determines whether or not the input key is empty (step S181).

入力キーが空の場合には(ステップS182,Yes)、トライ木生成部150aは、ステップS190に移行する。一方、入力キーが空ではない場合には(ステップS182,No)、トライ木生成部150aは、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS183)。   If the input key is empty (step S182, Yes), the trie tree generation unit 150a proceeds to step S190. On the other hand, when the input key is not empty (step S182, No), the trie tree generation unit 150a refers to the child node with the key of the first character of the input key, and determines whether or not the child node exists. (Step S183).

子ノードが存在する場合には(ステップS184,Yes)、トライ木生成部150aは、子ノードが長男であるか否かを判定し(ステップS185)、子ノードが長男の場合には(ステップS186,Yes)、ステップS188に移行する。   When a child node exists (step S184, Yes), the trie tree generation unit 150a determines whether the child node is the eldest son (step S185), and when the child node is the eldest son (step S186). , Yes), the process proceeds to step S188.

一方、子ノードが長男ではない場合には(ステップS186,No)、トライ木生成部150aは、スタックを空に設定し(ステップS187)、入力キーの先頭1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードへ遷移する(ステップS188)。トライ木生成部150aは、遷移したノードをスタックに追加し(ステップS189)、ステップS181に移行する。   On the other hand, when the child node is not the eldest son (step S186, No), the trie tree generation unit 150a sets the stack to empty (step S187), reads the first character of the input key, and sets the input key pointer. One character is advanced, and the read character is used as a key to make a transition to the child node (step S188). The trie tree generation unit 150a adds the transitioned node to the stack (step S189), and proceeds to step S181.

ところで、トライ木生成部150aは、ステップS184において、子ノードが存在しない場合には(ステップS184,No)、スタックが空であるか否かを判定し(ステップS191)、スタックが空ではない場合には(ステップS191,No)、スタックの真ん中のデータを現在のノードとし、入力キーのポインタを移動した分だけ、ずらす(ステップS192)。   By the way, when there is no child node in Step S184 (No in Step S184), the trie tree generation unit 150a determines whether or not the stack is empty (Step S191), and the stack is not empty. (Step S191, No), the data in the middle of the stack is set as the current node, and the input key pointer is shifted by the amount moved (step S192).

図46に移行する。トライ木生成部150aは、タグキーの優先度と入力キーの優先度が等しいか否かを判定し(ステップS193)、タグキーの優先度と入力キーの優先度が等しい場合には(ステップS194,Yes)、現在のノードに入力値を追加する(ステップS195)。   Shifting to FIG. The trie tree generation unit 150a determines whether the priority of the tag key and the priority of the input key are equal (step S193), and if the priority of the tag key and the priority of the input key are equal (step S194, Yes). ), An input value is added to the current node (step S195).

一方、トライ木生成部150aは、タグキーの優先度と入力キーの優先度が異なる場合には(ステップS194,No)、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS196)。   On the other hand, when the priority of the tag key and the priority of the input key are different (No in step S194), the trie tree generating unit 150a determines whether the priority of the tag key is higher than the priority of the input key. (Step S196).

トライ木生成部150aは、タグキーの優先度が入力キーの優先度よりも大きい場合には(ステップS197,Yes)、真ん中のスタックを含む、スタックの後半を削除し(ステップS199)、図45のステップS190に移行する。   If the priority of the tag key is higher than the priority of the input key (step S197, Yes), the trie tree generation unit 150a deletes the second half of the stack including the middle stack (step S199), and FIG. The process proceeds to step S190.

一方、トライ木生成部150aは、タグキーの優先度が入力キーの優先度よりも小さい場合には(ステップS197,No)、真ん中のスタックを含む、スタックの前半を削除し(ステップS198)、図45のステップS190に移行する。   On the other hand, when the priority of the tag key is lower than the priority of the input key (No at Step S197), the trie tree generation unit 150a deletes the first half of the stack including the middle stack (Step S198). The process proceeds to step S190 of 45.

ところで、図45のステップS191において、スタックが空の場合には(ステップS191,Yes)、図47に移行し、トライ木生成部150aは、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS200)。   By the way, when the stack is empty in step S191 of FIG. 45 (step S191, Yes), the process proceeds to FIG. 47, and the trie tree generation unit 150a refers to the child node with the key of the first character of the input key, It is determined whether or not a child node exists (step S200).

トライ木生成部150aは、子ノードが存在する場合には(ステップS201,Yes)、入力キーの先頭1文字を読み取り、残り入力キーのポインタを1文字進め、読み出した文字をキーとして、子ノードに遷移する(ステップS202)。そして、トライ木生成部150aは、現在のノードのタグキー、値と入力キー、入力値をそれぞれ交換し(ステップS203)、ステップS200に移行する。   If there is a child node (Yes in step S201), the trie tree generation unit 150a reads the first character of the input key, advances the pointer of the remaining input key by one character, and uses the read character as a key to set the child node. (Step S202). Then, the trie tree generation unit 150a exchanges the tag key, value, input key, and input value of the current node (step S203), and proceeds to step S200.

一方、トライ木生成部150aは、子ノードが存在しない場合には(ステップS201,No)、新しいノードを生成し(ステップS204)、入力キーの先頭1文字を読み取り、残り入力キーのポインタを1文字進め、読み出した文字をキーとして、現在のノードから新しいノードへ接続する(ステップS205)。トライ木生成部150aは、入力キーをタグキーとして新しいノードに付加し(ステップS206)、入力値を新しいノードに付加する(ステップS207)。   On the other hand, if there is no child node (No in step S201), the trie tree generation unit 150a generates a new node (step S204), reads the first character of the input key, and sets the pointer of the remaining input key to 1. The character is advanced and the current character is connected to the new node using the read character as a key (step S205). The trie tree generation unit 150a adds the input key as a tag key to the new node (step S206), and adds the input value to the new node (step S207).

次に、本実施例にかかる検索装置100がトライ木140bを用いて検索を行う処理について説明する。ここでは、二分探索法を用いないで検索処理を実行する場合と、二分探索法を用いて検索処理を実行する場合について説明する。   Next, a process in which the search device 100 according to the present embodiment performs a search using the trie tree 140b will be described. Here, a case where search processing is executed without using the binary search method and a case where search processing is executed using the binary search method will be described.

まず、二分探索法を用いない検索処理の処理手順について説明する。図48は、二分探索法を用いない検索処理の処理手順を示すフローチャートである。図48に示すように、トライ木探索部150bは、現在のノードをルートノードに設定し(ステップS300)、入力キーが空であるか否かを判定する(ステップS301)。   First, a processing procedure of search processing that does not use the binary search method will be described. FIG. 48 is a flowchart showing a processing procedure of search processing that does not use the binary search method. As shown in FIG. 48, the trie tree searching unit 150b sets the current node as the root node (step S300), and determines whether or not the input key is empty (step S301).

トライ木探索部150bは、入力キーが空ではない場合には(ステップS302,No)、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS303)。トライ木探索部150bは、子ノードが存在しない場合には(ステップS304,No)、ステップS306に移行する。   If the input key is not empty (No in step S302), the trie tree searching unit 150b refers to the child node with the key of the first character of the input key, and determines whether or not the child node exists (step). S303). If there is no child node (No at Step S304), the trie tree searching unit 150b proceeds to Step S306.

一方、トライ木探索部150bは、子ノードが存在する場合には(ステップS304,Yes)、入力キーの先頭1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードに遷移し(ステップS305)、ステップS301に移行する。   On the other hand, if there is a child node (Yes in step S304), the trie tree search unit 150b reads the first character of the input key, advances the pointer of the input key by one character, and uses the read character as a key to the child node. (Step S305), the process proceeds to Step S301.

ところで、ステップS302において、入力キーが空の場合には(ステップS302,Yes)、トライ木探索部150bは、ノードの情報を参照し、タグキーの優先度と入力キーの優先度が等しいか否かを判定する(ステップS306)。トライ木探索部150bは、タグキーの優先度と入力キーの優先度が等しい場合には(ステップS307,Yes)、現在のノードのデータ(値)を出力する(ステップS308)。   By the way, when the input key is empty in step S302 (step S302, Yes), the trie tree search unit 150b refers to the node information and determines whether the priority of the tag key is equal to the priority of the input key. Is determined (step S306). When the priority of the tag key and the priority of the input key are equal (Yes in step S307), the trie tree search unit 150b outputs data (value) of the current node (step S308).

一方、タグキーの優先度と入力キーの優先度が異なる場合には(ステップS307,No)、トライ木探索部150bは、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS310)。トライ木探索部150bは、タグキーの優先度が入力キーの優先度よりも小さい場合には(ステップS310,No)、ステップS314に移行する。   On the other hand, if the priority of the tag key is different from the priority of the input key (No in step S307), the trie tree search unit 150b determines whether the priority of the tag key is higher than the priority of the input key. (Step S310). When the priority of the tag key is smaller than the priority of the input key (No at Step S310), the trie tree searching unit 150b proceeds to Step S314.

一方、タグキーの優先度が入力キーの優先度よりも大きい場合には(ステップS310,Yes)、トライ木探索部150bは、兄ノードが存在するか、または、親ノードがルートノードであるか否かを判定する(ステップS311)。   On the other hand, if the priority of the tag key is higher than the priority of the input key (step S310, Yes), the trie tree search unit 150b determines whether there is an older brother node or whether the parent node is the root node. Is determined (step S311).

トライ木探索部150bは、兄ノードが存在しないで、かつ、親ノードがルートノードではない場合(条件を満たさない場合)に(ステップS312,No)、入力キーのポインタを1文字戻し、親ノードへ遷移する(ステップS313)。   When there is no brother node and the parent node is not the root node (when the condition is not satisfied) (No in step S312), the trie tree search unit 150b returns the input key pointer by one character, (Step S313).

一方、トライ木探索部150bは、兄ノードが存在するか、または、親ノードがルートノードの場合(条件を満たす場合)に(ステップS312,Yes)、一致するデータが存在しない旨を出力する(ステップS314)。   On the other hand, the trie tree searching unit 150b outputs that no matching data exists when there is an older brother node or when the parent node is a root node (when the condition is satisfied) (Yes in step S312) (step S312). Step S314).

続いて、二分探索法を用いる検索処理の処理手順について説明する。図49および図50は、二分探索法を用いる検索処理の処理手順を示すフローチャートである。図49に示すように、トライ木探索部150bは、現在のノードをルートノードに設定し(ステップS350)、入力キーが空であるか否かを判定する(ステップS351)。   Subsequently, a processing procedure of search processing using the binary search method will be described. FIG. 49 and FIG. 50 are flowcharts showing the processing procedure of search processing using the binary search method. As shown in FIG. 49, the trie tree searching unit 150b sets the current node as the root node (step S350), and determines whether or not the input key is empty (step S351).

トライ木探索部150bは、入力キーが空の場合には(ステップS352,Yes)、図50のステップS360に移行する。一方、トライ木探索部150bは、入力キーが空ではない場合に(ステップS352,No)、入力キーの先頭文字のキーで、子ノードが存在するか否かを判定する(ステップS353)。   If the input key is empty (Yes in step S352), the trie tree searching unit 150b proceeds to step S360 in FIG. On the other hand, when the input key is not empty (step S352, No), the trie tree searching unit 150b determines whether a child node exists with the key of the first character of the input key (step S353).

トライ木探索部150bは、子ノードが存在しない場合には(ステップS354,No)、図50のステップS360に移行する。一方、トライ木探索部150bは、子ノードが存在する場合に(ステップS354,Yes)、子ノードが長男であるか否かを判定する(ステップS355)。   If there is no child node (No in step S354), the trie tree searching unit 150b proceeds to step S360 in FIG. On the other hand, when there is a child node (Yes in step S354), the trie tree searching unit 150b determines whether the child node is the eldest son (step S355).

トライ木探索部150bは、子ノードが長男である場合には(ステップS356,Yes)、ステップS358に移行する。一方、トライ木探索部150bは、子ノードが長男ではない場合に(ステップS356,No)、スタックを空に設定する(ステップS357)。   When the child node is the eldest son (step S356, Yes), the trie tree searching unit 150b proceeds to step S358. On the other hand, when the child node is not the eldest son (step S356, No), the trie tree search unit 150b sets the stack to be empty (step S357).

トライ木探索部150bは、入力キーの先頭1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードに遷移する(ステップS358)。そして、トライ木探索部150bは、遷移したノードをスタックに追加し(ステップS359)、ステップS351に移行する。   The trie tree search unit 150b reads the first character of the input key, advances the pointer of the input key by one character, and transitions to a child node using the read character as a key (step S358). Then, the trie tree searching unit 150b adds the transitioned node to the stack (step S359), and proceeds to step S351.

ところで、トライ木探索部150bは、ステップS352において、入力キーが空の場合(ステップS352,Yes)、または、ステップS354において、子ノードが存在しない場合(ステップS354,No)には、図50のステップS360に移行する。   By the way, if the input key is empty in step S352 (step S352, Yes), or if no child node exists in step S354 (step S354, No), the trie tree searching unit 150b in FIG. The process proceeds to step S360.

図50において、トライ木探索部150bは、スタックが空であるか否かを判定し(ステップS360)、スタックが空の場合には(ステップS361,Yes)、一致データが無い旨の情報を出力する(ステップS362)。   In FIG. 50, the trie tree search unit 150b determines whether or not the stack is empty (step S360), and if the stack is empty (step S361, Yes), outputs information indicating that there is no matching data. (Step S362).

一方、トライ木探索部150bは、スタックが空ではない場合に(ステップS361,No)、スタックの真ん中のノードを現在のノードとし、入力キーのポインタを移動した分だけ、ずらす(ステップS363)。   On the other hand, when the stack is not empty (step S361, No), the trie tree search unit 150b sets the middle node of the stack as the current node and shifts the input key pointer by the amount moved (step S363).

トライ木探索部150bは、タグキーの優先度と入力キーの優先度が等しいか否かを判定し(ステップS364)、タグキーの優先度と入力キーの優先度が等しい場合には(ステップS365,Yes)、現在のノードのデータ(値)を出力する(ステップS366)。   The trie tree searching unit 150b determines whether the priority of the tag key and the priority of the input key are equal (step S364), and if the priority of the tag key and the priority of the input key are equal (step S365, Yes). ), Data (value) of the current node is output (step S366).

一方、トライ木探索部150bは、タグキーの優先度と入力キーの優先度が異なる場合には(ステップS365,No)、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS367)。   On the other hand, if the priority of the tag key and the priority of the input key are different (No in step S365), the trie tree searching unit 150b determines whether the priority of the tag key is higher than the priority of the input key. (Step S367).

トライ木探索部150bは、タグキーの優先度が入力キーの優先度よりも小さい場合には(ステップS368,No)、真ん中のスタックを含むスタックの前半を削除し(ステップS369)、ステップS360に移行する。   When the priority of the tag key is lower than the priority of the input key (No at Step S368), the trie tree searching unit 150b deletes the first half of the stack including the middle stack (Step S369), and proceeds to Step S360. To do.

一方、トライ木探索部150bは、タグキーの優先度が入力キーの優先度よりも大きい場合には(ステップS368,Yes)、真ん中のスタックを含むスタックの後半を削除し(ステップS370)、ステップS360に移行する。   On the other hand, when the priority of the tag key is higher than the priority of the input key (Yes in step S368), the trie tree searching unit 150b deletes the second half of the stack including the middle stack (step S370), and step S360. Migrate to

次に、検索装置100が、集計値を抽出する処理について説明する。図51は、集計値の抽出処理の処理手順を示すフローチャートである。図51に示すように、このトライ木探索部150bは、現在のノードをルートノードに設定し(ステップS400)、子ノードが存在するか否かを判定する(ステップS401)。   Next, a process in which the search device 100 extracts a total value will be described. FIG. 51 is a flowchart illustrating the processing procedure of the total value extraction processing. As shown in FIG. 51, the trie tree search unit 150b sets the current node as the root node (step S400), and determines whether there is a child node (step S401).

トライ木探索部150bは、子ノードが存在する場合には(ステップS402,Yes)、各子ノードのうち、長男ノードへ遷移し(ステップS403)、現在のノードの各種データを加工し出力し(ステップS404)、ステップS401に移行する。ステップS404において、トライ木探索部150bは、例えば、長男ノードに複数の値が登録されている場合には、各値を加算する処理をおこない、加算した値を出力する。   When there is a child node (Yes in step S402), the trie tree search unit 150b transitions to the eldest node among the child nodes (step S403), and processes and outputs various data of the current node ( Step S404) and the process proceeds to Step S401. In step S404, for example, when a plurality of values are registered in the eldest son node, the trie tree search unit 150b performs a process of adding each value and outputs the added value.

一方、子ノードが存在しない場合には(ステップS402,No)、トライ木探索部150bは、弟ノードが存在するか否かを判定し(ステップS405)、弟ノードが存在する場合には(ステップS406,Yes)、次の弟ノードへ遷移し(ステップS407)、ステップS404に移行する。   On the other hand, when there is no child node (step S402, No), the trie tree search unit 150b determines whether there is a younger brother node (step S405), and when there is a younger brother node (step S405). (S406, Yes), transition to the next younger brother node (step S407), and transition to step S404.

一方、トライ木探索部150bは、弟ノードが存在しない場合には(ステップS406,No)、親ノードへ遷移し(ステップS408)、現在のノードがルートノードであるか否かを判定する(ステップS409)。   On the other hand, if there is no younger brother node (step S406, No), the trie tree search unit 150b transitions to the parent node (step S408) and determines whether the current node is the root node (step S408). S409).

トライ木探索部150bは、現在のノードがルートノードでない場合には(ステップS410,No)、ステップS405に移行する。一方、トライ木探索部150bは、現在のノードがルートノードの場合に(ステップS410,Yes)、処理を終了する。   When the current node is not the root node (No at Step S410), the trie tree searching unit 150b proceeds to Step S405. On the other hand, when the current node is the root node (step S410, Yes), the trie tree search unit 150b ends the process.

次に、検索装置100が、トライ木140bのデータを削除する削除処理について説明する。図52および図53は、削除処理の処理手順を示すフローチャートである。図52に示すように、トライ木探索部150bは、現在のノードをルートノードに設定し(ステップS450)、入力キーが空か否かを判定する(ステップS451)。   Next, a deletion process in which the search device 100 deletes the data of the trie tree 140b will be described. 52 and 53 are flowcharts showing the procedure of the deletion process. As shown in FIG. 52, the trie tree searching unit 150b sets the current node as the root node (step S450), and determines whether or not the input key is empty (step S451).

トライ木探索部150bは、入力キーが空ではない場合に(ステップS452,No)、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS453)。トライ木探索部150bは、子ノードが存在しない場合には(ステップS454,No)、ステップS456に移行する。   When the input key is not empty (step S452, No), the trie tree searching unit 150b refers to the child node with the key of the first character of the input key, and determines whether or not the child node exists (step S453). ). If there is no child node (No in step S454), the trie tree searching unit 150b proceeds to step S456.

一方、トライ木探索部150bは、子ノードが存在する場合に(ステップS454,Yes)、入力キーの先頭1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードに遷移し(ステップS455)、ステップS451に移行する。   On the other hand, if there is a child node (Yes in step S454), the trie tree search unit 150b reads the first character of the input key, advances the pointer of the input key by one character, and sets the read character as a key to the child node. A transition is made (step S455), and the process proceeds to step S451.

ところで、ステップS452において、トライ木探索部150bは、入力キーが空の場合に(ステップS452,Yes)、ノードの情報を参照し、タグキーの優先度が入力キーの優先度と等しいか否かを判定する(ステップS456)。   By the way, in step S452, when the input key is empty (Yes in step S452), the trie tree searching unit 150b refers to the node information and determines whether the priority of the tag key is equal to the priority of the input key. Determination is made (step S456).

トライ木探索部150bは、タグキーの優先度と入力キーの優先度が等しくない場合に(ステップS457,No)、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS458)。トライ木探索部150bは、タグキーの優先度が入力キーの優先度よりも小さい場合に(ステップS459,No)、ステップS463に移行する。   When the priority of the tag key is not equal to the priority of the input key (No in step S457), the trie tree searching unit 150b determines whether the priority of the tag key is higher than the priority of the input key (step S457). S458). When the priority of the tag key is smaller than the priority of the input key (No in step S459), the trie tree searching unit 150b proceeds to step S463.

トライ木探索部150bは、タグキーの優先度が入力キーの優先度よりも大きい場合には(ステップS459,Yes)、兄ノードが存在、あるいは、親ノードがルートノードであるか否かを判定する(ステップS460)。   When the priority of the tag key is higher than the priority of the input key (step S459, Yes), the trie tree searching unit 150b determines whether there is an older brother node or whether the parent node is the root node. (Step S460).

トライ木探索部150bは、兄ノードが存在せず、かつ、親ノードがルートノードではない場合(条件を満たさない場合)に(ステップS461,No)、入力キーのポインタを1文字戻し、親ノードへ遷移し(ステップS462)、ステップS456に移行する。   When there is no brother node and the parent node is not the root node (when the condition is not satisfied) (step S461, No), the trie tree search unit 150b returns the input key pointer by one character, (Step S462), the process proceeds to Step S456.

一方、トライ木探索部150bは、兄ノードが存在する、または、親ノードがルートノードの場合に(ステップS461,Yes)、削除データが存在しない旨を出力する(ステップS463)。   On the other hand, the trie tree search unit 150b outputs that no deletion data exists (step S463) when the brother node exists or the parent node is the root node (step S461, Yes).

ところで、ステップS457において、トライ木探索部150bは、タグキーの優先度が入力キーの優先度と等しい場合に(ステップS457,Yes)、図53のステップS464に移行する。   Incidentally, in step S457, when the priority of the tag key is equal to the priority of the input key (step S457, Yes), the trie tree searching unit 150b proceeds to step S464 in FIG.

トライ木探索部150bは、削除対象のデータ(値)が存在するか否かを判定し(ステップS464)、削除対象のデータが存在しない場合には(ステップS465,No)、削除データが存在しない旨を出力する(ステップS466)。   The trie tree search unit 150b determines whether there is data (value) to be deleted (step S464). If there is no data to be deleted (step S465, No), no deleted data exists. A message is output (step S466).

一方、トライ木探索部150bは、削除対象のデータが存在する場合に(ステップS465,Yes)、他のデータ(値)が存在するか否かを判定する(ステップS467)。トライ木探索部150bは、他のデータが存在する場合に(ステップS468,Yes)、処理を終了する。   On the other hand, when there is data to be deleted (Yes in step S465), the trie tree searching unit 150b determines whether there is other data (value) (step S467). The trie tree search unit 150b ends the process when other data exists (step S468, Yes).

一方、トライ木探索部150bは、他のデータが存在しない場合に(ステップS468,No)、子ノードが存在するか否かを判定する(ステップS469)。トライ木探索部150bは、子ノードが存在しない場合に(ステップS470,No)、親ノードの現在のノードへのエッジを削除(接続を解除)し、現在のノードを削除する(ステップS471)。   On the other hand, when there is no other data (No at Step S468), the trie tree searching unit 150b determines whether there is a child node (Step S469). When there is no child node (No in step S470), the trie tree searching unit 150b deletes (disconnects) the edge of the parent node to the current node, and deletes the current node (step S471).

一方、トライ木探索部150bは、子ノードが存在する場合に(ステップS470,Yes)、現在のノードのデータを長男ノードのデータとし(ステップS472)、長男ノードへ遷移し(ステップS473)、ステップS469に移行する。   On the other hand, when there is a child node (step S470, Yes), the trie tree searching unit 150b sets the current node data as the eldest son node data (step S472), and transitions to the eldest son node (step S473). The process proceeds to S469.

上述してきたように、本実施例にかかる検索装置100は、トライ木生成部150aがトライ木140bを作成する場合に、1ノードにタグキーを1つ対応付け、タグキーを有さないノードを無くすので、メモリ使用効率を向上させることが出来る。   As described above, when the trie tree generation unit 150a creates the trie tree 140b, the search device 100 according to the present embodiment associates one tag key with one node and eliminates a node having no tag key. Memory usage efficiency can be improved.

また、本実施例にかかる検索装置100は、トライ木生成部150aがトライ木140bの各ノードにタグキーを登録する場合に、優先度の低いタグキーをルートノード側のタグキーに登録するので、トライ木探索部150bが検索処理などを実行する場合に、比較対象となるノードの領域を絞り込むことができ、検索処理にかかる処理効率を向上させることが出来る。   In addition, when the trie tree generating unit 150a registers a tag key in each node of the trie tree 140b, the search device 100 according to the present embodiment registers a tag key having a low priority in the tag key on the root node side. When the search unit 150b executes a search process or the like, it is possible to narrow down the area of the node to be compared and improve the processing efficiency of the search process.

まず、上述した実施例1にかかる検索装置100の課題を説明する。図54は、実施例1にかかる検索装置100の課題を説明するための図である。図54に示すトライ木は、ルートノードにノードh、ノードt(親)、ノードt(子)が順に接続されており、ノードhはタグキー「ttp://aaa.aaa/e/」を有し、ノードt(親)はタグキー「tp://aaa.aaa/e/c/」を有し、ノードt(子)はタグキー「p://aaa.aaa/g/」を有している。ここでは説明の便宜上、値の記載は省略するが、各ノードは値を有しているものとする。   First, the problem of the search device 100 according to the first embodiment will be described. FIG. 54 is a diagram for explaining the problem of the search device 100 according to the first embodiment. In the trie tree shown in FIG. 54, a node h, a node t (parent), and a node t (child) are connected in order to the root node, and the node h has a tag key “ttp: //aaa.aaa/e/”. Node t (parent) has a tag key “tp: //aaa.aaa/e/c/” and node t (child) has a tag key “p: //aaa.aaa/g/” Yes. Here, for convenience of explanation, description of values is omitted, but each node has a value.

例えば、検索装置100が新規にキーを登録する場合には、登録対象となる入力キーの先頭文字から順に文字を読み出し、読み出した文字をキーにしてトライ木の各ノードを遷移する。そして、検索装置100は、遷移先のノードから順に、ノードに登録されたタグキーの各文字と、入力キーの各文字を順に比較して、優先度の大小を判定することで、入力キーを登録していた。   For example, when the search device 100 newly registers a key, characters are read in order from the first character of the input key to be registered, and each node of the trie tree is transitioned using the read character as a key. Then, the search apparatus 100 registers the input key by sequentially comparing each character of the tag key registered in the node with each character of the input key in order from the transition destination node, and determining the priority level. Was.

具体的に、登録対象となる入力キーを「http://aaa.aaa/b/」として説明を行う。検索装置100は、入力キーの文字を先頭文字から順に読み出し、読み出した文字をキーにしてトライ木の各ノードを遷移する。ここでは、文字「h、t、t」が順に読み出されるので、ルートノードから、ノードh、ノードt(親)、ノードt(子)に遷移し、現在のノードをノードt(子)に設定する。   Specifically, the input key to be registered is described as “http://aaa.aaa/b/”. The search device 100 reads the characters of the input key in order from the first character, and transitions between the nodes of the trie tree using the read characters as keys. Here, since the characters “h, t, t” are read in order, the transition from the root node to node h, node t (parent), node t (child) is made, and the current node is set to node t (child) To do.

そして、検索装置100は、入力キーからトライ部分「htt」を除いたキー「p://aaa.aaa/d/」と、ノードt(子)のタグキー「p://aaa.aaa/g/」を先頭から1文字ずつ比較すると、タグキーの優先度が入力キーの優先度よりも大きいので、検索装置100は、現在のノードをノードt(親)に遷移する。   Then, the search device 100 uses the key “p: //aaa.aaa/d/” obtained by removing the trie part “htt” from the input key and the tag key “p: //aaa.aaa/g” of the node t (child). When “/” is compared character by character from the beginning, the priority of the tag key is higher than the priority of the input key, so the search device 100 transitions the current node to the node t (parent).

検索装置100は、入力キーからトライ部分「ht」を除いた「tp://aaa.aaa/b/」と、ノードt(親)のタグキー「tp://aaa.aaa/e/c/」を先頭から1文字ずつ比較すると、タグキーの優先度が入力キーの優先度よりも大きいので、検索装置100は、現在のノードをノードhに移行する。   The search apparatus 100 uses “tp: //aaa.aaa/b/” obtained by removing the trial part “ht” from the input key and the tag key “tp: //aaa.aaa/e/c/” of the node t (parent). ”Is compared character by character from the beginning, the priority of the tag key is higher than the priority of the input key, so the search device 100 moves the current node to the node h.

検索装置100は、入力キーからトライ部分「h」を除いた「ttp://aaa.aaa/b/」と、ノードhのタグキー「ttp://aaa.aaa/e/」を先頭から1文字ずつ比較すると、タグキーの優先度が入力キーの優先度よりも大きい。ここで、ノードhの親ノードはルートノードなので、検索装置100は、入力キーからトライ部分「h」を除いた「ttp://aaa.aaa/b/」をノードhに登録すると判定する。   The search device 100 adds “ttp: //aaa.aaa/b/” obtained by removing the trie part “h” from the input key and the tag key “ttp: //aaa.aaa/e/” of the node h from the top. When comparing character by character, the priority of the tag key is higher than the priority of the input key. Here, since the parent node of the node h is the root node, the search device 100 determines to register “ttp: //aaa.aaa/b/” in which the try part “h” is removed from the input key in the node h.

このように、実施例1にかかる検索装置100は、各ノードのタグキーの各文字と入力キーの各文字を順次比較することで、入力キーを登録するノードを判定していた。しかしながら、図54に示すトライ木の各タグキーを参照すると、トライ部分を含むタグキーの「http://aaa.aaa/」が共通している。このように、各タグキーの一部が共通している場合であっても、実施例1の検索装置100は、先頭文字から順に比較を行っているので、処理効率が悪かった。   As described above, the search device 100 according to the first embodiment determines a node to register an input key by sequentially comparing each character of the tag key of each node and each character of the input key. However, referring to each tag key of the trie tree shown in FIG. 54, the tag key “http://aaa.aaa/” including the trie portion is common. As described above, even when a part of each tag key is common, the search device 100 according to the first embodiment performs the comparison in order from the first character, and thus the processing efficiency is poor.

例えば、ノードt(子)のタグキーの「p://aaa.aaa/g/」と、入力キーを比較した後に、ノードt(親)のタグキー「tp://aaa.aaa/e/c/」と入力キーとを比較する場合には、タグキーの「tp://aaa.aaa/」は既に比較済みであるため、入力キーとタグキー「tp://aaa.aaa/e/c/」を初めから1文字ずつ比較することは無駄である。   For example, after comparing the input key with the tag key “p: //aaa.aaa/g/” of the node t (child), the tag key “tp: //aaa.aaa/e/c” of the node t (parent) / "And the input key, the tag key" tp: //aaa.aaa/ "has already been compared, so the input key and tag key" tp: //aaa.aaa/e/c/ It is useless to compare each character from the beginning.

本実施例2にかかる検索装置は、上述した実施例1にかかる検索装置の無駄を省くことで、処理の高速化を図る。図55は、本実施例2にかかる検索装置の概要を説明するための図である。同図に示すように、本実施例2にかかる検索装置がトライ木を生成する場合には、子ノードのタグキーと親ノードのタグキーとを比較する。そして、検索装置は、親ノードにタグキーを登録する場合に、全てのタグキーを登録するのではなく、子ノードと一致しない部分の文字列のみを親ノードに登録する。また、検索装置は、子ノードのタグキーと親ノードのタグキーと一致する部分の文字数もあわせて親ノードに登録する。   The search device according to the second embodiment increases the processing speed by eliminating the waste of the search device according to the first embodiment. FIG. 55 is a diagram for explaining the outline of the search device according to the second embodiment. As shown in the figure, when the search device according to the second embodiment generates a trie tree, the tag key of the child node is compared with the tag key of the parent node. Then, when registering the tag key in the parent node, the search device does not register all the tag keys but registers only the character string of the portion that does not match the child node in the parent node. In addition, the search device also registers the number of characters that match the tag key of the child node and the tag key of the parent node in the parent node.

例えば、図55に示すように、親ノードのタグキーが「tp://aaa.aaa/e/c/」、子ノードのタグキーが「p://aaa.aaa/g/」の場合には、一致する文字が「(t)p://aaa.aaa/」となるため、親ノードに一致する文字数「13」と、残りの文字列「e/c/」を登録する。以下の説明において、一致する文字数を一致数と表記する。   For example, as shown in FIG. 55, when the tag key of the parent node is “tp: //aaa.aaa/e/c/” and the tag key of the child node is “p: //aaa.aaa/g/” Since the matching character is “(t) p: //aaa.aaa/”, the number of characters “13” that matches the parent node and the remaining character string “e / c /” are registered. In the following description, the number of matching characters is expressed as the number of matches.

また、親ノードのタグキーが「ttp://aaa.aaa/e/」、子ノードのタグキーが「tp://aaa.aaa/e/c/」の場合には、一致する文字が「(t)tp://aaa.aaa/e/」となるため、親ノードに一致数「16」を親ノードに登録する。なお、この場合は、一致する文字列がそのまま、親ノードのタグキーとなるので、親ノードには、文字列が登録されない。   If the tag key of the parent node is “ttp: //aaa.aaa/e/” and the tag key of the child node is “tp: //aaa.aaa/e/c/”, the matching character is “( t) tp: //aaa.aaa/e/ ”, so that the number of matches“ 16 ”is registered in the parent node. In this case, since the matching character string is directly used as the tag key of the parent node, the character string is not registered in the parent node.

図55のように、トライ木を生成することで、実施例1の検索装置100のように、1度比較した文字列を重複して比較するという無駄を省くことが出来る。具体的に、登録対象となる入力キーを「http://aaa.aaa/b/」として説明を行う。   As shown in FIG. 55, by generating a trie tree, it is possible to eliminate the waste of redundantly comparing character strings that have been compared once, as in the search device 100 of the first embodiment. Specifically, the input key to be registered is described as “http://aaa.aaa/b/”.

本実施例2にかかる検索装置は、入力キーの文字を先頭から順に読み出し、読み出した文字をキーにしてトライ木の各ノードを遷移する。ここでは、文字「h、t、t」が順に読み出されるので、ルートノードから、ノードh、ノードt(親)、ノードt(子)に遷移し、現在のノードをノードt(子)に設定する。   The search device according to the second embodiment reads the characters of the input key in order from the top, and transitions each node of the trie tree using the read characters as keys. Here, since the characters “h, t, t” are read in order, the transition from the root node to node h, node t (parent), node t (child) is made, and the current node is set to node t (child) To do.

本実施例2にかかる検索装置は、入力キーからトライ部分「htt」を除いたキー「p://aaa.aaa/b/」と、ノードt(子)のタグキー「p://aaa.aaa/g/」を先頭から1文字ずつ比較すると、タグキーの優先度が入力キーの優先度よりも大きいので、検索装置は、現在のノードをノードt(親)に遷移する。   The search apparatus according to the second embodiment has a key “p: //aaa.aaa/b/” obtained by removing the try part “htt” from the input key and a tag key “p: // aaa. When comparing “aaa / g /” one character at a time from the beginning, the priority of the tag key is higher than the priority of the input key, so the search device transitions the current node to the node t (parent).

本実施例2にかかる検索装置は、入力キーからトライ部分「ht」を除いた「tp://aaa.aaa/b/」と、ノードt(親)のタグキーとを比較する。ここで、親ノードt(親)に一致数「13」が登録されているので、検索装置は、キー「tp://aaa.aaa/b/」のうち、先頭から13文字目までの比較処理をスキップし、14文字目から、ノードt(親)のタグキー「e/c/」と比較を行う。すると、タグキーの優先度が入力キーの優先度よりも大きいので、検索装置は、現在のノードをノードhに移行する。   The search device according to the second embodiment compares “tp: //aaa.aaa/b/” obtained by removing the try part “ht” from the input key and the tag key of the node t (parent). Here, since the number of matches “13” is registered in the parent node t (parent), the search device compares the 13th character from the beginning of the key “tp: //aaa.aaa/b/”. Processing is skipped, and comparison is made with the tag key “e / c /” of node t (parent) from the 14th character. Then, since the priority of the tag key is higher than the priority of the input key, the search device shifts the current node to the node h.

本実施例2にかかる検索装置は、入力キーからトライ部分「h」を除いた「ttp://aaa.aaa/b/」と、ノードhのタグキーを比較する。ここで、ノードhに一致数「16」が登録されているので、検索装置は、キー「ttp://aaa.aaa/b/」のうち、先頭から16文字目までの比較処理をスキップする。すると、比較対象となるキーが空になる。この場合には、タグキーが入力キーよりも大きいと判定する。ここで、ノードhの親ノードはルートノードなので、検索装置は、入力キーからトライ部「h」を除いた「ttp://aaa.aaa/b/」をノードhに登録すると判定する。   The search device according to the second embodiment compares the tag key of the node h with “ttp: //aaa.aaa/b/” obtained by removing the try portion “h” from the input key. Here, since the number of matches “16” is registered in the node h, the search device skips the comparison process from the head to the 16th character in the key “ttp: //aaa.aaa/b/”. . Then, the key to be compared becomes empty. In this case, it is determined that the tag key is larger than the input key. Here, since the parent node of the node h is the root node, the search device determines to register “ttp: //aaa.aaa/b/”, which is obtained by removing the try part “h” from the input key, in the node h.

このように、本実施例2にかかる検索装置は、各ノードのタグキーと入力キーとを比較する場合に、先頭文字から順に各キーの文字を比較するのではなく、一致数だけ比較する文字をスキップするので、入力キーをトライ木に登録する処理を高速化することが出来る。   As described above, when comparing the tag key of each node with the input key, the search device according to the second embodiment does not compare the characters of each key in order from the first character, but compares the characters to be compared by the number of matches. Skipping can speed up the process of registering the input key in the trie tree.

ところで、図55に示す例では、新規に入力キーを登録する場合の処理について説明したが、トライ木から入力キーと一致するタグキーを検索する場合にも、一致数を用いて同様に、検索処理の処理効率を向上させることが出来る。   By the way, in the example shown in FIG. 55, the process in the case of newly registering an input key has been described. However, when searching for a tag key that matches the input key from the trie tree, the search process is similarly performed using the number of matches. The processing efficiency can be improved.

次に、本実施例2にかかる検索装置200の構成について説明する。図56は、本実施例2にかかる検索装置200の構成を示す図である。図56に示すように、この検索装置200は、入力部210、出力部220、入出力制御部230、記憶部240、制御部250を有する。   Next, the configuration of the search device 200 according to the second embodiment will be described. FIG. 56 is a diagram illustrating the configuration of the search device 200 according to the second embodiment. As shown in FIG. 56, the search device 200 includes an input unit 210, an output unit 220, an input / output control unit 230, a storage unit 240, and a control unit 250.

このうち、入力部210は、入力キー等の情報を入力する入力部であり、キーボードやマウス等に該当する。出力部220は、トライ木を用いた検索結果などの情報を出力する出力部であり、モニタ、若しくはディスプレイ、タッチパネル等に該当する。入出力制御部230は、入力部210、出力部220、記憶部240、制御部250によるデータの入出力を制御する処理部である。   Among these, the input unit 210 is an input unit for inputting information such as input keys, and corresponds to a keyboard, a mouse, or the like. The output unit 220 is an output unit that outputs information such as search results using a trie tree, and corresponds to a monitor, a display, a touch panel, or the like. The input / output control unit 230 is a processing unit that controls input / output of data by the input unit 210, the output unit 220, the storage unit 240, and the control unit 250.

記憶部240は、制御部250による各種処理に必要なデータおよびプログラムを記憶する記憶部である。図56に示すように、この記憶部240は、登録データ管理テーブル240aとトライ木240bを有する。   The storage unit 240 is a storage unit that stores data and programs necessary for various processes performed by the control unit 250. As shown in FIG. 56, the storage unit 240 includes a registration data management table 240a and a trie tree 240b.

ここで、登録データ管理テーブル240aは、トライ木に登録するキーと値とを対応付けて記憶するテーブルである。図57は、本実施例2にかかる登録データ管理テーブル240aのデータ構造の一例を示す図である。図57に示すように、この登録データ管理テーブル240aは、キーと値を対応付けて記憶している。   Here, the registration data management table 240a is a table that stores the keys and values registered in the trie tree in association with each other. FIG. 57 is a diagram illustrating an example of the data structure of the registration data management table 240a according to the second embodiment. As shown in FIG. 57, the registered data management table 240a stores keys and values in association with each other.

トライ木240bは、登録データ管理テーブル240aを基にして生成されるトライ木である。図58は、本実施例2にかかるトライ木のデータ構造の一例を示す図である。図58では一例として、図57に示した登録データ管理テーブル240aに対応したトライ木を示す。図58に示すように、ルートノードにノードb、ノードgが接続されており、ノードbにノードlが接続されている。   The trie tree 240b is a trie tree generated based on the registered data management table 240a. FIG. 58 is a diagram illustrating an example of the data structure of the trie tree according to the second embodiment. FIG. 58 shows a trie tree corresponding to the registered data management table 240a shown in FIG. 57 as an example. As shown in FIG. 58, node b and node g are connected to the root node, and node l is connected to node b.

ノードbは、一致数「1」、タグキー「ack」、値「2」を有し、ノードlは、一致数「0」、タグキー「ue」、値「1、3」を有し、ノードgは、一致数「0」、タグキー「reen」、値「4」を有している。   The node b has a match number “1”, a tag key “ack”, and a value “2”, and the node l has a match number “0”, a tag key “ue”, and a value “1, 3”, and the node g Has a match number “0”, a tag key “reen”, and a value “4”.

図58に示したトライ木240bを実データで表すと、図59に示すデータ構造となる。図59は、図58に示したトライ木を実データで表した場合のデータ構造の一例を示す図である。図59に示すように、このトライ木240bは、ポインタ配列30〜33、テキスト表34を有している。   If the trie tree 240b shown in FIG. 58 is represented by real data, the data structure shown in FIG. 59 is obtained. FIG. 59 is a diagram showing an example of a data structure when the trie tree shown in FIG. 58 is represented by real data. As shown in FIG. 59, the trie tree 240b has pointer arrays 30 to 33 and a text table 34.

ここで、ルートノードポインタに接続されたポインタ配列30は、図58のルートノードに対応し、ポインタ配列31は、図58のノードbに対応する。また、ポインタ配列32は、図58のノードlに対応し、ポインタ配列33は、図58のノードgに対応する。   Here, the pointer array 30 connected to the root node pointer corresponds to the root node in FIG. 58, and the pointer array 31 corresponds to the node b in FIG. The pointer array 32 corresponds to the node l in FIG. 58, and the pointer array 33 corresponds to the node g in FIG.

ポインタ配列30〜33は、「一致」領域、「TAG」領域、「Data」領域を有している。「一致」は、数値と対応付けることで、ノードの一致数を表現する。「TAG」は、テキスト表34の文字と対応付けることで、ノードに接続されたタグキーを表現する。例えば、ポインタ配列31は、テキスト表34の「a」に接続されているので、「a」から次の空白前までの文字列「ack」をタグキーとして指定している。また、「Data」は、値と対応付けることで、ノードに接続された値を表現する。例えば、ポインタ配列31は、値「2」に接続されている。   The pointer arrays 30 to 33 have a “match” area, a “TAG” area, and a “Data” area. “Match” expresses the number of node matches by associating with a numerical value. “TAG” represents a tag key connected to a node by associating with a character in the text table 34. For example, since the pointer array 31 is connected to “a” in the text table 34, the character string “ack” from “a” to the next space is designated as a tag key. “Data” expresses a value connected to a node by associating it with a value. For example, the pointer array 31 is connected to the value “2”.

また、各ポインタ配列30〜33は、配下に接続されたポインタ配列を判定するためのキー番号(ポインタ)「0×00〜0×FF」を有している。例えば、ポインタ配列30のキー番号「0×62」が、ポインタ配列31に接続され、キー番号「0×67」が、ポインタ配列33に接続されている。   Further, each of the pointer arrays 30 to 33 has a key number (pointer) “0 × 00 to 0 × FF” for determining a pointer array connected to the subordinate array. For example, the key number “0 × 62” of the pointer array 30 is connected to the pointer array 31, and the key number “0 × 67” is connected to the pointer array 33.

図56の説明に戻ると、制御部250は、各種の処理手順を規定したプログラムや制御データを格納するための内部メモリを有し、これらによって種々の処理を実行する制御部である。図56に示すように、この制御部250は、トライ木生成部250aと、トライ木探索部250bを有する。   Returning to the description of FIG. 56, the control unit 250 is a control unit that includes an internal memory for storing programs and control data that define various processing procedures, and executes various processes. As shown in FIG. 56, the control unit 250 includes a trie tree generation unit 250a and a trie tree search unit 250b.

トライ木生成部250aは、登録データ管理テーブル240aに登録されたキーに基づいて、トライ木240bを生成する処理である。なお、トライ木生成部250aは、実施例1と同様にして、深さ優先探索順でタグキーが並ぶようにトライ木を生成する。更に、トライ木生成部250aは、図55で説明したように、親ノードのタグキーと子ノードのタグキーを比較して、一致する文字数を一致数としてノードに登録する。また、トライ木生成部250aは、親ノードのタグキーと子ノードのタグキーの一致する文字列を削除し、残りの文字列のみをタグキーとしてノードに登録する。   The trie tree generation unit 250a is a process of generating the trie tree 240b based on the key registered in the registration data management table 240a. Note that the trie tree generation unit 250a generates trie trees so that the tag keys are arranged in the depth-first search order, as in the first embodiment. Further, as described with reference to FIG. 55, the trie tree generation unit 250a compares the tag key of the parent node with the tag key of the child node, and registers the number of matching characters in the node as the number of matches. In addition, the trie tree generation unit 250a deletes the character string in which the tag key of the parent node and the tag key of the child node match, and registers only the remaining character string as a tag key in the node.

以下において、トライ木生成部250aがトライ木を生成する処理について具体的に説明する。図60〜図69は、本実施例2にかかるトライ木を生成する処理を説明するための図である。ここでは説明の便宜上、キー「http://aaa.aaa/e/」、値「1」と、キー「http://aaa.aaa/e/c/」、値「2」と、キー「http://aaa.aaa/d/」、値「3」と、キー「http://aaa.aaa/e/」、値「4」の順でトライ木を生成する場合について説明する。   Hereinafter, a process in which the trie tree generation unit 250a generates a trie tree will be described in detail. FIGS. 60 to 69 are diagrams for explaining processing for generating a trie tree according to the second embodiment. Here, for convenience of explanation, the key “http://aaa.aaa/e/”, the value “1”, the key “http://aaa.aaa/e/c/”, the value “2”, and the key “ A case where a trie tree is generated in the order of “http://aaa.aaa/d/”, value “3”, key “http://aaa.aaa/e/”, and value “4” will be described.

図60に示すように、まず、ノードが存在しない状態で、キー「http://aaa.aaa/e/」、値「1」を追加する場合について説明する。トライ木生成部250aは、ルートノードを生成する(ステップS70a)。実データ上において、トライ木生成部250aは、ルートノードに対応するポインタ配列30を生成し、ルートノードポインタとポインタ配列30を接続する。また、ポインタ配列30をルートノードに対応するので、「TAG」を空に接続する(ステップS70b)。   As shown in FIG. 60, first, a case where a key “http://aaa.aaa/e/” and a value “1” are added in a state where no node exists will be described. The trie tree generation unit 250a generates a root node (step S70a). On the actual data, the trie tree generation unit 250 a generates a pointer array 30 corresponding to the root node, and connects the root node pointer and the pointer array 30. Further, since the pointer array 30 corresponds to the root node, “TAG” is connected to the empty (step S70b).

トライ木生成部250aは、入力キー「http://aaa.aaa/e/」を用意する(ステップS71a)。実データ上において、トライ木生成部250aは、テキスト表34に入力キー「http://aaa.aaa/e/」を格納し、入力キーのポインタを、テキスト表34の1行目1列目の「h」に接続する(ステップS71b)。   The trie tree generation unit 250a prepares an input key “http://aaa.aaa/e/” (step S71a). On the actual data, the trie tree generation unit 250a stores the input key “http://aaa.aaa/e/” in the text table 34, and sets the input key pointer in the first row and first column of the text table 34. To "h" (step S71b).

トライ木生成部250aは、入力キー「http://aaa.aaa/e/」の先頭文字「h」をキーとする子ノードが存在しないので、ルートノードを参照する。ここで、ルートノードにタグキーは存在しないので、ルートノードのタグキーの優先度よりも、入力キー「http://aaa.aaa/e/」の優先度が大きくなる。   The trie tree generation unit 250a refers to the root node because there is no child node whose key is the first character “h” of the input key “http://aaa.aaa/e/”. Here, since the tag key does not exist in the root node, the priority of the input key “http://aaa.aaa/e/” becomes higher than the priority of the tag key of the root node.

したがって、トライ木生成部250aは、ルートノードの配下に「h」をキーとするノードを作成し、入力キー「http://aaa.aaa/e/」からトライ部分「h」を取り除いた残りのキー「ttp://aaa.aaa/e/」をタグキーとして、ノードhに接続する。また、トライ木生成部250aは、一致数「0」、値「1」をノードhに接続する(ステップS72a)。   Therefore, the trie tree generation unit 250a creates a node using “h” as a key under the root node, and removes the trie part “h” from the input key “http://aaa.aaa/e/”. The key “ttp: //aaa.aaa/e/” is used as a tag key to connect to the node h. In addition, the trie tree generation unit 250a connects the number of matches “0” and the value “1” to the node h (step S72a).

実データ上において、トライ木生成部250aは、ノードhに対応するポインタ配列31を生成し、ポインタ配列30のキー番号「0×68」で、ポインタ配列30とポインタ配列31を接続する。また、トライ木生成部250aは、ポインタ配列31の「TAG」をテキスト表34の1行目2列目の「t」に接続し、ポインタ配列31の「Data」に1を接続する。また、トライ木生成部250aは、ポインタ配列31の一致(一致数)を「0」に設定する(ステップS72b)。   On the actual data, the trie tree generation unit 250 a generates the pointer array 31 corresponding to the node h, and connects the pointer array 30 and the pointer array 31 with the key number “0 × 68” of the pointer array 30. The trie tree generation unit 250 a connects “TAG” in the pointer array 31 to “t” in the first row and second column of the text table 34, and connects 1 to “Data” in the pointer array 31. In addition, the trie tree generation unit 250a sets the match (number of matches) of the pointer array 31 to “0” (step S72b).

続いて、図61に移行し、ステップS72a、72bにおいて作成したトライ木に、キー「http://aaa.aaa/e/c/」、値「2」を追加する場合について説明する。トライ木生成部250aは、入力キー「http://aaa.aaa/e/c/」の先頭文字hでルートノードからノードhに遷移する。そして、トライ木生成部250aは、入力キー「http://aaa.aaa/e/c/」のポインタを1つ進め、2文字目の「t」に設定する(ステップS73a)。   Next, the case where the key “http://aaa.aaa/e/c/” and the value “2” are added to the trie tree created in steps S72a and 72b will be described with reference to FIG. The trie tree generation unit 250a transitions from the root node to the node h at the first character h of the input key “http://aaa.aaa/e/c/”. Then, the trie tree generation unit 250a advances the pointer of the input key “http://aaa.aaa/e/c/” by one and sets it to “t” of the second character (step S73a).

実データ上において、トライ木生成部250aは、テキスト表34に最後に登録されたキー「http://aaa.aaa/e/」との間を1つ空けて、キー「http://aaa.aaa/e/c」を登録する。そして、トライ木生成部250aは、テキスト表34の2行目2列目の文字「t」に入力キーのポインタを接続する(ステップS73b)。   On the actual data, the trie tree generating unit 250a leaves one key “http://aaa.aaa/e/” registered last in the text table 34 and the key “http: // aaa”. .aaa / e / c ”. Then, the trie tree generation unit 250a connects the pointer of the input key to the character “t” in the second row and second column of the text table 34 (step S73b).

トライ木生成部250aは、ノードhにおいて、「t」をキーとする子ノードが存在しないので、ノードhのタグキー「ttp://aaa.aaa/e/」の優先度と、トライ部分の「h」を取り除いた入力キー「ttp://aaa.aaa/e/c/」の優先度を比較する。トライ木生成部250aは、ノードhの一致数が「0」であるため、入力キーの先頭から順に比較を行う。   Since there is no child node having “t” as a key in the node h, the trie tree generation unit 250a determines the priority of the tag key “ttp: //aaa.aaa/e/” of the node h and “ The priority of the input key “ttp: //aaa.aaa/e/c/” from which “h” is removed is compared. Since the number of matches of node h is “0”, the trie tree generation unit 250a performs comparison in order from the top of the input key.

すると、入力キーの17文字目がcであり、タグキーの17文字目が空であるため、トライ木生成部250aは、入力キーの優先度が、タグキーの優先度よりも大きいと判定する。また、トライ木生成部250aは、入力キーとタグキーを比較し、16文字「ttp://aaa.aaa/e/」が一致していると判定する(ステップS74)。   Then, since the 17th character of the input key is c and the 17th character of the tag key is empty, the trie tree generation unit 250a determines that the priority of the input key is higher than the priority of the tag key. In addition, the trie tree generation unit 250a compares the input key and the tag key, and determines that the 16 characters “ttp: //aaa.aaa/e/” match (step S74).

続いて、図62に移行する。トライ木生成部250aは、ノードhに一致数「16」を登録し、ノードhのタグキー「ttp://aaa.aaa/e/」のポインタを16文字進める。その結果、ノードhに接続されるタグキーは空となる。   Subsequently, the flow proceeds to FIG. The trie tree generation unit 250a registers the number of matches “16” in the node h, and advances the pointer of the tag key “ttp: //aaa.aaa/e/” of the node h by 16 characters. As a result, the tag key connected to the node h becomes empty.

また、トライ木生成部250aは、入力キー「ttp://aaa.aaa/e/c/」の2文字目の「t」をキーとして新しいノードtを生成し、入力キーのポインタを3文字目の「t」に進める(ステップS75a)。   The trie tree generation unit 250a generates a new node t using the second character “t” of the input key “ttp: //aaa.aaa/e/c/” as a key, and sets the input key pointer to three characters. The process proceeds to “t” of the eye (step S75a).

実データ上において、トライ木生成部250aは、ノードtに対応するポインタ配列32を生成し、ポインタ配列31のキー番号「0×74」で、ポインタ配列31とポインタ配列32を接続する。トライ木生成部250aは、ノードhの「一致」に一致数「16」を登録し、「TAG」に接続される文字を16文字進め、テキスト表34の1行目18列目の空に設定する。トライ木生成部250aは、入力キーのポインタを1つ進め、テキスト表34の2行目3列目の「t」に入力キーのポインタを接続する(ステップS75b)。   On the actual data, the trie tree generation unit 250 a generates the pointer array 32 corresponding to the node t, and connects the pointer array 31 and the pointer array 32 with the key number “0 × 74” of the pointer array 31. The trie tree generation unit 250a registers the number of matches “16” in the “match” of the node h, advances the character connected to “TAG” by 16 characters, and sets it to empty in the first row and the 18th column of the text table 34. To do. The trie tree generation unit 250a advances the input key pointer by one and connects the input key pointer to “t” in the second row and third column of the text table 34 (step S75b).

トライ木生成部250aは、入力キー「http://aaa.aaa/e/c/」からトライ部分の「ht」を取り除いた残りのキー「tp://aaa.aaa/e/c/」を、ノードtのタグキーとして登録する。トライ木生成部250aは、入力キー「http://aaa.aaa/e/c/」に対応する値「2」をノードtに登録する。また、トライ木生成部250aは、一致数「0」をノードtに登録する(ステップS76a)。   The trie tree generation unit 250a removes the “ht” of the trie part from the input key “http://aaa.aaa/e/c/” and the remaining key “tp: //aaa.aaa/e/c/” Is registered as a tag key of the node t. The trie tree generation unit 250a registers the value “2” corresponding to the input key “http://aaa.aaa/e/c/” in the node t. Also, the trie tree generation unit 250a registers the number of matches “0” in the node t (step S76a).

実データ上において、トライ木生成部250aは、ポインタ配列32の「TAG」をテキスト表34の2行目3列目の「t」に接続し、ポインタ配列32の「Data」と値「2」を接続する。また、トライ木生成部250aは、ポインタ配列32の「一致」に、一致数「0」を登録する(ステップS76b)。   On the actual data, the trie tree generation unit 250a connects “TAG” in the pointer array 32 to “t” in the second row and third column of the text table 34, and “Data” and the value “2” in the pointer array 32 are displayed. Connect. Further, the trie tree generation unit 250a registers the number of matches “0” in the “match” of the pointer array 32 (step S76b).

続いて、図63に移行し、ステップS76a、76bにおいて作成したトライ木に、入力キー「http://aaa.aaa/d/」、値「3」を追加する場合について説明する。トライ木生成部250aは、入力キー「http://aaa.aaa/d/」の先頭文字から1文字ずつ取り出して、トライ木上をノードh、tの順に遷移する。そして、トライ木生成部250aは、遷移したノード数に応じて、入力キー「http://aaa.aaa/d/」のポインタを2つ進め、3文字目の「t」に設定する。   Next, the case where the input key “http://aaa.aaa/d/” and the value “3” are added to the trie tree created in steps S76a and 76b will be described with reference to FIG. The trie tree generation unit 250a extracts characters one by one from the first character of the input key “http://aaa.aaa/d/”, and transitions on the trie tree in the order of nodes h and t. Then, the trie tree generation unit 250a advances the pointer of the input key “http://aaa.aaa/d/” by two in accordance with the number of transitioned nodes, and sets the third character “t”.

トライ木生成部250aは、ノードtにおいて、「t」をキーとする子ノードが存在しないので、ノードtのタグキー「tp://aaa.aaa/e/c」の優先度と、トライ部分の「ht」を取り除いた入力キー「tp://aaa.aaa/d/」の優先度を比較する。すると、タグキーの14文字目が「e」であり、入力キーの14文字目が「d」であるため、タグキーの優先度の方が、入力キーの優先度よりも大きくなる(ステップS77a)。   Since there is no child node having “t” as a key in the node t, the trie tree generating unit 250a determines the priority of the tag key “tp: //aaa.aaa/e/c” of the node t and the trie portion. The priority of the input key “tp: //aaa.aaa/d/” with “ht” removed is compared. Then, since the 14th character of the tag key is “e” and the 14th character of the input key is “d”, the priority of the tag key is higher than the priority of the input key (step S77a).

実データ上において、トライ木生成部250aは、テキスト表34に最後に登録されたキー「http://aaa.aaa/e/c」との間を1つ空けて、キー「http://aaa.aaa/d/」を登録する。そして、トライ木生成部250aは、テキスト表34の3行目5列目の文字「t」に入力キーのポインタを接続する。また、ポインタ配列32の「TAG」に接続された文字を先頭とする文字列と、入力キーのポインタに接続された文字を先頭とする文字列とを順次比較すると、タグキーの14文字目が「e」であり、入力キーの14文字目が「d」であるため、タグキーの優先度の方が、入力キーの優先度よりも大きくなる(ステップS77b)。   On the actual data, the trie tree generation unit 250a leaves one key “http://aaa.aaa/e/c” registered last in the text table 34 and the key “http: // "aaa.aaa/d/" is registered. Then, the trie tree generation unit 250 a connects the pointer of the input key to the character “t” in the third row and the fifth column of the text table 34. When the character string starting with the character connected to “TAG” in the pointer array 32 and the character string starting with the character connected to the pointer of the input key are sequentially compared, the 14th character of the tag key is “ e ”and the 14th character of the input key is“ d ”, the priority of the tag key is greater than the priority of the input key (step S77b).

トライ木生成部250aは、入力キーとタグキーを比較して、世代数を判定する。この世代数は、入力キーが何文字目までタグキーと同じであるか否かを示す数値である。トライ木生成部250aは、ノードtに登録されたタグキー「tp://aaa.aaa/e/c」と入力キーからトライ部分「ht」を取り除いたキー「tp://aaa.aaa/d/」とを比較した場合に、先頭から13文字「tp://aaa.aaa/」が一致しているので、世代数が13となる。   The trie tree generation unit 250a compares the input key and the tag key to determine the number of generations. This number of generations is a numerical value indicating whether the input key is the same as the tag key up to the character number. The trie tree generation unit 250a has a key “tp: //aaa.aaa/d” obtained by removing the tag part “ht” from the tag key “tp: //aaa.aaa/e/c” and the input key registered in the node t. When comparing "/", the 13 characters "tp: //aaa.aaa/" from the beginning match, so the number of generations is 13.

トライ木生成部250aは、入力キー「http://aaa.aaa/d/」のポインタを現在の3文字目の「t」から13文字進めて、「d」に設定する。そして、トライ木生成部250aは、現在のノードをノードhに移行し、世代数に1を加算して、世代数を14とする(ステップS78a)。これは、親ノードとなるノードhに遷移することで、比較対象となる入力キーの文字が1文字増えるが、かかる増加分の文字は、親ノードのタグキーと一致しているためである。   The trie tree generation unit 250a advances the pointer of the input key “http://aaa.aaa/d/” by 13 characters from the current third character “t” and sets it to “d”. Then, the trie tree generation unit 250a moves the current node to the node h, adds 1 to the number of generations, and sets the number of generations to 14 (step S78a). This is because the character of the input key to be compared is increased by one character by transitioning to the node h that is the parent node, but the increased character matches the tag key of the parent node.

実データ上において、トライ木生成部250aは、テキスト表34の3行目18列目の文字「d」に、入力キーのポインタを接続する。また、トライ木生成部250aは、世代数を判定し、世代数に「14」を登録する。また、現在のノードのポインタをポインタ配列31に接続する(ステップS78b)。   On the actual data, the trie tree generation unit 250a connects the pointer of the input key to the character “d” in the third row and the 18th column of the text table 34. Also, the trie tree generation unit 250a determines the number of generations and registers “14” as the number of generations. Further, the pointer of the current node is connected to the pointer array 31 (step S78b).

続いて、図64に移行する。トライ木生成部250aは、ノードhのタグキーの優先度と、入力キー「http://aaa.aaa/d/」の優先度を比較する前に、ノードhに登録された一致数と、入力キーの世代数とを比較する。ノードhのタグキーの一致数は「16」であり、入力キーの世代数は「14」であるため、一致数の方が世代数よりも大きい。   Subsequently, the flow proceeds to FIG. The trie tree generation unit 250a compares the priority of the tag key of the node h with the number of matches registered in the node h before comparing the priority of the input key “http://aaa.aaa/d/”. Compare the number of key generations. Since the number of matches of the tag key of the node h is “16” and the number of generations of the input key is “14”, the number of matches is larger than the number of generations.

一致数が世代数よりも大き場合には、トライ木生成部250aは、ノードhのタグキーの優先度と、入力キー「http://aaa.aaa/d/」の優先度を直接比較しなくても、ノードhのタグキーの優先度の方が大きいと判定できる。   When the number of matches is larger than the number of generations, the trie tree generation unit 250a does not directly compare the priority of the tag key of the node h and the priority of the input key “http://aaa.aaa/d/”. However, it can be determined that the priority of the tag key of node h is higher.

例えば、世代数14の入力キーは、先頭文字から13文字目までは、ノードhの子ノードとなるノードtのタグキーと同じであることを示し、14文字目において、入力キーの優先度がノードtの優先度よりも小さい。そして、ノードhの一致数が入力キーの世代数より大きいということは、ノードtのタグキーの優先度が入力キーの優先度よりも大きいという決め手になった文字まで、ノードhのタグキーは少なくとも同じである。したがって、トライ木生成部250aは、ノードhのタグキーの優先度と、入力キー「http://aaa.aaa/d/」の優先度を直接比較しなくても、ノードhのタグキーの優先度の方が大きいと判定できる。   For example, the 14th generation input key indicates that the 13th character from the first character is the same as the tag key of the node t that is a child node of the node h, and the priority of the input key is the node at the 14th character. Less than t priority. And if the number of matches of node h is greater than the number of generations of input keys, the tag key of node h is at least the same until the character that made the priority of the tag key of node t greater than the priority of the input key. It is. Therefore, the trie tree generation unit 250a does not directly compare the priority of the tag key of the node h and the priority of the input key “http://aaa.aaa/d/”, and the priority of the tag key of the node h. Can be determined to be larger.

ノードhの親ノードがルートノードであるため、トライ木生成部250aは、ノードhのデータ(一致数、タグキー、値)と、入力データ(世代数、入力キー、値)を交換する。具体的に、トライ木生成部250aは、入力キーの世代数「14」を一致数としてノードhに登録し、入力キーの値「3」もノードhに登録する。また、入力キー「http://aaa.aaa/d/」のポインタ以降の文字列「d/」をノードhのタグキーに登録する。   Since the parent node of the node h is the root node, the trie tree generation unit 250a exchanges the data (number of matches, tag key, value) of the node h and input data (number of generations, input key, value). Specifically, the trie tree generation unit 250a registers the generation number “14” of the input key as the coincidence number in the node h, and also registers the input key value “3” in the node h. Further, the character string “d /” after the pointer of the input key “http://aaa.aaa/d/” is registered in the tag key of the node h.

そして、トライ木生成部250aは、現在の入力キーを「http://aaa.aaa/e/」、値「1」、世代数「16」に設定する。また、トライ木生成部250aは、入力キーのポインタを先頭文字から16文字ずらした「/」に設定する。トライ木生成部250aは、ノードhの子ノードとなるノードtに移行し、入力キーのポインタを1文字ずらした「空」に設定する(ステップS79a)。   Then, the trie tree generation unit 250a sets the current input key to “http://aaa.aaa/e/”, the value “1”, and the number of generations “16”. In addition, the trie tree generation unit 250a sets the input key pointer to “/”, which is 16 characters shifted from the first character. The trie tree generation unit 250a shifts to the node t that is a child node of the node h, and sets the input key pointer to “empty” shifted by one character (step S79a).

実データ上において、トライ木生成部250aは、ポインタ配列31の「TAG」と、テキスト表34の3行目8列目の「t」に接続し、ポインタ配列31の「一致」に「14」を登録する。また、入力キーのポインタを、テキスト表34の1行目18列目の「空」に接続する。また、トライ木生成部250aは、現在の世代数を「16」に設定する(ステップS79b)。   On the actual data, the trie tree generation unit 250a connects “TAG” in the pointer array 31 and “t” in the third row and eighth column of the text table 34, and “14” in “match” in the pointer array 31. Register. Further, the input key pointer is connected to “empty” in the first row and the 18th column of the text table 34. In addition, the trie tree generation unit 250a sets the current generation number to “16” (step S79b).

トライ木生成部250aは、ノードtに移行した場合に、世代数16から1を減算することで、世代数を「15」に設定する。そして、トライ木生成部250aは、ノードtのデータ(一致数、タグキー、値)と、入力データ(世代数、入力キー、値)を交換する。具体的に、トライ木生成部250aは、入力キーの世代数「15」を一致数としてノードtに登録し、入力キーの値「1」もノードtに登録する。また、入力キー「http://aaa.aaa/e/」のポインタ以降の文字「空」をノードtのタグキーに登録する。   The trie tree generation unit 250a sets the number of generations to “15” by subtracting 1 from the number of generations 16 when transitioning to the node t. Then, the trie tree generation unit 250a exchanges data (number of matches, tag key, value) of the node t and input data (number of generations, input key, value). Specifically, the trie tree generation unit 250a registers the generation number “15” of the input key as the coincidence number in the node t, and also registers the input key value “1” in the node t. Also, the character “empty” after the pointer of the input key “http://aaa.aaa/e/” is registered in the tag key of the node t.

そして、トライ木生成部250aは、現在の入力キーを「http://aaa.aaa/e/c/」、値「2」、世代数「0」に設定する。また、トライ木生成部250aは、入力キーのポインタを、トライ部分に対応して、3文字目の「t」に設定する(ステップS80a)。   Then, the trie tree generation unit 250a sets the current input key to “http://aaa.aaa/e/c/”, the value “2”, and the number of generations “0”. In addition, the trie tree generation unit 250a sets the pointer of the input key to “t” of the third character corresponding to the trie part (step S80a).

実データ上において、トライ木生成部250aは、現在のノードのポインタをポインタ配列32に接続する。トライ木生成部250aは、ポインタ配列32の「TAG」を、テキスト表34の1行目18列目の「空」に接続し、「一致」を15に設定する。また、トライ木生成部250aは、入力キーのポインタを、テキスト表34の2行目3列目に接続し、世代数を「0」に設定する(ステップS80b)。   On the actual data, the trie tree generation unit 250a connects the pointer of the current node to the pointer array 32. The trie tree generation unit 250 a connects “TAG” in the pointer array 32 to “empty” in the first row and 18th column of the text table 34 and sets “match” to 15. In addition, the trie tree generation unit 250a connects the input key pointer to the second row and third column of the text table 34, and sets the number of generations to “0” (step S80b).

続いて、図65の説明に移行する。トライ木生成部250aは、入力キー「http://aaa.aaa/e/c/」の3文字目に対応するノードtが、ノードtの配下に存在しないので、ノードtの配下に新たなノードtを生成する。ここで、各ノードtを区別するために以下の説明では、親側のノードtをノードt(親)と表記し、子側のノードtをノードt(子)と表記する。また、トライ木生成部250aは、入力キーのポインタを3文字目の「p」に設定する(ステップS81a)。   Subsequently, the description shifts to the description of FIG. Since the node t corresponding to the third character of the input key “http://aaa.aaa/e/c/” does not exist under the node t, the trie tree generation unit 250a adds a new node under the node t. A node t is generated. Here, in order to distinguish each node t, in the following description, the node t on the parent side is expressed as node t (parent), and the node t on the child side is expressed as node t (child). Further, the trie tree generating unit 250a sets the pointer of the input key to “p” of the third character (step S81a).

実データ上において、トライ木生成部250aは、ノードt(子)に対応するポインタ配列33を生成し、ポインタ配列32のキー番号「0×74」で、ポインタ配列32とポインタ配列33を接続する。また、トライ木生成部250aは、入力キーのポインタを、テキスト表34の2行目4列目の「p」に接続する(ステップS81b)。   On the actual data, the trie tree generation unit 250a generates a pointer array 33 corresponding to the node t (child), and connects the pointer array 32 and the pointer array 33 with the key number “0 × 74” of the pointer array 32. . In addition, the trie tree generation unit 250a connects the pointer of the input key to “p” in the second row and fourth column of the text table 34 (step S81b).

続いて、図66の説明に移行する。トライ木生成部250aは、入力キー「http://aaa.aaa/e/c/」からトライ部分を取り除いた残りのキー「p://aaa.aaa/e/c/」をノードt(子)に接続する。また、トライ木生成部250aは、入力キー「http://aaa.aaa/e/c/」に対応する値「2」をノードt(子)に接続する(ステップS82a)。   Subsequently, the description proceeds to FIG. The trie tree generation unit 250a transfers the remaining key “p: //aaa.aaa/e/c/” obtained by removing the trie portion from the input key “http://aaa.aaa/e/c/” to the node t ( To the child). Further, the trie tree generation unit 250a connects the value “2” corresponding to the input key “http://aaa.aaa/e/c/” to the node t (child) (step S82a).

実データ上において、トライ木生成部250aは、ポインタ配列33の「TAG」をテキスト表34の2行目4列目の「p」に接続し、入力キーのポインタを開放する。また、トライ木生成部250aは、ポインタ配列33の「Data」に値「2」を接続する(ステップS82b)。   On the actual data, the trie tree generation unit 250a connects “TAG” in the pointer array 33 to “p” in the second row and fourth column of the text table 34, and releases the pointer of the input key. Further, the trie tree generating unit 250a connects the value “2” to “Data” of the pointer array 33 (step S82b).

続いて、図67に移行し、ステップS82a、82bにおいて作成したトライ木に、キー「http://aaa.aaa/e/」、値「4」を追加する場合について説明する。トライ木生成部250aは、入力キー「http://aaa.aaa/e/」の先頭から文字を順次読み出し、ノードh、ノードt(親)、ノードt(子)に遷移する。そして、トライ木生成部250aは、入力キー「http://aaa.aaa/e/」のポインタを4文字目の「p」に設定する(ステップS83a)。   Subsequently, the case where the key “http://aaa.aaa/e/” and the value “4” are added to the trie tree created in steps S82a and 82b will be described with reference to FIG. The trie tree generation unit 250a sequentially reads characters from the head of the input key “http://aaa.aaa/e/”, and transitions to a node h, a node t (parent), and a node t (child). Then, the trie tree generation unit 250a sets the pointer of the input key “http://aaa.aaa/e/” to “p” of the fourth character (step S83a).

実データ上において、トライ木生成部250aは、テキスト表34において最後に登録されたキー「http://aaa.aaa/e/d/」との間を1つ空けて、キー「http://aaa.aaa/e/」を登録する。そして、トライ木生成部250aは、テキスト表34の4行目6列目の文字「p」に入力キーのポインタを接続する(ステップS83b)。   On the actual data, the trie tree generating unit 250a leaves one key “http://aaa.aaa/e/d/” registered last in the text table 34 and the key “http: / /aaa.aaa/e/ ”. Then, the trie tree generating unit 250a connects the pointer of the input key to the character “p” in the fourth row and sixth column of the text table 34 (step S83b).

続いて、図68に移行する。トライ木生成部250aは、ノードt(子)において、「p」をキーとする子ノードが存在しないので、ノードtのタグキー「p://aaa.aaa/e/c/」の優先度と、トライ部分の「htt」を取り除いた入力キー「p://aaa.aaa/e/」の優先度を比較する。トライ木生成部250aは、ノードt(子)の一致数が「0」であるため、入力キーの先頭から順に比較を行う。   Subsequently, the flow proceeds to FIG. Since there is no child node having “p” as a key in the node t (child), the trie tree generation unit 250a determines the priority of the tag key “p: //aaa.aaa/e/c/” of the node t. , The priority of the input key “p: //aaa.aaa/e/” from which “htt” in the trie portion is removed is compared. Since the number of matches of the node t (child) is “0”, the trie tree generation unit 250a performs comparison in order from the top of the input key.

すると、入力キーのトライ木部分を除いた15文字目が「空」であり、タグキーの15文字目が「c」であるため、トライ木生成部250aは、入力キーの優先度がタグキーの優先度よりも小さいと判定する。また、トライ木生成部250aは、入力キーとタグキーを比較し、14文字「p://aaa.aaa/e/」が一致していると判定する。   Then, since the 15th character excluding the trie portion of the input key is “empty” and the 15th character of the tag key is “c”, the trie generation unit 250a determines that the priority of the input key is the priority of the tag key. It is determined that it is smaller than the degree. Further, the trie tree generation unit 250a compares the input key and the tag key, and determines that the 14 characters “p: //aaa.aaa/e/” match.

トライ木生成部250aは、入力キーのポインタを4文字目「p」から14文字進める。また、トライ木生成部250aは、親ノードとなるノードt(親)に遷移し、世代数「14」に1を加算して「15」とする(ステップS84a)。   The trie tree generation unit 250a advances the pointer of the input key by 14 characters from the fourth character “p”. In addition, the trie tree generation unit 250a transitions to the node t (parent) as the parent node, and adds 1 to the generation number “14” to obtain “15” (step S84a).

実データ上において、トライ木生成部250aは、入力キーのポインタをテキスト表34の5行目2列目の空に接続する。また、トライ木生成部250aは、現在のノードをポインタ配列32に接続し、世代数を「15」に設定する(ステップS84b)。   On the actual data, the trie tree generation unit 250a connects the pointer of the input key to the empty space in the fifth row and the second column of the text table 34. The trie tree generation unit 250a connects the current node to the pointer array 32 and sets the number of generations to “15” (step S84b).

続いて、図69の説明に移行する。トライ木生成部250aは、ノードt(親)の一致数と、世代数を比較すると双方とも「15」で一致し、かつ、入力キーの優先度とタグキーの優先度が等しくなるので、ノードt(親)に値「4」を登録する(ステップS85a)。   Subsequently, the description proceeds to FIG. 69. The trie tree generation unit 250a compares the number of matches of the node t (parent) with the number of generations, and both match with “15”, and the priority of the input key is equal to the priority of the tag key. The value “4” is registered in (parent) (step S85a).

実データ上において、トライ木生成部250aは、ポインタ配列31の一致と世代数とを比較しと双方とも「15」で位置し、かつ、入力キーのポインタに接続された文字と、ポインタ配列32に接続された文字が「空」で一致するので、ポインタ配列32の「Data」に値「4」を接続する(ステップS85b)。   On the actual data, the trie tree generation unit 250a compares the match of the pointer array 31 with the number of generations, both are positioned at “15”, and the character connected to the pointer of the input key and the pointer array 32 Since the character connected to is “empty” and matches, the value “4” is connected to “Data” of the pointer array 32 (step S85b).

図56の説明に戻ると、トライ木探索部250bは、トライ木240bに登録された値の集計値を抽出する処理、所定のキーに対応する値をトライ木240bから検索する処理を実行する処理部である。   Returning to the description of FIG. 56, the trie tree search unit 250b executes a process of extracting a total value of values registered in the trie tree 240b and a process of searching the trie tree 240b for a value corresponding to a predetermined key. Part.

まず、トライ木探索部250bが、トライ木240bに登録された値の集計値を抽出する処理について説明する。図70〜図72は、本実施例2における集計値を抽出する処理を説明するための図である。図70に示すように、トライ木240bは、ルートノードの配下に、ノードh、ノードt(親)、ノードt(子)が順に接続されている。ノードhは、一致数「14」、タグキー「d/(http://aaa.aaa/d/)」、値「3」を登録し、ノードt(親)は、一致数「15」、タグキー「空(http://aaa.aaa/e/)」、値「1、4」を登録する。また、ノードt(子)は、一致数「0」、タグキー「p://aaa.aaa/e/c/(http://aaa.aaa/e/c/)」、値「2」を登録する。   First, a process in which the trie tree searching unit 250b extracts a total value of values registered in the trie tree 240b will be described. FIG. 70 to FIG. 72 are diagrams for explaining the process of extracting the total value in the second embodiment. As shown in FIG. 70, in the trie tree 240b, a node h, a node t (parent), and a node t (child) are sequentially connected under the root node. The node h registers the number of matches “14”, the tag key “d / (http://aaa.aaa/d/)”, and the value “3”, and the node t (parent) has the number of matches “15”, the tag key Register “empty (http://aaa.aaa/e/)” and values “1, 4”. In addition, the node t (child) has a match number “0”, a tag key “p: //aaa.aaa/e/c/ (http://aaa.aaa/e/c/)”, and a value “2”. sign up.

また、図70〜72における説明では、ルートノード、ノードh、ノードt(親)、ノードt(子)の順に、集計値を抽出する場合について説明する。図70において、トライ木探索部250bは、ルートノードからノードhに移行する。ノードhは、タグキー「d/(http://aaa.aaa/d/」、値「3」が登録されているので、トライ木探索部250bは、キー「http://aaa.aaa/d/」と、値(合計値)「3」を出力する(ステップS86a)。   Further, in the description of FIGS. 70 to 72, a case where the total value is extracted in the order of the root node, the node h, the node t (parent), and the node t (child) will be described. In FIG. 70, the trie tree search unit 250b moves from the root node to the node h. Since the node h is registered with the tag key “d / (http://aaa.aaa/d/” and the value “3”, the trie tree search unit 250b uses the key “http://aaa.aaa/d”. / "And the value (total value)" 3 "are output (step S86a).

実データ上において、トライ木探索部250bは、現在のノードをノードhに対応するポインタ配列31に接続する。トライ木探索部250bは、ノードhの階層数「1」と一致「14」を加算した値「15」を算出し、「TAG」に接続された文字「d」を起点として15文字戻す。そして、トライ木探索部250bは、戻した文字「h」から「空」までのキー「http://aaa.aaa/d/」を出力する。また、トライ木探索部250bは、ポインタ配列31の「Data」に接続された値「3」を出力する(ステップS86b)。   On the actual data, the trie tree search unit 250b connects the current node to the pointer array 31 corresponding to the node h. The trie tree search unit 250b calculates a value “15” obtained by adding the number of hierarchies “1” and the match “14” of the node h, and returns 15 characters starting from the character “d” connected to “TAG”. Then, the trie tree searching unit 250b outputs the key “http://aaa.aaa/d/” from the returned characters “h” to “empty”. In addition, the trie tree search unit 250b outputs the value “3” connected to “Data” of the pointer array 31 (step S86b).

図71の説明に移行する。トライ木探索部250bは、ノードhからノードt(親)に移行する。ノードt(親)は、タグキー「空(http://aaa.aaa/e/)」、値「1、4」が登録されているので、トライ木探索部250bは、キー「http://aaa.aaa/e/」と、値「1、4」を合計した値「5」を出力する(ステップS87a)。   The description shifts to the description of FIG. The trie tree search unit 250b moves from the node h to the node t (parent). Since the node t (parent) is registered with the tag key “empty (http://aaa.aaa/e/)” and the values “1, 4”, the trie tree search unit 250b uses the key “http: // A value “5”, which is the sum of “aaa.aaa/e/” and the values “1, 4”, is output (step S87a).

実データ上において、トライ木探索部250bは、現在のノードをノードt(親)に対応するポインタ配列32に接続する。トライ木探索部250bは、ノードt(親)の階層数「2」と一致「15」を加算した値「17」を算出し、「TAG」に接続された「空」を起点として17文字戻す。そして、トライ木探索部250bは、戻した文字「h」から「空」までのキー「http://aaa.aaa/e/」を出力する。また、トライ木探索部250bは、「Data」に接続された値「1、4」の合計値「5」を出力する(ステップS87b)。   On the actual data, the trie tree search unit 250b connects the current node to the pointer array 32 corresponding to the node t (parent). The trie tree search unit 250b calculates a value “17” obtained by adding the number of hierarchies “2” and the match “15” of the node t (parent), and returns 17 characters starting from “empty” connected to “TAG”. . Then, the trie tree searching unit 250b outputs the key “http://aaa.aaa/e/” from the returned characters “h” to “empty”. In addition, the trie tree search unit 250b outputs the total value “5” of the values “1, 4” connected to “Data” (step S87b).

図72の説明に移行する。トライ木探索部250bは、ノードt(親)からノードt(子)に移行する。ノードt(子)は、タグキー「p://aaa.aaa/e/c/(http://aaa.aaa/e/c/)」、値「2」が登録されているので、トライ木探索部250bは、キー「http://aaa.aaa/e/c/」と、値「2」を出力する(ステップS88a)。   Shifting to the description of FIG. The trie tree search unit 250b moves from the node t (parent) to the node t (child). The node t (child) has the tag key “p: //aaa.aaa/e/c/ (http://aaa.aaa/e/c/)” and the value “2” registered. The search unit 250b outputs the key “http://aaa.aaa/e/c/” and the value “2” (step S88a).

実データ上において、トライ木探索部250bは、現在のノードをノードt(子)に対応するポインタ配列33に接続する。トライ木探索部250bは、ノードt(子)の階層数「3」と一致「0」を加算した値「3」を算出し、「TAG」に接続された「p」を起点として3文字戻す。そして、トライ木探索部250bは、戻した文字「h」から「空」までのキー「http://aaa.aaa/e/c/」を出力する。また、トライ木探索部250bは、「Data」に接続された値「2」を出力する(ステップS88b)。   On the actual data, the trie tree search unit 250b connects the current node to the pointer array 33 corresponding to the node t (child). The trie tree search unit 250b calculates a value “3” obtained by adding the number “3” of the hierarchy of the node t (child) and the match “0”, and returns three characters starting from “p” connected to “TAG”. . Then, the trie tree searching unit 250b outputs the key “http://aaa.aaa/e/c/” from the returned characters “h” to “empty”. Further, the trie tree searching unit 250b outputs the value “2” connected to “Data” (step S88b).

図70〜図72では、ルートノードから順にノードを辿って、各ノードに登録されたキー、値を出力する場合について説明した。しかし、実施例1に示したように、所定のキーを指定し、指定したキーに基づいて集計値を抽出しても良い。   In FIG. 70 to FIG. 72, the case has been described in which the nodes are sequentially traced from the root node and the keys and values registered in each node are output. However, as shown in the first embodiment, a predetermined key may be designated, and the total value may be extracted based on the designated key.

次に、トライ木探索部250bが、指定された入力キーに対応する値をトライ木240bから検索する処理について説明する。トライ木探索部250bは、トライ木240bが、深さ優先探索順でタグキーが並ぶように生成されているので、比較対象ノードに登録されたタグキーと入力キーを比較すればよい。また、図60〜69に示したトライ木を生成する処理と同様にして、一致数、世代数を利用することで、比較する文字数を削減することも可能である。   Next, a process in which the trie tree search unit 250b searches the trie tree 240b for a value corresponding to the designated input key will be described. Since the trie tree 240b is generated so that the tag keys are arranged in the depth-first search order, the trie tree search unit 250b may compare the tag key registered in the comparison target node with the input key. Similarly to the process of generating the trie tree shown in FIGS. 60 to 69, the number of characters to be compared can be reduced by using the number of matches and the number of generations.

図73〜図77は、本実施例2にかかる探索処理を説明するための図である。図73に示すように、トライ木240bは、ルートノードの配下にノードb、ノードa、ノードb、ノードcが接続されている。ここで、各ノードbを区別するために、ルートノードの子ノードに対応するノードbをノードb(1)と表記し、もう一方のノードbをノードb(2)と表記する。   FIGS. 73 to 77 are diagrams for explaining the search processing according to the second embodiment. As shown in FIG. 73, in the trie tree 240b, node b, node a, node b, and node c are connected under the root node. Here, in order to distinguish each node b, the node b corresponding to the child node of the root node is expressed as node b (1), and the other node b is expressed as node b (2).

ノードb(1)は、一致数「1」、タグキー「空」、値「1」を登録し、ノードaは、一致数「0」、タグキー「aa」、値「3」を登録する。ノードb(2)は、一致数「0」、タグキー「c」、値「1」を登録し、ノードcは、一致数「0」、タグキー「b」、値「2」を登録する。   Node b (1) registers the number of matches “1”, tag key “empty”, and value “1”, and node a registers the number of matches “0”, tag key “aa”, and value “3”. Node b (2) registers the number of matches “0”, tag key “c”, and value “1”, and node c registers the number of matches “0”, tag key “b”, and value “2”.

また、図73〜図77における説明では、入力キー「baca」が指定された場合の検索処理について説明する。図73において、トライ木探索部250bは、入力キーのポインタを先頭文字「b」に設定し、ポインタの指定する「b」により、ルートノードからノードb(1)に遷移する。そして、トライ木探索部250bは、入力キーのポインタを「b」から1文字ずらした「a」に設定する(ステップS89a)。   73 to 77, search processing when the input key “baca” is designated will be described. In FIG. 73, the trie tree search unit 250b sets the pointer of the input key to the first character “b”, and transitions from the root node to the node b (1) by “b” designated by the pointer. Then, the trie tree searching unit 250b sets the pointer of the input key to “a” shifted by one character from “b” (step S89a).

実データ上では、トライ木探索部250bは、テキスト表34に入力キー「baca」を登録し、入力キーのポインタをテキスト表34の2行目1列目の「b」に接続する。トライ木探索部250bは、入力キーのポインタに接続された「b」により、ポインタ配列40からポインタ配列41に現在のノードのポインタを移動させ、入力キーのポインタを1文字ずらした「a」に設定する(ステップS89b)。   On the actual data, the trie tree search unit 250 b registers the input key “baca” in the text table 34 and connects the input key pointer to “b” in the second row and first column of the text table 34. The trie tree search unit 250b moves the pointer of the current node from the pointer array 40 to the pointer array 41 by “b” connected to the pointer of the input key, and changes the pointer of the input key to “a” shifted by one character. Setting is made (step S89b).

続いて、図74の説明に移行する。トライ木探索部250bは、ポインタの指定する「a」により、ノードb(1)からノードaに遷移し、入力キーのポインタを「a」から1文字ずらした「c」に設定する(ステップS90a)。   Subsequently, the description proceeds to FIG. The trie tree search unit 250b transitions from the node b (1) to the node a by “a” designated by the pointer, and sets the pointer of the input key to “c” shifted by one character from “a” (step S90a). ).

実データ上では、トライ木探索部250bは、入力キーのポインタに接続された「a」により、ポインタ配列41からポインタ配列42に現在のノードのポインタを遷移させ、入力キーのポインタを1文字ずらした「c」に設定する(ステップS90b)。   On the actual data, the trie tree search unit 250b shifts the pointer of the current node from the pointer array 41 to the pointer array 42 by “a” connected to the input key pointer, and shifts the input key pointer by one character. “C” is set (step S90b).

続いて、図75の説明に移行する。トライ木探索部250bは、ポインタの指定する「c」により、ノードaからノードcに遷移し、入力キーのポインタを「c」から1文字ずらした「a」に設定する(ステップS91a)。   Subsequently, the description proceeds to FIG. 75. The trie tree search unit 250b transitions from the node a to the node c by “c” designated by the pointer, and sets the pointer of the input key to “a” shifted by one character from “c” (step S91a).

実データ上では、トライ木探索部250bは、入力キーのポインタに接続された「c」により、ポインタ配列42からポインタ配列43に現在のノードのポインタを遷移させ、入力キーのポインタを1文字ずらした「a」に設定する(ステップS91b)。   On the actual data, the trie tree search unit 250b shifts the pointer of the current node from the pointer array 42 to the pointer array 43 by “c” connected to the input key pointer, and shifts the input key pointer by one character. “A” is set (step S91b).

続いて、図76の説明に移行する。トライ木探索部250bは、ポインタの指定する「a」に対応する子ノードが、ノードaに存在しないので、ノードcの一致数と世代数を比較する。一致数と世代数が等しいので、トライ木探索部250bは、ノードcのタグキー「b」と、トライ部分「bac」を取り除いた入力キー「a」の優先度とを比較する。トライ木探索部250bは、ノードcの一致数が「0」であるため、キーの先頭から順に比較を行う。トライ木探索部250bは、比較した結果、入力キーの優先度よりもタグキーの優先度の方が大きいと判定する(ステップS92a)。   Subsequently, the description proceeds to FIG. 76. Since the child node corresponding to “a” designated by the pointer does not exist in the node a, the trie tree searching unit 250b compares the number of matches of the node c with the number of generations. Since the number of matches is equal to the number of generations, the trie tree searching unit 250b compares the tag key “b” of the node c with the priority of the input key “a” from which the trie part “bac” is removed. Since the number of matches of node c is “0”, the trie tree search unit 250b performs comparison in order from the top of the key. As a result of the comparison, the trie tree search unit 250b determines that the priority of the tag key is higher than the priority of the input key (step S92a).

実データ上において、トライ木探索部250bは、ポインタ配列44の「一致」と世代数を比較する。一致数と世代数が等しいので、トライ木探索部250bは、ポインタ配列44の「TAG」に接続された文字「b」の優先度と、入力キーのポインタに接続された文字「a」の優先度を比較する。トライ木探索部250bは、比較した結果、入力キーの優先度よりもタグキーの優先度の方が大きいと判定する(ステップS92b)。   On the actual data, the trie tree search unit 250b compares “match” in the pointer array 44 with the number of generations. Since the number of matches is equal to the number of generations, the trie tree search unit 250b determines the priority of the character “b” connected to “TAG” in the pointer array 44 and the priority of the character “a” connected to the pointer of the input key. Compare degrees. As a result of the comparison, the trie tree search unit 250b determines that the priority of the tag key is higher than the priority of the input key (step S92b).

図77の説明に移行する。トライ木探索部250bは、ノードcが兄ノード「ノードb(2)」を有するので、ノードcより前のノード(ノードa、ノードb(1))に、入力キーと一致するタグキーを有するノードは存在しないと判定する。トライ木探索部250bは、該当データが存在しない旨を出力する(ステップS93)。   The description shifts to the description of FIG. Since the node c has the older brother node “node b (2)”, the trie tree search unit 250b has a node having a tag key that matches the input key in a node before the node c (node a, node b (1)). Is determined not to exist. The trie tree search unit 250b outputs that the corresponding data does not exist (step S93).

次に、本実施例2にかかる検索装置200の各種の処理手順について説明する。まず、本実施例2にかかる検索装置200がトライ木240bを生成する処理について説明する。図78は、本実施例2にかかるトライ木生成処理の処理手順を示すフローチャートである。   Next, various processing procedures of the search device 200 according to the second embodiment will be described. First, the process in which the search device 200 according to the second embodiment generates the trie tree 240b will be described. FIG. 78 is a flowchart of the process procedure of the trie tree generation process according to the second embodiment.

図78に示すように、トライ木生成部250aは、ルートノードを生成し(ステップS500)、次の入力データ(キー、値)が登録データ管理テーブル240aに存在するか否かを判定する(ステップS501)。   As shown in FIG. 78, the trie tree generation unit 250a generates a root node (step S500), and determines whether or not the next input data (key, value) exists in the registered data management table 240a (step S500). S501).

トライ木生成部250aは、次の入力データが登録データ管理テーブル240aに存在しないと判定した場合には(ステップS502,No)、処理を終了する。一方、トライ木生成部250aは、次の入力データが登録データ管理テーブル240aに登録されている場合には(ステップS502,Yes)、未読の入力データを読み出し(ステップS503)、データ追加処理を実行する(ステップS504)。   If the trie tree generation unit 250a determines that the next input data does not exist in the registered data management table 240a (No in step S502), the process ends. On the other hand, when the next input data is registered in the registered data management table 240a (Yes in step S502), the trie tree generation unit 250a reads unread input data (step S503) and executes data addition processing. (Step S504).

次に、図78のステップS504に示したデータ追加処理の処理手順について説明する。ここでは、二分探索法を用いないでデータ追加処理を実行する場合について説明するが、実施例1と同様にして、二分探索法を用いても良い。   Next, the processing procedure of the data addition processing shown in step S504 in FIG. 78 will be described. Here, the case where the data addition process is executed without using the binary search method will be described, but the binary search method may be used in the same manner as in the first embodiment.

図79〜図81は、本実施例2にかかるデータ追加処理の処理手順を示すフローチャートである。図79に示すように、トライ木生成部250aは、現在のノードをルートノードに設定し(ステップS510)、入力キーが空であるか否かを判定する(ステップS511)。   FIGS. 79 to 81 are flowcharts illustrating the processing procedure of the data addition processing according to the second embodiment. As shown in FIG. 79, the trie tree generation unit 250a sets the current node as the root node (step S510), and determines whether or not the input key is empty (step S511).

トライ木生成部250aは、入力キーが空の場合に(ステップS512,Yes)、世代数を0に設定し(ステップS513)、図80のステップS519に移行する。一方、トライ木生成部250aは、入力キーが空ではない場合に(ステップS512,No)、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS514)。   When the input key is empty (step S512, Yes), the trie tree generation unit 250a sets the number of generations to 0 (step S513), and proceeds to step S519 in FIG. On the other hand, when the input key is not empty (No in step S512), the trie tree generation unit 250a refers to the child node with the key of the first character of the input key, and determines whether or not the child node exists ( Step S514).

トライ木生成部250aは、子ノードが存在する場合に(ステップS515,Yes)、入力キーの先頭の1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードに遷移し(ステップS516)、ステップS511に移行する。   If there is a child node (step S515, Yes), the trie tree generation unit 250a reads the first character of the input key, advances the pointer of the input key by one character, and transitions to the child node using the read character as a key. (Step S516), the process proceeds to Step S511.

一方、トライ木生成部250aは、子ノードが存在しない場合に(ステップS515,No)、長男キーの優先度が入力キーの先頭文字のキーの優先度よりも小さいか否かを判定する(ステップS517)。トライ木生成部250aは、長男キーの優先度が入力キーの先頭文字のキーの優先度よりも小さくない場合に(ステップS518,No)、ステップS513に移行する。   On the other hand, when there is no child node (step S515, No), the trie tree generation unit 250a determines whether the priority of the eldest son key is lower than the priority of the key of the first character of the input key (step S515). S517). When the priority of the eldest son key is not lower than the priority of the key of the first character of the input key (No in step S518), the trie tree generation unit 250a proceeds to step S513.

一方、トライ木生成部250aは、長男キーの優先度が入力キーの先頭文字のキーの優先度よりも小さい場合に(ステップS518,Yes)、図81のステップ536に移行する。   On the other hand, when the priority of the eldest son key is lower than the priority of the key of the first character of the input key (step S518, Yes), the trie tree generation unit 250a proceeds to step 536 in FIG.

続いて、図80の説明に移行し、トライ木生成部250aは、ノードの情報を参照し(ステップS519)、一致数と世代数が等しいか否かを判定する(ステップS520)。トライ木生成部250aは、一致数と世代数が異なる場合に(ステップS521,No)、一致数が世代数よりも大きいか否かを判定する(ステップS522)。   Subsequently, the description proceeds to the description of FIG. 80. The trie tree generation unit 250a refers to the node information (step S519) and determines whether the number of matches is equal to the number of generations (step S520). When the number of matches is different from the number of generations (step S521, No), the trie tree generation unit 250a determines whether the number of matches is larger than the number of generations (step S522).

トライ木生成部250aは、一致数が世代数よりも大きくない場合には(ステップS523,No)、図81のステップS538に移行する。一方、トライ木生成部250aは、一致数が世代数よりも大きい場合に(ステップS523,Yes)、ステップS530に移行する。   If the number of matches is not greater than the number of generations (step S523, No), the trie tree generation unit 250a proceeds to step S538 in FIG. On the other hand, when the number of matches is larger than the number of generations (step S523, Yes), the trie tree generation unit 250a proceeds to step S530.

ところで、トライ木生成部250aは、ステップS525において、タブキーの優先度と入力キーの優先度が等しい場合に(ステップS525,Yes)、現在のノードのデータに入力値を追加し(ステップS526)、データ追加処理を終了する(ステップS527)。   By the way, if the priority of the tab key is equal to the priority of the input key in step S525 (step S525, Yes), the trie tree generating unit 250a adds the input value to the current node data (step S526). The data addition process is terminated (step S527).

一方、トライ木生成部250aは、タグキーの優先度と入力キーの優先度が異なる場合に(ステップS525,No)、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS527)。トライ木生成部250aは、タグキーの優先度が入力キーの優先度よりも大きくない場合には(ステップS528,No)、図81のステップS533に移行する。   On the other hand, when the priority of the tag key is different from the priority of the input key (No in step S525), the trie tree generation unit 250a determines whether the priority of the tag key is higher than the priority of the input key ( Step S527). If the priority of the tag key is not higher than the priority of the input key (No at Step S528), the trie tree generation unit 250a proceeds to Step S533 in FIG.

一方、トライ木生成部250aは、タグキーの優先度が入力キーの優先度よりも大きい場合に(ステップS528,Yes)、前方一致した文字数を世代数に追加し、入力キーのポインタを前方一致した文字数分だけ進める(ステップS529)。   On the other hand, when the priority of the tag key is higher than the priority of the input key (Yes in step S528), the trie tree generation unit 250a adds the number of characters that match forward to the number of generations and matches the pointer of the input key forward. Advance by the number of characters (step S529).

トライ木生成部250aは、兄ノードが存在する、または、親ノードがルートノードであるか否かを判定する(ステップS530)。トライ木生成部250aは、兄ノードが存在せず、かつ、親ノードがルートノードでない場合(条件を満たさない場合)に(ステップS531,No)、世代数に1を加算し、親ノードへ遷移し(ステップS532)、ステップS529に移行する。   The trie tree generation unit 250a determines whether there is an older brother node or whether the parent node is a root node (step S530). The trie tree generation unit 250a adds 1 to the number of generations and transitions to the parent node when the brother node does not exist and the parent node is not the root node (when the condition is not satisfied) (step S531, No). (Step S532), and the process proceeds to Step S529.

一方、トライ木生成部250aは、兄ノードが存在する、または、親ノードがルートノードである場合(条件を満たす場合)に(ステップS531,Yes)、図81のステップS539に移行する。   On the other hand, the trie tree generation unit 250a proceeds to step S539 in FIG. 81 when the brother node exists or the parent node is the root node (when the condition is satisfied) (step S531, Yes).

続いて、図81の説明に移行し、トライ木生成部250aは、現在のタグ情報において、一致数に前方一致した文字数を加算し、タグキーのポインタを前方一致した文字数分だけ進め(ステップS533)、世代数が0であるか否かを判定する(ステップS534)。   Subsequently, the description proceeds to the description of FIG. 81. The trie tree generation unit 250a adds the number of characters that have been forward-matched to the number of matches in the current tag information, and advances the tag key pointer by the number of characters that have been forward-matched (step S533). Then, it is determined whether or not the number of generations is 0 (step S534).

トライ木生成部250aは、世代数が0の場合に(ステップS535,Yes)、新しいノードを生成し、現在のノードから入力キーの先頭文字をキーとして新しいノードに接続し、入力キーのポインタを進める(ステップS536)。   When the generation number is 0 (Yes in step S535), the trie tree generation unit 250a generates a new node, connects the current node to the new node using the first character of the input key as a key, and sets the input key pointer. Advance (step S536).

トライ木生成部250aは、世代数、入力キーをタグ情報として新しいノードに付加し(ステップS537)、入力値を新しいノードに付加し(ステップS538)、データ追加処理を終了する。   The trie tree generation unit 250a adds the generation number and the input key as tag information to the new node (step S537), adds the input value to the new node (step S538), and ends the data addition process.

一方、トライ木生成部250aは、世代数が0ではない場合に(ステップS535,No)、世代数から1を減算し、長男ノードへ遷移する(ステップS538)。トライ木生成部250aは、現在のノードの一致数、タグキー、値と世代数、入力キー、入力値をぞれぞれ交換し(ステップS539)、世代数が0であるか否かを判定する(ステップS540)。   On the other hand, when the number of generations is not 0 (step S535, No), the trie tree generation unit 250a subtracts 1 from the number of generations and transitions to the eldest node (step S538). The trie tree generation unit 250a exchanges the current node match number, tag key, value and generation number, input key, and input value (step S539), and determines whether the generation number is 0 or not. (Step S540).

トライ木生成部250aは、世代数が0の場合に(ステップS541,Yes)、入力キーの先頭文字のキーで子ノードを参照し(ステップS542)、ステップS536に移行する。一方、トライ木生成部250aは、世代数が0ではない場合に(ステップS541,No)、ステップS538に移行する。   When the number of generations is 0 (step S541, Yes), the trie tree generation unit 250a refers to the child node with the key of the first character of the input key (step S542), and proceeds to step S536. On the other hand, when the number of generations is not zero (step S541, No), the trie tree generation unit 250a proceeds to step S538.

次に、本実施例2にかかる検索装置200がトライ木240bを用いて検索を行う処理について説明する。ここでは、二分探索法を用いないで検索処理を実行する場合について説明するが、実施例1と同様にして、二分探索法を用いても良い。   Next, processing in which the search device 200 according to the second embodiment performs a search using the trie tree 240b will be described. Here, the case where the search process is executed without using the binary search method will be described, but the binary search method may be used in the same manner as in the first embodiment.

図82および図83は、本実施例2にかかる検索処理の処理手順を示すフローチャートである。図82に示すように、トライ木探索部250bは、現在のノードをルートノードに設定し(ステップS550)、入力キーが存在するか否かを判定する(ステップS551)。   FIG. 82 and FIG. 83 are flowcharts illustrating the processing procedure of the search processing according to the second embodiment. As shown in FIG. 82, the trie tree search unit 250b sets the current node as the root node (step S550), and determines whether or not an input key exists (step S551).

トライ木探索部250bは、入力キーが存在する場合に(ステップS552,Yes)、入力キーの先頭文字のキーで子ノードを参照し、キーの子ノードが存在するか否かを判定する(ステップS553)。   When there is an input key (step S552, Yes), the trie tree search unit 250b refers to the child node with the key of the first character of the input key, and determines whether or not a child node of the key exists (step S52). S553).

トライ木探索部250bは、子ノードが存在する場合に(ステップS554,Yes)、先頭キーで子ノードへ遷移し、入力キーのポインタを進め(ステップS555)、ステップS551に移行する。   When there is a child node (Yes in step S554), the trie tree search unit 250b transitions to the child node with the top key, advances the pointer of the input key (step S555), and proceeds to step S551.

一方、トライ木探索部250bは、子ノードが存在しない場合に(ステップS554,No)、長男キーの優先度が入力キーの先頭のキーの優先度よりも小さいか否かを判定する(ステップS556)。   On the other hand, when there is no child node (No in step S554), the trie tree search unit 250b determines whether the priority of the eldest son key is lower than the priority of the first key of the input key (step S556). ).

トライ木探索部250bは、長男キーの優先度が入力キーの先頭のキーの優先度よりも小さい場合に(ステップS557,Yes)、一致データが無い旨を出力する(ステップS558)。一方、トライ木探索部250bは、長男キーの優先度が入力キーの先頭のキーの優先度よりも小さくない場合には(ステップS557,No)、ステップS559に移行する。   When the priority of the eldest son key is lower than the priority of the first key of the input key (step S557, Yes), the trie tree search unit 250b outputs that there is no matching data (step S558). On the other hand, if the priority of the eldest son key is not lower than the priority of the first key of the input key (No at Step S557), the trie tree searching unit 250b proceeds to Step S559.

ところで、トライ木探索部250bは、ステップS552において、入力キーが存在しない場合に(ステップS552,No)、世代数を0に設定し(ステップS559)、図83のステップS560に移行する。   By the way, if there is no input key in step S552 (step S552, No), the trie tree search unit 250b sets the number of generations to 0 (step S559), and proceeds to step S560 in FIG.

続いて、図83の説明に移行し、トライ木探索部250bは、ノードの情報を参照し、一致数が世代数と等しいか否かを判定する(ステップS560)。トライ木探索部250bは、一致数と世代数が等しくない場合に(ステップS561,No)、一致数が世代数よりも大きいか否かを判定する(ステップS562)。   Subsequently, the description proceeds to FIG. 83, and the trie tree searching unit 250b refers to the node information and determines whether or not the number of matches is equal to the number of generations (step S560). When the number of matches is not equal to the number of generations (No in step S561), the trie tree searching unit 250b determines whether the number of matches is larger than the number of generations (step S562).

トライ木探索部250bは、一致数が世代数よりも大きくない場合に(ステップS563,No)、一致データが無い旨を出力する(ステップS564)。トライ木探索部250bは、一致数が世代数よりも大きい場合に(ステップS563,Yes)、ステップS571に移行する。   When the number of matches is not greater than the number of generations (step S563, No), the trie tree search unit 250b outputs that there is no match data (step S564). When the number of matches is greater than the number of generations (Yes in step S563), the trie tree search unit 250b proceeds to step S571.

ところで、トライ木探索部250bは、ステップS561において、一致数と世代数が等しい場合に(ステップS561,Yes)、タグキーの優先度と入力キーの優先度が等しいか否かを判定する(ステップS565)。   By the way, the trie tree search unit 250b determines whether the priority of the tag key is equal to the priority of the input key when the number of matches is equal to the number of generations in step S561 (step S561, Yes) (step S565). ).

トライ木探索部250bは、タグキーの優先度と入力キーの優先度が等しい場合に(ステップS566,Yes)、現在のノードのデータを出力する(ステップS567)。一方、トライ木探索部250bは、タグキーの優先度と入力キーの優先度が異なる場合に(ステップS566,No)、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS568)。   When the priority of the tag key is equal to the priority of the input key (Yes in step S566), the trie tree search unit 250b outputs the data of the current node (step S567). On the other hand, when the priority of the tag key and the priority of the input key are different (No in step S566), the trie tree search unit 250b determines whether the priority of the tag key is higher than the priority of the input key ( Step S568).

トライ木探索部250bは、タグキーの優先度が入力キーの優先度よりも大きくない場合には(ステップS569,No)、ステップS564に移行する。一方、トライ木探索部250bは、タグキーの優先度が入力キーの優先度よりも大きい場合に(ステップS569,Yes)、前方一致した文字数を世代数に追加し、入力キーのポインタを前方一致した文字数分だけ進める(ステップS570)。   When the priority of the tag key is not greater than the priority of the input key (No at Step S569), the trie tree search unit 250b proceeds to Step S564. On the other hand, when the priority of the tag key is higher than the priority of the input key (step S569, Yes), the trie tree search unit 250b adds the number of characters that match forward to the number of generations, and matches the input key pointer forward. Advance by the number of characters (step S570).

トライ木探索部250bは、兄ノードが存在する、または、親ノードがルートノードであるか否かを判定する(ステップS571)。トライ木探索部250bは、兄ノードが存在しない、かつ、親ノードがルートノードでない場合(条件を満たさない場合)に(ステップS572,No)、世代数に1を加算し、親ノードへ遷移し(ステップS573)、ステップS560に移行する。   The trie tree search unit 250b determines whether there is an older brother node or whether the parent node is a root node (step S571). When the brother node does not exist and the parent node is not the root node (when the condition is not satisfied) (step S572, No), the trie tree search unit 250b adds 1 to the number of generations and transitions to the parent node. (Step S573), the process proceeds to step S560.

一方、トライ木探索部250bは、兄ノードが存在する、または、親ノードがルートノードである場合(条件を満たす場合)に(ステップS572,Yes)、ステップS564に移行する。   On the other hand, the trie tree searching unit 250b proceeds to step S564 when the brother node exists or the parent node is the root node (when the condition is satisfied) (step S572, Yes).

次に、本実施例2にかかる検索装置200が実行する集計値の抽出処理について説明する。図84は、本実施例2にかかる集計値の抽出処理の処理手順を示すフローチャートである。図84に示すように、トライ木探索部250bは、現在のノードをルートノードに設定し(ステップS600)、子ノードが存在するか否かを判定する(ステップS601)。   Next, a summary value extraction process executed by the search device 200 according to the second embodiment will be described. FIG. 84 is a flowchart of a process procedure of a total value extraction process according to the second embodiment. As shown in FIG. 84, the trie tree search unit 250b sets the current node as the root node (step S600), and determines whether there is a child node (step S601).

トライ木探索部250bは、子ノードが存在しない場合には(ステップS602,No)、弟ノードが存在するか否かを判定する(ステップS603)。トライ木探索部250bは、弟ノードが存在しない場合に(ステップS604,No)、親ノードへ遷移し(ステップS605)、ステップS603に移行する。   If there is no child node (No in step S602), the trie tree searching unit 250b determines whether there is a younger brother node (step S603). When there is no younger brother node (step S604, No), the trie tree search unit 250b transitions to the parent node (step S605), and proceeds to step S603.

一方、トライ木探索部250bは、弟ノードが存在する場合に(ステップS604,Yes)、次弟ノードへ遷移し(ステップS606)、ステップS609に移行する。   On the other hand, when the younger brother node exists (step S604, Yes), the trie tree search unit 250b transitions to the next younger brother node (step S606), and proceeds to step S609.

ところで、トライ木探索部250bは、ステップS602において、子ノードが存在する場合に(ステップS602,Yes)、タグキーのポインタから一致数+階層数分だけ戻した位置から、キーを取得する(ステップS608)。そして、トライ木探索部250bは、現在のノードの各種値を加工し出力し(ステップS609)、ステップS601に移行する。   By the way, if there is a child node in step S602 (step S602, Yes), the trie tree search unit 250b acquires a key from the position returned by the number of matches + the number of hierarchies from the tag key pointer (step S608). ). Then, the trie tree search unit 250b processes and outputs various values of the current node (step S609), and proceeds to step S601.

次に、本実施例2にかかる検索装置200が実行する削除処理の処理手順について説明する。図85〜図88は、本実施例2にかかる削除処理の処理手順を示すフローチャートである。図85に示すように、トライ木探索部250bは、入力キーが存在するか否かを判定し(ステップS610)、入力キーが存在する場合(ポインタの示す文字が空でない場合)には(ステップS611,Yes)、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS612)。   Next, a processing procedure of deletion processing executed by the search device 200 according to the second embodiment will be described. 85 to 88 are flowcharts illustrating the processing procedure of the deletion processing according to the second embodiment. As shown in FIG. 85, the trie tree search unit 250b determines whether or not there is an input key (step S610). If the input key exists (if the character indicated by the pointer is not empty) (step S610). S611, Yes), the child node is referred to by the key of the first character of the input key, and it is determined whether or not the child node exists (step S612).

トライ木探索部250bは、子ノードが存在する場合には(ステップS613,Yes)、先頭キーで子ノードへ遷移し、入力キーのポインタを進め(ステップS614)、ステップS610に移行する。   If there is a child node (step S613, Yes), the trie tree search unit 250b transitions to the child node with the top key, advances the pointer of the input key (step S614), and proceeds to step S610.

一方、トライ木探索部250bは、子ノードが存在しない場合には(ステップS613,No)、ノードの一致数が0であるか否かを判定する(ステップS615)。トライ木探索部250bは、一致数が0でない場合に(ステップS616,No)、長男キーの優先度が入力キーの先頭文字のキーの優先度よりも小さいか否かを判定する(ステップS617)。トライ木探索部250bは、長男キーの優先度が入力キーの先頭文字のキーの優先度よりも小さい場合には(ステップS618,Yes)、削除データが存在しない旨を出力する(ステップS619)。   On the other hand, when there is no child node (No in step S613), the trie tree searching unit 250b determines whether the number of node matches is 0 (step S615). When the number of matches is not 0 (step S616, No), the trie tree search unit 250b determines whether the priority of the eldest son key is lower than the priority of the key of the first character of the input key (step S617). . When the priority of the eldest son key is lower than the priority of the key of the first character of the input key (step S618, Yes), the trie tree search unit 250b outputs that no deletion data exists (step S619).

ところで、トライ木探索部250bは、ステップS611において、入力キーが存在しない場合(ポインタの文字が空の場合)には(ステップS611,No)、世代数を0に設定し(ステップS620)、図86のステップS621に移行する。   By the way, the trie tree search unit 250b sets the number of generations to 0 (step S620) when the input key does not exist in step S611 (when the pointer character is empty) (step S611, No). The process shifts to step S621 of 86.

続いて、トライ木探索部250bは、図86において、ノードの情報を参照し(ステップS621)、一致数が世代数と等しいか否かを判定する(ステップS622)。トライ木探索部250bは、一致数と世代数が等しくない場合に(ステップS623,No)、一致数が世代数よりも大きいか否かを判定する(ステップS624)。   Subsequently, the trie tree search unit 250b refers to the node information in FIG. 86 (step S621), and determines whether or not the number of matches is equal to the number of generations (step S622). If the number of matches is not equal to the number of generations (step S623, No), the trie tree searching unit 250b determines whether the number of matches is greater than the number of generations (step S624).

トライ木探索部250bは、一致数が世代数よりも大きい場合に(ステップS625,Yes)、ステップS631に移行する。一方、トライ木探索部250bは、一致数が世代数よりも大きくない場合に(ステップS625,No)、ステップS634に移行する。   When the number of matches is greater than the number of generations (Yes in step S625), the trie tree search unit 250b proceeds to step S631. On the other hand, if the number of matches is not greater than the number of generations (No in step S625), the trie tree search unit 250b proceeds to step S634.

ところで、トライ木探索部250bは、ステップS623において、一致数と世代数が等しい場合に(ステップS623,Yes)、タグキーの優先度が入力キーの優先度と等しいか否かを判定する(ステップS626)。   By the way, when the number of matches is equal to the number of generations in step S623 (step S623, Yes), the trie tree search unit 250b determines whether the priority of the tag key is equal to the priority of the input key (step S626). ).

トライ木探索部250bは、タグキーの優先度が入力キーの優先度と等しい場合に(ステップS627,Yes)、図87のステップS635に移行する。一方、トライ木探索部250bは、タグキーの優先度が入力キーの優先度と等しくない場合に(ステップS627,No)、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS628)。   If the priority of the tag key is equal to the priority of the input key (step S627, Yes), the trie tree search unit 250b proceeds to step S635 in FIG. On the other hand, when the priority of the tag key is not equal to the priority of the input key (No in step S627), the trie tree search unit 250b determines whether the priority of the tag key is higher than the priority of the input key. (Step S628).

トライ木探索部250bは、タグキーの優先度が入力キーの優先度よりも大きくない場合には(ステップS629,No)、ステップS634に移行する。一方、トライ木探索部250bは、タグキーの優先度が入力キーの優先度よりも大きい場合に(ステップS629,Yes)、前方一致した文字を世代数に追加し、入力キーのポインタを前方一致した文字数分だけ進める(ステップS630)。   When the priority of the tag key is not higher than the priority of the input key (No at Step S629), the trie tree search unit 250b proceeds to Step S634. On the other hand, when the priority of the tag key is higher than the priority of the input key (step S629, Yes), the trie tree search unit 250b adds the forward-matched character to the number of generations and forward-matches the input key pointer. Advance by the number of characters (step S630).

トライ木探索部250bは、兄ノードが存在する、または、親ノードがルートノードであるか否かを判定する(ステップS631)。トライ木探索部250bは、兄ノードが存在せず、かつ、親ノードがルートノードでない場合(条件を満たさない場合)に(ステップS632,No)、世代数に1を加算し、親ノードへ遷移し(ステップS633)、ステップS621に移行する。   The trie tree search unit 250b determines whether there is an older brother node or whether the parent node is a root node (step S631). The trie tree search unit 250b adds 1 to the number of generations and transitions to the parent node when no brother node exists and the parent node is not the root node (when the condition is not satisfied) (No in step S632). (Step S633), the process proceeds to Step S621.

一方、トライ木探索部250bは、兄ノードが存在する、または、親ノードがルートノードの場合に(ステップS632,Yes)、削除データが存在しない旨を出力する(ステップS634)。   On the other hand, the trie tree search unit 250b outputs that no deletion data exists (step S634) when there is an older brother node or when the parent node is the root node (step S632, Yes).

続いて、図87に移行し、トライ木探索部250bは、削除対象データが存在するか否かを判定する(ステップS635)。トライ木探索部250bは、削除対象データが存在しない場合に(ステップS636,No)削除データが存在しない旨を出力する(ステップS637)。   Subsequently, the process proceeds to FIG. 87, and the trie tree search unit 250b determines whether or not deletion target data exists (step S635). The trie tree searching unit 250b outputs that no deletion data exists (step S637) when no deletion target data exists (step S636, No).

一方、トライ木探索部250bは、削除対象データが存在する場合に(ステップS638)、他のデータが存在するか(ノードに他の値が登録されているか否か)否かを判定する(ステップS639)。トライ木探索部250bは、他のノードが存在する場合に(ステップS640,Yes)、処理を終了する。一方、トライ木探索部250bは、他のデータが存在しない場合に(ステップS640,No)、図88のステップS641に移行する。   On the other hand, when there is data to be deleted (step S638), the trie tree search unit 250b determines whether there is other data (whether another value is registered in the node) (step S638). S639). The trie tree search unit 250b ends the process when another node exists (step S640, Yes). On the other hand, if there is no other data (No at Step S640), the trie tree search unit 250b proceeds to Step S641 in FIG.

続いて、図88に移行し、トライ木探索部250bは、現在のノードが長男であるか否かを判定し(ステップS641)、長男ではない場合に(ステップS642,No)、ステップS647に移行する。   Subsequently, the process proceeds to FIG. 88, and the trie tree searching unit 250b determines whether or not the current node is the eldest son (step S641). If the current node is not the eldest son (step S642, No), the trie tree searching unit 250b proceeds to step S647. To do.

一方、トライ木探索部250bは、現在のノードが長男の場合に(ステップS642,Yes)、親ノードの一致数が現在のノードの一致数よりも大きいか否かを判定する(ステップS643)。トライ木探索部250bは、親ノードの一致数が現在のノードの一致数よりも大きくない場合に(ステップS644,No)、ステップS647に移行する。   On the other hand, when the current node is the eldest son (step S642, Yes), the trie tree search unit 250b determines whether the number of matches of the parent node is larger than the number of matches of the current node (step S643). When the number of matches of the parent node is not greater than the number of matches of the current node (step S644, No), the trie tree search unit 250b proceeds to step S647.

一方、トライ木探索部250bは、親ノードの一致数が現在のノードの一致数よりも大きい場合に(ステップS644,Yes)、親ノードの一致数から現在のノードの一致数を減算したものから更に1を減算したものを差分一致数として算出する(ステップS645)。   On the other hand, when the number of matches of the parent node is larger than the number of matches of the current node (step S644, Yes), the trie tree search unit 250b subtracts the number of matches of the current node from the number of matches of the parent node. Further, a value obtained by subtracting 1 is calculated as the difference coincidence (step S645).

トライ木探索部250bは、現在のノードの一致数に1を加算したものを親ノードの一致数に設定し、親ノードのタグ文字列のポインタを差分一致数分戻し(ステップS646)、子ノードが存在するか否かを判定する(ステップS647)。   The trie tree search unit 250b sets the number of matches of the current node plus 1 as the number of matches of the parent node, and returns the pointer character string pointer of the parent node by the number of differences matched (step S646), and the child node Is determined (step S647).

トライ木探索部250bは、子ノードが存在する場合に(ステップS648,Yes)、現在のノードのデータを長男ノードのデータとし、一致数に1加算する(ステップS649)。トライ木探索部250bは、長男ノードへ遷移し(ステップS650)、ステップS647に移行する。   When there is a child node (step S648, Yes), the trie tree search unit 250b sets the current node data as the eldest node data and adds 1 to the number of matches (step S649). The trie tree search unit 250b transitions to the eldest son node (step S650), and proceeds to step S647.

一方、トライ木探索部250bは、子ノードが存在しない場合に(ステップS648,No)、現在のノードが長男であるか否かを判定する(ステップS612)。トライ木探索部250bは、現在のノードが長男ではない場合に(ステップS652,No)、ステップS654に移行する。   On the other hand, when there is no child node (No in step S648), the trie tree search unit 250b determines whether the current node is the eldest son (step S612). When the current node is not the eldest son (step S652, No), the trie tree search unit 250b proceeds to step S654.

一方、トライ木探索部250bは、現在のノードが長男ノードの場合に(ステップS652,Yes)、親ノードのタグ文字列のポインタを親ノードの一致数分だけ戻し、親ノードの一致数を0にする(ステップS653)。そして、トライ木探索部250bは、親ノードの現在のノードへのエッジを削除し、現在のノードを削除する(ステップS654)。   On the other hand, when the current node is the eldest node (step S652, Yes), the trie tree search unit 250b returns the tag character string pointer of the parent node by the number of matches of the parent node, and sets the number of matches of the parent node to 0. (Step S653). Then, the trie tree search unit 250b deletes the edge of the parent node to the current node, and deletes the current node (step S654).

上述してきたように、本実施例2にかかる検索装置200は、各ノードのタグキーと入力キーとを比較する場合に、先頭文字から順に各キー(タグキーと入力キー)の文字を比較するのではなく、子ノードに登録されたタグキーとの一致数だけ比較する文字をスキップするので、入力キーをトライ木に登録する処理を高速化することが出来る。   As described above, the search device 200 according to the second embodiment does not compare the characters of each key (tag key and input key) in order from the first character when comparing the tag key and input key of each node. Rather than skipping characters to be compared by the number of matches with the tag key registered in the child node, the process of registering the input key in the trie tree can be speeded up.

なお、本実施例2では一例として、子ノードの文字列と一部一致する文字列を親ノードに登録する場合に、文字列をそのまま親ノードに登録する代わりに、一致する文字列の長さと、残りの文字列を親ノードに登録していた。しかし、本願発明は、これに限定されるものではない。例えば、親ノードの文字列と一部一致する文字列を子ノードに登録する場合に、文字列をそのまま子ノードに登録する代わりに、一致する文字列の長さと、残りの文字列を子ノードに登録してもよい。   In the second embodiment, as an example, when a character string that partially matches the character string of the child node is registered in the parent node, the length of the matching character string is used instead of registering the character string in the parent node as it is. The remaining character string was registered in the parent node. However, the present invention is not limited to this. For example, when registering a character string that partially matches the character string of the parent node to the child node, instead of registering the character string directly to the child node, the length of the matching character string and the remaining character string are set to the child node. You may register with.

ところで、本実施例において説明した各処理のうち、自動的におこなわれるものとして説明した処理の全部または一部を手動的におこなうこともでき、あるいは、手動的におこなわれるものとして説明した処理の全部または一部を公知の方法で自動的におこなうこともできる。この他、上記文書中や図面中で示した処理手順、制御手順、具体的名称、各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。   By the way, among the processes described in the present embodiment, all or part of the processes described as being automatically performed can be manually performed, or the processes described as being manually performed can be performed. All or a part can be automatically performed by a known method. In addition, the processing procedure, control procedure, specific name, and information including various data and parameters shown in the above-described document and drawings can be arbitrarily changed unless otherwise specified.

また、図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各装置の分散・統合の具体的形態は図示のものに限られず、その全部または一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的または物理的に分散・統合して構成することができる。さらに、各装置にて行なわれる各処理機能は、その全部または任意の一部が、CPUおよび当該CPUにて解析実行されるプログラムにて実現され、あるいは、ワイヤードロジックによるハードウェアとして実現され得る。   Further, each component of each illustrated apparatus is functionally conceptual, and does not necessarily need to be physically configured as illustrated. In other words, the specific form of distribution / integration of each device is not limited to that shown in the figure, and all or a part thereof may be functionally or physically distributed or arbitrarily distributed in arbitrary units according to various loads or usage conditions. Can be integrated and configured. Further, all or any part of each processing function performed in each device may be realized by a CPU and a program analyzed and executed by the CPU, or may be realized as hardware by wired logic.

図89は、実施例2に示した検索装置200(あるいは、実施例1にかかる検索装置100)に対応するコンピュータのハードウェア構成を示す図である。図89に示すように、このコンピュータ(検索装置)10は、入力装置11、モニタ12、RAM(Random Access Memory)13、ROM(Read Only Memory)14、ネットワークを介して他の装置とデータ通信を実行する通信制御装置15、媒体読取装置16、CPU(Central Processing Unit)17、HDD(Hard Disk Drive)18をバス19で接続している。   FIG. 89 is a diagram illustrating a hardware configuration of a computer corresponding to the search device 200 illustrated in the second embodiment (or the search device 100 according to the first embodiment). As shown in FIG. 89, the computer (search device) 10 performs data communication with other devices via an input device 11, a monitor 12, a RAM (Random Access Memory) 13, a ROM (Read Only Memory) 14, and a network. A communication control device 15, a medium reading device 16, a CPU (Central Processing Unit) 17, and an HDD (Hard Disk Drive) 18 are connected by a bus 19.

そして、HDD18には、上述した検索装置200の機能と同様の機能を発揮するトライ木生成プログラム18b、トライ木探索プログラム18cが記憶されている。CPU17が、トライ木生成プログラム18b、トライ木探索プログラム18cを読み出して実行することにより、トライ木生成プロセス17a、トライ木探索プロセス17bが起動される。   The HDD 18 stores a trie tree generation program 18b and a trie tree search program 18c that exhibit functions similar to the functions of the search device 200 described above. When the CPU 17 reads and executes the trie tree generation program 18b and the trie tree search program 18c, the trie tree generation process 17a and the trie tree search process 17b are activated.

ここで、トライ木生成プロセス17aは、図56に示したトライ木生成部250aに対応する。また、トライ木探索プロセス17bは、図56に示したトライ木探索部250bに対応する。   Here, the trie tree generation process 17a corresponds to the trie tree generation unit 250a illustrated in FIG. The trie tree search process 17b corresponds to the trie tree search unit 250b shown in FIG.

なお、HDD18は、図56で示した記憶部240に記憶されたデータに対応する各種データ18aを記憶している。CPU17は、HDD18に記憶された各種データ18aをRAM13に読み出し、各種データ13aを利用して、トライ木の構築等を実行する。   The HDD 18 stores various data 18a corresponding to the data stored in the storage unit 240 shown in FIG. The CPU 17 reads various data 18a stored in the HDD 18 into the RAM 13, and executes construction of a trie tree using the various data 13a.

以上の各実施例を含む実施形態に関し、さらに以下の付記を開示する。   The following supplementary notes are further disclosed with respect to the embodiments including the above examples.

(付記1)コンピュータに、
所定の文字に対応するノードが木構造にて接続されるトライ木を記憶装置に記憶し、当該トライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木に含まれるノードを当該ノードに対応する文字に応じて辿り、単一のノードに対して単一の文字列が登録されるように、辿ったノードの何れかに新規の文字列を登録する場合に、登録対象のノードの子ノードに登録された文字列と新規の文字列とを比較して一致する文字を判定し、新規の文字列から一致する文字を除いた残りの文字列と一致文字数を、登録対象のノードに登録する文字列登録機能
を実現させるためのプログラムを格納した記憶媒体。
(Supplementary note 1)
When a trie tree in which nodes corresponding to a predetermined character are connected in a tree structure is stored in the storage device and a new character string is registered in the trie tree, the characters of the new character string are read in order from the top. The node included in the trie tree is traced according to the character corresponding to the node, and a new character string is added to any of the traced nodes so that a single character string is registered for the single node. When registering, the character string registered in the child node of the registration target node is compared with the new character string to determine the matching character, and the remaining characters excluding the matching character from the new character string A storage medium that stores a program that implements a character string registration function that registers the number of characters that match a character string in a node to be registered.

(付記2)前記文字列登録機能は、各ノードに登録される各文字列に対して所定も文字順序に基づく優先度を設定し、当該優先度に基づいて各ノードに各文字列を登録することを特徴とする付記1に記載の記憶媒体。 (Supplementary Note 2) The character string registration function sets a priority based on a predetermined character order for each character string registered in each node, and registers each character string in each node based on the priority. The storage medium according to appendix 1, wherein

(付記3)前記文字列登録機能は、ノードに登録された文字列の優先度と、新規の文字列の優先度とを比較して、登録されたノードの文字列の優先度よりも新規の文字列の優先度の方が小さい場合に、登録された文字列と新規の文字列で一致する文字数を判定する判定機能と、前記ノードの親ノードに遷移し、前記判定機能で判定した一致する文字数と、前記親ノードに登録された一致文字数とを基にして、新規のノードを前記親ノードに登録するか否かを判定する登録機能を更に実現させるためのプログラムを格納した付記1または2に記載の記憶媒体。 (Supplementary note 3) The character string registration function compares the priority of the character string registered in the node with the priority of the new character string, and is newer than the priority of the character string of the registered node. When the priority of the character string is lower, the determination function that determines the number of characters that match between the registered character string and the new character string, and the matching that is determined by the determination function by transitioning to the parent node of the node Appendix 1 or 2 storing a program for further realizing a registration function for determining whether or not to register a new node in the parent node based on the number of characters and the number of matching characters registered in the parent node The storage medium described in 1.

(付記4)検索文字列を検索する場合に、ノードに登録された文字列と、該検索文字列とを比較して、各文字列が一致しない場合に、登録された文字列と該検索文字列で一致する文字数を判定する検索判定機能と、前記ノードの親ノードに遷移し、前記検索判定機能で判定した一致する文字数に応じて、該検索文字列と前記親ノードの文字列の一部を除いた後に、各文字列が一致するか否かを判定する一致判定機能を更に実現させるためのプログラムを格納した記憶媒体。 (Supplementary Note 4) When searching for a search character string, the character string registered in the node is compared with the search character string, and if the character strings do not match, the registered character string and the search character string A search determination function that determines the number of characters that match in the column, and a transition to the parent node of the node, and according to the number of matching characters determined by the search determination function, the search character string and a part of the character string of the parent node A storage medium storing a program for further realizing a coincidence determination function for determining whether or not each character string matches after removing.

(付記5)検索装置が、
所定の文字に対応するノードが木構造にて接続されるトライ木を記憶装置に記憶するステップと、
前記記憶装置に記憶されたトライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木に含まれるノードを当該ノードに対応する文字に応じて辿り、単一のノードに対して単一の文字列が登録されるように、辿ったノードの何れかに新規の文字列を登録する場合に、登録対象のノードの子ノードに登録された文字列と新規の文字列とを比較して一致する文字を判定し、新規の文字列から一致する文字を除いた残りの文字列と一致文字数を、登録対象のノードに登録するステップと
を含んだことを特徴とするトライ木生成方法。
(Supplementary Note 5) The search device is
Storing a trie tree in which nodes corresponding to predetermined characters are connected in a tree structure in a storage device;
When registering a new character string in the trie tree stored in the storage device, the characters of the new character string are read in order from the top, and the node included in the trie tree is determined according to the character corresponding to the node. If a new character string is registered in any of the traced nodes so that a single character string is registered for a single node, the characters registered in the child nodes of the registered node And comparing the new character string with the new character string to determine the matching character, and registering the remaining character string excluding the matching character from the new character string and the number of matching characters in the node to be registered. A trie tree generation method characterized by that.

(付記6)所定の文字に対応するノードが木構造にて接続されるトライ木を記憶装置に記憶し、当該トライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木に含まれるノードを当該ノードに対応する文字に応じて辿り、単一のノードに対して単一の文字列が登録されるように、辿ったノードの何れかに新規の文字列を登録する場合に、登録対象のノードの子ノードに登録された文字列と新規の文字列とを比較して一致する文字を判定し、新規の文字列から一致する文字を除いた残りの文字列と一致文字数を、登録対象のノードに登録する文字列登録手段
を有することを特徴とするトライ木生成装置。
(Supplementary note 6) When a trie tree in which nodes corresponding to a predetermined character are connected in a tree structure is stored in a storage device and a new character string is registered in the trie tree, the character of the new character string is Read from the top in order and follow the node included in the trie tree according to the character corresponding to the node, so that a single character string is registered for a single node. When registering a new character string, the character string registered in the child node of the node to be registered is compared with the new character string to determine a matching character, and the matching character is excluded from the new character string. A trie tree generating device, comprising: a character string registration unit that registers the number of matching characters with the remaining character string in a node to be registered.

10 コンピュータ
11 入力装置
12 モニタ
13 RAM
13a,18a 各種データ
14 ROM
15 通信制御装置
16 媒体読取装置
17 CPU
17a トライ木生成プロセス
17b トライ木探索プロセス
18b トライ木生成プログラム
18c トライ木探索プログラム
19 バス
100,200 検索装置
110,210 入力部
120,220 出力部
130,230 入出力制御部
140,240 記憶部
140a,240a 登録データ管理テーブル
140b,240b トライ木
150,250 制御部
150a,250a トライ木生成部
150b,250b トライ木探索部
10 Computer 11 Input Device 12 Monitor 13 RAM
13a, 18a Various data 14 ROM
15 Communication Control Device 16 Medium Reading Device 17 CPU
17a Trie tree generation process 17b Trie tree search process 18b Trie tree generation program 18c Trie tree search program 19 Bus 100, 200 Search unit 110, 210 Input unit 120, 220 Output unit 130, 230 Input / output control unit 140, 240 Storage unit 140a , 240a registered data management tables 140b, 240b trie trees 150, 250 control units 150a, 250a trie tree generation units 150b, 250b trie tree search units

Claims (5)

コンピュータに、
ノードに対応付けられる文字列のうち、子ノードに登録された文字列と一致する一致文字数と、ノードに対応付けられた文字列から子ノードに対応付けられた文字列を取り除いた残りの文字列とを登録したノードが木構造にて接続されるトライ木を記憶装置に記憶し、当該トライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木に含まれるノードを当該ノードに対応する文字に応じて辿り、単一のノードに対して単一の文字列が登録されるように、辿ったノードの何れかに新規の文字列を登録する場合に、先頭文字から登録対象のノードに登録された一致文字数だけ比較する文字をスキップした新規の文字列と、登録対象のノードの子ノードに登録された文字列とを比較して一致する文字を判定し、新規の文字列から一致する文字を除いた残りの文字列と一致文字数を、登録対象のノードに登録する文字列登録機能
を実現させるためのプログラムを格納した記憶媒体。
On the computer,
Of the character strings associated with the node, the number of matching characters that match the character string registered with the child node, and the remaining character string obtained by removing the character string associated with the child node from the character string associated with the node storing trie tree node that registered the door is connected by a tree structure in the storage device, to register a new string in the prefix tree, the said new string characters from the beginning are read sequentially Follow a node included in the trie tree according to the character corresponding to the node, and register a new character string in one of the traced nodes so that a single character string is registered for a single node. If a new character string skipped from the first character compared to the number of matching characters registered in the registration target node is compared with the character string registered in the child node of the registration target node character Determined, a new remaining string as matched characters excluding the character that matches the character string, storage medium storing a program for realizing the character string registration function of registering a node to be registered.
前記文字列登録機能は、各ノードに登録される各文字列に対して所定の文字順序に基づく優先度を設定し、当該優先度に基づいて各ノードに各文字列を登録することを特徴とする請求項1に記載の記憶媒体。   The character string registration function sets a priority based on a predetermined character order for each character string registered in each node, and registers each character string in each node based on the priority. The storage medium according to claim 1. 前記文字列登録機能は、ノードに登録された文字列の優先度と、新規の文字列の優先度とを比較して、登録されたノードの文字列の優先度よりも新規の文字列の優先度の方が小さい場合に、登録された文字列と新規の文字列で一致する文字数を判定する判定機能と、前記ノードの親ノードに遷移し、前記判定機能で判定した一致する文字数と、前記親ノードに登録された一致文字数とを基にして、新規の文字列を前記親ノードに登録するか否かを判定する登録機能を更に実現させるためのプログラムを格納した請求項1または2に記載の記憶媒体。 The character string registration function compares the priority of the character string registered in the node with the priority of the new character string, and prioritizes the new character string over the priority of the character string of the registered node. When the degree is smaller, a determination function that determines the number of characters that match a registered character string and a new character string, a transition to the parent node of the node, and the number of matching characters determined by the determination function, 3. A program for further realizing a registration function for determining whether to register a new character string in the parent node based on the number of matching characters registered in the parent node is stored. Storage media. 検索文字列を検索する場合に、ノードに登録された文字列と、該検索文字列とを比較して、各文字列が一致しない場合に、登録された文字列と該検索文字列で一致する文字数を判定する検索判定機能と、前記ノードの親ノードに遷移し、前記検索判定機能で判定した一致する文字数に応じて、該検索文字列と前記親ノードの文字列の一部を除いた後に、各文字列が一致するか否かを判定する一致判定機能を更に実現させるためのプログラムを格納した請求項1、2または3に記載の記憶媒体。 When searching for a search character string, the character string registered in the node is compared with the search character string. If the character strings do not match, the registered character string matches the search character string. A search determination function for determining the number of characters, and after transitioning to the parent node of the node, and excluding a part of the character string of the search character string and the parent node according to the number of matching characters determined by the search determination function The storage medium according to claim 1, 2 or 3, wherein a program for further realizing a match determination function for determining whether or not each character string matches is stored. 検索装置が、
ノードに対応付けられる文字列のうち、子ノードに登録された文字列と一致する一致文字数と、ノードに対応付けられた文字列から子ノードに対応付けられた文字列を取り除いた残りの文字列とを登録したノードが木構造にて接続されるトライ木を記憶装置に記憶するステップと、
前記記憶装置に記憶されたトライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木に含まれるノードを当該ノードに対応する文字に応じて辿り、単一のノードに対して単一の文字列が登録されるように、辿ったノードの何れかに新規の文字列を登録する場合に、先頭文字から登録対象のノードに登録された一致文字数だけ比較する文字をスキップした新規の文字列と、登録対象のノードの子ノードに登録された文字列とを比較して一致する文字を判定し、新規の文字列から一致する文字を除いた残りの文字列と一致文字数を、登録対象のノードに登録するステップと
を含んだことを特徴とするトライ木生成方法。
The search device
Of the character strings associated with the node, the number of matching characters that match the character string registered with the child node, and the remaining character string obtained by removing the character string associated with the child node from the character string associated with the node Storing in a storage device a trie tree in which nodes that are registered in a tree structure are connected;
When registering a new character string in the trie tree stored in the storage device, the characters of the new character string are read in order from the top, and the node included in the trie tree is determined according to the character corresponding to the node. If a new character string is registered in any of the traced nodes so that a single character string is registered for a single node, the match registered in the registration target node from the first character A new character string that is skipped by the number of characters to be compared is compared with a character string that is registered in the child node of the registration target node to determine a matching character, and the matching character is excluded from the new character string. A trie tree generation method comprising: registering a remaining character string and the number of matching characters in a registration target node.
JP2009080245A 2009-03-27 2009-03-27 Storage medium and trie tree generation method Active JP5387092B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009080245A JP5387092B2 (en) 2009-03-27 2009-03-27 Storage medium and trie tree generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009080245A JP5387092B2 (en) 2009-03-27 2009-03-27 Storage medium and trie tree generation method

Publications (2)

Publication Number Publication Date
JP2010231643A JP2010231643A (en) 2010-10-14
JP5387092B2 true JP5387092B2 (en) 2014-01-15

Family

ID=43047372

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009080245A Active JP5387092B2 (en) 2009-03-27 2009-03-27 Storage medium and trie tree generation method

Country Status (1)

Country Link
JP (1) JP5387092B2 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5202986A (en) * 1989-09-28 1993-04-13 Bull Hn Information Systems Inc. Prefix search tree partial key branching
JP3570323B2 (en) * 1999-05-11 2004-09-29 日本電気株式会社 How to store prefixes for addresses
JP2000339332A (en) * 1999-05-28 2000-12-08 Nippon Telegr & Teleph Corp <Ntt> Medium recording retrieval index, method and device for updating retrieval index and medium recording its program
JP4726310B2 (en) * 2001-03-01 2011-07-20 ソフトバンクテレコム株式会社 Information retrieval apparatus, information retrieval multiprocessor and router
US20070094313A1 (en) * 2005-10-24 2007-04-26 Igor Bolotin Architecture and method for efficient bulk loading of a PATRICIA trie

Also Published As

Publication number Publication date
JP2010231643A (en) 2010-10-14

Similar Documents

Publication Publication Date Title
JP5278534B2 (en) Storage medium
US8208408B2 (en) Tree-based node insertion method and memory device
CN102841852B (en) Wear leveling method, storing device and information system
CN103455432B (en) It is used for managing the method for a memory and its relevant memory
KR20210057835A (en) Compressed Key-Value Store Tree Data Block Leak
JP6262874B2 (en) Database implementation method
CN113196260A (en) Key value storage tree capable of selectively using key portions
WO2015096698A1 (en) Data writing and reading methods for flash
CN107291858B (en) Data indexing method based on character string suffix
TWI329804B (en)
JP2008181260A5 (en)
JP2009015530A5 (en)
CN101908102B (en) Precasting method and device for stalk-based RNA (Ribonucleic Acid) secondary structure
CN101158955A (en) A Construction Method of Chinese Thesaurus
CN110955713A (en) Mnemonic word generating method and device and storage medium
CA2936485C (en) Optimized data condenser and method
JP5387092B2 (en) Storage medium and trie tree generation method
CN105138528B (en) Method and device for storing and reading multi-value data and access system thereof
JP2014093612A (en) Coding device and method of controlling the same
CN101452459B (en) System and method for finding similar translation results using index
JP5493431B2 (en) Storage medium, trie tree generation method, and trie tree generation apparatus
CN115630100A (en) Mixed processing method and device for unit and multivariate time sequence data and computer equipment
JP6524668B2 (en) Document retrieval apparatus, document retrieval method, program,
CN102968467A (en) Optimization method and query method for multiple layers of Bloom Filters
CN114254591A (en) Construction method and device of simplified and traditional conversion tool

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20111205

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130702

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130822

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: 20130910

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130923

R150 Certificate of patent or registration of utility model

Ref document number: 5387092

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150