JP5220057B2 - Bit string search device, search method and program - Google Patents
Bit string search device, search method and program Download PDFInfo
- Publication number
- JP5220057B2 JP5220057B2 JP2010121153A JP2010121153A JP5220057B2 JP 5220057 B2 JP5220057 B2 JP 5220057B2 JP 2010121153 A JP2010121153 A JP 2010121153A JP 2010121153 A JP2010121153 A JP 2010121153A JP 5220057 B2 JP5220057 B2 JP 5220057B2
- Authority
- JP
- Japan
- Prior art keywords
- node
- array
- branch destination
- branch
- tree
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims description 105
- 238000004364 calculation method Methods 0.000 claims description 22
- 238000010586 diagram Methods 0.000 description 24
- 238000006243 chemical reaction Methods 0.000 description 10
- 238000013500 data storage Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 6
- 239000000284 extract Substances 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
本発明は、ビット列検索の技術に関し、特にカップルドノードツリーを用いたビット列検索に関する。 The present invention relates to a bit string search technique, and more particularly to a bit string search using a coupled node tree.
近年、社会の情報化が進展し、大規模なデータベースが各所で利用されるようになってきている。このような大規模なデータベースからレコードを検索するには、各レコードの記憶されたアドレスと対応づけられたレコード内の項目をインデックスキーとして検索をし、所望のレコードを探し出すことが通例である。また、全文検索における文字列も、文書のインデックスキーと見なすことができる。 In recent years, with the progress of informatization of society, large-scale databases are being used in various places. In order to search for a record from such a large database, it is usual to search for an item in the record associated with the stored address of each record using an index key to find a desired record. A character string in full-text search can also be regarded as a document index key.
そして、それらのインデックスキーはビット列で表現されることから、データベースの検索はビット列データの検索に帰着されるということができる。
ビット列データを検索するビット列検索に関するものとして、下記特許文献1、特許文献2及び特許文献3等に開示されたカップルドノードツリーを用いた検索技術がある。
Since these index keys are represented by bit strings, it can be said that a database search is reduced to a bit string data search.
As a technique related to bit string search for searching bit string data, there is a search technique using a coupled node tree disclosed in
図1Aに示すのは、従来の、配列に配置されたカップルドノードツリーの構成例を説明する図である。
図1Aを参照すると、ノード101が配列100の配列番号10の配列要素に配置されている。ノード101はノード種別102、弁別ビット位置103及び代表ノード番号104で構成されている。ノード種別102は0であり、ノード101がブランチノードであることを示している。弁別ビット位置103には1が格納されている。代表ノード番号104にはリンク先のノード対の代表ノードの配列番号20が格納されている。なお、以下では表記の簡略化のため、代表ノード番号に格納された配列番号を代表ノード番号ということもある。また、代表ノード番号に格納された配列番号をそのノードに付した符号あるいはノード対に付した符号で表すこともある。
FIG. 1A is a diagram illustrating a configuration example of a conventional coupled node tree arranged in an array.
Referring to FIG. 1A, a
配列番号20の配列要素には、ノード対111の代表ノードであるノード[0]112が格納されている。そして隣接する次の配列要素(配列番号20+1)に代表ノードと対になるノード[1]113が格納されている。ノード[0]112のノード種別114には0が、弁別ビット位置115には3が、代表ノード番号116には30が格納されている。またノード[1]113のノード種別117には1が格納されており、ノード[1]113がリーフノードであることを示している。インデックスキー118には、“0001”が格納されている。
The array element with the
なお、代表ノードをノード[0]で表し、それと対になるノードをノード[1]で表すことがある。また、ある配列番号の配列要素に格納されたノードを、その配列番号のノードということがあり、ノードの格納された配列要素の配列番号を、ノードの配列番号ということもある。
配列番号30及び31の配列要素に格納されたノード122とノード123からなるノード対121の内容は省略されている。
A representative node may be represented by a node [0] and a node paired therewith may be represented by a node [1]. In addition, a node stored in an array element having a certain array number may be referred to as a node having the array number, and an array number of the array element in which the node is stored may be referred to as a node array number.
The contents of the
ノード[0]112、ノード[1]113、ノード122、及びノード123の格納された配列要素にそれぞれ付された0あるいは1は、検索キーで検索を行う場合にノード対のどちらのノードにリンクするかを示すものである。前段のブランチノードの弁別ビット位置にある検索キーのビット値である0か1を代表ノード番号に加えた配列番号のノードにリンクする。
したがって、前段のブランチノードの代表ノード番号に、検索キーの弁別ビット位置のビット値を加えることにより、リンク先のノードが格納された配列要素の配列番号を求めることができる。
なお、上記の例では代表ノード番号をノード対の配置された配列番号のうち小さい方を採用しているが、大きいほうを採用することも可能であることは明らかである。
The 0 or 1 added to the array elements stored in the node [0] 112, the node [1] 113, the
Therefore, by adding the bit value of the discrimination bit position of the search key to the representative node number of the preceding branch node, the array element number of the array element storing the link destination node can be obtained.
In the above example, the representative node number is the smaller of the array element numbers where the node pairs are arranged. However, it is obvious that the larger one can be adopted.
図1Bは、従来のカップルドノードツリーのツリー構造を概念的に示す図である。
符号210aで示すのが図1Bに例示するカップルドノードツリー200のルートノードである。図示の例では、ルートノード210aは配列番号220に配置されたノード対201aの代表ノードとしている。
FIG. 1B is a diagram conceptually showing a tree structure of a conventional coupled node tree.
ツリー構造としては、ルートノード210aの下にノート対201bが、その下層にノード対201cとノード対201fが配置され、ノード対201fの下層にはノード対201hとノード対201gが配置されている。ノード対201cの下にはノード対201dが、さらにその下にはノード対201eが配置されている。
As a tree structure, a
各ノードの前に付された0あるいは1の符号は、図1において説明した配列要素の前に付された符号と同じである。検索キーの弁別ビット位置のビット値に応じてツリーをたどり、検索対象のリーフノードを見つけることになる。 The code of 0 or 1 added before each node is the same as the code assigned before the array element described in FIG. The tree is traversed according to the bit value of the discrimination bit position of the search key, and the leaf node to be searched is found.
図示された例では、ルートノード210aのノード種別260aは0でブランチノードであることを示し、弁別ビット位置230aは0を示している。代表ノード番号は220aであり、それはノード対201bの代表ノード210bの格納された配列要素の配列番号である。
ノード対201bはノード210bと211bで構成され、それらのノード種別260b、261bはともに0であり、ブランチノードであることを示している。ノード210bの弁別ビット位置230bには1が格納され、リンク先の代表ノード番号にはノード対201cの代表ノード210cの格納された配列要素の配列番号220bが格納されている。
In the illustrated example, the
The
ノード210cのノード種別260cには1が格納されているので、このノードはリーフノードであり、したがって、インデックスキーを含んでいる。インデックスキー250cには“000111”が格納されている。一方ノード211cのノード種別261cは0、弁別ビット位置231cは2であり、代表ノード番号にはノード対201dの代表ノード210dの格納された配列要素の配列番号221cが格納されている。
ノード210dのノード種別260dは0、弁別ビット位置230dは5であり、代表ノード番号にはノード対201eの代表ノード210eの格納された配列要素の配列番号220dが格納されている。ノード210dと対になるノード211dのノード種別261dは1であり、インデックスキー251dには“011010”が格納されている。
ノード対201eのノード210e、211eのノード種別260e、261eはともに1であり双方ともリーフノードであることを示し、それぞれのインデックスキー250e、251eにはインデックスキーとして“010010”と“010011”が格納されている。
Since 1 is stored in the
The
The
ノード対201bのもう一方のノードであるノード211bの弁別ビット位置231bには2が格納され、リンク先の代表ノード番号にはノード対201fの代表ノード210fの格納された配列要素の配列番号221bが格納されている。
ノード対201fのノード210f、211fのノード種別260f、261fはともに0であり双方ともブランチノードである。それぞれの弁別ビット位置230f、231fには5、3が格納されている。ノード210fの代表ノード番号にはノード対201gの代表ノード210gの格納された配列要素の配列番号220fが格納され、ノード211fの代表ノード番号にはノード対201hの代表ノードであるノード[0]210hの格納された配列要素の配列番号221fが格納されている。
ノード対201gのノード210g、211gのノード種別260g、261gはともに1であり双方ともリーフノードであることを示し、それぞれのインデックスキー250g、251gには“100010”と“100011”が格納されている。
また同じくノード対201hの代表ノードであるノード[0]210hとそれと対をなすノード[1]211hのノード種別260h、261hはともに1であり双方ともリーフノードであることを示し、それぞれのインデックスキー250h、251hには“101011”と“101100“が格納されている。
2 is stored in the
The
The
Similarly, the
次に、上述のカップルドノードツリーを用いた基本的な検索処理について説明する。以下の説明においては、特に図示されてはいないが、処理の途中で得られた各種の値を後の処理で用いるためにそれぞれの処理に応じた一時記憶領域が用いられる。また、あるデータ格納領域に格納されるデータ自体にデータ格納領域の符号を付して説明する場合があるし、データ自体の名前をそのデータを格納する一時記憶領域の名前として用いることもある。 Next, basic search processing using the above-described coupled node tree will be described. In the following description, although not particularly illustrated, a temporary storage area corresponding to each process is used in order to use various values obtained during the process in a later process. In some cases, data stored in a certain data storage area is described with the data storage area code added, and the name of the data itself may be used as the name of a temporary storage area for storing the data.
まず、検索開始ノードの配列番号を取得する。取得された配列番号に対応する配列は、カップルドノードツリーを構成する任意のノードを格納したものである。検索開始ノードの指定は、オペレータからの入力によってもよいし、検索処理の結果を利用するアプリケーションプログラムによるものでもよい。
取得された検索開始ノードの配列番号は、図示しない検索開始ノード設定エリアに設定されるが、この検索開始ノード設定エリアは、先に述べた「処理の途中で得られた各種の値を後の処理で用いるためにそれぞれの処理に応じた一時記憶領域」の一つである。以下の説明では、「図示しない検索開始ノード設定エリアに設定する」のような表現に変えて、「検索開始ノードの配列番号を得る。」、「検索開始ノードとして設定する」あるいは単に「検索開始ノードに設定する」のように記述することもある。
First, the array element number of the search start node is acquired. The array corresponding to the acquired array element number stores arbitrary nodes constituting a coupled node tree. The search start node may be specified by an input from an operator or by an application program that uses the result of the search process.
The obtained array number of the search start node is set in a search start node setting area (not shown). This search start node setting area is used to set various values obtained in the middle of processing as described later. This is one of the “temporary storage areas corresponding to each process for use in the process”. In the following description, instead of the expression “set in a search start node setting area (not shown)”, “get the search start node array number”, “set as search start node” or simply “start search” It may also be described as “set to node”.
次に、探索経路スタックに取得された配列番号を格納し、その配列番号に対応する配列要素を参照すべきノードとして読み出す。そして、読み出したノードから、ノード種別を取り出し、ノード種別がブランチノードであるか否かを判定する。
この判定において、読み出したノードがブランチノードである場合は、ノードから弁別ビット位置についての情報を取り出し、更に、取り出した弁別ビット位置に対応するビット値を検索キーから取り出す。そして、ノードから代表ノード番号を取り出して、検索キーから取り出したビット値と代表ノード番号とを加算し、新たな配列番号として、上述の探索経路スタックに取得された配列番号を格納する処理に戻るループ処理を実行する。
Next, the acquired array element number is stored in the search path stack, and the array element corresponding to the array element number is read as a node to be referred to. Then, the node type is extracted from the read node, and it is determined whether or not the node type is a branch node.
In this determination, when the read node is a branch node, information on the discrimination bit position is extracted from the node, and further, a bit value corresponding to the extracted discrimination bit position is extracted from the search key. Then, the representative node number is extracted from the node, the bit value extracted from the search key and the representative node number are added, and the process returns to the process of storing the array number acquired in the search path stack described above as a new array number. Perform loop processing.
以降、ノード種別の判定においてリーフノードと判定されるまで、上述のループ処理を繰り返す。ノード種別の判定においてリーフノードと判定されると、リーフノードからインデックスキーを検索結果キーとして取り出して、処理を終了する。 Thereafter, the above loop processing is repeated until the node type is determined as a leaf node. If the node type is determined to be a leaf node, the index key is extracted from the leaf node as a search result key, and the process ends.
次に、ルートノードを検索開始ノードとして図1Bに例示するカップルドノードツリー200からインデックスキー“100010”を検索する処理を簡単に説明する。弁別ビット位置は、最上位ビットの位置から0、1、2、・・・とする。 Next, a process for searching the index key “100010” from the coupled node tree 200 illustrated in FIG. 1B with the root node as a search start node will be briefly described. The discrimination bit positions are 0, 1, 2,... From the most significant bit position.
検索開始ノードがルートノードであるので、ビット列“100010”を検索キーとしてルートノード210aから処理をスタートする。ルートノード210aの弁別ビット位置230aは0であるので、検索キー“100010”の弁別ビット位置が0のビット値をみると1である。そこで代表ノード番号の格納された配列番号220aに1を加えた配列番号の配列要素に格納されたノード211bにリンクする。ノード211bの弁別ビット位置231bには2が格納されているので、検索キー“100010”の弁別ビット位置が2のビット値をみると0であるから、代表ノード番号の格納された配列番号221bの配列要素に格納されたノード210fにリンクする。
ノード210fの弁別ビット位置230fには5が格納されているので、検索キー“100010”の弁別ビット位置が5のビット値をみると0であるから、代表ノード番号の格納された配列番号220fの配列要素に格納されたノード210gにリンクする。
ノード210gのノード種別260gは1でありリーフノードであることを示しているので、インデックスキー250gを検索結果キーとして読み出す。このようにしてカップルドノードツリーを用いた検索が行われる。なお、検索結果キーを検索キーと比較すると両方とも“100010”であって一致している。
Since the search start node is the root node, processing is started from the
Since 5 is stored in the
Since the
上述の検索処理の説明では、検索処理をノードからインデックスキーを検索結果キーとして取り出すことで終了しているが、さらに検索結果キーと検索キーの一致判定を行い、一致すれば検索成功とし、一致しなければ検索失敗とすることもできる。 In the above description of the search process, the search process is completed by taking out the index key from the node as the search result key. However, the search result key and the search key are further matched, and if they match, the search is successful. If you don't do it, you can make the search fail.
図1A及び図1Bに示すカップルドノードツリーのリーフノードは、リーフノードインデックスキーを直接含むものであり、上述の検索処理は、リーフノードからインデックスキーを取り出すものである。このリーフノードの構成と検索処理におけるインデックスキーの取り出しは、特許文献1及び特許文献2に開示されたものと同様である。
The leaf nodes of the coupled node tree shown in FIGS. 1A and 1B directly include a leaf node index key, and the search process described above extracts an index key from the leaf node. The configuration of the leaf node and the retrieval of the index key in the search process are the same as those disclosed in
一方、特許文献3に開示されたカップルドノードツリーのリーフノードには、インデックスキーに替えて、インデックスキーの記憶された記憶領域の位置を示すポインタである参照ポインタが格納されている。そして、検索処理におけるインデックスキーの取り出しは、リーフノードから参照ポインタを取り出し、参照ポインタの指す記憶領域にアクセスすることにより行われる。
On the other hand, a leaf node of the coupled node tree disclosed in
カップルドノードツリーは、それ以前に検索処理に用いられていたツリーと比べてツリーを記憶する記憶容量が少ないという特徴を有する。しかしながら、検索対象のデータサイズが非常に大きくなると、より小さい容量の記憶手段に配置可能なツリー構造であることが望ましい。
そこで、本発明が解決しようとする課題は、より小さい容量の記憶手段に配置可能なカップルドノードツリーのツリー構造を提供することである。
The coupled node tree has a feature that the storage capacity for storing the tree is smaller than that of the tree previously used for the search process. However, when the search target data size becomes very large, it is desirable that the tree structure be arranged in a storage unit having a smaller capacity.
Therefore, the problem to be solved by the present invention is to provide a tree structure of a coupled node tree that can be arranged in a storage means having a smaller capacity.
本発明によれば、カップルドノードツリーの各ノードは、ツリー上の位置に応じた配列の配列要素に配置される。ルートノードの配置される配列要素の仮想的な配列番号であるノード参照番号は1とされ、ブランチノードのリンク先のノード対の代表ノードの配置された配列要素のノード参照番号は、ブランチノードが配置された配列要素のノード参照番号を2倍することにより求められる。したがって、本発明によるブランチノードは、代表ノード番号を含む必要がない。 According to the present invention, each node of the coupled node tree is arranged in an array element of an array corresponding to the position on the tree. The node reference number, which is a virtual array number of the array element in which the root node is arranged, is 1, and the node reference number of the array element in which the representative node of the node pair to which the branch node is linked is It is obtained by doubling the node reference number of the arranged array element. Therefore, the branch node according to the present invention does not need to include the representative node number.
また、本発明によれば、検索対象のインデックスキーのある特定のビット位置に特定のビット値“0”あるいは“1”を挿入したものによりカップルドノードツリーを構成し、同様に検索キーの、検索対象のインデックスキーと同一の特定のビット位置に同一の特定のビット値“0”あるいは“1”を挿入したものにより検索を行う。そして、ブランチノードとリーフノードはノード種別を含まず、ブランチノードは弁別ビット位置を含むが代表ノード番号は含まず、リーフノードはインデックスキーあるいはインデックスキーにアクセスするための情報を含む。 Further, according to the present invention, a coupled node tree is configured by inserting a specific bit value “0” or “1” into a specific bit position of an index key to be searched, and similarly, The search is performed by inserting the same specific bit value “0” or “1” into the same specific bit position as the index key to be searched. The branch node and the leaf node do not include the node type, the branch node includes the discrimination bit position but does not include the representative node number, and the leaf node includes the index key or information for accessing the index key.
リーフノードは、カップルドノードツリーの最大段数をNとしたとき、N段目にのみ存在し、かつN段目にはリーフノードしか存在しないようにツリーを構成することにより、ノードの種別の判別を可能としている。 A leaf node is determined only when the maximum number of stages of a coupled node tree is N. The tree is configured so that only a leaf node exists at the Nth stage and only a leaf node exists at the Nth stage. Is possible.
さらに、本発明によれば、検索キーによる検索処理の始めに、ブランチノードの弁別ビット位置と検索キーのビット値により、各ブランチノードにおけるリンク先においてノード位置[0]とノード位置[1]のどちらに分岐するかを示す分岐先情報を求める。そして、検索処理は、ルートノードから最終段であるN段目のノードまでの各段の分岐先情報をたどるリンク動作を繰り返すことで行われる。 Further, according to the present invention, at the beginning of the search process using the search key, the node position [0] and the node position [1] are linked at the link destination in each branch node based on the discrimination bit position of the branch node and the bit value of the search key. Find branch destination information that indicates which branch to branch to. The search process is performed by repeating a link operation that follows the branch destination information of each stage from the root node to the N-th node that is the final stage.
本発明によれば、ブランチノードはリンク先を識別する代表ノード番号を含まないので、ノードのサイズを小さくすることができる。例えばインデックキーの数が16とすると、リーフノードのサイズを規定するインデックスキーを表現するためのビット数は4である。一方、従来のブランチノードのサイズを規定する弁別ビット位置に必要なビット数は2、代表ノード番号に必要なビット数は、ルートノードを含めたリンク先となるノード対の数が1+1+2+4+8=16であることから4であるので、必要なビット数は合計で6となる。 According to the present invention, since the branch node does not include the representative node number for identifying the link destination, the size of the node can be reduced. For example, if the number of index keys is 16, the number of bits for expressing an index key that defines the size of a leaf node is four. On the other hand, the number of bits necessary for the discrimination bit position that defines the size of the conventional branch node is 2, and the number of bits necessary for the representative node number is 1 + 1 + 2 + 4 + 8 = 16, which is the number of node pairs as link destinations including the root node. Since it is 4, the total number of required bits is 6.
したがって、従来のブランチノードは、リーフノードと比べて大きな記憶容量を必要としていた。この記憶容量の差は、インデックスキーの数が大きくなるとさらに拡大する。しかし、本発明によれば、代表ノード番号を格納する記憶領域が必要なくなることから、カップルドノードツリーを配置する配列のサイズを小さくすることができる。 Therefore, the conventional branch node requires a larger storage capacity than the leaf node. This difference in storage capacity further increases as the number of index keys increases. However, according to the present invention, since the storage area for storing the representative node number is not necessary, the size of the array for arranging the coupled node tree can be reduced.
さらに、本発明によれば、カップルドノードツリーを配置する配列のサイズを小さくすることに加えて、検索処理におけるノード種別の判定による分岐動作が削除されるので、処理速度を向上させることができる。 Furthermore, according to the present invention, in addition to reducing the size of the array in which the coupled node tree is arranged, the branch operation based on the determination of the node type in the search process is deleted, so that the processing speed can be improved. .
次に図2A〜図4を参照して、本発明の基本的な概念について説明する。
図2Aは、本発明の一実施形態における配列に配置されたカップルドノードツリーの構成例を説明する図である。図1Aに示す構成例と比べると、リーフノード、ブランチノードからノード種別を格納する領域を削除し、またブランチノードから代表ノード番号を格納する領域がなくなっている。また、図2Aに示す構成例では、後に説明する仮想的な配列番号は、配列番号と一致するものとしているので、表示されていない。
Next, the basic concept of the present invention will be described with reference to FIGS.
FIG. 2A is a diagram illustrating a configuration example of a coupled node tree arranged in an array according to an embodiment of the present invention. Compared to the configuration example shown in FIG. 1A, the area for storing the node type is deleted from the leaf node and the branch node, and the area for storing the representative node number from the branch node is eliminated. In the configuration example shown in FIG. 2A, a virtual array number described later is not displayed because it matches the array number.
本構成例は、リーフノードをツリーの最下段にのみに配置している。また、各ノードが配置される配列要素は、配列番号が、1から15への連続した番号のものが使用されている。そして、インデックスキー、検索キーは、本来のインデックスキー、検索キーに対して、ある特定のビット位置である最上位ビットに0を挿入したものとしている。なお、最上位ビットとして付加するビット値は、0ではなく1とすることもできる。要するに、同一のビット値を最上位ビットとして付加すればよい。また、特定のビット値を挿入するある特定のビット位置も、最上位のビット位置に限ることなく、任意のビット位置とすることができる。同一のビット値を挿入したビット位置は、カップルドノードツリーの本来のブランチノードの弁別ビット位置に現れることはない。そこで、上記特定のビット位置を、後に説明するダミーのブランチノードの弁別ビット位置として用い、そのダミーのブランチノードをツリーに挿入することにより、リーフノードをツリーの最下段にのみに配置することを可能としている。 In this configuration example, leaf nodes are arranged only at the bottom level of the tree. In addition, as the array element in which each node is arranged, an array element having a sequence number from 1 to 15 is used. In the index key and search key, 0 is inserted in the most significant bit which is a specific bit position with respect to the original index key and search key. The bit value added as the most significant bit can be 1 instead of 0. In short, the same bit value may be added as the most significant bit. Also, a specific bit position into which a specific bit value is inserted is not limited to the most significant bit position, and can be an arbitrary bit position. The bit position into which the same bit value is inserted does not appear in the discrimination bit position of the original branch node of the coupled node tree. Therefore, the specific bit position is used as a discrimination bit position of a dummy branch node, which will be described later, and the dummy branch node is inserted into the tree so that the leaf node is arranged only at the bottom stage of the tree. It is possible.
図2Aを参照すると、ルートノード401が配列400の配列番号1の配列要素に配置されている。ルートノード401は弁別ビット位置403で構成されている。弁別ビット位置403には2が格納されている。
Referring to FIG. 2A, the root node 401 is arranged in the array element of
配列番号が1であるルートノード401からの点線の矢印410で示すリンク先ノード対411の代表ノードであるノード[0]412は、ツリー上で直近上位に位置する親ノードであるルートノード401の配列番号1の2倍の値を持つ配列番号2の配列要素に配置されている。そして隣接する次の配列要素(配列番号3)に代表ノードと対になるノード[1]413が配置されている。
The node [0] 412 that is the representative node of the link destination node pair 411 indicated by the dotted-
ノード[0]412の弁別ビット位置には0が格納されており、そのリンク先は、点線の矢印440で示すように、ノード[0]412の配列番号2の2倍の配列番号4の配列要素に格納されたノード442である。また、ノード442の弁別ビット位置には0が格納されており、そのリンク先は、点線の矢印450で示すように、ノード442の配列番号4の2倍の配列番号4の配列要素に格納されたノード452である。
0 is stored in the discrimination bit position of the node [0] 412, and the link destination is an array of the
ノード452は、図2Aに例示するカップルドノードツリーの最下段に位置するので、リーフノードであり、インデックスキー418には最上位ビットに0が挿入されたインデックスキー“00001”が格納されている。
図2Aに示す例では、インデックスキー“00001”は、ルートノード401の弁別ビット位置403のビット位置2におけるビット値0によりすでに他の配列要素に格納されたインデックスキーとは弁別されている。したがって、ルートノードの直近下位の配列番号2の配列要素に格納されたノードが本来のリーフノードの位置であるが、本実施形態においてはリーフノードであることを識別するノード種別を用いないので、弁別ビット位置が最上位ビット位置の0であるダミーのブランチノード412、442を挿入して最下段に位置するようにしている。なお、図2Aに示す配列番号5の配列要素が空きとなっているように、2段目のダミーのブランチノード442と対をなすノードは実質的に存在しない空きノードとなる。
Since the
In the example shown in FIG. 2A, the index key “00001” is distinguished from the index key already stored in another array element by the
一方、ノード[1]413の弁別ビット位置には4が格納されている。配列番号が3であるブランチノード413からの点線の矢印420で示すリンク先ノード対421の代表ノードであるノード422は、親ノードであるノード413の配列番号3の2倍の値を持つ配列番号6の配列要素に配置されている。そして隣接する次の配列要素(配列番号7)に代表ノードと対になるノード423が配置されている。ノード422の弁別ビット位置には5が格納されている。また、ノード423の弁別ビット位置には6が格納されている。
On the other hand, 4 is stored in the discrimination bit position of the node [1] 413. The
配列番号が6であるブランチノード422からの点線の矢印430で示すリンク先ノード対431の代表ノードであるノード432は、配列番号12の配列要素に配置されている。そして隣接する次の配列要素(配列番号13)に代表ノードと対になるノード433が配置されている。ノード432及びノード433の内容の記載は省略されている。また、ブランチノード423のリンク先の記載も省略されている。
A
図2Bは、本発明の一実施形態におけるカップルドノードツリーのツリー構造を概念的に示す図である。図2Bに示すツリー構造を、図1Bに示すツリー構造と比較すると、先に述べたように、ブランチノードとリーフノードからノード種別がなくなり、ブランチノードからは代表ノード番号もなくなっている。代表ノード番号は、ブランチノードの配列番号を2倍することにより得られるので、代表ノード番号によるリンク先への結合を、代表ノード番号の符号を付した点線の矢印により表している。また、各ノードの近傍に、各ノードが配置される配列要素の配列番号を、ルートノード210aに対して、[1]のように表示している。また、図2Bの説明においても、図2Aの例示と同様に、後に説明する仮想的な配列番号は、配列番号と一致するものとしているので、表示されていない。
FIG. 2B is a diagram conceptually showing a tree structure of a coupled node tree in one embodiment of the present invention. When the tree structure shown in FIG. 2B is compared with the tree structure shown in FIG. 1B, as described above, the node type disappears from the branch node and the leaf node, and the representative node number disappears from the branch node. Since the representative node number is obtained by doubling the array number of the branch node, the connection to the link destination by the representative node number is represented by a dotted arrow with a symbol of the representative node number. Further, the array element number of the array element in which each node is arranged in the vicinity of each node is displayed as [1] with respect to the
さらに、図2Bに示すツリー構造を、図1Bに示すツリー構造と比較すると、図2Bに示すツリー構造では、リーフノードに格納された各インデックスキーの最上位のビット位置に0が追加され、ビット長が6ビットから7ビットになっている。それに伴い、図1Bに示すブランチノードと同一の符号を付したブランチノードの弁別ビット位置は1つシフトされ、値が1つ大きくなっている。 Furthermore, when the tree structure shown in FIG. 2B is compared with the tree structure shown in FIG. 1B, in the tree structure shown in FIG. 2B, 0 is added to the most significant bit position of each index key stored in the leaf node. The length is changed from 6 bits to 7 bits. Accordingly, the discrimination bit position of the branch node denoted by the same reference numeral as that of the branch node shown in FIG. 1B is shifted by one, and the value is increased by one.
また、図1Bに示すツリー構造における段数は5段であるので、図2Bに示すツリー構造においては、最下段である5段目にのみリーフノードが位置している。そして、図1Bに示すツリー構造において5段目より上位の階層に位置するリーフノードは、弁別ビット位置が0のダミーのブランチノードとなっている。そして、ダミーのブランチノードの直近下位のノードが5段目のノードとなるまで、ダミーのブランチノードが挿入されている。 Further, since the number of stages in the tree structure shown in FIG. 1B is five, in the tree structure shown in FIG. 2B, leaf nodes are located only at the fifth stage, which is the lowest stage. In the tree structure shown in FIG. 1B, the leaf node located in the hierarchy higher than the fifth level is a dummy branch node whose discrimination bit position is 0. The dummy branch nodes are inserted until the node immediately below the dummy branch node becomes the fifth-stage node.
なお、図2Bに示す例示では、最上位ビットとして0を付加しているため、例えば本来的なインデックスキー“000111”はリーフノード210jに格納されているが、最上位ビットとして1を付加した場合はリーフノード211jに格納することは明らかである。
In the example shown in FIG. 2B, since 0 is added as the most significant bit, for example, the original index key “000111” is stored in the leaf node 210j, but 1 is added as the most significant bit. Is stored in the
図3は、本発明を実施するためのハードウェア構成例を説明する図である。本発明の検索装置による検索処理は中央処理装置302及びキャッシュメモリ303を少なくとも備えたデータ処理装置301によりデータ格納装置308を用いて実施することができる。カップルドノードツリーが配置される配列309と検索中にたどるノードが格納された配列要素の配列番号を記憶する探索経路スタック310、及びカップルドノードツリーに格納されたブランチノードの弁別ビット位置と検索キーの該弁別ビット位置のビット値により決定される分岐先を示す分岐先情報を格納する分岐先配列311を有するデータ格納装置308は、主記憶装置305または外部記憶装置306で実現することができ、あるいは通信装置307を介して接続された遠方に配置された装置を用いることも可能である。
なお、リーフノードにインデックスキーではなくインデックスキーにアクセスするための情報を格納する場合には、データ格納装置には、インデックスキーを記憶する記憶領域が設けられる。
FIG. 3 is a diagram for explaining a hardware configuration example for carrying out the present invention. The search processing by the search device of the present invention can be performed using the data storage device 308 by the data processing device 301 including at least the
When storing information for accessing the index key instead of the index key in the leaf node, the data storage device is provided with a storage area for storing the index key.
図3の例示では、主記憶装置305、外部記憶装置306及び通信装置307が一本のバス304によりデータ処理装置301に接続されているが、接続方法はこれに限るものではない。また、主記憶装置305をデータ処理装置301内のものとすることもできるし、探索経路スタック310を中央処理装置302内のハードウェアとして実現することも可能である。あるいは、配列309は外部記憶装置306に、探索経路スタック310と分岐先配列311を主記憶装置305に、持つなど、使用可能なハードウェア環境、インデックスキー集合の大きさ等に応じて適宜ハードウェア構成を選択できることは明らかである。
また、特に図示されてはいないが、処理の途中で得られた各種の値を後の処理で用いるためにそれぞれの処理に応じた一時記憶装置が用いられることは当然である。
In the example of FIG. 3, the
Further, although not particularly illustrated, it is natural that a temporary storage device corresponding to each process is used in order to use various values obtained during the process in a later process.
図4は、本発明の一実施形態による検索処理の概念を説明する図である。
図3に示すカップルドノードツリーを格納する配列309は、ブランチノードを格納するブランチノード配列309aとリーフノードを格納するリーフノード配列309bに分離されている。それぞれの配列には、図2Bに示すカップルドノードツリー200bのブランチノードとリーフノードが格納されている。
FIG. 4 is a diagram illustrating the concept of search processing according to an embodiment of the present invention.
The array 309 for storing the coupled node tree shown in FIG. 3 is separated into a branch node array 309a for storing branch nodes and a leaf node array 309b for storing leaf nodes. Each array stores a branch node and a leaf node of the coupled node tree 200b shown in FIG. 2B.
ブランチノード配列309aとリーフノード配列309bの配列要素には、それぞれの配列番号730a、730bに加えて、それぞれノード参照番号720a、720bが付されている。そして、ブランチノード配列309aとリーフノード配列309bには、さらにベース番号700a、700bがそれぞれ付されている。ノード参照番号は、いわば仮想的なあるいは論理的な配列番号であり、1から始まる連続番号である。
In addition to the
ベース番号は配列の配列要素のノード参照番号を1番から開始するためのものである。ベース番号とノード参照番号の和が配列番号となる。図4の例では、ブランチノード配列309aの配列番号730aの先頭の値は11であるから、ベース番号700aの値を10とすることにより、ノード参照番号720aの値は1から始まるものとなる。リーフノード配列309bの配列番号730bの先頭の値は51であるから、ベース番号700bの値を50とすることにより、ノード参照番号720bの値は、ノード参照番号720aと同様に、1から始まるものとなる。
ベース番号とノード参照番号を導入することにより、ブランチノード配列309aとリーフノード配列309bの配列内での配置の自由度を高めることができる。また、ブランチノード配列309aとリーフノード配列309bを格納する記憶手段の選択度も高めることができる。
なお、ベース番号を0とするとノード参照番号と配列番号は等しくなる。ブランチノード配列とリーフノード配列を分離せず、ベース番号を0とした配列に格納されたカップルドノードツリーの構成例が、図2Aに例示するものである。また、ブランチノード配列とリーフノード配列を分離せず、ベース番号を0とした配列に格納されたカップルドノードツリーのツリー構造を概念的に示す図が、図2Bである。
The base number is for starting the node reference number of the array element of the array from the first. The sum of the base number and the node reference number is the array number. In the example of FIG. 4, since the top value of the array number 730a of the branch node array 309a is 11, the value of the node reference number 720a starts from 1 by setting the value of the base number 700a to 10. Since the leading value of the
By introducing the base number and the node reference number, the degree of freedom of arrangement within the branch node array 309a and the leaf node array 309b can be increased. In addition, the selectivity of the storage means for storing the branch node array 309a and the leaf node array 309b can be increased.
If the base number is 0, the node reference number and the array number are equal. A configuration example of a coupled node tree stored in an array in which the base number is 0 without separating the branch node array and the leaf node array is illustrated in FIG. 2A. Further, FIG. 2B is a diagram conceptually showing a tree structure of a coupled node tree stored in an array in which the base number is 0 without separating the branch node array and the leaf node array.
図4には、さらに、検索キー280と分岐先配列311が記載されている。検索キー280にはビット列“0011010”が格納されている。
ブランチノード配列309aのノード参照番号720aの値1の配列要素(以下、ノード参照番号1の配列要素のようにいう。)には、ルートノード220aの弁別ビット位置の値1(以下、弁別ビット位置1のようにいう。)が格納され、検索キー280に格納されたビット列のビット位置1のビット値が0であるので、分岐先配列の配列番号1の配列要素には0が格納される。
この分岐先配列の配列番号1の配列要素に格納された分岐先情報0は、検索キー280で図2Bに示すカップルドノードツリーを検索すると、ルートノード210aの直近下位のノード対210bにおいて、ノード位置が0であるノード210bにサーチパスが分岐することを示している。
FIG. 4 further shows a search key 280 and a branch destination array 311. The search key 280 stores a bit string “0011010”.
The array element with the
The
次に、ブランチノード配列309aのノード参照番号2の配列要素には、ノード210bの弁別ビット位置2が格納され、検索キー280に格納されたビット列のビット位置2のビット値が1であるので、分岐先配列の配列番号2の配列要素には1が格納される。
以下同様に、ブランチノード配列309aのノード参照番号3の配列要素には、ノード211bの弁別ビット位置3が格納され、検索キー280に格納されたビット列のビット位置3のビット値が1であるので、分岐先配列の配列番号3の配列要素には1が格納される。
Next, the
Similarly, the
ブランチノード配列309aのノード参照番号5の配列要素には、ノード211cの弁別ビット位置3が格納され、検索キー280に格納されたビット列のビット位置3のビット値が1であるので、分岐先配列の配列番号5の配列要素には1が格納される。
ブランチノード配列309aのノード参照番号6の配列要素には、弁別ビット位置6が格納され、検索キー280に格納されたビット列のビット位置6のビット値が0であるので、分岐先配列の配列番号6の配列要素には0が格納される。
In the array element of the
The
ブランチノード配列309aのノード参照番号7の配列要素には、弁別ビット位置4が格納され、検索キー280に格納されたビット列のビット位置4のビット値が0であるので、分岐先配列の配列番号4の配列要素には0が格納される。
ブランチノード配列309aのノード参照番号10の配列要素には、弁別ビット位置6が格納され、検索キー280に格納されたビット列のビット位置6のビット値が0であるので、分岐先配列の配列番号10の配列要素には0が格納される。
The
The
ブランチノード配列309aのノード参照番号11の配列要素には、ノード211dの弁別ビット位置0が格納され、検索キー280に格納されたビット列のビット位置0のビット値が0であるので、分岐先配列の配列番号11の配列要素には0が格納される。同様に、その他のブランチノード配列309aの、弁別ビット位置0が格納された配列要素のノード参照番号と同一の値の配列番号が指す分岐先配列311の配列要素には0が格納される。
Since the
本発明の一実施形態においては、ビット列検索の対象となるビット列の集合からブランチノード配列309aとリーフノード配列309bが生成されており、検索キー280が指定されると、検索キー280とブランチノード配列により分岐先配列311が生成される。
そして、分岐先配列により、検索結果であるインデックスキーが格納されたリーフノード配列の配列番号を求める。
In one embodiment of the present invention, a branch node array 309a and a leaf node array 309b are generated from a set of bit strings to be subjected to bit string search, and when the search key 280 is designated, the search key 280 and the branch node array As a result, a branch destination array 311 is generated.
Then, the array element number of the leaf node array storing the index key as the search result is obtained from the branch destination array.
まず、分岐先配列311の配列番号1の太枠で示した配列要素に格納された分岐先情報(以下、配列番号1の分岐先情報のようにいう。)を読み出し、配列番号を2倍した値に加えて、次に読み出す分岐先情報が格納されて配列要素の配列番号を求める。図4の例示では、図2Bにおける表記と同様に符号を付した点線の矢印220aで示すように、配列番号1を2倍して0を加えて配列番号2を求める。太枠で示した配列要素に格納された分岐先情報の値1を読み出す。
First, the branch destination information stored in the array element indicated by the thick frame of the
次に、点線の矢印220bで示すように、配列番号2の太枠で示した配列要素に格納された分岐先情報の値1を読み出し、配列番号2を2倍した値に加えて配列番号5を求める。
さらに、点線の矢印221cで示すように、配列番号5の太枠で示した配列要素に格納された分岐先情報の値1を読み出し、配列番号5を2倍した値に加えて配列番号11を求める。
Next, as indicated by the dotted
Further, as indicated by the dotted
次の分岐先は、カップルドノードツリーの最下段である。点線の矢印221iで示すように、配列番号11の太枠で示した配列要素に格納された分岐先情報の値0を読み出し、それを、配列番号11を2倍した値に加えて求められる値からブランチノード配列309aの最大のノード参照番号である15を減じてリーフノード配列309bのノード参照番号7を得る。太枠で示したリーフノード配列309bのノード参照番号7の配列要素に格納されたリーフノード210iからインデックスキー“0011010”を取り出して、検索処理を終了する。
The next branch destination is the lowest level of the coupled node tree. A value obtained by reading the
なお、上述の図4の例示では、ブランチノード配列309aとリーフノード配列309bが分離されたものとして説明し、リーフノード配列309bのノード参照番号7を求めるために、分岐先情報0を分区先配列の配列番号11を2倍した値に加えて求められる値からブランチノード配列309aの最大のノード参照番号である15を減じたが、ブランチノードとリーフノードを1つの配列に格納する場合は、ノード参照番号は一連の番号となるので、リーフノードの格納された配列要素のノード参照番号を求めるときに、ブランチノードを格納する最後の配列要素のノード参照番号を減じる必要はない。
In the example of FIG. 4 described above, it is assumed that the branch node array 309a and the leaf node array 309b are separated. In order to obtain the
次に、図5〜図7を参照して、本発明の一実施形態における検索処理について詳細に説明する。
図5は、本発明の一実施形態における検索処理の処理フロー例を示す図である。
Next, with reference to FIGS. 5 to 7, the search processing in one embodiment of the present invention will be described in detail.
FIG. 5 is a diagram showing an example of a processing flow of search processing in one embodiment of the present invention.
図5に示すように、まずステップS501において、検索キーを設定する。この検索キーの設定は、図4に示す例では、検索キー280にビット列“0011010”を設定することに相当する。
次にステップS502において、検索キーをもとに、ブランチノード配列から分岐先配列を求める。この処理は、図4に示す例では、先に説明した検索キー280とブランチノード配列309aから分岐先配列311を生成する処理に相当する。ステップS502の詳細な処理フローは、後に図6A及び図6Bを参照して説明する。
As shown in FIG. 5, first, in step S501, a search key is set. This search key setting corresponds to setting the bit string “0011010” in the search key 280 in the example shown in FIG.
In step S502, a branch destination array is obtained from the branch node array based on the search key. In the example shown in FIG. 4, this process corresponds to the process of generating the branch destination array 311 from the search key 280 and the branch node array 309a described above. The detailed processing flow of step S502 will be described later with reference to FIGS. 6A and 6B.
次にステップS503において、分岐先配列をもとに、リーフノード配列のノード参照番号を求める。この処理は、図4に示す例では、先に説明した分岐先配列の配列番号1の配列要素に格納された分岐先情報から配列番号11までの配列要素に格納された分岐先情報を順次読み出し、配列番号11の配列要素に格納された分岐先情報とブランチノード配列のノード参照番号の最大値にもとづいてリーフノード配列のノード参照番号を求める処理に相当する。ステップS503の詳細な処理フローは、後に図7A及び図7Bを参照して説明する。
In step S503, the node reference number of the leaf node array is obtained based on the branch destination array. In the example shown in FIG. 4, this processing sequentially reads the branch destination information stored in the array elements from the branch destination information stored in array element No. 1 of the branch destination array described above to the array elements of
最後に、ステップS504において、ステップS503で求めたノード参照番号の指すリーフノード配列の配列要素の内容をインデックスキーとして取り出し、処理を終了する。ここで、ステップS504で取り出したインデックスキーを検索結果キーとすることもできるし、該インデックスキーを検索キーと比較し、一致すれば検索成功とし、一致しなければ検索失敗とすることもできる。 Finally, in step S504, the content of the array element of the leaf node array pointed to by the node reference number obtained in step S503 is extracted as an index key, and the process ends. Here, the index key extracted in step S504 can be used as a search result key, or the index key is compared with the search key. If they match, the search can be successful, and if they do not match, the search can be failed.
図6Aは、検索キーによりブランチノード配列から分岐先配列を求める処理フロー例を説明する図であり、図5に示すステップS502の詳細な処理フローを説明する図である。図6Aに示す例では、ブランチノード配列に配置されたブランチノードの数はmとする。 FIG. 6A is a diagram illustrating an example of a processing flow for obtaining a branch destination array from a branch node array using a search key, and is a diagram illustrating a detailed processing flow of step S502 illustrated in FIG. In the example shown in FIG. 6A, the number of branch nodes arranged in the branch node array is m.
まず、ステップS600において、配列番号及びノード参照番号に1を設定する。
次にステップS601において、ノード参照番号1の指すブランチノード配列の配列要素に格納された弁別ビット位置と検索キーにより、配列番号1の指す分岐先配列の配列要素に分岐先情報を示すビット値を設定する。
First, in step S600, 1 is set to the array element number and the node reference number.
In step S601, a bit value indicating branch destination information is assigned to the array element of the branch destination array pointed to by
続いてステップS602において、ノード参照番号2の指すブランチノード配列の配列要素に格納された弁別ビット位置と検索キーにより、配列番号2の指す分岐先配列の配列要素に分岐先情報を示すビット値を設定する。
Subsequently, in step S602, a bit value indicating branch destination information is assigned to the array element of the branch destination array pointed to by
以下同様に、ステップS603〜ステップS60mにおいて、ノード参照番号3〜mの指すブランチノード配列の配列要素に格納された弁別ビット位置と検索キーにより、配列番号3〜mの指す分岐先配列の配列要素に分岐先情報を示すビット値をそれぞれ設定する。
Similarly, in step S603 to step S60m, the array element of the branch destination array indicated by
なお、図6Aに例示する処理フロー例は、特定の数であるm個のブランチノードが配置されたブランチノード配列により分岐先配列を生成するものであるが、個数mをパラメータとしたアセンブラマクロにより、任意の個数のブランチノードが配置されたブランチノード配列により分岐先配列を生成する処理を実現するための処理フローを生成することが可能である。 In the example of the processing flow illustrated in FIG. 6A, a branch destination array is generated by a branch node array in which a specific number of m branch nodes are arranged, but an assembler macro using the number m as a parameter is used. It is possible to generate a processing flow for realizing a process of generating a branch destination array from a branch node array in which an arbitrary number of branch nodes are arranged.
また、図6Aに例示するように、ブランチノード配列に配置された各弁別ビット位置に対応して、該弁別ビット位置を用いた処理を順次直列的に実行する処理フローに替えて、ブランチノード配列に配置された弁別ビット位置に対応する処理が全て終了したかを判定する判定処理を設け、終了していなければ次の弁別ビット位置を用いた処理を繰り返すループ処理を含む処理フローにより、同一の処理結果が得られることは明らかである。ステップS601〜ステップS60mの処理の詳細は、次に図6Bを参照して説明する。 Further, as illustrated in FIG. 6A, in correspondence with each discrimination bit position arranged in the branch node array, the branch node array is replaced with a processing flow that sequentially executes processing using the discrimination bit positions. A determination process for determining whether all the processes corresponding to the discrimination bit positions arranged in is completed, and if the process is not completed, the same processing flow including a loop process that repeats the process using the next discrimination bit position is performed. It is clear that a processing result is obtained. Details of steps S601 to S60m will be described with reference to FIG. 6B.
図6Bは、ブランチノード配列の配列要素に格納された弁別ビット位置と検索キーにより、分岐先配列の配列要素に分岐先情報を示すビット値を設定する処理フロー例を説明する図である。 FIG. 6B is a diagram for explaining an example of a processing flow in which a bit value indicating branch destination information is set in an array element of a branch destination array based on a discrimination bit position and a search key stored in the array element of the branch node array.
まずステップS610において、ブランチノード配列から、ノード参照番号の指す配列要素の内容を弁別ビット位置として読み出す。ステップS610の最初の処理では、図6AのステップS600における処理で、ノード参照番号に1が設定されている。 First, in step S610, the contents of the array element pointed to by the node reference number are read from the branch node array as a discrimination bit position. In the first process of step S610, 1 is set as the node reference number in the process of step S600 of FIG. 6A.
次にステップS611において、検索キーから、ステップS610で読み出した弁別ビット位置の指すビット値を取り出し、ステップS612において、該取り出したビット値を、配列番号の指す分岐先配列の配列要素に分岐先情報として設定する。ステップS612の最初の処理では、図6AのステップS600における処理で、配列番号に1が設定されている。 Next, in step S611, the bit value indicated by the discrimination bit position read in step S610 is extracted from the search key, and in step S612, the extracted bit value is stored in the array element of the branch destination array indicated by the array number. Set as. In the first process in step S612, 1 is set as the array element number in the process in step S600 of FIG. 6A.
次にステップS613において、配列番号に1を加え、ステップS614において、ノード参照番号に1を加えて処理を終了する。以上説明したステップS610〜ステップS614の処理がブランチノード配列の配列要素毎に順次実行されることにより、分岐先配列の配列要素に分岐先情報を順次設定することができる。 In step S613, 1 is added to the array element number. In step S614, 1 is added to the node reference number, and the process is terminated. The processing in steps S610 to S614 described above is sequentially executed for each array element in the branch node array, so that branch destination information can be sequentially set in the array elements in the branch destination array.
図7Aは、分岐先配列をもとにリーフノード配列のノード参照番号を求める処理フロー例を説明する図であり、図5に示すステップS503の詳細な処理フローを説明する図である。図7Aに示す例では、カップルドノードツリーの段数はnとする。 FIG. 7A is a diagram illustrating an example of a processing flow for obtaining a node reference number of a leaf node array based on a branch destination array, and is a diagram illustrating a detailed processing flow of step S503 illustrated in FIG. In the example shown in FIG. 7A, the number of stages of the coupled node tree is n.
まず、ステップS700で、配列番号に1を設定する。次にステップS701において、1段目のノード(ルートノード)に対応する配列番号(以下、1段目のノードの配列番号のようにいう。)、すなわち配列番号1の指す分岐先配列に格納された分岐先情報により、2段目のノードの配列番号を求める。
First, in step S700, 1 is set as the array element number. Next, in step S701, it is stored in the array element number corresponding to the first node (root node) (hereinafter referred to as the array element number of the first node), that is, the branch destination array indicated by
続いてステップS702において、2段目のノードの配列番号の指す分岐先配列に格納された分岐先情報により、3段目のノードの配列番号を求める。
以下同様に、ステップS703〜ステップS70n−2において、3段目〜n−2段目のノードの配列番号の指す分岐先配列に格納された分岐先情報により、それぞれ4段目〜n−1段目のノードの配列番号を求める。ステップS701〜ステップS70n−2の処理の詳細は、後に図7Bを参照して説明する。
Subsequently, in step S702, the array element number of the third stage node is obtained from the branch destination information stored in the branch destination array indicated by the array element number of the second stage node.
Similarly, in steps S703 to S70n-2, the fourth to n-1 stages are respectively determined according to the branch destination information stored in the branch destination arrays indicated by the array element numbers of the third to n-2 stage nodes. Find the array number of the eye node. Details of the processing in steps S701 to S70n-2 will be described later with reference to FIG. 7B.
最後にステップS70n−1において、n−1段目のノードの配列番号の指す分岐先配列に格納された分岐先情報により、リーフノード配列のノード参照番号を求めて処理を終了する。ステップS70n−1の処理の詳細は、後に図7Cを参照して説明する。
なお、図7Aに例示する処理フロー例は、特定の段数nを有する本実施形態のカップルドノードツリーを用いたものであるが、段数nをパラメータとしたアセンブラマクロにより、本実施形態の任意の段数のカップルドノードツリーを用いた検索処理を実現するための処理フローを生成することが可能である。
Finally, in step S70n-1, the node reference number of the leaf node array is obtained from the branch destination information stored in the branch destination array indicated by the array element number of the (n-1) th node, and the process is terminated. Details of the processing in step S70n-1 will be described later with reference to FIG. 7C.
Note that the processing flow example illustrated in FIG. 7A uses the coupled node tree of the present embodiment having a specific number of stages n. However, any assembler macro using the number of stages n as a parameter can be used for any of the embodiments. It is possible to generate a processing flow for realizing search processing using a coupled node tree having the number of stages.
また、図7Aに例示するように、分岐先配列に配置されたカップルドノードツリーの各段のノードの分岐先情報に対応して、該分岐先情報を用いた処理を順次直列的に実行する処理フローに替えて、最下段の1つ上位の段のノードの分岐先情報に対応する処理が終了したかを判定する判定処理を設け、終了していなければ次の段のノードの分岐先情報を用いた処理を繰り返すループ処理を含む処理フローにより、同一の処理結果が得られることは明らかである。 Further, as illustrated in FIG. 7A, processing using the branch destination information is sequentially executed in series corresponding to the branch destination information of the nodes of each stage of the coupled node tree arranged in the branch destination array. In place of the processing flow, a determination process is provided for determining whether the processing corresponding to the branch destination information of the node at the uppermost level of the lowest level has been completed. If not, the branch destination information of the node at the next level It is clear that the same processing result can be obtained by the processing flow including the loop processing that repeats the processing using.
図7Bは、分岐先情報により次段のノードの配列号を求める処理フロー例を説明する図であり、図7Aに示すステップS702〜ステップS70n−2の処理の詳細な処理フローを説明する図である。 FIG. 7B is a diagram for explaining an example of a processing flow for obtaining the array number of the next-stage node from the branch destination information, and is a diagram for explaining a detailed processing flow of the processing in steps S702 to S70n-2 shown in FIG. 7A. is there.
図に示すように、まずステップS711において、分岐先配列から、配列番号の指す分岐先情報を読み出す。ステップS711の最初の処理では、図7AのステップS700における処理で、配列番号に1が設定されている。 As shown in the figure, first, in step S711, the branch destination information indicated by the array element number is read from the branch destination array. In the first process of step S711, 1 is set as the array element number in the process of step S700 of FIG. 7A.
次にステップS712において、配列番号を2倍し、ステップS713において、配列番号にステップS711で得た分岐先情報を加えて処理を終了する。
上述の図7Bの処理は、図4に示す例示では、点線の矢印220a、220b、221cで示す処理である。例えば点線の矢印220bで示すように、配列番号2の太枠で示した配列要素に格納された分岐先情報の値1を読み出し、配列番号2を2倍した値に加えて配列番号5を求める処理である。
Next, in step S712, the array element number is doubled, and in step S713, the branch destination information obtained in step S711 is added to the array element number, and the process ends.
The process of FIG. 7B described above is a process indicated by dotted
図7Cは、分岐先情報によりリーフノード配列のノード参照番号を求める処理フロー例を説明する図であり、図7Aに示すステップS70n−1の詳細な処理フローを説明する図である。 FIG. 7C is a diagram illustrating an example of a processing flow for obtaining a node reference number of a leaf node array based on branch destination information, and is a diagram illustrating a detailed processing flow of step S70n-1 illustrated in FIG. 7A.
図に示すように、まずステップS721において、分岐先配列から、(n−1)段目のノードの配列番号の指す分岐先情報を読み出す。(n−1)段目のノードの配列番号は、図7AのステップS70n−2における処理で、設定されている。 As shown in the figure, first, in step S721, the branch destination information indicated by the array element number of the (n−1) -th node is read from the branch destination array. The array element number of the (n-1) -th node is set by the process in step S70n-2 of FIG. 7A.
次にステップS722において、配列番号を2倍し、ステップS723において、配列番号にステップS711で得た分岐先情報を加えた値をリーフノード配列のノード参照番号に設定する。 Next, in step S722, the array element number is doubled, and in step S723, a value obtained by adding the branch destination information obtained in step S711 to the array element number is set as the node reference number of the leaf node array.
そしてさらにステップS724において、ステップS723で設定したリーフノード配列のノード参照番号からブランチノード配列のノード参照番号の最大値を減じた値をリーフノード配列のノード参照番号に設定して処理を終了する。 In step S724, the value obtained by subtracting the maximum value of the node reference number of the branch node array from the node reference number of the leaf node array set in step S723 is set as the node reference number of the leaf node array, and the process is terminated.
上述の図7Cの処理は、図4に示す例示では、点線の矢印221iで示す処理である。
先に述べたように、ブランチノードとリーフノードを1つの配列に格納する場合は、ノード参照番号は一連の番号となるので、リーフノードの格納された配列要素のノード参照番号を求めるときに、ブランチノードを格納する最後の配列要素のノード参照番号を減じる必要はない。したがって、その場合には、図7Cに示すステップS724の処理は処理フローから削除される。
The process of FIG. 7C described above is a process indicated by a dotted
As described above, when the branch node and the leaf node are stored in one array, the node reference number is a series of numbers. Therefore, when obtaining the node reference number of the array element in which the leaf node is stored, There is no need to decrement the node reference number of the last array element that stores the branch node. Therefore, in that case, the process of step S724 shown in FIG. 7C is deleted from the process flow.
図8は、本発明の一実施形態におけるビット列検索装置の機能ブロック構成例を説明する図である。
図8に例示する本実施態様に係るビット列検索装置800は、検索ツリー記憶手段810、検索開始位置設定手段820、検索キー設定手段850、分岐先情報設定実行部802、分岐先情報記憶手段812、初段ノード分岐先情報格納位置設定手段880、次段ノード分岐先情報格納位置計算実行部804、及びリーフノード出力実行部806を備えている。
FIG. 8 is a diagram illustrating an example of a functional block configuration of the bit string search device according to the embodiment of the present invention.
The bit string search apparatus 800 according to this embodiment illustrated in FIG. 8 includes a search
検索ツリー記憶手段810の記憶領域には配列が確保され、その配列に本発明の一実施形態に係るカップルドノードツリーが配置される。カップルドノードツリーは、図4に例示するように、ブランチノードを格納するブランチノード配列とリーフノードを格納するリーフノード配列に分離して配置することもできる。
検索開始位置設定手段820は、検索開始ノードのノード参照番号に、ルートノードのノード参照番号である1を設定するとともに、分岐先情報を格納する分岐先配列の配列番号に1を設定する。検索開始位置設定手段820の機能は、図6Aに示すステップS600の処理に対応する。また、検索キー設定手段850には、検索キーが設定される。
An array is secured in the storage area of the search
The search start position setting means 820
分岐先情報設定実行部802は、ブランチノード読出手段8301〜830m及び分岐先情報抽出手段8601〜860mを含む。mは検索ツリー記憶手段810に格納されたブランチノードの数である。図4に示す例では、m=15である。
ブランチノード読出手段8301〜830mは、検索ツリー記憶手段810に配置されたブランチノード配列から、ノード参照番号の指す配列要素の内容を弁別ビット位置として読み出し、分岐先配列の配列番号とともに分岐先情報抽出手段に出力する。そして、分岐先配列の配列番号とブランチノード配列のノード参照番号にそれぞれ1を加えて次のブランチノード読出手段に出力する。
The branch destination information setting execution unit 802 includes branch node reading means 8301 to 830m and branch destination
The branch node reading means 8301 to 830m read the contents of the array element indicated by the node reference number from the branch node array arranged in the search tree storage means 810 as the discrimination bit position, and extract branch destination information together with the array number of the branch destination array Output to the means. Then, 1 is added to the array element number of the branch destination array and the node reference number of the branch node array, and the result is output to the next branch node reading means.
分岐先情報抽出手段8601〜860mは、検索キー設定手段850に設定された検索キーから、ブランチノード読出手段8301〜830mが出力した弁別ビット位置の指すビット値を取り出し、該ビット値を、ブランチノード読出手段8301〜830mが出力した配列番号が指す分岐先配列の配列要素に、分岐先情報として設定する。ブランチノード読出手段8301と分岐先情報抽出手段8601の機能は、図6Aに示すステップS601の処理に対応する。同様に、ブランチノード読出手段830mと分岐先情報抽出手段860mまでの各ブランチノード読出手段と分岐先情報抽出手段の機能は、図6Aに示すステップS60mまでの各処理に対応する。
分岐先配列は、分岐先情報記憶手段812の記憶領域に確保される。
The branch destination information extracting means 8601-860m takes out the bit value indicated by the discrimination bit position output from the branch node reading means 8301-830m from the search key set in the search key setting means 850, and uses the bit value as the branch node. It is set as branch destination information in the array element of the branch destination array indicated by the array element number output by the reading means 8301 to 830m. The functions of the branch
The branch destination array is secured in the storage area of the branch destination
初段ノード分岐先情報格納位置設定手段880は、分岐先配列の配列番号に1を設定する。初段ノード分岐先情報格納位置設定手段880の機能は、図7Aに示すステップS700の処理に対応する。
First stage node branch destination information storage position setting means 880
次段ノード分岐先情報格納位置計算実行部804は、次段ノード分岐先情報格納位置計算算手段8401〜840n−2を含む。nは、カップルドノードツリーの段数である。 The next-stage node branch destination information storage position calculation execution unit 804 includes next-stage node branch destination information storage position calculation calculation means 8401 to 840n-2. n is the number of stages in the coupled node tree.
次段ノード分岐先情報格納位置計算手段8401〜840n−2は、分岐先配列から、配列番号の指す分岐先情報を読み出し、配列番号を2倍し、2倍した配列番号に分岐先情報を加えた値を次段のノードに対応する分岐先情報の格納された分岐先配列の配列要素の配列番号として求める。次段ノード分岐先情報格納位置計算手段8401〜840n−2の機能は、図7Aに示すステップS701〜S70n−2の処理にそれぞれ対応する。 Next-stage node branch destination information storage position calculation means 8401 to 840n-2 reads the branch destination information pointed to by the array element number from the branch object array, doubles the array element number, and adds the branch destination information to the array element number multiplied by 2. Is obtained as the array element number of the array element of the branch destination array in which the branch destination information corresponding to the next node is stored. The functions of the next-stage node branch destination information storage position calculation means 8401 to 840n-2 correspond to the processes of steps S701 to S70n-2 shown in FIG. 7A, respectively.
次段ノード分岐先情報格納位置計算手段8401が分岐先情報を読み出すための配列番号は、初段ノード分岐先情報格納位置設定手段880が設定したものである。次段ノード分岐先情報格納位置計算手段8402〜840n−2が分岐先情報を読み出すための配列番号は、それぞれ前の段の次段ノード分岐先情報格納位置計算手段が求めた配列番号である。
次段ノード分岐先情報格納位置計算手段840n−2が求めた配列番号は、次に説明するリーフノード出力実行部806に入力され、リーフノードの読み出しに用いられる。
The array element number for the next stage node branch destination information storage position calculation means 8401 to read the branch destination information is set by the first stage node branch destination information storage position setting means 880. The array element numbers for the next-stage node branch destination information storage position calculation means 8402 to 840n-2 to read the branch destination information are array numbers obtained by the next-stage node branch destination information storage position calculation means of the previous stage.
The array element number obtained by the next-stage node branch destination information storage position calculation means 840n-2 is input to a leaf node output execution unit 806, which will be described next, and used for reading the leaf node.
リーフノード出力実行部806は、リーフノード格納位置計算手段8061及び検索結果出力手段8062を含む。
リーフノード格納位置計算手段8061は、次段ノード分岐先情報格納位置計算手段840n−2が求めた配列番号の指す分岐先情報を読み出し、配列番号を2倍し、2倍した配列番号に分岐先情報を加えた値をリーフノード配列の配列要素の仮のノード参照番号として求める。そして、仮のノード参照番号からブランチノード配列のノード参照番号の最大値、すなわち検索ツリー記憶手段810に格納されたブランチノードの数mを減じた値をリーフノード配列の配列要素のノード参照番号として求める。リーフノード格納位置計算手段8061の機能は、図7AのステップS70n−1、すなわち図7Cに示す処理に対応する。
The leaf node output execution unit 806 includes a leaf node storage
The leaf node storage position calculation means 8061 reads the branch destination information pointed to by the array number obtained by the next-stage node branch destination information storage position calculation means 840n-2, doubles the array number, and branches to the array number that is doubled. A value obtained by adding information is obtained as a temporary node reference number of the array element of the leaf node array. Then, a value obtained by subtracting the maximum value of the node reference numbers in the branch node array from the temporary node reference number, that is, the number m of branch nodes stored in the search
検索結果出力手段8062は、リーフノード格納位置計算手段8061が求めたリーフノード配列の配列要素のノード参照番号により、検索ツリー記憶手段810からリーフノードを読み出し、インデックスキーあるいはインデックスキーにアクセスするための情報を取り出す。リーフノードから取り出すものがインデックスキーであるときは、そのインデックスキーを検索結果キーとして出力する。リーフノードから取り出すものがインデックスキーにアクセスするための情報であるときは、取り出したインデックスキーにアクセスするための情報に基づき、インデックスキーを読み出して検索結果キーとして出力する。
また、検索結果キーと検索キーを比較し、一致すれば検索成功とし、一致しなければ検索失敗とする検索結果を出力することも可能である。
The search
It is also possible to compare the search result key with the search key and output a search result indicating that the search is successful if they match, and that the search fails if they do not match.
次に、本発明の一実施形態に係るカップルドノードツリーの生成について説明する。なお、以下の説明において、本発明の一実施形態に係るカップルドノードツリーをポインタレスツリーといい、従来のカップルドノードツリーを単にツリー、あるいは変換前のツリーということがある。
本発明のポインタレスツリーの生成は、例えば次のようにして実現することができる。すなわち、ポインタレスツリーを生成する際には、ポインタレスツリーに格納されるインデックスキーにより、図1A及び図1Bに例示する形態のツリーが生成されているものとする。そして、ポインタレスツリーの生成は、ツリーのノードをルートノードから順次巡回し、本発明の一実施形態のノードに変換することにより、実現される。
ツリーの生成は、前記特許文献1として引用した特開2008−15872号公報の図5〜図8及びそれに関連した明細書の記載に開示され、詳細に説明されているので、ここでの説明は省略する。
Next, generation of a coupled node tree according to an embodiment of the present invention will be described. In the following description, a coupled node tree according to an embodiment of the present invention may be referred to as a pointerless tree, and a conventional coupled node tree may be simply referred to as a tree or a tree before conversion.
The generation of the pointerless tree according to the present invention can be realized as follows, for example. That is, when the pointerless tree is generated, it is assumed that the tree in the form illustrated in FIGS. 1A and 1B is generated by the index key stored in the pointerless tree. Then, the generation of the pointerless tree is realized by sequentially traversing the nodes of the tree from the root node and converting them into the nodes of one embodiment of the present invention.
The generation of the tree is disclosed and described in detail in FIGS. 5 to 8 of Japanese Patent Application Laid-Open No. 2008-15872 cited as
図9Aは、本発明の一実施形態におけるポインタレスツリーを生成する処理の前段の処理フロー例を説明する図である。図9Aに示すように、まずステップS901において、ポインタレスツリーを生成するための配列(ブランチノード配列とリーフノード配列)を取得し、ステップS902おいて、配列要素を初期化する。このステップS902の処理は、ダミーのブランチノードを用いるために必要となるものである。 FIG. 9A is a diagram illustrating an example of a processing flow in the previous stage of processing for generating a pointerless tree according to an embodiment of the present invention. As shown in FIG. 9A, first, in step S901, an array (branch node array and leaf node array) for generating a pointerless tree is acquired, and in step S902, array elements are initialized. The processing in step S902 is necessary to use a dummy branch node.
次にステップS902aにおいて変換前のツリーの最大段数を求め、ステップS902bにおいて該最大段数を段数カウンタの上限値に設定する。
ステップS902aの処理の詳細については、後に図12A及び図12Bを参照して説明する。
Next, in step S902a, the maximum number of stages of the tree before conversion is obtained, and in step S902b, the maximum number of stages is set as the upper limit value of the stage number counter.
Details of the processing in
次にステップS903において、ブランチノード配列とリーフノード配列のベース番号を設定し、ステップS905において、段数カウンタに1を設定する。次にステップS906において、ノード参照番号に1を設定し、ステップS907において、配列番号に、ツリーのルートノードの配列番号を設定する。さらにステップS908において、探索経路スタックに配列番号と段数カウンタのカウント値を格納して図9Bに示すステップS913に進む。 In step S903, the base numbers of the branch node array and the leaf node array are set, and in step S905, 1 is set in the stage number counter. In step S906, 1 is set as the node reference number, and in step S907, the array element number of the root node of the tree is set as the array element number. Further, in step S908, the array element number and the count value of the stage number counter are stored in the search path stack, and the process proceeds to step S913 shown in FIG. 9B.
図9Bは、本発明の一実施形態におけるポインタレスツリーを生成する処理の後段の処理フロー例を示す図である。図9Bに示すように、ステップS913において、変換前のツリーが格納された配列から、配列番号の指す配列要素をノードとして読み出す。ステップS913の最初の処理においては、配列番号にはステップS907でルートノードの配列番号が設定されている。2回目以降の処理においては、後に説明するステップS920あるいはステップS928で設定される。以下の説明において、ステップS913で読み出されたノードを巡回開始ノードということがある。
FIG. 9B is a diagram showing an example of a processing flow at the latter stage of the processing for generating the pointerless tree in one embodiment of the present invention. As illustrated in FIG. 9B, in step S913, the array element indicated by the array element number is read out as a node from the array in which the tree before conversion is stored. In the first process of step S913, the array element number of the root node is set to the array element number in step S907. In the second and subsequent processing, have in step S920 to be described later is set at step S928. In the following description, the node read in step S913 may be referred to as a tour start node.
次にステップS915において、ステップS913で読み出したノードからノード種別を取り出し、ステップS916で、該取り出したノード種別はブランチノードを示すものか判定する。ステップS916の判定が、ノード種別はブランチノードを示すものではなくリーフノードを示すものであればステップS922に進み、ブランチノードを示すものであれば、ステップS916aに進む。 In step S915, the node type is extracted from the node read in step S913. In step S916, it is determined whether the extracted node type indicates a branch node. If it is determined in step S916 that the node type does not indicate a branch node but indicates a leaf node, the process proceeds to step S922. If the node type indicates a branch node, the process proceeds to step S916a.
ステップS916aでは、ノード参照番号をもとに、ブランチノード配列の配列要素にノードを書き込む。ステップS916aの処理の詳細は、後に図10を参照して説明する。 In step S916a, the node is written to the array element of the branch node array based on the node reference number. Details of the processing in step S916a will be described later with reference to FIG.
次にステップS917において、段数カウンタに値1を加え、ステップS918に進み、ノード参照番号を2倍にする。さらにステップS919において、ステップS913で読み出したノードから、代表ノード番号を取り出し、ステップS920で、該取り出した代表ノード番号に値0を加えた値を配列番号に設定する。
そして、ステップS921において、探索経路スタックに、配列番号と段数カウンタのカウント値を格納してステップS913に戻る。ここで探索経路スタックに格納される配列番号は、ステップS920で代表ノード番号に値0を加えた値のものであるから、ノード[0]の配列番号である。
In step S917, a value of 1 is added to the stage number counter, and the flow advances to step S918 to double the node reference number. In step S919, the representative node number is extracted from the node read in step S913. In step S920, a value obtained by adding the
In step S921, the array element number and the count value of the stage number counter are stored in the search path stack, and the process returns to step S913. Here, since the array element number stored in the search path stack is the value obtained by adding the
上述のステップS913〜ステップS921のループ処理を、ステップS916においてノード種別がリーフノードを示すまで繰り返す。つまり、ひとまとまりの処理として、巡回開始ノードから最初のリーフノードまでノードを巡回してノードを読み出し、それを変換してポインタレスツリーのノードを書き込む。図9Bに示す処理フロー例では、ステップS920において、代表ノード番号に値0を加えて配列番号に設定していることから、ノード[0]側を優先してノードを巡回しているが、ノード[1]側を優先してノードを巡回することも可能であることは、以上の説明から当業者に明らかである。
The loop processing from step S913 to step S921 described above is repeated until the node type indicates a leaf node in step S916. That is, as a group of processes, the node is visited from the tour start node to the first leaf node, the node is read, the node is converted, and the node of the pointerless tree is written. In the example of the processing flow shown in FIG. 9B, since the array node number is set by adding the
一方ステップS916において、ノード種別はブランチノードを示すものではなくリーフノードを示すものと判定され、ステップS922に進むと、ノード参照番号をもとに、リーフノード配列の配列要素にノードを書き込む。ステップS922の処理の詳細は、後に図11を参照して説明する。 On the other hand, in step S916, the node type is determined not to indicate a branch node but to indicate a leaf node. When the process proceeds to step S922, the node is written to the array element of the leaf node array based on the node reference number. Details of the processing in step S922 will be described later with reference to FIG.
次にステップS923において、探索経路スタックのスタックポインタはツリーのルートノードの配列番号を指しているか判定する。
探索経路スタックのスタックポインタはツリーのルートノードの配列番号を指していれば、ツリーの全てのノードの処理は完了しているので処理を終了する。そうでなければ、ステップS924に進む。
In step S923, it is determined whether the stack pointer of the search path stack points to the array element number of the root node of the tree.
If the stack pointer of the search path stack points to the array element number of the root node of the tree, the processing is completed because the processing of all the nodes of the tree has been completed. Otherwise, the process proceeds to step S924.
ステップS924では、探索経路スタックから配列番号と段数カウンタのカウント値を取り出し、探索経路スタックのスタックポインタを1つ減らす。次にステップS928において、ステップS924で取り出した配列番号に値1を加えて、巡回開始ノードの配列番号としてノード[1]の配列番号を得る。そして、ステップS930で、ノード参照番号に1を加えてステップS913に戻る。
In step S924, the array element number and the count value of the stage number counter are extracted from the search path stack, and the stack pointer of the search path stack is decremented by one. Next, in step S928, the
上述のステップS913〜ステップS930のループ処理を、ステップS923において探索経路スタックのスタックポインタがツリーのルートノードの配列番号を指していると判定されるまで繰り返すことにより、ツリー上のすべてのノードの巡回が行われ、各ノードがポインタレスツリーのノードに変換されてポインタレスツリーが生成される。 The loop processing of steps S913 to S930 described above is repeated until it is determined in step S923 that the stack pointer of the search path stack points to the array element number of the root node of the tree. Each node is converted into a node of a pointerless tree, and a pointerless tree is generated.
図10は、本発明の一実施形態におけるブランチノードを生成する処理の処理フロー例を説明する図であり、図9Bに示すステップS916aの処理の詳細を説明する図である。 FIG. 10 is a diagram illustrating an example of a processing flow of processing for generating a branch node according to an embodiment of the present invention, and is a diagram illustrating details of processing in step S916a illustrated in FIG. 9B.
図に示すように、まずステップS1025において、配列番号に、ノード参照番号にブランチノード配列のベース番号を加えた値を設定する。そしてステップS1026で、ノードから弁別ビット位置を取り出し、ステップS1027で、該弁別ビット位置に値1を加え、ステップS1028において、ステップS1025で設定した配列番号の指すブランチノード配列の配列要素に弁別ビット位置を書き込み、ブランチノードを生成して処理を終了する。 As shown in the figure, first, in step S1025, a value obtained by adding the base number of the branch node array to the node reference number is set to the array element number. In step S1026, the discrimination bit position is extracted from the node. In step S1027, a value of 1 is added to the discrimination bit position. In step S1028, the discrimination bit position is added to the array element of the branch node array pointed to by the array element number set in step S1025. Is generated, a branch node is generated, and the process is terminated.
図11は、本発明の一実施形態におけるリーフノードを生成する処理の処理フロー例を説明する図であり、図9Bに示すステップS922の処理の詳細を説明する図である。 FIG. 11 is a diagram illustrating an example of a processing flow of processing for generating a leaf node according to an embodiment of the present invention, and illustrates details of the processing in step S922 illustrated in FIG. 9B.
図に示すように、まずステップS1129において、ノード参照番号と段数カウンタを退避し、ステップS1130に進む。
ステップS1130では、段数カウンタは上限値か判定し、上限値でなければ、ステップS1131でノード参照番号を2倍し、ステップS1132で段数カウンタに値1を加えてステップS1130に戻る。
As shown in the figure, first, in step S1129, the node reference number and the stage number counter are saved, and the process proceeds to step S1130.
In step S1130, it is determined whether the stage number counter is an upper limit value. If not, the node reference number is doubled in step S1131,
上述のステップS1130〜S1132のループ処理は、リーフノードをポインタレスツリーの最下段のレベルに配置するためのものである。図1B、図2Bの例示では、例えば図1Bの変換前のツリーでは3段目にあるリーフノード210cは、図2Bでは5段目のノード210jに変換されている。そして、図2Bにおけるノード210cの位置情報は、図11のステップS1129の処理により、退避される。
The loop processing of steps S1130 to S1132 described above is for placing leaf nodes at the lowest level of the pointerless tree. In the example of FIGS. 1B and 2B, for example, the
なお、段数カウンタの上限値については、図9Aに示すステップS902bで設定されているが、それに替えて、変換前のツリーを生成するときに、リーフノードを挿入するごとにそのリーフノードの段数をカウントし、その最大値をツリーの属性として記憶しておき、本発明の一実施形態のポインタレスツリーを生成するときに、その最大値を段数カウンタの上限値とすることができる。 The upper limit value of the stage number counter is set in step S902b shown in FIG. 9A. Instead, when generating a tree before conversion, the number of stages of the leaf node is set each time a leaf node is inserted. The maximum value is counted and stored as an attribute of the tree, and when the pointerless tree according to the embodiment of the present invention is generated, the maximum value can be used as the upper limit value of the stage number counter.
上述のステップS1130で、段数カウンタは上限値であると判定されると、ステップS1134に進む。ステップS1134では、段数カウンタの上限値から1を減じた値による2のべき乗の数値を求め、ノード参照番号から該数値を減じた値とリーフノード配列のベース番号との和を、リーフノード配列の配列番号に設定する。図2Bの例示では、段数カウンタの上限値は5であり、該上限値から1を減じた値による2のべき乗数は16となる。この値から1を減じた値15は、ブランチノード配列に配置されたブランチノードの数になる。ここでノード参照番号はブランチノード配列のノード参照番号であるから、このノード参照番号から15を減じた値は図4の例示で説明したように、リーフノード配列のノード参照番号である。そして、ノード参照番号とベース番号の和により、配列番号が求められる。
If it is determined in step S1130 that the stage number counter is the upper limit value, the process proceeds to step S1134. In step S1134, a numerical value of a power of 2 is obtained by subtracting 1 from the upper limit value of the stage number counter, and the sum of the value obtained by subtracting the numerical value from the node reference number and the base number of the leaf node array is calculated . Set to array number. In the example of FIG. 2B, the upper limit value of the stage number counter is 5, and the power of 2 by the value obtained by subtracting 1 from the upper limit value is 16. A
そしてステップS1135で、図9Bに示すステップS913で読み出されているノードからインデックスキーを取り出し、ステップS1136で、該インデックスキーの最上位のビット位置にビット値“0”を挿入し、ステップS1137において、ステップS1134で設定した配列番号の指すリーフノード配列の配列要素にインデックスキーを書き込み、リーフノードを生成してステップS1138に進む。
ステップS1138では、ノード参照番号と段数カウンタに、ステップS1129で退避したノード参照番号と段数カウンタをそれぞれ設定して処理を終了する。
In step S1135, the index key is extracted from the node read in step S913 shown in FIG. 9B. In step S1136, a bit value “0” is inserted into the most significant bit position of the index key. The index key is written in the array element of the leaf node array pointed to by the array element number set in step S1134, a leaf node is generated, and the process proceeds to step S1138.
In step S1138, the node reference number and stage number counter saved in step S1129 are set in the node reference number and stage number counter, respectively, and the process ends.
次に、変換前のツリーの最大段数を求める処理について図12A及び図12Bを参照して説明する。図12A及び図12Bに示す処理フロー例は、図9Aに示すステップS902aの処理の詳細を説明するものである。
図12Aは、変換前のツリーの最大段数を求める処理の前段の処理フロー例を説明する図である。
Next, processing for obtaining the maximum number of levels of a tree before conversion will be described with reference to FIGS. 12A and 12B. The processing flow example shown in FIGS. 12A and 12B explains details of the processing in step S902a shown in FIG. 9A.
FIG. 12A is a diagram for explaining an example of the processing flow of the previous stage of the process for obtaining the maximum number of stages of the tree before conversion.
図12Aに示すように、まずステップS1201において、段数カウンタに値1を設定し、ステップS1202において、最大段数カウンタに、段数カウンタに設定された値を設定する。すなわち、段数カウンタ及び最大段数カウンタには、初期値として値1が設定される。
次にステップS1207において、配列番号に、ツリーのルートノードの配列番号を設定して図12Bに示すステップS1213に進む。
As shown in FIG. 12A, first, in step S1201, a
In step S1207, the array element number is set to the array node number of the root node of the tree, and the process advances to step S1213 shown in FIG. 12B.
図12Bは、変換前のツリーの最大段数を求める処理の後段の処理フロー例を説明する図である。図12Bに示すように、ステップS1213において、変換前のツリーが格納された配列から、配列番号の指す配列要素をノードとして読み出す。ステップS1213の最初の処理においては、配列番号にはステップS1207でルートノードの配列番号が設定されている。2回目以降の処理においては、後に説明するステップS1220あるいはステップS1228で設定される。図9Bにおける説明と同様に、以下の説明において、ステップS1213で読み出されたノードを巡回開始ノードということがある。
12B is a drawing describing the processing flow example of a stage after the process for obtaining the maximum number of the previous tree transformation. As shown in FIG. 12B, in step S1213, the array element indicated by the array element number is read out as a node from the array in which the tree before conversion is stored. In the first process of step S1213, the array element number is set to the array element number of the root node in step S1207. In the second and subsequent processing, it is set in step S1220 or step S1228 described later. Similar to the description in FIG. 9B, in the following description, the node read in step S1213 may be referred to as a tour start node.
次にステップS1215において、ステップS1213で読み出したノードからノード種別を取り出し、ステップS1216で、該取り出したノード種別はブランチノードを示すものか判定する。ステップS1216の判定が、ノード種別はブランチノードを示すものではなくリーフノードを示すものであればステップS1221に進み、ブランチノードを示すものであれば、ステップS1217に進む。 In step S1215, the node type is extracted from the node read in step S1213. In step S1216, it is determined whether the extracted node type indicates a branch node. If the determination in step S1216 indicates that the node type does not indicate a branch node but a leaf node, the process proceeds to step S1221, and if the determination indicates a branch node, the process proceeds to step S1217.
ステップS1217では、段数カウンタに値1を加え、ステップS1219に進み、ステップS1213で読み出したノードから、代表ノード番号を取り出し、ステップS1220で、該取り出した代表ノード番号に値0を加えた値を配列番号に設定する。
そして、ステップS1220aにおいて、探索経路スタックに、配列番号と段数カウンタのカウント値を格納してステップS1213に戻る。ここで探索経路スタックに格納される配列番号は、ステップS1220で代表ノード番号に値0を加えた値のものであるから、ノード[0]の配列番号である。
In step S1217, a value of 1 is added to the stage number counter, the process proceeds to step S1219, the representative node number is extracted from the node read in step S1213, and in step S1220, the value obtained by adding the
In step S1220a, the array element number and the count value of the stage number counter are stored in the search path stack, and the process returns to step S1213. Here, since the array element number stored in the search path stack is the value obtained by adding the
上述のステップS1213〜ステップS1220aのループ処理を、ステップS1216においてノード種別がリーフノードを示すまで繰り返す。つまり、ひとまとまりの処理として、巡回開始ノードから最初のリーフノードまでノードを巡回してリーフノードの段数を求める。図12Bに示す処理フロー例では、ステップS1220において、代表ノード番号に値0を加えて配列番号に設定していることから、ノード[0]側を優先してノードを巡回しているが、ノード[1]側を優先してノードを巡回することも可能であることは、以上の説明から当業者に明らかである。
The loop processing from step S1213 to step S1220a described above is repeated until the node type indicates a leaf node in step S1216. That is, as a group of processes, the number of leaf nodes is obtained by circulating the nodes from the tour start node to the first leaf node. In the processing flow example shown in FIG. 12B, since the array node number is set by adding the
一方ステップS1216において、ノード種別はブランチノードを示すものではなくリーフノードを示すものと判定されると、ステップS1221に進み、段数カウンタのカウント値は最大段数カウンタに設定された値より大きいか判定する。ステップS1216の判定結果が、段数カウンタのカウント値は最大段数カウンタに設定された値より大きい、であれば、ステップS1222で、最大段数カウンタに、段数カウンタのカウント値を設定してステップS1223に進み、前記判定結果が、段数カウンタのカウント値は最大段数カウンタに設定された値より大きくない、であれば、ステップS1223に進む。 On the other hand, if it is determined in step S1216 that the node type indicates not a branch node but a leaf node, the process proceeds to step S1221, and it is determined whether or not the count value of the stage number counter is greater than the value set in the maximum stage number counter. . If the determination result in step S1216 is that the count value of the stage number counter is larger than the value set in the maximum stage number counter, in step S1222, the count value of the stage number counter is set in the maximum stage number counter, and the process proceeds to step S1223. If the determination result indicates that the count value of the stage number counter is not larger than the value set in the maximum stage number counter, the process proceeds to step S1223.
ステップS1223では、探索経路スタックのスタックポインタはツリーのルートノードの配列番号を指しているか判定する。
探索経路スタックのスタックポインタはツリーのルートノードの配列番号を指していれば、ツリーの全てのリーフノードについての段数の処理は完了しているので処理を終了する。そうでなければ、ステップS1224に進む。
In step S1223, it is determined whether the stack pointer of the search path stack points to the array element number of the root node of the tree.
If the stack pointer of the search path stack points to the array element number of the root node of the tree, the processing is completed because the processing of the number of stages for all the leaf nodes of the tree has been completed. Otherwise, the process proceeds to step S1224.
ステップS1224では、探索経路スタックから配列番号と段数カウンタのカウント値を取り出し、探索経路スタックのスタックポインタを1つ減らす。次にステップS1228において、ステップS1224で取り出した配列番号に値1を加えて、巡回開始ノードの配列番号としてノード[1]の配列番号を得てステップS1213に戻る。
In step S1224, the array element number and the count value of the stage counter are extracted from the search path stack, and the stack pointer of the search path stack is decremented by one. Next, in step S1228, the
上述のステップS1213〜ステップS1228のループ処理を、ステップS1223において探索経路スタックのスタックポインタがツリーのルートノードの配列番号を指していると判定されるまで繰り返すことにより、ツリー上のすべてのノードの巡回が行われ、ツリーの最大段数が求められる。 The loop processing of steps S1213 to S1228 described above is repeated until it is determined in step S1223 that the stack pointer of the search path stack points to the array element number of the root node of the tree. And the maximum number of levels of the tree is obtained.
以上本発明を実施するための形態について詳細に説明したが、本発明の実施の形態はそれに限ることなく種々の変形が可能であることは当業者に明らかである。
また、本発明の一実施形態に係るビット列検索装置が、図5〜図7Cに例示した処理をコンピュータに実行させるプログラムによりコンピュータ上に構築可能なことは明らかである。
したがって、上記プログラム、及びプログラムを記憶したコンピュータ読み取り可能な記憶媒体は、本発明の実施の形態に含まれる。さらに、本発明のカップルドノードツリーのデータ構造も、本発明の実施の形態に含まれる。
Although the embodiment for carrying out the present invention has been described in detail above, it is obvious to those skilled in the art that the embodiment of the present invention is not limited thereto and can be variously modified.
It is also clear that the bit string search device according to an embodiment of the present invention can be constructed on a computer by a program that causes the computer to execute the processes illustrated in FIGS.
Therefore, the program and a computer-readable storage medium storing the program are included in the embodiment of the present invention. Furthermore, the data structure of the coupled node tree of the present invention is also included in the embodiment of the present invention.
100、400 配列
101 ノード
102 ノード種別
103、403 弁別ビット位置
104 代表ノード番号
118、418 インデックスキー
200、200b カップルドノードツリー
210a、401 ルートノード
280 検索キー
301 データ処理装置
302 中央処理装置
303 キャッシュメモリ
304 バス
305 主記憶装置
306 外部記憶装置
307 通信装置
308 データ格納装置
309 配列
309a ブランチノード配列
309b リーフノード配列
310 探索経路スタック
311 分岐先配列
700a、700b ベース番号
720a、720b ノード参照番号
730a、730b 配列番号
800 ビット列検索装置
802 分岐先情報設定実行部
804 次段ノード分岐先情報格納位置計算実行部
806 リーフノード出力実行部
810 検索ツリー記憶手段
812 分岐先情報記憶手段
820 検索開始位置設定手段
100, 400
Claims (6)
前記インデックスキーは、本来のインデックスキーのある特定のビット位置に特定のビット値を挿入したものであり、
前記検索キーは、本来の検索キーの、前記本来のインデックスキーと同一の特定のビット位置に前記特定のビット値を挿入したものであり、
前記ツリーは配列に記憶され、n段目(nは正整数)までのツリーの構成要素を有するものであり、
該ツリーの始点であるルートノードであって、ノード参照番号1に、前記配列の先頭の配列要素の位置を定める番号であるベース番号を加えた値の配列番号の配列要素に配置されるルートノードと、前記配列の隣接した配列要素に配置される代表ノードと非代表ノードである2つのノードを有する、ツリーの構成要素としてのノード対を有し、前記ノードはブランチノードかリーフノードであって、前記ブランチノードは、前記検索キーの弁別ビット位置を格納する領域を含むが、ブランチノードとリーフノードを識別するノード種別を格納する領域、リンク先である直近下位のノード対の代表ノードの配置された配列要素の配列番号を格納する領域、及び前記インデックスキーあるいは該インデックスキーにアクセスするための情報を格納する領域を含まないものであり、前記リーフノードは、前記インデックスキーあるいは該インデックスキーにアクセスするための情報を格納する領域を含むが、前記ノード種別を格納する領域、及び前記検索キーの弁別ビット位置を格納する領域を含まないものであって、前記代表ノードは該代表ノードの直近上位のブランチノードのノード参照番号の2倍の値のノード参照番号に、前記ベース番号を加えた値の配列番号の配列要素に配置され、前記リーフノードはn段目にのみ位置する、カップルドノードツリーを記憶する検索ツリー記憶手段と、
前記検索キーの、各ブランチノードの前記弁別ビット位置と一致するビット位置のビット値を分岐先情報として前記ブランチノードに対応して格納する分岐先配列を記憶する分岐先情報記憶手段と、
前記検索ツリー記憶手段に記憶されたカップルドノードツリーからブランチノードをノード参照番号順に読み出し、該ブランチノードの弁別ビット位置と前記検索キーにより前記分岐先情報を抽出して前記分岐先配列の配列番号1の配列要素から順次各配列要素に設定する分岐先情報設定実行部と、
前記分岐先配列に設定された配列番号1の配列要素に格納された分岐先情報を前記カップルドノードツリーの第1段のノードの分岐先情報として読み出し、該読み出した分岐先情報に前記配列番号1を2倍した値を加えて得られる値を、前記カップルドノードツリーの第2段のノードの分岐先情報が格納された前記分岐先配列の配列要素の配列番号とし、以下、第2段のノードの分岐先情報に該第2段のノードの分岐先情報が格納された前記配列要素の配列番号を2倍した値を加えて得られる値を、前記カップルドノードツリーの第3段のノードの分岐先情報が格納された前記分岐先配列の配列要素の配列番号とするように、自段のノードの分岐先情報に該自段のノードの分岐先情報が格納された前記配列要素の配列番号を2倍した値を加えて得られる値を、前記カップルドノードツリーの次段のノードの分岐先情報が格納された前記分岐先配列の配列要素の配列番号とすることを前記カップルドノードツリーの第n−2段のノードまで繰り返して前記カップルドノードツリーの第n−1段のノードの分岐先情報の格納された前記分岐先配列の配列要素の配列番号を求める次段ノード分岐先情報格納位置計算実行部と、
前記次段ノード分岐先情報格納位置計算実行部が求めた配列番号により、前記分岐先配列から前記カップルドノードツリーの第n−1段のノードの分岐先情報を読み出し、該読み出した分岐先情報と該配列番号に基づいてリーフノードの格納位置を求め、前記検索ツリー記憶手段に記憶されたカップルドノードツリーから該格納位置に格納されたリーフノードを読み出すリーフノード出力実行部と、
を備えることを特徴とするビット列検索装置
In a bit string search device for searching for an index key based on a data structure of a tree in which an index key consisting of a bit string to be searched or information for accessing the index key is stored using a search key consisting of a bit string,
The index key is obtained by inserting a specific bit value at a specific bit position of the original index key,
The search key is the original search key with the specific bit value inserted in the same specific bit position as the original index key,
The tree is stored in an array and has tree components up to the nth stage (n is a positive integer),
A root node which is a root node which is a starting point of the tree, and which is arranged in an array element having an array number having a value obtained by adding a base number which is a number for determining the position of the top array element of the array to node reference number And a node pair as a component of a tree having two nodes that are a representative node and a non-representative node arranged in adjacent array elements of the array, and the node is a branch node or a leaf node The branch node includes an area for storing a discrimination bit position of the search key, an area for storing a node type for identifying a branch node and a leaf node, and arrangement of representative nodes of the nearest lower-level node pair that is a link destination Stores the area for storing the array element number of the array element and the index key or information for accessing the index key The leaf node includes an area for storing the index key or information for accessing the index key, the area for storing the node type, and a discrimination bit for the search key. An array of values obtained by adding the base number to a node reference number that is twice the node reference number of a branch node immediately above the representative node, the area not including an area for storing a position Search tree storage means for storing a coupled node tree, which is arranged in an array element of a number, and the leaf node is located only in the nth stage;
Branch destination information storage means for storing a branch destination array for storing the bit value of the bit position matching the discrimination bit position of each branch node of the search key as branch destination information corresponding to the branch node;
The branch nodes are read from the coupled node tree stored in the search tree storage means in the order of node reference numbers, the branch destination information is extracted by the discrimination bit position of the branch node and the search key, and the array number of the branch destination array A branch destination information setting execution unit for sequentially setting each array element from one array element;
The branch destination information stored in the array element of array number 1 set in the branch destination array is read as branch destination information of the first node of the coupled node tree, and the array number is read in the read branch destination information. A value obtained by adding a value obtained by doubling 1 is used as an array element number of the array element of the branch destination array in which the branch destination information of the second stage node of the coupled node tree is stored. The value obtained by adding twice the array element number of the array element in which the branch destination information of the second stage node is stored to the branch destination information of the second node is obtained as the third stage of the coupled node tree. As the array element number of the array element of the branch destination array in which the branch destination information of the node is stored, the branch destination information of the own node is stored in the branch destination information of the own node. Add the doubled sequence number The obtained value is used as the array element number of the array element of the branch destination array in which the branch destination information of the next node of the coupled node tree is stored. A next-stage node branch destination information storage position calculation execution unit that obtains the array element number of the branch destination array in which the branch destination information of the n−1-th stage node of the coupled node tree is stored,
The branch destination information of the (n−1) -th stage node of the coupled node tree is read from the branch destination array according to the array number obtained by the next-stage node branch destination information storage position calculation execution unit, and the read branch destination information A leaf node output execution unit that obtains a storage position of the leaf node based on the array number, and reads the leaf node stored in the storage position from the coupled node tree stored in the search tree storage unit;
A bit string search device comprising:
前記カップルドノードツリーを記憶する配列は、ブランチノードを記憶するブランチノード配列とリーフノードを記憶するリーフノード配列から構成され、該ブランチノード配列は、前記カップルドノードツリーを記憶する配列のうち、前記カップルドノードツリーのn−1段目までのツリーの構成要素を記憶する部分と一致するものであり、
前記リーフノード出力実行部は、前記次段ノード分岐先情報格納位置計算実行部が求めた配列番号により、前記分岐先配列から前記カップルドノードツリーの第n−1段のノードの分岐先情報を読み出し、該読み出した分岐先情報と該配列番号を2倍した値の和から前記ブランチノード配列のノード参照番号の最大値を減じたリーフノード配列のノード参照番号を求め、該リーフノード配列のノード参照番号に該リーフノード配列の先頭の配列要素の位置を定める番号であるベース番号を加えた値の配列番号を前記リーフノードの格納位置として求め、前記検索ツリー記憶手段に記憶されたカップルドノードツリーから該格納位置に格納されたリーフノードを読み出し、該リーフノードからインデックスキーを読み出す、あるいはインデックスキーにアクセスするための情報に基づき当該インデックスキーを読み出すことを特徴とするビット列検索装置。 The bit string search device according to claim 1, wherein
The array for storing the coupled node tree includes a branch node array for storing branch nodes and a leaf node array for storing leaf nodes, and the branch node array is an array for storing the coupled node tree. It is the same as the part storing the elements of the tree up to the n-1 stage of the coupled node tree,
The leaf node output execution unit obtains branch destination information of the n−1-th stage node of the coupled node tree from the branch destination array based on the array number obtained by the next-stage node branch destination information storage position calculation execution unit. Read, obtain the node reference number of the leaf node array obtained by subtracting the maximum value of the node reference number of the branch node array from the sum of the read branch destination information and the value obtained by doubling the array number, and the node of the leaf node array A coupled node stored in the search tree storage means is obtained as an array number of a value obtained by adding a base number which is a number for determining the position of the first array element of the leaf node array to a reference number as a storage position of the leaf node Read the leaf node stored in the storage location from the tree, read the index key from the leaf node, or index Bit string search apparatus characterized by reading the index key based on the information for accessing the key.
前記検索ツリー記憶手段に記憶されたカップルドノードツリーからブランチノードをノード参照番号順に読み出し、該ブランチノードの弁別ビット位置と前記検索キーにより前記分岐先情報を抽出して前記分岐先配列の配列番号1の配列要素から順次各配列要素に設定する分岐先情報設定ステップと、
前記分岐先配列に設定された配列番号1の配列要素に格納された分岐先情報を前記カップルドノードツリーの第1段のノードの分岐先情報として読み出し、該読み出した分岐先情報に前記配列番号1を2倍した値を加えて得られる値を、前記カップルドノードツリーの第2段のノードの分岐先情報が格納された前記分岐先配列の配列要素の配列番号とし、以下、第2段のノードの分岐先情報に該第2段のノードの分岐先情報が格納された前記配列要素の配列番号を2倍した値を加えて得られる値を、前記カップルドノードツリーの第3段のノードの分岐先情報が格納された前記分岐先配列の配列要素の配列番号とするように、自段のノードの分岐先情報に該自段のノードの分岐先情報が格納された前記配列要素の配列番号を2倍した値を加えて得られる値を、前記カップルドノードツリーの次段のノードの分岐先情報が格納された前記分岐先配列の配列要素の配列番号とすることを前記カップルドノードツリーの第n−2段のノードまで繰り返して前記カップルドノードツリーの第n−1段のノードの分岐先情報の格納された前記分岐先配列の配列要素の配列番号を求める次段ノード分岐先情報格納位置計算ステップと、
前記次段ノード分岐先情報格納位置計算ステップで求めた配列番号により、前記分岐先配列から前記カップルドノードツリーの第n−1段のノードの分岐先情報を読み出し、該読み出した分岐先情報と該配列番号に基づいてリーフノードの格納位置を求め、前記検索ツリー記憶手段に記憶されたカップルドノードツリーから該格納位置に格納されたリーフノードを読み出すリーフノード出力ステップと、
を備えることを特徴とするビット列検索方法。 The bit string search method executed by the bit string search device according to claim 1,
The branch nodes are read from the coupled node tree stored in the search tree storage means in the order of node reference numbers, the branch destination information is extracted by the discrimination bit position of the branch node and the search key, and the array number of the branch destination array A branch destination information setting step for sequentially setting each array element from one array element;
The branch destination information stored in the array element of array number 1 set in the branch destination array is read as branch destination information of the first node of the coupled node tree, and the array number is read in the read branch destination information. A value obtained by adding a value obtained by doubling 1 is used as an array element number of the array element of the branch destination array in which the branch destination information of the second stage node of the coupled node tree is stored. The value obtained by adding twice the array element number of the array element in which the branch destination information of the second stage node is stored to the branch destination information of the second node is obtained as the third stage of the coupled node tree. As the array element number of the array element of the branch destination array in which the branch destination information of the node is stored, the branch destination information of the own node is stored in the branch destination information of the own node. Add the doubled sequence number The obtained value is used as the array element number of the array element of the branch destination array in which the branch destination information of the next node of the coupled node tree is stored. The next-stage node branch destination information storage position calculation step for obtaining the array element number of the array element of the branch destination array in which the branch destination information of the n-1 stage node of the coupled node tree is stored,
Based on the array element number obtained in the next-stage node branch destination information storage position calculation step, the branch destination information of the (n−1) -th stage node of the coupled node tree is read from the branch destination array, and the read branch destination information and A leaf node output step of obtaining a storage position of the leaf node based on the array number and reading the leaf node stored in the storage position from the coupled node tree stored in the search tree storage unit;
A bit string search method comprising:
前記カップルドノードツリーを記憶する配列は、ブランチノードを記憶するブランチノード配列とリーフノードを記憶するリーフノード配列から構成され、該ブランチノード配列は、前記カップルドノードツリーを記憶する配列のうち、前記カップルドノードツリーのn−1段目までのツリーの構成要素を記憶する部分と一致するものであり、
前記リーフノード出力ステップは、前記次段ノード分岐先情報格納位置計算ステップで求めた配列番号により、前記分岐先配列から前記カップルドノードツリーの第n−1段のノードの分岐先情報を読み出し、該読み出した分岐先情報と該配列番号を2倍した値の和から前記ブランチノード配列のノード参照番号の最大値を減じたリーフノード配列のノード参照番号を求め、該リーフノード配列のノード参照番号に該リーフノード配列の先頭の配列要素の位置を定める番号であるベース番号を加えた値の配列番号を前記リーフノードの格納位置として求め、前記検索ツリー記憶手段に記憶されたカップルドノードツリーから該格納位置に格納されたリーフノードを読み出し、該リーフノードからインデックスキーを読み出す、あるいはインデックスキーにアクセスするための情報に基づき当該インデックスキーを読み出すことを特徴とするビット列検索方法。
The bit string search method according to claim 3, wherein
The array for storing the coupled node tree includes a branch node array for storing branch nodes and a leaf node array for storing leaf nodes, and the branch node array is an array for storing the coupled node tree. It is the same as the part storing the elements of the tree up to the n-1 stage of the coupled node tree,
The leaf node output step reads the branch destination information of the n−1-th stage node of the coupled node tree from the branch destination array according to the array element number obtained in the next node branch destination information storage position calculation step, The node reference number of the leaf node array is obtained by subtracting the maximum value of the node reference number of the branch node array from the sum of the read branch destination information and the value obtained by doubling the array number. the determined sequence number of the value obtained by adding the head base number position is a number defining the array elements of leaf nodes arranged as a storage position of the leaf node, the coupled node stored before dangerous search tree storing means Read the leaf node stored at the storage location from the tree, read the index key from the leaf node, or Bit string search method characterized by reading the index key based on the information for accessing the Kusuki.
Priority Applications (5)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010121153A JP5220057B2 (en) | 2010-05-27 | 2010-05-27 | Bit string search device, search method and program |
| PCT/JP2010/006834 WO2011064984A1 (en) | 2009-11-30 | 2010-11-23 | Bit stream retrieval device, retrieval method, and program |
| EP10832837A EP2515245A1 (en) | 2009-11-30 | 2010-11-23 | Bit stream retrieval device, retrieval method, and program |
| CN2010800626871A CN102741841A (en) | 2009-11-30 | 2010-11-23 | Bit stream retrieval device, retrieval method, and program |
| US13/483,940 US20120239664A1 (en) | 2009-11-30 | 2012-05-30 | Bit string search apparatus, search method, and program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010121153A JP5220057B2 (en) | 2010-05-27 | 2010-05-27 | Bit string search device, search method and program |
Publications (3)
| Publication Number | Publication Date |
|---|---|
| JP2011248626A JP2011248626A (en) | 2011-12-08 |
| JP2011248626A5 JP2011248626A5 (en) | 2013-01-31 |
| JP5220057B2 true JP5220057B2 (en) | 2013-06-26 |
Family
ID=45413809
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2010121153A Expired - Fee Related JP5220057B2 (en) | 2009-11-30 | 2010-05-27 | Bit string search device, search method and program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5220057B2 (en) |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| DE19810843B4 (en) * | 1998-03-12 | 2004-11-25 | Telefonaktiebolaget Lm Ericsson (Publ) | Method and access device for determining the storage address of a data value in a storage device |
| JP4271214B2 (en) * | 2006-07-07 | 2009-06-03 | 株式会社エスグランツ | Bit string search device, search method and program |
| JP4439013B2 (en) * | 2007-04-25 | 2010-03-24 | 株式会社エスグランツ | Bit string search method and search program |
| JP2009251840A (en) * | 2008-04-04 | 2009-10-29 | S Grants Co Ltd | Bit sequence search device, search method, and program |
-
2010
- 2010-05-27 JP JP2010121153A patent/JP5220057B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2011248626A (en) | 2011-12-08 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN101911060B (en) | Database index key update method | |
| CN101535993B (en) | Bit sequence searching method and device | |
| JP4502223B2 (en) | Bit string merge sort apparatus, method, and program | |
| JP4271214B2 (en) | Bit string search device, search method and program | |
| JP4514771B2 (en) | Coupled node tree longest match / shortest match search device, search method and program | |
| JP4848317B2 (en) | Database indexing system, method and program | |
| JP4527753B2 (en) | Bit string search device, search method and program | |
| JP5165662B2 (en) | Bit string key classification / distribution device, classification / distribution method and program | |
| WO2012090763A1 (en) | Code string search device, search method, and program | |
| WO2008065735A1 (en) | Splitting/connecting method for coupled node tree, and program | |
| CN101589390A (en) | Bit sequence search device, search method, and program | |
| JP2008269197A (en) | Method and program for saving/restoring coupled node tree | |
| JP3630057B2 (en) | Data structure construction method for search, apparatus thereof, and machine-readable program recording medium | |
| JP5220057B2 (en) | Bit string search device, search method and program | |
| JP4514810B2 (en) | Bit string search device, search method and program | |
| CN101911068B (en) | Bit sequence retrieval device, retrieval method | |
| JP5912714B2 (en) | Data structure, data structure generation method, information processing apparatus, information processing system, and information processing program | |
| JP2009251840A (en) | Bit sequence search device, search method, and program | |
| JPWO2018012413A1 (en) | Similar data search device, similar data search method and recording medium | |
| JP4813575B2 (en) | Bit string search device | |
| Golovach et al. | Enumeration and maximum number of minimal connected vertex covers in graphs | |
| JP2010257427A (en) | Apparatus and method for preparing index update data, and program | |
| JP5165654B2 (en) | Bit string data sorting apparatus, method and program | |
| JP2009199577A (en) | Bit string retrieval device, retrieval method, and program |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A711 | Notification of change in applicant |
Free format text: JAPANESE INTERMEDIATE CODE: A712 Effective date: 20121010 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20121211 |
|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20121211 |
|
| A871 | Explanation of circumstances concerning accelerated examination |
Free format text: JAPANESE INTERMEDIATE CODE: A871 Effective date: 20121211 |
|
| A975 | Report on accelerated examination |
Free format text: JAPANESE INTERMEDIATE CODE: A971005 Effective date: 20130116 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130122 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20130123 |
|
| 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: 20130305 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130305 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160315 Year of fee payment: 3 |
|
| R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| LAPS | Cancellation because of no payment of annual fees |