JP2010238195A - Storage medium, trie generation method, and trie generating device - Google Patents

Storage medium, trie generation method, and trie generating device Download PDF

Info

Publication number
JP2010238195A
JP2010238195A JP2009088385A JP2009088385A JP2010238195A JP 2010238195 A JP2010238195 A JP 2010238195A JP 2009088385 A JP2009088385 A JP 2009088385A JP 2009088385 A JP2009088385 A JP 2009088385A JP 2010238195 A JP2010238195 A JP 2010238195A
Authority
JP
Japan
Prior art keywords
node
trie tree
key
aaa
input key
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.)
Granted
Application number
JP2009088385A
Other languages
Japanese (ja)
Other versions
JP5493431B2 (en
Inventor
Shinichiro Tako
真一郎 多湖
Tatsuya Asai
達哉 浅井
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 JP2009088385A priority Critical patent/JP5493431B2/en
Publication of JP2010238195A publication Critical patent/JP2010238195A/en
Application granted granted Critical
Publication of JP5493431B2 publication Critical patent/JP5493431B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a storage medium that reduces the memory consumption of a trie. <P>SOLUTION: In a retrieving device 200, a trie generating part 250a connects a fixed-length character string to a node as a tag key, creates a new root node under the fixed-length character string (under a node having the fixed-length character string), and generates a hierarchical trie. Consequently, when the retrieving device 200 reconfigures the trie, a tag key to be connected to the node and a tag key to be updated are executed only within a corresponding hierarchy. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

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

文書検索システムにおいて、キーから所望の文書、値等を高速に検索するべく、トライ木が用いられている(例えば、特許文献1、2参照)。図109は、従来のトライ木の一例を示す図である。このトライ木は、ルートノードを除くノードに対して、1文字当たり1ノードを割当てることにより、木構造を構築している。また、図109に示すトライ木は、キー「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 (for example, see Patent Documents 1 and 2). FIG. 109 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. The trie tree shown in FIG. 109 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 designated, the search device traces the nodes of the trie tree in the order of b, l, u, and e, thereby detecting “4” assigned to “blue”. .

ところで、図109に示したトライ木では、トライ木を構築するキーが長い場合に、ノード数が増えてしまい、使用メモリ量が増大してしまうという問題があった。また、キーが長い場合に、検索処理時に比較するノード数が増えてしまい、検索処理等が完了するまでの時間が長くなってしまうという問題が発生する。   By the way, in the trie tree shown in FIG. 109, when the key for constructing the trie tree is long, there is a problem that the number of nodes increases and the amount of used memory increases. 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参照)。図110は、パトリシア木の一例を示す図である。このパトリシア木は、ノードから他のノードへ遷移するエッジ部を、文字ではなく文字列で表現することで、使用メモリ量を削減している。なお、図110に示すパトリシア木は、キー「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. 110 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. 110 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 tree “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, a trie tree generation method, and a trie tree generation apparatus that can reduce the memory usage. And

上述した課題を解決し、目的を達成するため、この記憶媒体は、所定の文字数を含む文字列に対応するノードが木構造にて接続されるトライ木を記憶装置に記憶し、当該トライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木の各ノードを辿り、辿ったノードに対応する文字列と一致する文字列を新規の文字列から除いた後、ノードに新規の根ノードを接続し、接続した根ノードに新規のノードを追加すると共に、新規の文字列のうち、所定の文字数を含む文字列を新規のノードに登録する文字列登録機能を実現させるためのプログラムを格納することを要件とする。   In order to solve the above-described problems and achieve the object, this storage medium stores a trie tree in which nodes corresponding to a character string including a predetermined number of characters are connected in a tree structure in a storage device, and stores the trie tree in the trie tree. When registering a new character string, the characters of the new character string are read in order from the beginning, followed by each node of the trie tree, and a character string that matches the character string corresponding to the traced node is a new character string After removing from, connect a new root node to the node, add a new node to the connected root node, and register a new character string containing a specified number of characters in the new node It is a requirement to store a program for realizing the column registration function.

この記憶媒体が記憶するプログラムを実行することで、コンピュータは、メモリ使用効率を向上させることが出来る。   By executing the program stored in the storage medium, the computer can improve the memory use efficiency.

図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は、図12に示したトライ木を実データで表した場合のデータ構造の一例を示す図である。FIG. 13-2 is a diagram illustrating an example of a data structure when the trie tree illustrated in FIG. 12 is represented by real data. 図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にかかるトライ木を生成する処理を説明するための図(11)である。FIG. 70 is a diagram (11) for explaining the process of generating the trie tree according to the second embodiment. 図71は、本実施例2にかかるトライ木を生成する処理を説明するための図(12)である。FIG. 71 is a diagram (12) illustrating the process of generating the trie tree according to the second embodiment. 図72は、本実施例2にかかるトライ木を生成する処理を説明するための図(13)である。FIG. 72 is a diagram (13) illustrating the process of generating the trie tree according to the second embodiment. 図73は、本実施例2にかかるトライ木を生成する処理を説明するための図(14)である。FIG. 73 is a diagram (14) illustrating the process of generating the trie tree according to the second embodiment. 図74は、本実施例2にかかるトライ木を生成する処理を説明するための図(15)である。FIG. 74 is a diagram (15) illustrating the process of generating the trie tree according to the second embodiment. 図75は、本実施例2にかかるトライ木を生成する処理を説明するための図(16)である。FIG. 75 is a diagram (16) illustrating the process of generating the trie according to the second embodiment. 図76は、本実施例2にかかるトライ木を生成する処理を説明するための図(17)である。FIG. 76 is a diagram (17) illustrating the process of generating the trie tree according to the second embodiment. 図77は、本実施例2にかかる集計値を抽出する処理を説明するための図(1)である。FIG. 77 is a diagram (1) illustrating the process of extracting the aggregate value according to the second embodiment. 図78は、本実施例2にかかる集計値を抽出する処理を説明するための図(2)である。FIG. 78 is a diagram (2) for explaining the process of extracting the aggregate value according to the second embodiment. 図79は、本実施例2にかかる集計値を抽出する処理を説明するための図(3)である。FIG. 79 is a diagram (3) for explaining the process of extracting the total value according to the second embodiment. 図80は、本実施例2にかかる集計値を抽出する処理を説明するための図(4)である。FIG. 80 is a diagram (4) illustrating the process of extracting the aggregate value according to the second embodiment. 図81は、本実施例2にかかる集計値を抽出する処理を説明するための図(5)である。FIG. 81 is a diagram (5) for explaining the process of extracting the aggregate value according to the second embodiment. 図82は、本実施例2にかかる集計値を抽出する処理を説明するための図(6)である。FIG. 82 is a diagram (6) for explaining the process of extracting the aggregate value according to the second embodiment. 図83は、本実施例2にかかる集計値を抽出する処理を説明するための図(7)である。FIG. 83 is a diagram (7) for explaining the process of extracting the total value according to the second embodiment. 図84は、本実施例2にかかる集計値を抽出する処理を説明するための図(8)である。FIG. 84 is a diagram (8) for explaining the process of extracting the aggregate value according to the second embodiment. 図85は、本実施例2にかかる集計値を抽出する処理を説明するための図(9)である。FIG. 85 is a diagram (9) for explaining the process of extracting the aggregate value according to the second embodiment. 図86は、本実施例2にかかる集計値を抽出する処理を説明するための図(10)である。FIG. 86 is a diagram (10) for explaining the process of extracting the aggregate value according to the second embodiment. 図87は、本実施例2にかかる集計値を抽出する処理を説明するための図(11)である。FIG. 87 is a diagram (11) for explaining the process of extracting the total value according to the second embodiment. 図88は、本実施例2にかかる集計値を抽出する処理を説明するための図(12)である。FIG. 88 is a diagram (12) for explaining the process of extracting the aggregate value according to the second embodiment. 図89は、本実施例2にかかる集計値を抽出する処理を説明するための図(13)である。FIG. 89 is a diagram (13) for explaining the process of extracting the total value according to the second embodiment. 図90は、本実施例2にかかる検索処理を説明するための図(1)である。FIG. 90 is a diagram (1) for explaining the search processing according to the second embodiment. 図91は、本実施例2にかかる検索処理を説明するための図(2)である。FIG. 91 is a diagram (2) for explaining the search process according to the second embodiment. 図92は、本実施例2にかかる検索処理を説明するための図(3)である。FIG. 92 is a diagram (3) for explaining the search processing according to the second embodiment. 図93は、本実施例2にかかる検索処理を説明するための図(4)である。FIG. 93 is a diagram (4) for explaining the search processing according to the second embodiment. 図94は、本実施例2にかかる検索処理を説明するための図(5)である。FIG. 94 is a diagram (5) for explaining the search processing according to the second embodiment. 図95は、本実施例2にかかる検索処理を説明するための図(6)である。FIG. 95 is a diagram (6) illustrating the search process according to the second embodiment. 図96は、本実施例2にかかる検索処理を説明するための図(7)である。FIG. 96 is a diagram (7) for explaining the search processing according to the second embodiment. 図97は、本実施例2にかかる検索処理を説明するための図(8)である。FIG. 97 is a schematic diagram (8) illustrating the search process according to the second embodiment. 図98は、本実施例2にかかる検索処理を説明するための図(9)である。FIG. 98 is a diagram (9) for explaining the search processing according to the second embodiment. 図99は、本実施例2にかかるトライ木生成処理の処理手順を示すフローチャートである。FIG. 99 is a flowchart of the process procedure of the trie tree generation process according to the second embodiment. 図100は、本実施例2にかかるデータ追加処理の処理手順を示すフローチャート(1)である。FIG. 100 is a flowchart (1) illustrating the processing procedure of the data addition processing according to the second embodiment. 図101は、本実施例2にかかるデータ追加処理の処理手順を示すフローチャート(2)である。FIG. 101 is a flowchart (2) illustrating the processing procedure of the data addition processing according to the second embodiment. 図102は、本実施例2にかかるデータ追加処理の処理手順を示すフローチャート(3)である。FIG. 102 is a flowchart (3) of the data addition process according to the second embodiment. 図103は、本実施例2にかかる検索処理の処理手順を示すフローチャート(1)である。FIG. 103 is a flowchart (1) illustrating the processing procedure of the search processing according to the second embodiment. 図104は、本実施例2にかかる検索処理の処理手順を示すフローチャート(2)である。FIG. 104 is a flowchart (2) illustrating the processing procedure of the search processing according to the second embodiment. 図105は、本実施例2にかかる出力処理の処理手順を示すフローチャートである。FIG. 105 is a flowchart of a process procedure of the output process according to the second embodiment. 図106は、本実施例2にかかる削除処理の処理手順を示すフローチャート(1)である。FIG. 106 is a flowchart (1) illustrating the processing procedure of the deletion processing according to the second embodiment. 図107は、本実施例2にかかる削除処理の処理手順を示すフローチャート(2)である。FIG. 107 is a flowchart (2) illustrating the processing procedure of the deletion processing according to the second embodiment. 図108は、実施例に示した検索装置に対応するコンピュータのハードウェア構成を示す図である。FIG. 108 is a diagram illustrating a hardware configuration of a computer corresponding to the search device illustrated in the embodiment. 図109は、従来のトライ木の一例を示す図である。FIG. 109 is a diagram illustrating an example of a conventional trie tree. 図110は、パトリシア木の一例を示す図である。FIG. 110 is a diagram illustrating an example of a Patricia tree.

以下に、本願の開示する記憶媒体、トライ木生成方法およびトライ木生成装置の実施例を図面に基づいて詳細に説明する。なお、この実施例によりこの発明が限定されるものではない。   Hereinafter, embodiments of a storage medium, a trie tree generation method, and a trie tree generation device 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つのキーを割当てる。以下の説明において、ノードに割当てられたキーをタグキーと表記する。図1において、ノード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. 1, 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、Bに示したトライ木、パトリシア木と異なり、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 tree and the Patricia tree shown in FIGS. 90 and B, 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 nodes directly connected to the same parent node, a key with a low priority is arranged on the brother node side, and a key with a high priority is arranged on the brother node side. To do. 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 is following 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」を登録すればよい。この場合には、図4の右側に示すように、ノード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. 4, a key “blue” and a value “4” are assigned to the node u, a node e is created under the node u, and “blueviolet” 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 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 12 corresponds to the node l in FIG. . 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 the 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 trie tree generation unit 150a generates a new node t using the second character “t” of the input key “http://aaa.aaa/e/c” as a key, and proceeds to FIG. The key pointer is advanced to “t” as 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.” To the node t created in step S15a by removing the “ht” of the trie part from the input key “http://aaa.aaa/e/c”. "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)。   Then, the trie tree generation unit 150a does not have a child node with “t” as a key in the node t, so the priority of the tag key “tp: //aaa.aaa/e/c” of the node t and the trie Compare the priority of the input key “tp: //aaa.aaa/d/” with the part “ht” removed. 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/" is registered. 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は、現在のノードのポインタをポインタ配列31に接続し、テキスト表14の3行目4文字目の文字「t」に入力キーのポインタを接続する。また、ポインタ配列22の「TAG」に接続された文字を先頭とする文字列と、入力キーのポインタに接続された文字を先頭とする文字列とを順次比較すると、タグキーの15文字目が「e」であり、入力キーの15文字目が「d」であるため、タグキーの優先度の方が、入力キーの優先度よりも大きくなる(ステップS18b)。   On the actual data, the trie tree generation unit 150a connects the pointer of the current node to the pointer array 31, 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 column and the 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」を取り除いた残りのキー「ttp://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 “ttp: //aaa.aaa/e/” obtained by removing the trie part “ht” from the input key “http://aaa.aaa/e/” as the 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”, 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 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」をタグキー「tp://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 searching unit 150b uses the trie part “htt” as the tag key “tp”. 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に遷移し、入力キーのポインタを戻った分だけ戻す。子kでは、ノード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. Since the child k has returned from the node t (parent) 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に現在のノードのポインタを移動させる(ステップS42b)。   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 S42b).

図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 search unit 150b determines the priority of the tag key “ttp: //aaa.aaa/d” of the node h and the priority of the input key “ttp: //aaa.aaa/d” obtained by removing the trie part “h”. Compare degrees. 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 tries the head of the tag key “ttp: //aaa.aaa/d” connected to the node h. The key “http://aaa.aaa/d” with the part “h” 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 uses 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 priority of the removed input key “tp: //aaa.aaa/d”. 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. Since 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” at the time of transition to the node c, 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に対応するポインタ配列に接続されたスタックを削除する。全てのスタックが無くなり、入力キー「ac」と一致するタグキーが存在しないので、トライ木探索部150bは、一致データが存在しない旨を出力する(ステップS53b)。   On the actual data, the trie tree search unit 150b deletes the stack connected to the pointer array corresponding to the node c because the tag key priority is higher than the input key priority. 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 elder brother node (node b (2)), the trie tree search unit 150b 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 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は、本実施例1にかかるトライ木生成処理の処理手順を示すフローチャートである。   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 first 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は、次の入力データが登録データ管理テーブルに登録されている場合には(ステップS103,Yes)、未読の入力データを読み出し(ステップS104)、データ追加処理を実行する(ステップS105)。   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 process ends. On the other hand, if the next input data is registered in the registered data management table (Yes at Step S103), the trie tree generation unit 150a reads the unread input data (Step S104) and executes data addition processing. (Step S105).

次に、図42のステップS105に示したデータ追加処理の処理手順について説明する。ここでは、二分探索法を用いないでデータ追加処理を実行する場合と、二分探索法を用いてデータ追加処理を実行する場合に分けて説明する。   Next, the processing 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)、スタックが空であるか否かを判定し(ステップS190)、スタックが空の場合には(ステップS191,No)、スタックの真ん中のデータを現在のノードとし、入力キーのポインタを移動した分だけ、ずらす(ステップS192)。   By the way, if there is no child node in step S184 (step S184, No), the trie tree generation unit 150a determines whether or not the stack is empty (step S190), and if the stack is empty. (Step S191, No), the data in the middle of the stack is set as the current node, and the input key pointer is moved 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 in step S197), the trie tree generating unit 150a deletes the first half of the stack including the middle stack (step S198), and FIG. 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)、ステップS306に移行する。   When the input key is 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 (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は、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS309)。トライ木探索部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 S309). 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(子)、ノードp、ノード:、ノード/が順に接続されている。   First, problems 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 the upper part of FIG. 54, a node h, a node t (parent), a node t (child), a node p, a node :, and a node / are sequentially connected to the root node.

また、図54の上段に示すトライ木は、優先度の小さいタグキーから順に、各ノードに登録されている。ノードhはタグキー「ttp://aaa.aaa/e/」を有し、ノードt(親)はタグキー「tp://aaa.aaa/e/c/」を有し、ノードt(子)はタグキー「p://aaa.aaa/g/」を有する。ノードpはタグキー「://aaa.aaa/h/」を有し、ノード:はタグキー「//aaa.aaa/k/」を有し、ノード/はタグキー「/aaa.aaa/m/」を有する。   Also, the trie tree shown in the upper part of FIG. 54 is registered in each node in order from the tag key with the lowest priority. 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/”. Node p has a tag key “: //aaa.aaa/h/”, node: has a tag key “//aaa.aaa/k/”, and node / has a tag key “/aaa.aaa/m/”. Have

図54に示すように、各ノードに登録するタグキーの内、先頭文字列が一致しているタグキーが多いと、トライ木が深くなってしまい、トライ木に新しいキーを登録してトライ木を再構築する場合の処理が多くなってしまうという問題がある。   As shown in FIG. 54, if there are many tag keys with the same initial character string among the tag keys registered in each node, the trie tree becomes deep, and a new key is registered in the trie tree and the trie tree is re-registered. There is a problem that the number of processes when building is increased.

図54の下段は、図54の上段に示したトライ木に、キー「http://aaa.aaa/b/」を登録した場合のトライ木を示す。ここで、入力キー「http://aaa.aaa/b/」からトライ部分「h」を削除したキー「ttp://aaa.aaa/b/」の優先度は、ノードhのタグキー「ttp://aaa.aaa/e/」の優先度よりも小さい。   The lower part of FIG. 54 shows a trie tree when the key “http://aaa.aaa/b/” is registered in the trie tree shown in the upper part of FIG. Here, the priority of the key “ttp: //aaa.aaa/b/” obtained by deleting the trial part “h” from the input key “http://aaa.aaa/b/” is the tag key “ttp” of the node h. It is smaller than the priority of “: //aaa.aaa/e/”.

したがって、検索装置100は、ノードhにキー「ttp://aaa.aaa/b/」をタグキーとして登録し、ノードhに登録されていたキー「(ht)tp://aaa.aaa/e/」を子ノードのノードt(親)のタグキーとして登録する。同様に、ノードt(親)〜ノード/に登録されていたタグキーも、子ノードに順次登録する。   Therefore, the search device 100 registers the key “ttp: //aaa.aaa/b/” as a tag key in the node h, and the key “(ht) tp: //aaa.aaa/e registered in the node h”. / "Is registered as a tag key of the node t (parent) of the child node. Similarly, tag keys registered in nodes t (parent) to node / are sequentially registered in child nodes.

この場合、ノードhに新たなキーを登録したので、ノードh〜ノード/に登録されていたタグキーを更新すると共に、ノードh〜ノード/に登録されていたタグキーを子ノードに再接続する必要があるため、検索装置100が実行すべき処理が多くなり、迅速にトライ木の再構築処理を実行することが出来ないという課題が存在する。   In this case, since a new key is registered in node h, it is necessary to update the tag key registered in node h to node / and to reconnect the tag key registered in node h to node / to the child node. For this reason, there is a problem that the search apparatus 100 needs to execute many processes, and the trie tree reconstruction process cannot be executed quickly.

次に、本実施例2にかかる検索装置の概要について説明する。図55は、本実施例2にかかる検索装置の概要を説明するための図である。本実施例2にかかる検索装置は、実施例1の検索装置100の課題を解消するべく、入力キーの文字列を固定長で分割し、階層的なトライ木を構築する。   Next, an outline of the search device according to the second embodiment will be described. FIG. 55 is a diagram for explaining the outline of the search device according to the second embodiment. The search apparatus according to the second embodiment divides the character string of the input key into a fixed length to solve the problem of the search apparatus 100 according to the first embodiment, and constructs a hierarchical trie tree.

図55の上段に示すように、本実施例2にかかるトライ木は、各階層にルートノードが存在し、ルートノードに接続されるノードには、6文字毎にタグキーを接続している。ルートノードaは、ノードh、ノードtを順に接続し、ノードhはタグキー「ttp://」を有し、ノードtはタグキー「tps:/」を有する。   As shown in the upper part of FIG. 55, in the trie tree according to the second embodiment, a root node exists in each layer, and a tag key is connected to each node connected to the root node every six characters. The root node a connects the node h and the node t in order, the node h has a tag key “ttp: //”, and the node t has a tag key “tps: /”.

タグキー「ttp://」はルートノードbに接続し、ルートノードbはノードaに接続する。ノードaは、タグキー「a.aaa/」に接続する。タグキー「tps:/」はルートノードcに接続し、ルートノードcはノード/に接続する。ノード/(1)は、タグキー「b.b」に接続する。   The tag key “ttp: //” is connected to the root node b, and the root node b is connected to the node a. The node a is connected to the tag key “a.aaa/”. The tag key “tps: /” is connected to the root node c, and the root node c is connected to the node /. Node / (1) connects to tag key “b.b”.

タグキー「a.aaa/」はルートノードdに接続し、ルートノードdは、ノードe、ノードg、ノードh、ノードk、ノードmに接続する。ノードeはタグキー「/」を登録し、ノード/(2)に接続する。ノード/(2)はタグキー「c/」を登録し、ノードgはタグキー「/」を登録する。ノードhはタグキー「/」を登録し、ノードkはタグキー「/」を登録し、ノードmはタグキー「/」を登録する。   The tag key “a.aaa/” is connected to the root node d, and the root node d is connected to the node e, the node g, the node h, the node k, and the node m. Node e registers tag key “/” and connects to node / (2). Node / (2) registers tag key “c /”, and node g registers tag key “/”. The node h registers the tag key “/”, the node k registers the tag key “/”, and the node m registers the tag key “/”.

図55に示すように、入力キーの文字列を固定長で分割し、階層的なトライ木を構築すると、新規のキーを登録してトライ木の再構築を実行する場合に、再接続するタグキーの数、更新するタグキーの数を大幅に削減することが出来る。   As shown in FIG. 55, when a character string of an input key is divided at a fixed length and a hierarchical trie tree is constructed, a tag key to be reconnected when a new key is registered and a trie tree is reconstructed. And the number of tag keys to be updated can be greatly reduced.

図55の下段は、図55の上段に示したトライ木に、キー「http://aaa.aaa/b/」を登録した場合のトライ木を示す。本実施例2にかかる検索装置は、入力キー「http://aaa.aaa/b/」を1文字ずつ読み出し、トライ木を辿ると、ルートノードa、ノードh、タグキー「ttp://」、ルートノードb、ノードa、タグキー「a.aaa/」、ルートノードdの順に遷移する。   The lower part of FIG. 55 shows a trie tree when the key “http://aaa.aaa/b/” is registered in the trie tree shown in the upper part of FIG. The search apparatus according to the second embodiment reads out the input key “http://aaa.aaa/b/” character by character and traces the trie tree to find the root node a, the node h, and the tag key “ttp: //”. , Root node b, node a, tag key “a.aaa/”, and root node d.

検索装置は、ルートノードdにおいて、遷移先となるノード「b」が存在しないので、ノードbを新規に作成し、入力キーからトライ部分「http://aaa.aaa/b」を除いた残りのキー「/」をノードbに接続する。この際、タグキーの再接続、更新処理は、ルートノードdの存在する階層のみで実行すればよく、ルートノードa、b、cの存在する階層において、タグキーの再接続、更新処理を実行する必要はない。   Since there is no transition destination node “b” in the root node d, the search device creates a new node b, and removes the trie part “http://aaa.aaa/b” from the input key. The key “/” is connected to the node b. At this time, the tag key reconnection and update processes need only be executed in the hierarchy where the root node d exists, and the tag key reconnection and update processes need to be executed in the hierarchy where the root nodes a, b and c exist. There is no.

このように、本実施例2にかかる検索装置は、固定長の文字列をタグキーとしてノードに接続し、固定長の文字列の配下(固定長の文字列を有するノードの配下)に新たにルートノードを作成して、トライ木を各階層に区切っている。したがって、トライ木の再構築を実行する場合には、ノードに接続するタグキーおよび更新するタグキーを該当する階層内のみで実行すればよいので、再接続するタグキーの数、更新するタグキーの数を大幅に削減することが出来る。   As described above, the search device according to the second embodiment connects a fixed-length character string to a node as a tag key, and newly routes a fixed-length character string (subordinate to a node having a fixed-length character string). A node is created to divide the trie tree into each hierarchy. Therefore, when rebuilding a trie tree, the tag key to be connected to the node and the tag key to be updated need only be executed within the corresponding hierarchy, so the number of tag keys to be reconnected and the number of tag keys to be updated are greatly increased. Can be reduced.

次に、本実施例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 illustrated 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による各種処理に必要なデータおよびプログラムを記憶する記憶部である。この記憶部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. The storage unit 240 includes a registered 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 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に対応したトライ木を示す。   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.

図58に示すように、ルートノードaがノードdを接続し、ノードdがルートノードbを接続し、ルートノードbがノードb、ノードcを接続する。ノードdはタグキー「ark」を有し、ノードbはタグキー「lue」と値「2」を有する。ノードcはタグキー「yan」と値「1、3」を有する。   As shown in FIG. 58, the root node a connects the node d, the node d connects the root node b, and the root node b connects the nodes b and c. Node d has a tag key “ark” and node b has a tag key “lue” and a value “2”. The node c has a tag key “yan” and a value “1, 3”.

図58に示したトライ木を実データで表すと図59に示すデータ構造となる。図59は、図58に示したトライ木を実データで表した場合のデータ構造の一例を示す図である。図59に示すように、このトライ木240bは、ポインタ配列30〜34、テキスト表35を有している。   If the trie tree 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, this trie tree 240b has pointer arrays 30 to 34 and a text table 35.

テキスト表35は、登録データ管理テーブル240aに登録された各キーを記憶するテーブルである。検索装置200は、各キーをテキスト表35に記憶する場合に、各キーの間に空欄を設ける。また、検索装置200は、各キーにおいて、所定の文字列毎にカンマを登録する。図59に示す例では、4文字毎にカンマを設けている。   The text table 35 is a table for storing each key registered in the registered data management table 240a. When storing each key in the text table 35, the search device 200 provides a blank between the keys. In addition, the search device 200 registers a comma for each predetermined character string in each key. In the example shown in FIG. 59, a comma is provided for every four characters.

ルートノードポインタに接続するポインタ配列30は、図58のルートノードaに対応し、ポインタ配列31は図58のノードdに対応する。ポインタ配列32は図58のルートノードbに対応し、ポインタ配列33は図58のノードbに対応し、ポインタ配列34は図58のノードcに対応する。   The pointer array 30 connected to the root node pointer corresponds to the root node a in FIG. 58, and the pointer array 31 corresponds to the node d in FIG. The pointer array 32 corresponds to the root node b in FIG. 58, the pointer array 33 corresponds to the node b in FIG. 58, and the pointer array 34 corresponds to the node c in FIG.

ポインタ配列30〜34は、「Next」領域、「TAG」領域、「Data」領域を有している。「Next」領域は、1つ下の階層に位置するルートノードと接続するポインタである。例えば、ポインタ配列31の「Next」は、1つ下の階層に位置するルートノードbのポインタ配列32に接続している。   The pointer arrays 30 to 34 have a “Next” area, a “TAG” area, and a “Data” area. The “Next” area is a pointer connected to the root node located in the next lower hierarchy. For example, “Next” in the pointer array 31 is connected to the pointer array 32 of the root node b located in the next lower layer.

「TAG」は、テキスト表35の文字と対応付けることで、ノードに接続されたタグキーを表現する。例えば、ポインタ配列31は、テキスト表35の1行目1列目の「a」に接続しているので、「e」から次のカンマ(または空欄)までの文字列「ark」をタグキーとして指定している。また、「Data」は、値と対応付けることで、ノードに接続された値を表現する。例えば、ポインタ配列33は、値「2」に接続されている。   “TAG” represents a tag key connected to a node by associating with a character in the text table 35. For example, since the pointer array 31 is connected to “a” in the first row and first column of the text table 35, the character string “ark” from “e” to the next comma (or blank) is designated as the tag key. is doing. “Data” expresses a value connected to a node by associating it with a value. For example, the pointer array 33 is connected to the value “2”.

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

図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は、トライ木240aを生成する場合に、固定長の文字列をタグキーとしてノードに接続し、固定長の文字列を有するノードの配下に新たなルートノードを作成することで、トライ木を各階層に区切る。   The trie tree generation unit 250a is a processing unit that generates the trie tree 240b based on the key registered in the registration data management table 240a. When generating the trie tree 240a, the trie tree generation unit 250a connects a fixed-length character string to a node as a tag key, and creates a new root node under the node having the fixed-length character string. The trie tree is divided into layers.

また、トライ木生成部250aは、実施例1と同様にして、新規のノードをトライ木に追加する場合に、新規の文字列の文字を先頭から順に読み出して、トライ木240bのノードを辿り、辿ったノードのうち、兄ノードを有するノードの中で最下層に位置する特定ノードを特定する。トライ木生成部250aは、兄ノードが存在しない場合に、最下層のルートノードに接続された子ノードを特定ノードとする。   Similarly to the first embodiment, when adding a new node to the trie tree, the trie tree generation unit 250a reads the characters of the new character string in order from the top, and traces the node of the trie tree 240b. Among the traced nodes, the specific node located at the lowest layer among the nodes having brother nodes is specified. When there is no older brother node, the trie tree generation unit 250a sets a child node connected to the root node of the lowest layer as a specific node.

トライ木生成部250aは、特定ノードから、新規の文字列の文字を順に読み出すことで最終的に到達するノードまでの経路に含まれるノードの何れか、または、葉ノードの配下に新規のノードを追加して、新規の文字列をノードに登録する。   The trie tree generation unit 250a reads a new node under a subordinate of a leaf node or any of the nodes included in the route from the specific node to the node that finally arrives by sequentially reading the characters of the new character string. Add and register a new string to the node.

図60〜図76は、本実施例2にかかるトライ木を生成する処理を説明するための図である。ここでは説明の便宜上、キー「http://aaa.aaa/e/」、値「1」と、キー「http://aaa.aaa/」、値「2」と、キー「http://aaa.aaa/c/」、値「3」の順で、トライ木を生成する場合について説明する。   FIGS. 60 to 76 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/”, the value “2”, and the key “http: // A case where a trie tree is generated in the order of “aaa.aaa/c/” and a value “3” will be described.

図60に示すように、まず、ノードが存在しない状態で、キー「http://aaa.aaa/e/」、値「2」を追加する場合について説明する。トライ木生成部250aは、ルートノードaを生成する(ステップS70a)。   As shown in FIG. 60, first, a case where the key “http://aaa.aaa/e/” and the value “2” are added in a state where no node exists will be described. The trie tree generation unit 250a generates a root node a (step S70a).

実データ上において、トライ木生成部250aは、ルートノードaに対応するポインタ配列40を生成し、ルートノードポインタとポインタ配列40を接続する。また、ポインタ配列40は、ルートノードaに対応するので、「TAG」を空に接続する(ステップS70b)。   On the actual data, the trie tree generation unit 250a generates a pointer array 40 corresponding to the root node a, and connects the root node pointer and the pointer array 40. Also, since the pointer array 40 corresponds to the root node a, “TAG” is connected to the empty (step S70b).

トライ木生成部250aは、入力キー「http://aaa.aaa/e/」を用意し、ポインタを入力キーの1文字目の「h」に設定する。(ステップS71a)。実データ上において、トライ木生成部250aは、テキスト表35に入力キー「http://aaa.aaa/e/」を格納し、n(nは自然数)文字毎にカンマで文字列を区切る。ここでは、一例として、7文字毎にカンマで文字列を区切るものとする。トライ木生成部250aは、入力キーのポインタを、テキスト表35の1行目1列目の「h」に接続する(ステップS71b)。   The trie tree generation unit 250a prepares the input key “http://aaa.aaa/e/” and sets the pointer to “h” of the first character of the input key. (Step S71a). On the actual data, the trie tree generation unit 250a stores the input key “http://aaa.aaa/e/” in the text table 35, and divides the character string with a comma for each n (n is a natural number) characters. Here, as an example, it is assumed that the character string is separated by a comma every 7 characters. The trie tree generation unit 250a connects the pointer of the input key to “h” in the first row and first column of the text table 35 (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は、ルートノードaの配下に「h」をキーとするノードを作成する。トライ木生成部250aは、入力キー「http://aaa.aaa/e/」の現在のポインタの文字「h」から6文字目までの文字列「http://」を抽出し、抽出した文字列から「h」を除いた残りのキー「ttp://」をタグキーとして、ノードhに接続する(ステップS72a)。   The trie tree generation unit 250a creates a node with “h” as a key under the root node a. The trie tree generation unit 250a extracts and extracts the character string “http: //” from the character “h” of the current pointer of the input key “http://aaa.aaa/e/” to the sixth character. The remaining key “ttp: //” obtained by removing “h” from the character string is used as a tag key to connect to the node h (step S72a).

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

続いて、図61に移行する。トライ木生成部250aは、次の階層の入力キーがあり、次の階層へのリンクがないので、新規のルートノードbを生成し、ノードh(タグキー「ttp://」)の配下に接続する。トライ木生成部250aは、入力キーにおいて、現在のポインタを、現在の文字「h」から7文字目(カンマを除く)の「a」に設定する。   Subsequently, the flow proceeds to FIG. Since the trie tree generation unit 250a has an input key of the next layer and does not have a link to the next layer, the trie tree generation unit 250a generates a new root node b and connects it under the node h (tag key “ttp: //”). To do. The trie tree generation unit 250a sets the current pointer to “a” of the seventh character (excluding the comma) from the current character “h” in the input key.

トライ木生成部250aは、ルートノードbの配下に「a」をキーとするノードaを生成する。トライ木生成部250aは、入力キー「http://aaa.aaa/e/」の現在のポインタの文字「a」から6文字目までの文字列「aaa.aaa」を抽出し、抽出した文字列から「a」を除いた残りのキー「aa.aaa」をタグキーとして、ノードaに接続する(ステップS73a)。   The trie tree generation unit 250a generates a node a having “a” as a key under the root node b. The trie tree generation unit 250a extracts the character string “aaa.aaa” from the character “a” of the current pointer of the input key “http://aaa.aaa/e/” to the sixth character, and the extracted characters The remaining key “aa.aaa” obtained by removing “a” from the column is used as a tag key to connect to the node a (step S73a).

実データ上において、トライ木生成部250aは、新規のルートノードbに対応するポインタ配列42を生成し、ポインタ配列41の「Next」で、ポインタ配列41とポインタ配列42を接続する。トライ木生成部250aは、入力キーのポインタを1行目9列目の「a」に接続する。   On the actual data, the trie tree generation unit 250a generates a pointer array 42 corresponding to the new root node b, and connects the pointer array 41 and the pointer array 42 by “Next” of the pointer array 41. The trie tree generation unit 250a connects the pointer of the input key to “a” in the first row and the ninth column.

トライ木生成部250aは、ノードaに対応するポインタ配列43を生成し、ポインタ配列42のキー番号「0×61」で、ポインタ配列42とポインタ配列43を接続する。トライ木生成部250aは、ポインタ配列43の「TAG」をテキスト表35の1行目10列目に接続する(ステップS73b)。   The trie tree generation unit 250 a generates a pointer array 43 corresponding to the node a, and connects the pointer array 42 and the pointer array 43 with the key number “0 × 61” of the pointer array 42. The trie tree generation unit 250a connects “TAG” in the pointer array 43 to the first row and the tenth column of the text table 35 (step S73b).

続いて、図62に移行する。トライ木生成部250aは、次の階層の入力キーがあり、次の階層へのリンクがないので、新規のルートノードcを生成し、ノードa(タグキー「aa.aaa」)の配下に接続する。トライ木生成部250aは、入力キーにおいて、現在のポインタを、現在の文字「a」から7文字目(カンマを除く)の「/」に設定する。   Subsequently, the flow proceeds to FIG. Since the trie tree generation unit 250a has an input key of the next layer and does not have a link to the next layer, the trie tree generation unit 250a generates a new root node c and connects it to the node a (tag key “aa.aaa”). . The trie tree generation unit 250a sets the current pointer to “/” of the seventh character (excluding the comma) from the current character “a” in the input key.

トライ木生成部250aは、ルートノードcの配下に「/」をキーとするノード/を生成する。トライ木生成部250aは、入力キー「http://aaa.aaa/e/」の現在のポインタの文字「/」から最後までの文字列「/e/」を抽出し、抽出した文字列から「/」を除いた残りのキー「e/」をタグキーとして、ノード/に接続する。トライ木生成部250aは、入力キーのポインタを「e」に設定する(ステップS74a)。   The trie tree generation unit 250a generates a node / having “/” as a key under the root node c. The trie tree generation unit 250a extracts the character string “/ e /” from the character “/” to the end of the current pointer of the input key “http://aaa.aaa/e/”, and extracts the character string “/ e /” from the extracted character string. The remaining key “e /” excluding “/” is connected to the node “/” using the tag key. The trie tree generation unit 250a sets the pointer of the input key to “e” (step S74a).

実データ上において、トライ木生成部250aは、新規のルートノードcに対応するポインタ配列44を生成し、ポインタ配列43の「Next」で、ポインタ配列43とポインタ配列44を接続する。   On the actual data, the trie tree generation unit 250 a generates a pointer array 44 corresponding to the new root node c, and connects the pointer array 43 and the pointer array 44 by “Next” of the pointer array 43.

トライ木生成部250aは、ノード/に対応するポインタ配列45を生成し、ポインタ配列44のキー番号「0×2f」で、ポインタ配列44とポインタ配列45を接続する。トライ木生成部250aは、ポインタ配列45の「TAG」をテキスト表35の1行目18列目の「e」に接続する(ステップS74b)。   The trie tree generation unit 250 a generates the pointer array 45 corresponding to the node /, and connects the pointer array 44 and the pointer array 45 with the key number “0 × 2f” of the pointer array 44. The trie tree generation unit 250a connects “TAG” in the pointer array 45 to “e” in the first row and 18th column of the text table 35 (step S74b).

続いて、図63の説明に移行する。トライ木生成部250aは、ノード/にタグキー「e/」を接続した時点で、入力キー「http://aaa.aaa/e/」に含まれる文字列の登録が完了する。トライ木生成部250aは、入力キーに対応する値「1」をノード/に接続する(ステップS75a)。実データ上において、トライ木生成部250aは、ポインタ配列45の「Data」に値「1」を登録する(ステップS75b)。   Subsequently, the description proceeds to FIG. The trie tree generation unit 250a completes registration of the character string included in the input key “http://aaa.aaa/e/” when the tag key “e /” is connected to the node “/”. The trie tree generation unit 250a connects the value “1” corresponding to the input key to the node / (step S75a). On the actual data, the trie tree generation unit 250a registers the value “1” in “Data” of the pointer array 45 (step S75b).

続いて、図64に移行し、ステップS75a、75bにおいて作成したトライ木に、キー「http://aaa.aaa/g/」、値「2」を追加する場合について説明する。トライ木生成部250aは、入力キー「http://aaa.aaa/g/」のポインタを先頭文字の「h」に設定し、ルートノードaからノードhへ遷移する。   Subsequently, the case where the key “http://aaa.aaa/g/” and the value “2” are added to the trie tree created in steps S75a and 75b will be described with reference to FIG. The trie tree generation unit 250a sets the pointer of the input key “http://aaa.aaa/g/” to the first character “h”, and transitions from the root node a to the node h.

トライ木生成部250aは、入力キーのポインタを1文字進め、2文字目の「t」に設定する。トライ木生成部250aは、「t」をキーとする子ノードがノードhに存在しないので、ノードhを参照する(ステップS76a)。   The trie tree generation unit 250a advances the pointer of the input key by one character and sets it to “t” of the second character. Since the child node having “t” as a key does not exist in the node h, the trie tree generation unit 250a refers to the node h (step S76a).

実データ上において、トライ木生成部250aは、テキスト表35に最後に登録されたキー「http://aaa.aaa/e/」との間を1つ空けて、キー「http://aaa.aaa/g/」を格納し、7文字毎にカンマで文字列を区切る。トライ木生成部250aは、現在のノードをポインタ配列41に接続し、入力キーのポインタをテキスト表35の2行目1文字目の「t」に接続する(ステップS76b)。   On the actual data, the trie tree generating unit 250a leaves one key “http://aaa.aaa/e/” registered last in the text table 35, and the key “http: // aaa”. .aaa / g / "is stored, and the character string is separated by a comma every 7 characters. The trie tree generation unit 250a connects the current node to the pointer array 41, and connects the pointer of the input key to “t” in the second line and the first character of the text table 35 (step S76b).

続いて、図65に移行する。トライ木生成部250aは、ノードhのタグキー「ttp://」と、入力キーの現在のポインタの文字「t」から5文字目「/」までの文字列「ttp://」を比較する。各キーが一致するので、トライ木生成部250aは、現在のノードをルートノードcに遷移させる(次の階層に遷移する)。トライ木生成部250aは、入力キーの現在のポインタを、8文字目(カンマを除く)の「a」に設定する(ステップS77a)。   Subsequently, the flow proceeds to FIG. The trie tree generation unit 250a compares the tag key “ttp: //” of the node h with the character string “ttp: //” from the character “t” of the current pointer of the input key to the fifth character “/”. . Since the keys match, the trie tree generation unit 250a changes the current node to the root node c (changes to the next hierarchy). The trie tree generation unit 250a sets the current pointer of the input key to “a” of the eighth character (excluding the comma) (step S77a).

実データ上において、トライ木生成部250aは、ポインタ配列41の「TAG」に接続された「t」から次のカンマまでの文字列「ttp://」と、入力キーのポインタに接続された「t」からカンマまでの文字列「ttp://」を比較する。各キーが一致するので、トライ木生成部250aは、現在のノードをポインタ配列42に接続し、入力キーのポインタをテキスト表35の2行目8列目の「a」に接続する(ステップS77b)。   On the actual data, the trie tree generation unit 250a is connected to the character string “ttp: //” from “t” connected to “TAG” of the pointer array 41 to the next comma and the pointer of the input key. The character string “ttp: //” from “t” to comma is compared. Since the keys match, the trie tree generation unit 250a connects the current node to the pointer array 42, and connects the pointer of the input key to “a” in the second row and eighth column of the text table 35 (step S77b). ).

続いて、図66に移行する。トライ木生成部250aは、ルートノードbからノードaに移行し、入力キーのポインタを9文字目(カンマを除く)の「a」に設定する。トライ木生成部250aは、「a」をキーとする子ノードがノードaに存在しないので、ノードaを参照する。トライ木生成部250aは、ノードaのタグキー「aa.aaa」と、入力キーの現在のポインタの文字「a」から5文字目「a」までの文字列「aa.aaa」比較する(ステップS78a)。   Subsequently, the flow proceeds to FIG. The trie tree generating unit 250a moves from the root node b to the node a, and sets the pointer of the input key to “a” of the ninth character (excluding the comma). The trie tree generation unit 250a refers to the node a because no child node having “a” as a key exists in the node a. The trie tree generation unit 250a compares the tag key “aa.aaa” of the node “a” with the character string “aa.aaa” from the character “a” to the fifth character “a” of the current pointer of the input key (step S78a). ).

実データ上において、トライ木生成部250aは、現在のノードをポインタ配列43に接続する。トライ木生成部250aは、ポインタ配列43の「TAG」に接続された「a」から次のカンマまでの文字列「aa.aaa」と、入力キーのポインタに接続された「a」から次のカンマまでの文字列「aa.aaa」を比較する(ステップS78b)。   On the actual data, the trie tree generation unit 250 a connects the current node to the pointer array 43. The trie tree generation unit 250a performs the next operation from the character string “aa.aaa” from “a” connected to “TAG” in the pointer array 43 to the next comma and “a” connected to the pointer of the input key. The character strings “aa.aaa” up to the comma are compared (step S78b).

続いて、図67に移行する。ステップS78aで比較した結果、各キーが一致し、かつ、次の階層の入力キーがある。トライ木生成部250aは、次の階層の入力キーがあるので、次の階層に遷移し、ルートノードcに遷移する。トライ木生成部250aは、入力キーの現在のポインタを15文字目(カンマを除く)の「/」に設定する(ステップS79a)。   Subsequently, the flow proceeds to FIG. As a result of the comparison in step S78a, the keys match and there is an input key of the next hierarchy. Since there is an input key for the next hierarchy, the trie tree generation unit 250a transitions to the next hierarchy and transitions to the root node c. The trie tree generating unit 250a sets the current pointer of the input key to “/” of the 15th character (excluding the comma) (step S79a).

実データ上において、トライ木生成部250aは、ステップS78bで比較した結果、各キーが一致し、かつ、次の階層の入力キーがあるので、現在のノードをポインタ配列44に接続する。また、トライ木生成部250aは、入力キーのポインタをテキスト表35の2行目16列目の「/」に接続する(ステップS79b)。   On the actual data, the trie tree generation unit 250a connects the current node to the pointer array 44 because the keys match and there is an input key of the next hierarchy as a result of comparison in step S78b. Further, the trie tree generating unit 250a connects the input key pointer to “/” in the second row and the 16th column of the text table 35 (step S79b).

続いて、図68に移行する。トライ木生成部250aは、キー「/」にてルートノードcからノード/に遷移し、入力キーの現在のポインタを1文字ずらした「g」に設定する。トライ木生成部250aは、ノード/において、キー「g」を遷移先とする子ノードが存在しないので、ノード/を参照する。トライ木生成部250aは、ノード/のタグキー「e/」と、入力キーの現在のポインタの文字「g」から最後までの文字列「g/」を比較する(ステップS80a)。   Subsequently, the flow proceeds to FIG. The trie tree generation unit 250a transits from the root node c to the node / with the key “/”, and sets the current pointer of the input key to “g” shifted by one character. The trie tree generation unit 250a refers to the node / because there is no child node having the key “g” as the transition destination in the node /. The trie tree generation unit 250a compares the tag key “e /” of the node / with the character string “g /” from the character “g” to the end of the current pointer of the input key (step S80a).

実データ上において、トライ木生成部250aは、現在のノードをポインタ配列45に接続する。トライ木生成部250aは、ポインタ配列45の「TAG」に接続された「e」から次の空まので文字列「e/」と、入力キーのポインタに接続された「g」から次の空までの文字列「g/」を比較する(ステップS80b)。   On the actual data, the trie tree generation unit 250 a connects the current node to the pointer array 45. The trie tree generation unit 250a uses the character string “e /” from “e” connected to “TAG” in the pointer array 45 to the next empty character and the next empty character from “g” connected to the pointer of the input key. The character strings “g /” up to are compared (step S80b).

続いて、図69に移行する。トライ木生成部250aは、ステップS80aで比較した結果、タグキーの優先度が入力キーの優先度よりも小さいと判定する。したがって、トライ木生成部250aは、入力キーのポインタに指定された文字「g」をキーとするノードgを生成し、ノード/に接続する。   Subsequently, the flow proceeds to FIG. As a result of the comparison in step S80a, the trie tree generation unit 250a determines that the priority of the tag key is lower than the priority of the input key. Therefore, the trie tree generation unit 250a generates a node g using the character “g” designated as the pointer of the input key as a key, and connects to the node /.

トライ木生成部250aは、入力キーのポインタを1文字ずらして「/」に設定し、入力キーのポインタで指定する文字以降の文字「/」をノードgにタグキーとして接続する。また、トライ木生成部250aは、入力キーに対応する値「2」をノードgに接続する(ステップS81a)。   The trie tree generation unit 250a shifts the input key pointer by one character and sets it to “/”, and connects the character “/” following the character specified by the input key pointer to the node g as a tag key. Further, the trie tree generation unit 250a connects the value “2” corresponding to the input key to the node g (step S81a).

実データ上において、トライ木生成部250aは、ステップS80aで比較した結果、タグキーの優先度が入力キーの優先度よりも小さいと判定する。したがって、トライ木生成部250aは、ノードgに対応するポインタ配列46を生成する。トライ木生成部250aは、ポインタ配列45のキー番号「0×67」で、ポインタ配列45とポインタ配列46を接続する。   On the actual data, the trie tree generation unit 250a determines that the priority of the tag key is lower than the priority of the input key as a result of the comparison in step S80a. Therefore, the trie tree generation unit 250a generates a pointer array 46 corresponding to the node g. The trie tree generation unit 250 a connects the pointer array 45 and the pointer array 46 with the key number “0 × 67” of the pointer array 45.

トライ木生成部250aは、ポインタ配列46の「TAG」をテキスト表35の2行目8列目の「/」に接続する。トライ木生成部250aは、ポインタ配列46の「Data」に入力キーに対応する値「2」を格納する(ステップS81b)。   The trie tree generation unit 250 a connects “TAG” in the pointer array 46 to “/” in the second row and the eighth column of the text table 35. The trie tree generation unit 250a stores the value “2” corresponding to the input key in “Data” of the pointer array 46 (step S81b).

続いて、図70に移行し、ステップS81a、ステップ81bにおいて作成したトライ木に、キー「http://aaa.aaa/c/」、値「3」を追加する場合について説明する。トライ木生成部250aは、入力キー「http://aaa.aaa/c/」のポインタを先頭文字の「h」に設定し、ルートノードaからノードhに遷移する。   Subsequently, the case where the key “http://aaa.aaa/c/” and the value “3” are added to the trie tree created in steps S81a and 81b will be described with reference to FIG. The trie tree generation unit 250a sets the pointer of the input key “http://aaa.aaa/c/” to the first character “h”, and transitions from the root node a to the node h.

トライ木生成部250aは、入力キーのポインタを1文字進めて2文字目の「t」に設定する。トライ木生成部250aは、「t」をキーとする子ノードがノードhに存在しないので、ノードhを参照する。また、トライ木生成部250aは、ノードhのタグキー「ttp://」と、入力キーの現在のポインタの文字「t」から5文字目「/」までの文字列「ttp://」を比較する(ステップS82a)。   The trie tree generation unit 250a advances the input key pointer by one character and sets it to the second character “t”. The trie tree generation unit 250a refers to the node h because no child node having “t” as a key exists in the node h. Further, the trie tree generation unit 250a receives the tag key “ttp: //” of the node h and the character string “ttp: //” from the character “t” to the fifth character “/” of the current pointer of the input key. Compare (step S82a).

実データ上において、トライ木生成部250aは、テキスト表35に最後に登録されたキー「http://aaa.aaa/g/」との間を1つ空けて、キー「http://aaa.aaa/c/」を格納し、7文字毎にカンマで文字列を区切る。トライ木生成部250aは、現在のノードをポインタ配列41に接続し、入力キーのポインタをテキスト表35の2行目11列目の「t」に接続する。   On the actual data, the trie tree generation unit 250a leaves one key “http://aaa.aaa/g/” registered last in the text table 35, and the key “http: // aaa”. .aaa / c / "is stored, and the character string is separated by a comma every 7 characters. The trie tree generation unit 250 a connects the current node to the pointer array 41, and connects the input key pointer to “t” in the second row and the eleventh column of the text table 35.

トライ木生成部250aは、ポインタ配列41の「TAG」に接続された「t」から次のカンマまでの文字列「ttp://」と、入力キーのポインタに接続された文字「t」から5文字目「/」までの文字列「ttp://」を比較する(ステップS82b)。   The trie tree generation unit 250a uses the character string “ttp: //” from “t” connected to “TAG” in the pointer array 41 to the next comma and the character “t” connected to the pointer of the input key. The character strings “ttp: //” up to the fifth character “/” are compared (step S82b).

続いて、図71に移行する。トライ木生成部250aは、ステップS82aで比較した結果、タグキーと入力キーが一致し、かつ、次の階層の入力キーがある。トライ木生成部250aは、次の階層の入力キーがあるので、次の階層に遷移し、ルートノードaに遷移する。トライ木生成部250aは、入力キーの現在のポインタを8文字目(カンマを除く)の「a」に設定する(ステップS83a)。   Subsequently, the flow proceeds to FIG. As a result of the comparison in step S82a, the trie tree generation unit 250a matches the tag key and the input key, and has an input key of the next layer. Since there is an input key for the next hierarchy, the trie tree generation unit 250a transitions to the next hierarchy and transitions to the root node a. The trie tree generation unit 250a sets the current pointer of the input key to “a” of the eighth character (excluding the comma) (step S83a).

実データ上において、トライ木生成部250aは、ステップS82bで比較した結果、各キーが一致し、かつ、次の階層の入力キーがあるので、現在のノードをポインタ配列42に接続する。また、トライ木生成部250aは、入力キーのポインタをテキスト表35の3行目7列目の「a」に接続する(ステップS83b)。   On the actual data, the trie tree generation unit 250a connects the current node to the pointer array 42 because the keys match and there is an input key of the next hierarchy as a result of the comparison in step S82b. Further, the trie tree generation unit 250a connects the pointer of the input key to “a” in the third row and the seventh column of the text table 35 (step S83b).

続いて、図72の説明に移行する。トライ木生成部250aは、ルートノードbからノードaに移行し、入力キーのポインタを9文字目(カンマを除く)の「a」に設定する。トライ木生成部250aは、「a」をキーとする子ノードがノードaに存在しないので、ノードaを参照する。トライ木生成部250aは、ノードaのタグキー「aa.aaa」と、入力キーの現在のポインタの文字「a」から5文字目「a」までの文字列「aa.aaa」比較する(ステップS84a)。   Subsequently, the description shifts to the description of FIG. The trie tree generation unit 250a moves from the root node b to the node a, and sets the pointer of the input key to “a” of the ninth character (excluding the comma). The trie tree generation unit 250a refers to the node a because no child node having “a” as a key exists in the node a. The trie tree generation unit 250a compares the tag key “aa.aaa” of the node a with the character string “aa.aaa” from the character “a” to the fifth character “a” of the current pointer of the input key (step S84a). ).

実データ上において、トライ木生成部250aは、現在のノードをポインタ配列43に接続する。トライ木生成部250aは、ポインタヒア列43の「TAG」に接続された「a」から次のカンマまでの文字列「aa.aaa」と、入力キーのポインタに接続された「a」から次のカンマまでの文字列「aa.aaa」を比較する(ステップS84b)。   On the actual data, the trie tree generation unit 250 a connects the current node to the pointer array 43. The trie tree generation unit 250a proceeds from the character string “aa.aaa” from “a” connected to “TAG” of the pointer track 43 to the next comma and from “a” connected to the pointer of the input key. The character strings “aa.aaa” up to the commas are compared (step S84b).

続いて、図73の説明に移行する。トライ木生成部250aは、ステップS84aで比較した結果、各キーが一致し、かつ、次の階層の入力キーがある。トライ木生成部250aは、次の階層の入力キーがあるので、次の階層に遷移し、ルートノードcに遷移する。トライ木生成部250aは、入力キーの現在のポインタを15文字目(カンマを除く)の「/」に設定する(ステップS85a)。   Subsequently, the description proceeds to FIG. 73. As a result of the comparison in step S84a, the trie tree generation unit 250a matches the keys and has an input key of the next layer. Since there is an input key for the next hierarchy, the trie tree generation unit 250a transitions to the next hierarchy and transitions to the root node c. The trie tree generation unit 250a sets the current pointer of the input key to “/” of the 15th character (excluding the comma) (step S85a).

実データ上において、トライ木生成部250aは、ステップS84で比較した結果、各キーが一致し、かつ、次の階層の入力キーがあるので、現在のノードをポインタ配列44に接続する。また、トライ木生成部250aは、入力キーのポインタをテキスト表35の3行目15列目の「/」に接続する(ステップS85b)。   On the actual data, the trie tree generation unit 250a connects the current node to the pointer array 44 because the keys match and there is an input key of the next hierarchy as a result of the comparison in step S84. In addition, the trie tree generation unit 250a connects the pointer of the input key to “/” in the third row and the fifteenth column of the text table 35 (step S85b).

続いて、図74の説明に移行する。トライ木生成部250aは、キー「/」にてルートノードcからノード/に遷移し、入力キーの現在のポインタを1文字ずらした「c」に設定する。トライ木生成部250aは、ノード/において、キー「c」を遷移先とする子ノードが存在しないので、ノード/を参照する。トライ木生成部250aは、ノード/のタグキー「e/」と、入力キーの現時のポインタの文字「c/」を比較する(ステップS86a)。   Subsequently, the description proceeds to FIG. The trie tree generation unit 250a transitions from the root node c to the node / with the key “/”, and sets the current pointer of the input key to “c” shifted by one character. The trie tree generation unit 250a refers to the node / because there is no child node having the key “c” as the transition destination in the node /. The trie tree generation unit 250a compares the tag key “e /” of the node / with the character “c /” of the current pointer of the input key (step S86a).

実データ上において、トライ木生成部250aは、現在のノードをポインタ配列45に接続する。トライ木生成部250aは、ポインタ配列45の「TAG」に接続された「e」から次の空までの文字列「e/」と、入力キーのポインタに接続された「c」から次の空までの文字列「c/」を比較する(ステップS86b)。   On the actual data, the trie tree generation unit 250 a connects the current node to the pointer array 45. The trie tree generation unit 250a uses the character string “e /” from “e” connected to “TAG” in the pointer array 45 to the next empty and the next empty from “c” connected to the pointer of the input key. The character strings “c /” up to are compared (step S86b).

続いて、図75に移行する。トライ木生成部250aは、ステップS86aで比較した結果、タグキーの優先度が入力キーの優先度よりも大きいと判定する。したがって、トライ木生成部250aは、タグキー「e/」およびタグキーの値「1」と、入力キー「c/」および入力キーの値「3」を交換する。そして、トライ木生成部250aは、入力キーをキー「http://aaa.aaa/e/」とし、入力キーの16文字目(カンマを除く)の「e」にポインタを設定する(ステップS87a)。   Subsequently, the flow proceeds to FIG. The trie tree generation unit 250a determines that the priority of the tag key is higher than the priority of the input key as a result of the comparison in step S86a. Therefore, the trie tree generation unit 250a exchanges the tag key “e /” and the tag key value “1” with the input key “c /” and the input key value “3”. Then, the trie tree generating unit 250a sets the input key as the key “http://aaa.aaa/e/” and sets a pointer to “e” of the 16th character (excluding the comma) of the input key (step S87a). ).

実データ上において、トライ木生成部250aは、ステップS86bで比較した結果、タグキーの優先度が入力キーの優先度よりも大きいと判定する。したがって、トライ木生成部250aは、ポインタ配列45の「TAG」をテキスト表35の3行目16列目の「c」に接続する。トライ木生成部250aは、入力キーのポインタをテキスト表35の1行目18列目の「e」に接続する(ステップS87b)。   On the actual data, the trie tree generation unit 250a determines that the priority of the tag key is higher than the priority of the input key as a result of the comparison in step S86b. Therefore, the trie tree generation unit 250 a connects “TAG” in the pointer array 45 to “c” in the third row and 16th column of the text table 35. The trie tree generation unit 250a connects the pointer of the input key to “e” in the first row and the 18th column of the text table 35 (step S87b).

続いて、図76に移行する。トライ木生成部250aは、ノード/において、キー「e」とする子ノードが存在しないので、新しいノードeを生成し、生成したノードeをノード/に接続する。トライ木生成部250aは、ノードeにタグキー「/」を接続し、入力キーに対応する値「1」を接続する(ステップS88a)。   Subsequently, the flow proceeds to FIG. Since there is no child node with the key “e” in the node /, the trie tree generation unit 250a generates a new node e and connects the generated node e to the node /. The trie tree generation unit 250a connects the tag key “/” to the node e and connects the value “1” corresponding to the input key (step S88a).

実データ上において、トライ木生成部250aは、ノードeに対応するポインタ配列46を生成し、ポインタ配列45のキー番号「0×65」で、ポインタ配列45とポインタ配列46を接続する。トライ木生成部250aは、ポインタ配列46の「TAG」を、テキスト表35の1行目18列目の「e」に接続する(ステップS88b)。   On the actual data, the trie tree generation unit 250 a generates a pointer array 46 corresponding to the node e, and connects the pointer array 45 and the pointer array 46 with the key number “0 × 65” of the pointer array 45. The trie tree generation unit 250a connects “TAG” in the pointer array 46 to “e” in the first row and 18th column of the text table 35 (step S88b).

図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に登録された値の集計値を抽出する処理について説明する。トライ木探索部250bは、トライ木240bを順に辿り、ノードに登録された値を順次出力する。ノードに複数の値が登録されている場合には、トライ木探索部250bは、各値を合計しても良いし、別々に出力しても良い。   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. The trie tree searching unit 250b sequentially follows the trie tree 240b and sequentially outputs values registered in the nodes. When a plurality of values are registered in the node, the trie tree search unit 250b may sum each value or may output them separately.

図77〜図89は、本実施例2にかかる集計値を抽出する処理を説明するための図である。図77に示すトライ木は、図60〜図76の説明において作成したトライ木とする。トライ木探索部250bは、ルートノードaの長男ノードとなるノードhに現在のノードを移行する(ステップS90a)。実データ上において、トライ木探索部250bは、現在のノードをポインタ配列41に接続する(ステップS90b)。   77 to 89 are diagrams for explaining the process of extracting the aggregate value according to the second embodiment. The trie tree shown in FIG. 77 is the trie tree created in the description of FIGS. The trie tree search unit 250b moves the current node to the node h that is the eldest node of the root node a (step S90a). On the actual data, the trie tree search unit 250b connects the current node to the pointer array 41 (step S90b).

図78に移行する。トライ木探索部250bは、次の階層に遷移し、現在のノードをルートノードbに移行する(ステップS91a)。実データ上において、トライ木探索部250aは、現在のノードをポインタ配列42に接続する(ステップS91b)。   Shifting to FIG. The trie tree search unit 250b transitions to the next hierarchy, and transitions the current node to the root node b (step S91a). On the actual data, the trie tree search unit 250a connects the current node to the pointer array 42 (step S91b).

図79に移行する。トライ木探索部250bは、ルートノードbの長男ノードとなるノードaに現在のノードを移行する(ステップS92a)。実データ上において、トライ木探索部250bは、現在のノードをポインタ配列43に接続する(ステップS92b)。   Shifting to FIG. The trie tree search unit 250b moves the current node to the node a that is the eldest node of the root node b (step S92a). On the actual data, the trie tree search unit 250b connects the current node to the pointer array 43 (step S92b).

図80に移行する。トライ木探索部250bは、次の階層に遷移し、現在のノードをルートノードcに移行する(ステップS93a)。実データ上において、トライ木探索部250aは、現在のノードをポインタ配列44に接続する(ステップS93b)。   Turning to FIG. The trie tree search unit 250b transitions to the next hierarchy, and transitions the current node to the root node c (step S93a). On the actual data, the trie tree search unit 250a connects the current node to the pointer array 44 (step S93b).

図81に移行する。トライ木探索部250bは、ルートノードcの長男ノードとなるノード/に現在のノードを移行する。ノードhは値「3」を登録しているので、トライ木探索部250bは、キー「http://aaa.aaa/c/」と、値「3」を対応付けて出力する(ステップS94a)。   Turning to FIG. The trie tree search unit 250b moves the current node to the node / becoming the eldest node of the root node c. Since the node h has registered the value “3”, the trie tree searching unit 250b outputs the key “http://aaa.aaa/c/” and the value “3” in association with each other (step S94a). .

実データ上において、トライ木探索部250aは、現在のノードをポインタ配列45に接続する。ポインタ配列45は「Data」に「3」を格納しているので、トライ木探索部250bは、ポインタ配列45の「TAG」に接続された文字「c」の前後空までの文字列「http://aaa.aaa/c/」と、値「3」を対応付けて出力する(ステップS94b)。   On the actual data, the trie tree search unit 250 a connects the current node to the pointer array 45. Since the pointer array 45 stores “3” in “Data”, the trie tree search unit 250 b performs the character string “http: before and after the character“ c ”connected to“ TAG ”of the pointer array 45. //aaa.aaa/c/ "and the value" 3 "are output in association with each other (step S94b).

図82に移行する。トライ木探索部250bは、ノード/の長男ノードとなるノードeに現在のノードを移行する。ノードeは値「1」を登録しているので、トライ木探索部250bは、キー「http://aaa.aaa/e/」と、値「1」を対応付けて出力する(ステップS95a)。   Turning to FIG. The trie tree search unit 250b moves the current node to the node e that is the eldest node of the node /. Since the node “e” has registered the value “1”, the trie tree searching unit 250b outputs the key “http://aaa.aaa/e/” and the value “1” in association with each other (step S95a). .

実データ上において、トライ木探索部250bは、現在のノードをポインタ配列46に接続する。ポインタ配列46は「Data」に「1」を格納しているので、トライ木探索部250bは、ポインタ配列46の「TAG」に接続された文字「e」の前後空までの文字列「http://aaa.aaa/e/」と、値「1」を対応付けて出力する(ステップS95b)。   On the actual data, the trie tree search unit 250 b connects the current node to the pointer array 46. Since the pointer array 46 stores “1” in “Data”, the trie tree search unit 250 b performs the character string “http: before and after the character“ e ”connected to“ TAG ”of the pointer array 46. //aaa.aaa/e/ ”and the value“ 1 ”are output in association with each other (step S95b).

図83に移行する。トライ木探索部250bは、ノード/の弟ノードとなるノードgに現在のノードを移行する。ノードgは値「2」を登録しているので、トライ木探索部250bは、キー「http://aaa.aaa/g/」と、値「2」を対応付けて出力する(ステップS96a)。   Shifting to FIG. The trie tree search unit 250b moves the current node to the node g that is the brother node of the node /. Since the value “2” is registered in the node g, the trie tree searching unit 250b outputs the key “http://aaa.aaa/g/” and the value “2” in association with each other (step S96a). .

実データ上において、トライ木探索部250bは、現在のノードをポインタ配列47に接続する。ポインタ配列47は「Data」に「2」を格納しているので、トライ木探索部250bは、ポインタ配列47の「TAG」に接続された文字「/」の前後空までの文字列「http://aaa.aaa/g/」と、値「2」を対応付けて出力する(ステップS96b)。   On the actual data, the trie tree search unit 250 b connects the current node to the pointer array 47. Since the pointer array 47 stores “2” in “Data”, the trie tree search unit 250 b performs the character string “http: before and after the character“ / ”connected to“ TAG ”of the pointer array 47. //aaa.aaa/g/ ”and the value“ 2 ”are output in association with each other (step S96b).

図84に移行する。トライ木探索部250bは、ノード/にノードe、ノードg以外の子ノードが存在しないので、ノードgからノード/に現在のノードを移行する(ステップS97a)。実データ上において、トライ木探索部250bは、現在のノードをポインタ配列45に接続する(ステップS97b)。   Turning to FIG. The trie tree search unit 250b moves the current node from the node g to the node / because there is no child node other than the node e and the node g in the node / (step S97a). On the actual data, the trie tree search unit 250b connects the current node to the pointer array 45 (step S97b).

図85に移行する。トライ木探索部250bは、ルートノードcにノード/以外の子ノードが存在しないので、ノード/からルートノードcに現在のノードを移行する(ステップS98a)。実データ上において、トライ木探索部250bは、現在のノードをポインタ配列44に接続する(ステップS98b)。   Shifting to FIG. Since there is no child node other than node / in the root node c, the trie tree search unit 250b moves the current node from the node / to the root node c (step S98a). On the actual data, the trie tree search unit 250b connects the current node to the pointer array 44 (step S98b).

図86に移行する。トライ木探索部250bは、ルートノードcにおいて、前の階層が存在するので、前の階層に戻り、現在のノードをノードaに移行する(ステップS99a)。実データ上において、トライ木探索部250bは、現在のノードをポインタ配列43に接続する(ステップS99b)。   Moving to FIG. Since the previous hierarchy exists in the root node c, the trie tree search unit 250b returns to the previous hierarchy and moves the current node to the node a (step S99a). On the actual data, the trie tree search unit 250b connects the current node to the pointer array 43 (step S99b).

図87に移行する。トライ木探索部250bは、ノードaに子ノード(ルートノードcを除く)と弟ノードが存在しないので、ルートノードbに現在のノードを移行する(ステップS100a)。実データ上において、トライ木探索部250bは、現在のノードをポインタ配列42に接続する(ステップS100b)。   Shifting to FIG. The trie tree search unit 250b moves the current node to the root node b because there are no child nodes (except for the root node c) and younger brother nodes at the node a (step S100a). On the actual data, the trie tree search unit 250b connects the current node to the pointer array 42 (step S100b).

図88に移行する。トライ木探索部250bは、ルートノードbにおいて、前の階層が存在するので、前の階層に戻り、現在のノードをノードhに移行する(ステップS101a)。実データ上において、トライ木探索部250bは、現在のノードをポインタ配列41に接続する(ステップS101b)。   Shifting to FIG. Since the previous hierarchy exists in the root node b, the trie tree search unit 250b returns to the previous hierarchy and moves the current node to the node h (step S101a). On the actual data, the trie tree search unit 250b connects the current node to the pointer array 41 (step S101b).

図89に移行する。トライ木探索部250bは、ノードhに子ノード(ルートノードbを除く)と弟ノードが存在しないので、ルートノードaに現在のノードを移行する。ルートノードaにおいて、前の階層が存在しないので、トライ木探索部250bは、集計値を抽出する処理を終了する(ステップS102a)。実データ上において、トライ木探索部250bは、現在のノードをポインタ配列40に接続する。そして、トライ木探索部250bは、集計値を抽出する処理を終了する(ステップS102b)。   Shifting to FIG. The trie tree search unit 250b shifts the current node to the root node a because there are no child nodes (except for the root node b) and brother nodes in the node h. Since there is no previous hierarchy in the root node a, the trie tree search unit 250b ends the process of extracting the total value (step S102a). On the actual data, the trie tree search unit 250 b connects the current node to the pointer array 40. Then, the trie tree search unit 250b ends the process of extracting the total value (step S102b).

図77〜図89では、ルートノードから順にノードを辿って、ノードに登録された値を出力する場合について説明した。しかし、実施例1に示したように、所定のキーを指定し、指定したキーに基づいて集計値を抽出しても良い。   77 to 89, the case where the nodes are sequentially traced from the root node and the values registered in the nodes are output has been described. 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から検索する処理について説明する。図90〜図98は、本実施例2にかかる検索処理を説明するための図である。図90〜図98に示すトライ木は、図60〜図76の説明において作成したトライ木とする。また、図90〜図98に示す説明では、入力キー「http://aaa.aaa/c/」が指定された場合の検索処理について説明する。   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. 90 to 98 are diagrams for explaining the search processing according to the second embodiment. 90 to 98 is the trie tree created in the description of FIGS. In addition, in the description shown in FIGS. 90 to 98, search processing when the input key “http://aaa.aaa/c/” is designated will be described.

図90において、トライ木探索部250bは、入力キーのポインタを先頭文字「h」に設定し、現在のノードをルートノードaに設定する(ステップS110a)。実データ上において、トライ木探索部250bは、入力キー「http://aaa.aaa/c/」をテキスト表36に格納し、7文字毎にカンマで区切る。トライ木探索部250bは、テキスト表36の1列目の文字「h」に入力キーのポインタを接続する。トライ木探索部250bは、現在のノードをポインタ配列40に接続する(ステップS110b)。   In FIG. 90, the trie tree search unit 250b sets the pointer of the input key to the first character “h”, and sets the current node to the root node a (step S110a). On the actual data, the trie tree search unit 250b stores the input key “http://aaa.aaa/c/” in the text table 36, and separates it with a comma every 7 characters. The trie tree search unit 250 b connects the pointer of the input key to the character “h” in the first column of the text table 36. The trie tree search unit 250b connects the current node to the pointer array 40 (step S110b).

図91に移行する。トライ木探索部250bは、入力キーのポインタの指定する「h」により、ルートノードaからノードhに遷移する。トライ木探索部250bは、入力キーのポインタを2文字目の「t」に設定する(ステップS111a)。   Shifting to FIG. The trie tree search unit 250b transits from the root node a to the node h by “h” designated by the input key pointer. The trie tree search unit 250b sets the pointer of the input key to “t” of the second character (step S111a).

実データ上において、トライ木探索部250bは、現在のノードをポインタ配列41に接続する。トライ木探索部250bは、テキスト表36の2列目の文字「t」に入力キーのポインタを接続する(ステップS111b)。   On the actual data, the trie tree search unit 250 b connects the current node to the pointer array 41. The trie tree search unit 250b connects the pointer of the input key to the character “t” in the second column of the text table 36 (step S111b).

図92に移行する。ノードhにおいて「t」をキーとする子ノードが存在しないので、トライ木探索部250bは、ノードhのタグキー「ttp://」と、入力キーのポインタから5文字目までの文字列「ttp://」を比較する。トライ木探索部250bは、タグキーと文字列が一致すると判定する(ステップS112a)。   Shifting to FIG. Since there is no child node having “t” as a key in the node h, the trie tree search unit 250b performs the tag key “ttp: //” of the node h and the character string “ttp” from the input key pointer to the fifth character. Compare ": //". The trie tree search unit 250b determines that the tag key matches the character string (step S112a).

実データ上において、トライ木探索部250bは、ポインタ配列41の「TAG」に接続された文字「t」から次のカンマまでの文字列「ttp://」と、入力キーのポインタに接続された文字「t」から次のカンマまでの文字列「ttp://」を比較する。トライ木探索部250bは、各文字列が一致すると判定する(ステップS112b)。   On the actual data, the trie tree search unit 250b is connected to the character string “ttp: //” from the character “t” connected to “TAG” in the pointer array 41 to the next comma and the pointer of the input key. The character string “ttp: //” from the character “t” to the next comma is compared. The trie tree search unit 250b determines that the character strings match (step S112b).

図93に移行する。トライ木探索部250bは、次の階層の入力キーと次の階層へのリンクが存在するので、次の階層に遷移し、現在のノードをルートノードbに設定する。トライ木探索部250bは、入力キーを9文字目(カンマを除く)の「a」に設定する(ステップS113a)。   Shifting to FIG. The trie tree search unit 250b transitions to the next layer and sets the current node as the root node b because there is an input key of the next layer and a link to the next layer. The trie tree searching unit 250b sets the input key to “a” of the ninth character (excluding the comma) (step S113a).

実データ上において、トライ木探索部250bは、ポインタ配列41の「Next」に接続されたポインタ配列42に現在のノードのポインタを接続する。また、トライ木探索部250bは、入力キーのポインタをテキスト表36の9列目の「a」に設定する(ステップS113b)。   On the actual data, the trie tree search unit 250 b connects the pointer of the current node to the pointer array 42 connected to “Next” of the pointer array 41. In addition, the trie tree search unit 250b sets the pointer of the input key to “a” in the ninth column of the text table 36 (step S113b).

図94に移行する。トライ木探索部250bは、入力キーのポインタの指定する「a」により、ルートノードbからノードaに現在のノードを設定する。トライ木探索部250bは、入力キーを10文字目(カンマを除く)の「a」に設定する(ステップS114a)。   Shifting to FIG. The trie tree search unit 250b sets the current node from the root node b to the node a by “a” designated by the input key pointer. The trie tree searching unit 250b sets the input key to “a” of the tenth character (excluding the comma) (step S114a).

実データ上において、トライ木探索部250bは、現在のノードをポインタ配列43に接続する。トライ木探索部250bは、入力キーのポインタをテキスト表36の10列目の「a」に設定する(ステップS114b)。   On the actual data, the trie tree search unit 250 b connects the current node to the pointer array 43. The trie tree search unit 250b sets the pointer of the input key to “a” in the tenth column of the text table 36 (step S114b).

図95に移行する。ノードaにおいて「a」をキーとする子ノードが存在しないので、トライ木探索部250bは、ノードaのタグキー「aa.aaa」と、入力キーのポインタから5文字目までの文字列「aa.aaa」を比較する。トライ木探索部250bは、タグキーと文字列が一致すると判定する(ステップS115a)。   Shifting to FIG. Since there is no child node having “a” as a key in the node a, the trie tree search unit 250b performs the tag key “aa.aaa” of the node a and the character string “aa. Compare "aaa". The trie tree search unit 250b determines that the tag key matches the character string (step S115a).

実データ上において、トライ木探索部250bは、ポインタ配列43の「TAG」に接続された文字「a」から次のカンマまでの文字列「aa.aaa」と、入力キーのポインタに接続された文字「a」から次のカンマまでの文字列「aa.aaa」を比較する。トライ木探索部250bは、各文字列が一致すると判定する(ステップS115b)。   On the actual data, the trie tree search unit 250b is connected to the character string “aa.aaa” from the character “a” connected to “TAG” of the pointer array 43 to the next comma and the pointer of the input key. The character string “aa.aaa” from the character “a” to the next comma is compared. The trie tree search unit 250b determines that the character strings match (step S115b).

図96に移行する。トライ木探索部250bは、次の階層の入力キーと次の階層へのリンクが存在するので、次の階層に遷移し、現在ノードをルートノードcに設定する。トライ木探索部250bは、入力キーを17文字目(カンマを除く)の「/」に設定する(ステップS116a)。   Shifting to FIG. The trie tree search unit 250b transitions to the next layer and sets the current node as the root node c because the input key of the next layer and the link to the next layer exist. The trie tree search unit 250b sets the input key to “/” of the 17th character (excluding the comma) (step S116a).

実データ上において、トライ木探索部250bは、ポインタ配列43の「Next」に接続されたポインタ配列44に現在のノードのポインタを接続する。また、トライ木探索部250bは、入力キーのポインタをテキスト表36の17列目の「/」に設定する(ステップS116b)。   On the actual data, the trie tree search unit 250 b connects the pointer of the current node to the pointer array 44 connected to “Next” of the pointer array 43. In addition, the trie tree search unit 250b sets the pointer of the input key to “/” in the 17th column of the text table 36 (step S116b).

図97に移行する。トライ木探索部250bは、入力キーのポインタの指定する「/」により、ルートノードcからノード/に現在のノードを設定する。トライ木探索部250bは、入力キーを18文字目(カンマを除く)の「c」に設定する(ステップS117a)。   Shifting to FIG. The trie tree searching unit 250b sets the current node from the root node c to the node / by “/” designated by the input key pointer. The trie tree searching unit 250b sets the input key to “c” of the 18th character (excluding the comma) (step S117a).

実データ上において、トライ木探索部250bは、現在のノードをポインタ配列45に接続する。トライ木探索部250bは、入力キーのポインタをテキスト表36の18列目の「c」に設定する(ステップS117b)。   On the actual data, the trie tree search unit 250 b connects the current node to the pointer array 45. The trie tree searching unit 250b sets the pointer of the input key to “c” in the 18th column of the text table 36 (step S117b).

図98に移行する。トライ木探索部250bは、ノード/において「c」をキーとする子ノードが存在しないので、トライ木探索部250bは、ノード/のタグキー「c/」と、入力キーのポインタから最後までの文字列「c/」を比較する。トライ木探索部250bは、タグキーと文字列が一致すると判定し、ノード/に登録された値「3」を検索結果として出力する(ステップS118a)。   Shifting to FIG. Since the trie tree search unit 250b does not have a child node with “c” as a key in the node /, the trie tree search unit 250b uses the tag key “c /” of the node / and the characters from the pointer to the end of the input key. Compare column "c /". The trie tree search unit 250b determines that the tag key matches the character string, and outputs the value “3” registered in the node / as a search result (step S118a).

実データ上において、トライ木探索部250bは、ポインタ配列45の「TAG」に接続された文字「c」から次の空までの文字列「c/」と、入力キーのポインタに接続された文字「c」から次の空までの文字列「c/」を比較する。トライ木探索部250bは、各文字列が一致すると判定し、ポインタ配列45の「Data」に格納された値「3」を検索結果として出力する(ステップS118b)。   On the actual data, the trie tree search unit 250b displays the character string “c /” from the character “c” connected to “TAG” in the pointer array 45 to the next empty character and the character connected to the pointer of the input key. The character string “c /” from “c” to the next empty is compared. The trie tree search unit 250b determines that the character strings match, and outputs the value “3” stored in “Data” of the pointer array 45 as a search result (step S118b).

次に、本実施例2にかかる検索装置200の各種の処理手順について説明する。まず、本実施例2にかかる検索装置200がトライ木240bを生成する処理について説明する。図99は、本実施例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. 99 is a flowchart of the process procedure of the trie tree generation process according to the second embodiment.

図99に示すように、トライ木生成部250aは、ルートノードを生成し(ステップS500)、次の入力データ(キー、値)が登録データ管理テーブル240aに存在するか否かを判定する(ステップS501)。   As shown in FIG. 99, 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).

ここで、図99のステップS504に示したデータ追加処理の処理手順について説明する。図100〜図102は、本実施例2にかかるデータ追加処理の処理手順を示すフローチャートである。   Here, the processing procedure of the data addition processing shown in step S504 of FIG. 99 will be described. FIGS. 100 to 102 are flowcharts illustrating the processing procedure of the data addition processing according to the second embodiment.

図100に示すように、トライ木生成部250aは、現在のノードをルートノードに設定し(ステップS510)、入力キーが空であるか否かを判定する(ステップS511)。トライ木生成部250aは、入力キーが空でない場合に(ステップS512,No)、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS513)。   As shown in FIG. 100, 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). If the input key is not empty (step S512, No), 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 S513). .

トライ木生成部250aは、子ノードが存在しない場合に(ステップS514,No)、ステップS516に移行する。一方、トライ木生成部250aは、子ノードが存在する場合に(ステップS514,Yes)、入力キーの先頭の1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードへ遷移し(ステップS515)、ステップS511に移行する。   If there is no child node (No in step S514), the trie tree generation unit 250a proceeds to step S516. On the other hand, if there is a child node (step S514, 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 sets the read character as a key to the child node. (Step S515), the process proceeds to Step S511.

ところで、ステップS512において、入力キーが空の場合には(ステップS512,Yes)、トライ木生成部250aは、ノードの情報を参照する(ステップS516)。トライ木生成部250aは、タグキーの優先度が入力キーの優先度と等しいか否かを判定し(ステップS517)、等しい場合には(ステップS518,Yes)、図101のステップS524に移行する。   By the way, when the input key is empty in step S512 (step S512, Yes), the trie tree generation unit 250a refers to the node information (step S516). The trie tree generation unit 250a determines whether the priority of the tag key is equal to the priority of the input key (step S517). If the priority is equal (Yes in step S518), the process shifts to step S524 in FIG.

トライ木生成部250aは、タグキーの優先度と入力キーの優先度が異なる場合に(ステップS518,No)、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS519)。トライ木生成部250aは、タグキーの優先度が入力キーの優先度よりも大きくない場合に(ステップS520,No)、図102のステップS532に移行する。   When the priority of the tag key is different from the priority of the input key (No in step S518), the trie tree generation unit 250a determines whether the priority of the tag key is higher than the priority of the input key (step S519). ). When the priority of the tag key is not higher than the priority of the input key (No in step S520), the trie tree generation unit 250a proceeds to step S532 in FIG.

一方、トライ木生成部250aは、タグキーの優先度が入力キーの優先度よりも大きい場合に(ステップS520,Yes)、兄ノードが存在する、または、親ノードがルートノードであるか否かを判定する(ステップS521)。   On the other hand, when the priority of the tag key is higher than the priority of the input key (Yes in step S520), the trie tree generation unit 250a determines whether there is an older brother node or whether the parent node is a root node. Determination is made (step S521).

トライ木生成部250aは、兄ノードが存在しない、かつ、親ノードがルートノードではない場合(条件を満たさない場合)に(ステップS522,No)、入力キーのポインタを1文字戻し、親ノードへ遷移し(ステップS523)、ステップS516に遷移する。   When there is no brother node and the parent node is not the root node (when the condition is not satisfied) (step S522, No), the trie tree generation unit 250a returns the input key pointer by one character and returns to the parent node. A transition is made (step S523), and a transition is made to step S516.

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

図101に移行する。トライ木生成部250aは、次の階層の入力キーが存在するか否かを判定する(ステップS524)。トライ木生成部250aは、次の階層の入力キーが存在しない場合に(ステップS525,No)、現在のノードに入力値を追加し(ステップS526)、データ追加処理を終了する。   Shifting to FIG. The trie tree generation unit 250a determines whether there is an input key of the next hierarchy (step S524). When there is no input key of the next hierarchy (step S525, No), the trie tree generation unit 250a adds an input value to the current node (step S526), and ends the data addition process.

一方、トライ木生成部250aは、次の階層の入力キーが存在する場合に(ステップS525,Yes)、次の階層へのリンクが存在するか否かを判定する(ステップS527)。トライ木生成部250aは、次の階層へのリンクが存在する場合に(ステップS528,Yes)、次の階層へ遷移し、入力キーを次の階層の入力キーに設定し(ステップS529)、図100のステップS511に移行する。   On the other hand, when the input key of the next hierarchy exists (Yes in step S525), the trie tree generation unit 250a determines whether there is a link to the next hierarchy (step S527). When there is a link to the next hierarchy (step S528, Yes), the trie tree generation unit 250a transitions to the next hierarchy, sets the input key to the input key of the next hierarchy (step S529), The process proceeds to step S511 of 100.

トライ木生成部250aは、次の階層へのリンクが存在しない場合には(ステップS528,No)、新しいルートノードと新しいノードを生成する(ステップS530)。トライ木生成部250aは、次の階層へのリンクを新しいルートノードにし、現在のノードを新しいノードにし、入力キーを次の階層の入力キーにし(ステップS531)、図102のステップS537に移行する。   When there is no link to the next hierarchy (No at Step S528), the trie tree generation unit 250a generates a new root node and a new node (Step S530). The trie tree generation unit 250a sets the link to the next hierarchy as the new root node, the current node as the new node, the input key as the input key of the next hierarchy (step S531), and proceeds to step S537 in FIG. .

図102に移行する。トライ木生成部250aは、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS532)。トライ木生成部250aは、子ノードが存在する場合に(ステップS533,Yes)、入力キーの先頭1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードに遷移する(ステップS534)。   Shifting to FIG. 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 S532). When there is a child node (step S533, 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 S534).

トライ木生成部250aは、現在のノードのタグキー、値と入力キー、入力値をそれぞれ交換し(ステップS535)、ステップS532に移行する。   The trie tree generation unit 250a exchanges the tag key, value, input key, and input value of the current node, respectively (step S535), and proceeds to step S532.

ところで、ステップS533において、子ノードが存在しない場合に(ステップS533,No)、トライ木生成部250aは、新しいノードを生成する(ステップS536)。トライ木生成部250aは、入力キーの先頭1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして、現在のノードから新しいノードへ接続する(ステップS537)。   By the way, when there is no child node in step S533 (step S533, No), the trie tree generation unit 250a generates a new node (step S536). 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 connects the current node to the new node using the read character as a key (step S537).

トライ木生成部250aは、入力キーをタグキーとして新しいノードに追加し(ステップS538)、図101のステップS524に移行する。   The trie tree generation unit 250a adds the input key as a tag key to the new node (step S538), and proceeds to step S524 in FIG.

次に、本実施例2にかかる検索装置200がトライ木から入力キーに対応した値を検索する処理について説明する。図103および図104は、本実施例2にかかる検索処理の処理手順を示すフローチャートである。   Next, processing in which the search device 200 according to the second embodiment searches for a value corresponding to the input key from the trie tree will be described. 103 and 104 are flowcharts illustrating the processing procedure of the search processing according to the second embodiment.

図103に示すように、トライ木探索部250bは、現在のノードをルートノードに設定し(ステップS550)、入力キーが空であるか否かを判定する(ステップS551)。トライ木探索部250bは、入力キーが空ではない場合に(ステップS552,No)、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS553)。   As shown in FIG. 103, the trie tree searching unit 250b sets the current node as the root node (step S550), and determines whether or not the input key is empty (step S551). When the input key is not empty (step S552, No), 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 the child node exists (step S553). ).

トライ木探索部250bは、子ノードが存在しない場合に(ステップS554,No)、図104のステップS556に移行する。トライ木探索部250bは、子ノードが存在する場合に(ステップS554,Yes)、入力キーの先頭文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードへ遷移し(ステップS555)、ステップS551に移行する。   If there is no child node (No at Step S554), the trie tree searching unit 250b proceeds to Step S556 in FIG. When there is a child node (step S554, Yes), the trie tree search unit 250b 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 S555) and the process proceeds to Step S551.

なお、ステップS552において、トライ木探索部250bは、入力キーが空の場合に(ステップS552,Yes)、図104のステップS556に移行する。   In step S552, when the input key is empty (step S552, Yes), the trie tree search unit 250b proceeds to step S556 in FIG.

図104に移行する。トライ木探索部250bは、ノードの情報を参照し(ステップS556)、タグキーの優先度が入力キーの優先度と等しいか否かを判定する(ステップS557)。トライ木探索部250bは、タグキーの優先度と入力キーの優先度が等しい場合に(ステップS558,Yes)、次の階層の入力キーが存在するか否かを判定する(ステップS559)。   Shifting to FIG. The trie tree search unit 250b refers to the node information (step S556), and determines whether the priority of the tag key is equal to the priority of the input key (step S557). When the priority of the tag key and the priority of the input key are equal (step S558, Yes), the trie tree search unit 250b determines whether the input key of the next layer exists (step S559).

トライ木探索部250bは、次の階層の入力キーが存在しない場合に(ステップS560,No)、現在のノード(ノードに登録された値)を出力する(ステップS561)。一方、トライ木探索部250bは、次の階層の入力キーが存在する場合に(ステップS560,Yes)、次の階層へのリンクが存在するか否かを判定する(ステップS562)。   The trie tree search unit 250b outputs the current node (value registered in the node) when the input key of the next layer does not exist (step S560, No) (step S561). On the other hand, the trie tree searching unit 250b determines whether or not there is a link to the next hierarchy when there is an input key of the next hierarchy (step S560, Yes) (step S562).

トライ木探索部250bは、次の階層へのリンクが存在しない場合に(ステップS563,No)、データが無い旨を出力する(ステップS564)。一方、トライ木探索部250bは、次の階層へのリンクが存在する場合に(ステップS563,Yes)、次の階層へ遷移し、入力キーを次の階層の入力キーに設定し(ステップS565)、図103のステップS551に移行する。   When there is no link to the next hierarchy (step S563, No), the trie tree search unit 250b outputs that there is no data (step S564). On the other hand, when there is a link to the next hierarchy (Yes in step S563), the trie tree search unit 250b transitions to the next hierarchy and sets the input key as the input key of the next hierarchy (step S565). , The process proceeds to step S551 in FIG.

ところで、ステップS558において、トライ木探索部250bは、タグキーの優先度と入力キーの優先度が異なる場合に(ステップS558,No)、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS566)。   By the way, in step S558, when the priority of the tag key and the priority of the input key are different (No in step S558), the trie tree searching unit 250b determines whether the priority of the tag key is higher than the priority of the input key. Is determined (step S566).

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

トライ木探索部250bは、兄ノードが存在する、または、親ノードがルートノードである場合(条件を満たす場合)に(ステップS570,Yes)、ステップS568に移行する。一方、トライ木探索部250bは、兄ノードが存在しない、かつ、親ノードがルートノードではない場合(条件を満たさない場合)に(ステップS570,No)、入力キーのポインタを1文字戻し、親ノードへ遷移し(ステップS571)、ステップS556に移行する。   The trie tree search unit 250b proceeds to step S568 when there is an older brother node or when the parent node is the root node (when the condition is satisfied) (step S570, Yes). On the other hand, if there is no brother node and the parent node is not the root node (when the condition is not satisfied) (No in step S570), the trie tree search unit 250b returns the input key pointer by one character, It changes to a node (step S571) and moves to step S556.

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

トライ木探索部250bは、次の階層が存在する場合に(ステップS602,Yes)、次の階層へ遷移し(ステップS603)、ノードにデータが存在するか否かを判定する(ステップS604)。   When the next hierarchy exists (step S602, Yes), the trie tree search unit 250b transitions to the next hierarchy (step S603) and determines whether data exists in the node (step S604).

トライ木探索部250bは、ノードにデータが存在しない場合に(ステップS605,No)、ステップS600に移行する。一方、トライ木探索部250bは、ノードにデータが存在する場合に(ステップS605,Yes)、現在のノードの各種データを加工(ノードに登録された各値を集計)し出力し(ステップS606)、ステップS600に移行する。   The trie tree search unit 250b proceeds to step S600 when there is no data in the node (step S605, No). On the other hand, when there is data in the node (Yes in step S605), the trie tree search unit 250b processes various data of the current node (summarizes each value registered in the node) and outputs it (step S606). The process proceeds to step S600.

ところで、ステップS602において、トライ木探索部250bは、次の階層が存在しない場合に(ステップS602,No)、子ノードが存在するか否かを判定する(ステップS607)。トライ木探索部250bは、子ノードが存在する場合に(ステップS608,Yes)、長男ノードに遷移し(ステップS609)、ステップS604に移行する。   By the way, in step S602, when the next hierarchy does not exist (step S602, No), the trie tree search unit 250b determines whether a child node exists (step S607). When there is a child node (step S608, Yes), the trie tree search unit 250b transitions to the eldest son node (step S609), and proceeds to step S604.

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

トライ木探索部250bは、弟ノードが存在する場合に(ステップS611,Yes)、親ノードへ遷移し(ステップS613)、現在のノードがルートノードであるか否かを判定する(ステップS614)。   When there is a younger brother node (step S611, Yes), the trie tree search unit 250b transitions to the parent node (step S613) and determines whether the current node is a root node (step S614).

トライ木探索部250bは、現在のノードがルートノードではない場合に(ステップS615,No)、ステップS610に移行する。一方、トライ木探索部250bは、現在のノードがルートノードの場合に(ステップS615,Yes)、1つ前に階層が存在するか否かを判定する(ステップS616)。   When the current node is not the root node (step S615, No), the trie tree search unit 250b proceeds to step S610. On the other hand, when the current node is the root node (step S615, Yes), the trie tree search unit 250b determines whether or not a previous hierarchy exists (step S616).

トライ木探索部250bは、1つ前に階層が存在しない場合に(ステップS617,No)、処理を終了する。一方、トライ木探索部250bは、1つ前に階層が存在する場合に(ステップS617,Yes)、1つ前の階層に戻り(ステップS618)、ステップS607に移行する。   The trie tree search unit 250b ends the process when there is no previous hierarchy (No in step S617). On the other hand, when there is a previous hierarchy (Yes in step S617), the trie tree search unit 250b returns to the previous hierarchy (step S618), and proceeds to step S607.

次に、本実施例2にかかる検索装置200が、トライ木240bからデータを削除する削除処理について説明する。図106および図107は、本実施例2にかかる削除処理の処理手順を示すフローチャートである。   Next, a deletion process in which the search device 200 according to the second embodiment deletes data from the trie tree 240b will be described. 106 and 107 are flowcharts illustrating the processing procedure of the deletion processing according to the second embodiment.

図106に示すように、トライ木生成部250aは、現在のノードをルートノードに設定し(ステップS650)、入力キーが空であるか否かを判定する(ステップS651)。トライ木生成部250aは、入力キーが空ではない場合に(ステップS652,No)、入力キーの先頭文字のキーで子ノードを参照し、子ノードが存在するか否かを判定する(ステップS653)。   As shown in FIG. 106, the trie tree generation unit 250a sets the current node as the root node (step S650), and determines whether or not the input key is empty (step S651). When the input key is not empty (step S652, No), 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 the child node exists (step S653). ).

トライ木生成部250aは、子ノードが存在する場合に(ステップS654,Yes)、入力キーの先頭1文字を読み取り、入力キーのポインタを1文字進め、読み出した文字をキーとして子ノードへ遷移し(ステップS655)、ステップS651に移行する。一方、トライ木生成部250aは、子ノードが存在しない場合に(ステップS654,No)、ステップS656に移行する。   When there is a child node (Yes in step S654), 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 S655), the process proceeds to step S651. On the other hand, the trie tree generation unit 250a proceeds to step S656 when there is no child node (step S654, No).

ところで、ステップS652において、トライ木生成部250aは、入力キーが空の場合に(ステップS652,Yes)、ノードの情報を参照し(ステップS656)、タグキーの優先度が入力キーの優先度と等しいか否かを判定する(ステップS657)。   By the way, in step S652, when the input key is empty (step S652, Yes), the trie tree generation unit 250a refers to the node information (step S656), and the priority of the tag key is equal to the priority of the input key. It is determined whether or not (step S657).

トライ木生成部250aは、タグキーの優先度と入力キーの優先度が等しい場合に(ステップS658,Yes)、次の階層の入力キーが存在するか否かを判定する(ステップS659)。トライ木生成部250aは、次の階層の入力キーが存在しない場合に(ステップS660,No)、図107のステップS670に移行する。   When the priority of the tag key is equal to the priority of the input key (Yes in step S658), the trie tree generation unit 250a determines whether there is an input key in the next hierarchy (step S659). The trie tree generation unit 250a proceeds to step S670 of FIG. 107 when the input key of the next layer does not exist (step S660, No).

一方、トライ木生成部250aは、次の階層の入力キーが存在する場合に(ステップS660,Yes)、次の階層へのリンクが存在するか否かを判定する(ステップS661)。トライ木生成部250aは、次の階層へのリンクが存在しない場合に(ステップS662,No)、ステップS669に移行する。   On the other hand, the trie tree generation unit 250a determines whether or not there is a link to the next hierarchy when there is an input key of the next hierarchy (step S660, Yes) (step S661). When the link to the next hierarchy does not exist (No at Step S662), the trie tree generation unit 250a proceeds to Step S669.

トライ木生成部250aは、次の階層へのリンクが存在する場合に(ステップS662,Yes)、次の階層へ遷移し、入力キーを次の階層の入力キーに設定し(ステップS663)、ステップS651に移行する。   When there is a link to the next hierarchy (step S662, Yes), the trie tree generation unit 250a transitions to the next hierarchy, sets the input key to the input key of the next hierarchy (step S663), and step The process proceeds to S651.

ところで、ステップS658において、トライ木生成部250aは、タグキーの優先度が入力キーの優先度と異なる場合に(ステップS658,No)、タグキーの優先度が入力キーの優先度よりも大きいか否かを判定する(ステップS664)。   By the way, in step S658, when the priority of the tag key is different from the priority of the input key (No in step S658), the trie tree generating unit 250a determines whether the priority of the tag key is higher than the priority of the input key. Is determined (step S664).

トライ木生成部250aは、タグキーの優先度が入力キーの優先度よりも大きくない場合に(ステップS665,No)、ステップS669に移行する。一方、トライ木生成部250aは、タグキーの優先度が入力キーの優先度よりも大きい場合に(ステップS665,Yes)、兄ノードが存在する、または、親ノードがルートノードであるか否かを判定する(ステップS666)。   When the priority of the tag key is not higher than the priority of the input key (No in step S665), the trie tree generation unit 250a proceeds to step S669. On the other hand, when the priority of the tag key is higher than the priority of the input key (Yes in step S665), the trie tree generation unit 250a determines whether there is an older brother node or whether the parent node is a root node. Determination is made (step S666).

トライ木生成部250aは、兄ノードが存在しない、かつ、親ノードがルートノードではない場合(条件を満たさない場合)に(ステップS667,No)、入力キーのポインタを1文字戻し、親ノードへ遷移し(ステップS668)、ステップS651に移行する。   When the brother node does not exist and the parent node is not the root node (when the condition is not satisfied) (No in step S667), the trie tree generation unit 250a returns the input key pointer by one character and returns to the parent node. A transition is made (step S668), and the process proceeds to step S651.

トライ木生成部250aは、兄ノードが存在する、または、親ノードがルートノードの場合(条件を満たす場合)に(ステップS667,Yes)、削除データが存在しない旨を出力する(ステップS669)。   When the older brother node exists or the parent node is the root node (when the condition is satisfied) (Yes in step S667), the trie tree generation unit 250a outputs that no deletion data exists (step S669).

図107に移行する。トライ木生成部250aは、削除対象データが存在するか否かを判定する。(ステップS670)トライ木生成部250aは、削除対象データが存在しない場合に(ステップS671,No)、削除対象が無い旨を出力する(ステップS672)。   Shifting to FIG. The trie tree generation unit 250a determines whether there is data to be deleted. (Step S670) When the deletion target data does not exist (No at Step S671), the trie tree generation unit 250a outputs that there is no deletion target (Step S672).

トライ木生成部250aは、削除対象データが存在する場合に(ステップS671,Yes)、対象データを削除し(ステップS673)、他のデータが存在するか否かを判定する(ステップS674)。   When there is data to be deleted (Yes in step S671), the trie tree generation unit 250a deletes the target data (step S673) and determines whether there is other data (step S674).

トライ木生成部250aは、他のデータが存在する場合に(ステップS675,Yes)、処理を終了する。トライ木生成部250aは、他のデータが存在しない場合に(ステップS675,No)、現在のノードはルートノードであるか否かを判定する(ステップS676)。   The trie tree generation unit 250a ends the process when other data exists (step S675, Yes). When there is no other data (step S675, No), the trie tree generation unit 250a determines whether or not the current node is a root node (step S676).

トライ木生成部250aは、現在のノードがルートノードの場合に(ステップS677,Yes)、処理を終了する。トライ木生成部250aは、現在のノードがルートノードではない場合に(ステップS677,No)、子ノードが存在するか否かを判定する(ステップS678)。   When the current node is the root node (step S677, Yes), the trie tree generation unit 250a ends the process. When the current node is not the root node (step S677, No), the trie tree generation unit 250a determines whether there is a child node (step S678).

トライ木生成部250aは、子ノードが存在する場合に(ステップS679,Yes)、現在のノードのデータを長男ノードのデータに設定し(ステップS680)、長男ノードへ遷移し(ステップS681)、ステップS678に移行する。トライ木生成部250aは、子ノードが存在しない場合に(ステップS679,No)、親ノードの現在のノードへのエッジを削除し、現在のノードを削除する(ステップS682)。   If there is a child node (step S679, Yes), the trie tree generation unit 250a sets the data of the current node as the data of the eldest node (step S680), transitions to the eldest node (step S681), and step The process proceeds to S678. When there is no child node (No in step S679), the trie tree generation unit 250a deletes the edge of the parent node to the current node, and deletes the current node (step S682).

上述してきたように、本実施例2にかかる検索装置200は、固定長の文字列をタグキーとしてノードに接続し、固定長の文字列の配下(固定帳の文字列を有するノードの配下)に新たにルートノードを作成して、階層的なトライ木を生成する。したがって、検索装置200が、トライ木の再構築を実行する場合に、ノードに接続するタグキーおよび更新するタグキーを該当する階層内のみで実行すればよいので、再接続するタグキーの数、更新するタグキーの数を大幅に削減することが出来る。   As described above, the search device 200 according to the second embodiment connects a fixed-length character string to a node as a tag key, and subordinates the fixed-length character string (under a node having a fixed-book character string). A new root node is created to generate a hierarchical trie tree. Therefore, when the search device 200 executes the reconstruction of the trie tree, the tag key to be connected to the node and the tag key to be updated need only be executed within the corresponding hierarchy. Therefore, the number of tag keys to be reconnected and the tag key to be updated Can be greatly reduced.

ところで、本実施例において説明した各処理のうち、自動的におこなわれるものとして説明した処理の全部または一部を手動的におこなうこともでき、あるいは、手動的におこなわれるものとして説明した処理の全部または一部を公知の方法で自動的におこなうこともできる。この他、上記文書中や図面中で示した処理手順、制御手順、具体的名称、各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。   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にて解析実行されるプログラムにて実現され、あるいは、ワイヤードロジックによるハードウェアとして実現され得る。   Each component of each illustrated device 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.

図108は、実施例2に示した検索装置200(あるいは、実施例1にかかる検索装置100)に対応するコンピュータのハードウェア構成を示す図である。図108に示すように、このコンピュータ(検索装置)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. 108 is a diagram illustrating a hardware configuration of a computer corresponding to the search device 200 (or the search device 100 according to the first embodiment) illustrated in the second embodiment. As shown in FIG. 108, 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 character string including a predetermined number of characters 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 each node of the trie tree, remove the character string that matches the character string corresponding to the traced node from the new character string, connect the new root node to the node, and connect the connected root A storage medium storing a program for adding a new node to a node and realizing a character string registration function for registering a new character string including a predetermined number of characters in a new node.

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

(付記3)前記文字列登録機能は、新規の文字列の文字を先頭から順に読み出して、前記トライ木のノードを辿り、辿ったノードのうち、兄ノードを有するノードの中で最下層に位置する特定ノードを判定する判定機能と、前記特定ノードから、前記新規の文字列の文字を順に読み出すことで最終的に到達するノードまでの経路に含まれるノードの何れか、または、葉ノードの配下に新規のノードを追加して、前記新規の文字列をノードに登録する登録機能を有することを特徴とする付記1または2に記載の記憶媒体。 (Additional remark 3) The said character string registration function reads the character of a new character string in order from the top, and follows the node of the said trie tree, and is located in the lowest layer among the nodes which have the elder node among the traced nodes. A determination function for determining a specific node to perform, and any of the nodes included in the path from the specific node to the node that finally arrives by sequentially reading the characters of the new character string, or subordinate to the leaf node The storage medium according to appendix 1 or 2, further comprising a registration function for adding a new node to the node and registering the new character string in the node.

(付記4)前記判定機能は、新規の文字列の文字を先頭から順に読み出して前記トライ木のノードを辿り、辿ったノードのうち、兄ノードを有するノードが存在しない場合には、最下層の根ノードに接続する子ノードを特定ノードとして判定することを特徴とする付記3に記載の記憶媒体。 (Additional remark 4) The said determination function reads the character of a new character string in order from the head, and traces the node of the said trie tree, and when the node which has an elder brother node does not exist among the traced nodes, it is the lowest layer. The storage medium according to appendix 3, wherein a child node connected to the root node is determined as a specific node.

(付記5)検索装置が、
所定の文字数を含む文字列に対応するノードが木構造にて接続されるトライ木を記憶装置に記憶するステップと、
当該トライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木の各ノードを辿り、辿ったノードに対応する文字列と一致する文字列を新規の文字列から除いた後、ノードに新規の根ノードを接続し、接続した根ノードに新規のノードを追加すると共に、新規の文字列のうち、所定の文字数を含む文字列を新規のノードに登録するステップと
を含んだことを特徴とするトライ木生成方法。
(Supplementary Note 5) The search device is
Storing in a storage device a trie tree in which nodes corresponding to a character string including a predetermined number of characters are connected in a tree structure;
When registering a new character string in the trie tree, the characters of the new character string are read in order from the top and traced through each node of the trie tree, and a character string that matches the character string corresponding to the traced node is After removing from the new character string, connect the new root node to the node, add the new node to the connected root node, and also add the new character string that contains the specified number of characters to the new node A trie tree generation method characterized by including the steps of:

(付記6)所定の文字数を含む文字列に対応するノードが木構造にて接続されるトライ木を記憶装置に記憶し、当該トライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木の各ノードを辿り、辿ったノードに対応する文字列と一致する文字列を新規の文字列から除いた後、ノードに新規の根ノードを接続し、接続した根ノードに新規のノードを追加すると共に、新規の文字列のうち、所定の文字数を含む文字列を新規のノードに登録する文字列登録部
を有することを特徴とするトライ木生成装置。
(Supplementary note 6) When a trie tree in which nodes corresponding to a character string including a predetermined number of characters are connected in a tree structure is stored in a storage device and a new character string is registered in the trie tree, the new character Read the characters in the sequence from the beginning and follow each node of the trie tree. After removing the character string that matches the character string corresponding to the traced node from the new character string, connect the new root node to the node. A trie tree generation device comprising: a character string registration unit that adds a new node to a connected root node and registers a character string including a predetermined number of characters among the new character strings in the new node. .

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,
When a trie tree in which nodes corresponding to a character string including a predetermined number of characters 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 each node of the trie tree, remove the character string that matches the character string corresponding to the traced node from the new character string, connect the new root node to the node, and connect the connected root A storage medium storing a program for adding a new node to a node and realizing a character string registration function for registering a new character string including a predetermined number of characters in a new node.
前記文字列登録機能は、各ノードに登録される各文字列に優先度を設定し、当該優先度に基づいて各ノードに各文字列を登録することを特徴とする請求項1に記載の記憶媒体。   The storage according to claim 1, wherein the character string registration function sets a priority for each character string registered in each node, and registers each character string in each node based on the priority. Medium. 前記文字列登録機能は、新規の文字列の文字を先頭から順に読み出して、前記トライ木のノードを辿り、辿ったノードのうち、兄ノードを有するノードの中で最下層に位置する特定ノードを判定する判定機能と、前記特定ノードから、前記新規の文字列の文字を順に読み出すことで最終的に到達するノードまでの経路に含まれるノードの何れか、または、葉ノードの配下に新規のノードを追加して、前記新規の文字列をノードに登録する登録機能を有することを特徴とする請求項1または2に記載の記憶媒体。   The character string registration function reads the characters of the new character string in order from the beginning, traces the nodes of the trie tree, and among the traced nodes, the specific node located at the lowest layer among the nodes having the older brother nodes A determination function for determining, and any of the nodes included in the path from the specific node to the node finally reached by sequentially reading the characters of the new character string, or a new node under the leaf node The storage medium according to claim 1, further comprising a registration function of registering the new character string in a node by adding 前記判定機能は、新規の文字列の文字を先頭から順に読み出して前記トライ木のノードを辿り、辿ったノードのうち、兄ノードを有するノードが存在しない場合には、最下層の根ノードに接続する子ノードを特定ノードとして判定することを特徴とする請求項3に記載の記憶媒体。   The determination function reads the characters of the new character string in order from the beginning and traces the nodes of the trie tree. If there is no node having an elder node among the traced nodes, the determination function connects to the root node of the lowest layer The storage medium according to claim 3, wherein a child node to be determined is determined as a specific node. 検索装置が、
所定の文字数を含む文字列に対応するノードが木構造にて接続されるトライ木を記憶装置に記憶するステップと、
当該トライ木に新規の文字列を登録する場合に、当該新規の文字列の文字を先頭から順に読み出して前記トライ木の各ノードを辿り、辿ったノードに対応する文字列と一致する文字列を新規の文字列から除いた後、ノードに新規の根ノードを接続し、接続した根ノードに新規のノードを追加すると共に、新規の文字列のうち、所定の文字数を含む文字列を新規のノードに登録するステップと
を含んだことを特徴とするトライ木生成方法。
The search device
Storing in a storage device a trie tree in which nodes corresponding to a character string including a predetermined number of characters are connected in a tree structure;
When registering a new character string in the trie tree, the characters of the new character string are read in order from the top and traced through each node of the trie tree, and a character string that matches the character string corresponding to the traced node is After removing from the new character string, connect the new root node to the node, add the new node to the connected root node, and also add the new character string that contains the specified number of characters to the new node A trie tree generation method characterized by including the steps of:
JP2009088385A 2009-03-31 2009-03-31 Storage medium, trie tree generation method, and trie tree generation apparatus Expired - Fee Related JP5493431B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009088385A JP5493431B2 (en) 2009-03-31 2009-03-31 Storage medium, trie tree generation method, and trie tree generation apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009088385A JP5493431B2 (en) 2009-03-31 2009-03-31 Storage medium, trie tree generation method, and trie tree generation apparatus

Publications (2)

Publication Number Publication Date
JP2010238195A true JP2010238195A (en) 2010-10-21
JP5493431B2 JP5493431B2 (en) 2014-05-14

Family

ID=43092418

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009088385A Expired - Fee Related JP5493431B2 (en) 2009-03-31 2009-03-31 Storage medium, trie tree generation method, and trie tree generation apparatus

Country Status (1)

Country Link
JP (1) JP5493431B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9535825B2 (en) 2012-02-23 2017-01-03 Fujitsu Limited Information processing device and information processing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH03122766A (en) * 1989-09-28 1991-05-24 Bull Hn Inf Syst Inc Prefix search tree with partial key branch function
JP2000324172A (en) * 1999-05-11 2000-11-24 Nec Corp Method for storing prefix concerning address
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
JP2002259452A (en) * 2001-03-01 2002-09-13 Japan Telecom Co Ltd Information retrieval device, multiprocessor for information retrieval and router
JP2009512950A (en) * 2005-10-24 2009-03-26 ライトオーダー インコーポレイテッド Architecture and method for efficiently bulk loading Patricia Tri

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH03122766A (en) * 1989-09-28 1991-05-24 Bull Hn Inf Syst Inc Prefix search tree with partial key branch function
JP2000324172A (en) * 1999-05-11 2000-11-24 Nec Corp Method for storing prefix concerning address
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
JP2002259452A (en) * 2001-03-01 2002-09-13 Japan Telecom Co Ltd Information retrieval device, multiprocessor for information retrieval and router
JP2009512950A (en) * 2005-10-24 2009-03-26 ライトオーダー インコーポレイテッド Architecture and method for efficiently bulk loading Patricia Tri

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
CSNG199800555009; 程亜非 他: '可変長節パトリシアトライ索引構造' 情報処理学会論文誌 第37巻,第8号, 19960815, p.1626-1629, 社団法人情報処理学会 *
CSNG200000722001; 山田憲晋 他: 'IP経路制御におけるアドレス解決エンジン' 電子情報通信学会技術研究報告 第98巻,第297号, 19980924, p.1-6, 社団法人電子情報通信学会 *
JPN6013032417; 程亜非 他: '可変長節パトリシアトライ索引構造' 情報処理学会論文誌 第37巻,第8号, 19960815, p.1626-1629, 社団法人情報処理学会 *
JPN6013032419; 山田憲晋 他: 'IP経路制御におけるアドレス解決エンジン' 電子情報通信学会技術研究報告 第98巻,第297号, 19980924, p.1-6, 社団法人電子情報通信学会 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9535825B2 (en) 2012-02-23 2017-01-03 Fujitsu Limited Information processing device and information processing method

Also Published As

Publication number Publication date
JP5493431B2 (en) 2014-05-14

Similar Documents

Publication Publication Date Title
JP5278534B2 (en) Storage medium
US8208408B2 (en) Tree-based node insertion method and memory device
EP2048584B1 (en) Bit sequence search device, search method, and program
CN100550847C (en) A kind of method and device that solves the Hash conflict
CN108628753A (en) Memory headroom management method and device
CN105847145A (en) Important node searching method based on network diameters
JP5493431B2 (en) Storage medium, trie tree generation method, and trie tree generation apparatus
JP6428615B2 (en) Multidimensional range search apparatus and multidimensional range search method
JP5646775B2 (en) Memory system having a key-value store system
CN105940611A (en) Optimized data condenser and method
JP5293301B2 (en) SEARCH DEVICE, SEARCH METHOD, AND STORAGE MEDIUM
US8166043B2 (en) Bit strings search apparatus, search method, and program
JP5387092B2 (en) Storage medium and trie tree generation method
CN103425629B (en) Generation apparatus, generation method, searching apparatus, and searching method
JP5299095B2 (en) Tri-tree character string registration program and tri-tree character string registration device
CN111797285A (en) Character string fuzzy matching method, device, equipment and readable storage medium
CN106649303A (en) Operation method for solution search system and solution search system
JP5041003B2 (en) Search device and search method
JP2002024233A (en) Recording medium with recorded dictionary data structure, dictionary consulting method, word and phrase acquiring method, dictionary consulting device, word and phrase acquiring device, and recording medium with recorded program
CN101742064B (en) Method for controlling television through keyboard and mouse
TWI430128B (en) Method for mining biclusters from dna microarray data using condition-enumeration tree
CN108153813B (en) Data matching method and system
JP6155920B2 (en) Multidimensional range search apparatus and multidimensional range search method
US7840583B2 (en) Search device and recording medium
JP5365347B2 (en) Tri-tree character string registration program and tri-tree character string registration device

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

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140217

R150 Certificate of patent or registration of utility model

Ref document number: 5493431

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees