WO2010106605A1 - コード列検索装置、検索方法及びプログラム - Google Patents

コード列検索装置、検索方法及びプログラム Download PDF

Info

Publication number
WO2010106605A1
WO2010106605A1 PCT/JP2009/006921 JP2009006921W WO2010106605A1 WO 2010106605 A1 WO2010106605 A1 WO 2010106605A1 JP 2009006921 W JP2009006921 W JP 2009006921W WO 2010106605 A1 WO2010106605 A1 WO 2010106605A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
search
string
type
code string
Prior art date
Application number
PCT/JP2009/006921
Other languages
English (en)
French (fr)
Inventor
新庄敏男
國分光裕
Original Assignee
株式会社エスグランツ
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 株式会社エスグランツ filed Critical 株式会社エスグランツ
Publication of WO2010106605A1 publication Critical patent/WO2010106605A1/ja
Priority to US13/064,487 priority Critical patent/US9009655B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques

Definitions

  • the present invention relates to a code string search for searching a code or code string composed of a bit string by a computer, such as a character string search for retrieving a character code or character code string composed of a bit string.
  • index for example, a transposed index in which words in a document are extracted and a document name included in each word is associated is well known.
  • This inverted index is characterized by its relatively small size, high speed search, and simple index construction.
  • processing for matching word positions in a document is required. It is also difficult to search for an arbitrary character string in a sentence.
  • FIG. 1A illustrates an example of a conventional search method related to the suffix arrangement described above.
  • FIG. 1A illustrates a character string 10 to be searched.
  • the character string 10 is composed of alphabetic characters A, B, C, E and a delimiter character $.
  • the character A is located at the character positions 1, 4, and 7 of the character string 10.
  • the character B is located at the character positions 2 and 5 of the character string 10.
  • the character C is located at the character positions 6 and 8 of the character string 10.
  • the character E is located at the character position 3 of the character string 10.
  • the delimiter character $ is located at the character position 9 which is the last position of the character string 10.
  • FIG. 1A shows a suffix 20 in the character position order, a suffix 20a in the dictionary order, and a suffix array 30 corresponding to the character string 10.
  • the character string 10 can be considered to have nine suffixes as its partial character string, as indicated by the suffix 20 of the character round.
  • the suffixes 20a in the dictionary order are obtained.
  • the suffix array 30 is obtained by storing the character positions of the first characters of the suffixes sorted in the dictionary order in the array. With this suffix array, it is possible to obtain the leading character position of the partial character string in the search target character string that matches the pattern of the search character string.
  • FIG. 1B illustrates the concept of a character string search using a compression suffix array in a conventional search method example, and a compression suffix array (conceptual diagram) corresponding to the search character string 40 and the suffix array 30. 50 is shown.
  • the next array number ( ⁇ ) is stored in the array number (i) of the compression suffix array (conceptual diagram) 50.
  • the next array number ( ⁇ ) is the array element number of the suffix array 30 in which the character position obtained by adding 1 to the character position stored in the array element number (i) of the suffix array 30 is stored.
  • the values stored for each character are in ascending order as shown in the figure. Therefore, since the value stored in each array element can be the increment of the value stored in the previous array element, not the next array number ( ⁇ ) itself, the bit width can be reduced, and the amount of information Can be compressed.
  • an arbitrary character string can be searched, and the capacity of the array can be reduced.
  • the processing time for creating a compressed suffix array from a long time becomes large. Therefore, the problem to be solved by the present invention is to reduce the time for creating index data that can search for an arbitrary code string, not just a character string, as compared with the conventional one.
  • An object of the present invention is to provide an index data structure that can be searched for an arbitrary code string and can be created in a shorter time than before, and to provide a code string search method using the index data structure. It is.
  • the search target code string is divided into several blocks (hereinafter also referred to as code string blocks), and each code string located in the code string block is uniquely assigned to each code string block.
  • the code ID to be identified is a different code value (hereinafter, when there is no possibility of misunderstanding, it may be simply referred to as a code. Conversely, it may be referred to as a code type by emphasizing that it is a different code value. .)) So that the code ID ranges do not overlap each other.
  • the code-specific ID range table storing the range of the code ID for each code corresponding to each code string block and the next code ID which is the code ID positioned next to each code ID are stored.
  • An ID relationship table is created, and a code string search is performed using the ID range table for each code and the ID relationship table.
  • the range of the code ID of the code constituting the search code string is read from the code-specific ID range table of the first code string block, and the search code string
  • the next code ID stored corresponding to the code ID included in the code ID range of the first code of the code is read from the ID relation table created for each code string block, and the next code ID stored corresponding to the next code ID is stored.
  • the code ID is sequentially read from the ID relation table, the code corresponding to the entry in the ID range table for each code including the next code ID read from the ID relation table in the code ID range is obtained, and the obtained code and the search code string Whether the next code matches the next code is sequentially checked, and this check is similarly performed on the subsequent code string block.
  • FIG. 2A is a diagram illustrating functional blocks for creating an index data structure according to an embodiment of the present invention.
  • the index data creation management means 104 manages the creation of index data for each block (code string block) obtained by dividing the search target code string by the index data creation means 105, and creates an index data management table.
  • the index data creation unit 105 includes a search target code string reading unit 101, a code-specific ID range table generation unit 102, and an ID relation table generation unit 103.
  • the search target code string is read by the search target code string reading unit 101 and passed to the code-specific ID range table generating unit 102 and the ID relation table generating unit 103.
  • the code-specific ID range table generating unit 102 creates a code-specific ID range table storing the range of the code ID for each code, and the ID relation table generating unit 103 is a code ID positioned next to each code ID. An ID relation table storing the next code ID is generated.
  • FIG. 2B is a diagram illustrating functional blocks for performing code string search according to an embodiment of the present invention.
  • the code string search management unit 116 manages the search for each code string block of the search target code string by the code string search unit 117.
  • the code string search means 117 includes a search code string reading means 111, a code-specific ID range reading means 112, an ID relation reading means 113, a code type searching means 114, and a code type checking means 115.
  • the first code of the search code string is read by the search code string reading unit 111 and passed to the code-specific ID range reading unit 112.
  • the code-specific ID range reading unit 112 reads the code ID range of the first code passed from the search code string reading unit 111 from the code-specific ID range table generated by the code-specific ID range table generation unit 102 to obtain an ID.
  • the data is transferred to the relationship reading unit 113.
  • the ID relation reading unit 113 generates an ID relation table by generating the next code ID stored corresponding to the code ID included in the code ID range of the first code in the search code string passed from the ID range reading unit 112 by code.
  • the next code ID stored corresponding to the next code is sequentially read from the ID relationship table and passed to the code type search means 114.
  • the code type searching unit 114 searches for a code type including the next code ID passed from the ID relation reading unit 113 in the range of the code ID using the code ID range table and passes the code type to the code type checking unit 115.
  • the code type collating unit 115 collates the code type read by the search code string reading unit 111 with the code type searched by the code type searching unit 114 and outputs a search result.
  • FIG. 2C is a diagram illustrating an exemplary hardware configuration according to an embodiment of the present invention.
  • Search processing and index generation processing by the search device of the present invention are performed by a data processing device 301 including at least a central processing unit 302 and a cache memory 303 using a data storage device 308.
  • the data storage device 308 including the storage region of the index data management table 321 and the index data storage region 324 for storing the ID range table 309 and the ID relation table 310 corresponding to the code string block is the main storage device 305 or external It can be realized by the storage device 306, or a remote device connected via the communication device 307 can be used.
  • Each function block such as the code string search unit 117 described with reference to FIGS. 2A and 2B can be realized by hardware illustrated in FIG. 2C and software including steps described later.
  • the main storage device 305, the external storage device 306, and the communication device 307 are connected to the data processing device 301 by one bus 304, but the connection method is not limited to this.
  • the main storage device 305 can be in the data processing device 301.
  • a temporary storage area corresponding to each process is used in order to use various values obtained during the process in a later process.
  • the value stored or set in the temporary storage area may be called by the name of the temporary storage area.
  • FIG. 3A is a diagram for explaining the structure of index data according to an embodiment of the present invention.
  • a search target code string 10a is described as an example of a search target code string for which index data is to be created.
  • the search target code string 10a is composed of alphabetic character codes of codes A, B, E, A, B, C, A,. P1 to P8,..., Pn ⁇ 1, Pn described below each character code indicate the position of the code in the search target code string 10a.
  • the code position pointer 11 is a pointer indicating the position of the code in the search target code string 10a, and points to the code position P1 in the illustrated example.
  • the search target code string 10a is divided into four codes. Therefore, as indicated by the arrow 12, the head position of the second code string block is P5. As indicated by an arrow 13, the end position of the second code string block is P8. The code position Pn indicated by the arrow 14 is defined as the end position. Only the last code string block is composed of two codes. For each code string block, a code-specific ID range table and an ID relationship table are generated as index data.
  • FIG. 3A shows an example of the data structure of an index for code string search corresponding to the search target code string 10a.
  • ID range table 309d by code and the ID relation table 310d stored in the index data storage area 324d corresponding to the last code string block are illustrated.
  • the notation of the index data stored in the index data storage area 324c is omitted.
  • common items may be described using notations such as “ID range table by code 309” and “ID relation table 310”.
  • other codes may be similarly described.
  • An entry in the code-specific ID range table 309 is created for each type of different code that appears in the search target code string that is the target for creating index data.
  • a search target code string that is a code string consisting of codes A to E among alphabets is a target for creating index data.
  • An entry is created for each code.
  • the code type pointer 311 is a pointer that points to an entry in the code-specific ID range table 309.
  • the code type pointer 311a points to the entry corresponding to the code A.
  • the code type pointer 311b points to the entry corresponding to the code A.
  • the code type pointer 311d points to the entry corresponding to the code A. Since each code is composed of a bit string, it has a value represented by the bit value of the bit string. Therefore, it is clear that the position of the entry corresponding to each code in the code-specific ID range table 309 can be associated with the value of each code. That is, the value taken by the code type pointer 311 can be the code itself. Therefore, in the following description, an entry corresponding to each code may be described as an entry indicated by each code.
  • the entry of the code-specific ID range table 309a includes items of setting display, appearance count, start code ID, end code ID, and code-specific ID counter. ing.
  • the setting display indicates by 1 or 0 whether the code appears in the corresponding code string block.
  • the entries of the code C and the code D are 0, and the other entries are 1.
  • the entries of the code D and the code E are 0, and the other entries are 1.
  • code-specific ID range table 309D only the code B and the code C appear in the last code string block, so the entries of the code B and the code C are 1, and the other entries are 0.
  • the number of appearances is the number of times the code appears in the corresponding code string block.
  • 2, 1, 0, 0, 1 are stored for code A to code E.
  • 1, 1, 2, 0, 0 are stored for the code A to the code E.
  • 0, 1, 1, 0, 0 are stored for code A to code E.
  • the head code ID and the tail code ID indicate a range of code IDs for each code.
  • the code ID is assigned for each code in the order of appearance in the code string block so that the codes do not overlap.
  • the number of appearances for code A is 2, so the range of code IDs is ID1 to ID2, and for the next code B, the number of appearances is 1.
  • the number of appearances of code C and code D is 0, neither the start code ID nor the end code ID is set.
  • the number of appearances is 1, so that the head code and the tail code are both ID4.
  • the first code and the last code of the code A are both ID1
  • the first code and the last code of the code B are both ID2
  • the number of appearances is 2 for the code C.
  • the range of ID is ID3 to ID4.
  • the first code and the last code of the code B are both ID1
  • the first code and the last code of the code C are both ID2.
  • ID1 is preferably an integer value starting from 1, but is not limited thereto, and any value that can identify an ID range by code is acceptable.
  • the range of the code ID is indicated by the head code ID and the tail code ID. However, if it is willing to be variable length data, it can also be indicated by listing all the code IDs.
  • the code-specific ID counter is a counter that is necessary when generating the ID-related table after generating the code-specific ID range table, and is not necessary as index data. Accordingly, a counter different from the code-specific ID range table can be provided for each different code type.
  • An entry in the ID relation table 310 is created for each code ID assigned to a code string block code. As shown on the left side of the ID relationship table 310, in the example shown in the figure, entries are created corresponding to the code ID1 to code ID4 except for the link table 310d of the last code string block. Each entry is composed of items of code position and next code ID.
  • the code ID pointer 312 is a pointer that points to an entry in the ID relationship table 310. In the example of the figure, the ID ID pointer 312 points to ID1 in any ID relationship table 310.
  • the code position of each code ID entry is the code position in the search target code string 10a where the code of the code ID is located.
  • P1 is stored for ID1, P4 for ID2, P2 for ID3, and P3 for ID4.
  • the first and second entries of the ID relationship table 310a correspond to the code A.
  • the third entry corresponds to the code B as indicated by the dotted arrow 313a (B)
  • the fourth entry corresponds to the code E as indicated by the dotted arrow 313a (E).
  • the next code ID of each code ID entry is the code ID of the code positioned next to the code of the code ID in the code string block.
  • ID3 is stored as ID3 for ID1, ID1 for ID2, ID4 for ID3, and ID2 for ID4.
  • ID relationship table 310b P7 is stored for ID1, P5 for ID2, P6 for ID3, and P8 for ID4.
  • the first entry in the ID relationship table 310b corresponds to the code A.
  • the second entry corresponds to the code B as indicated by the dotted arrow 313b (B)
  • the third to fourth entries correspond to the code C as indicated by the dotted arrow 313b (C).
  • ID4 is stored for ID1, ID3 is stored for ID2, ID1 is stored for ID3, and ID2 is stored for ID4.
  • ID relationship table 310d Pn is stored for ID1, and Pn-1 is stored for ID2.
  • the first entry in the ID relationship table 310d corresponds to the code B.
  • the second entry corresponds to the code C, as indicated by the dotted arrow 313d (C).
  • ID2 is stored for ID1
  • ID1 is stored for ID2.
  • the ID relation table 310 holds, as index data, that two codes represented by code IDs have a continuous positional relation in the code string block.
  • the relationship between the code at the end position of the front code string block and the code at the head position of the rear code string block is managed by having the index data management table 321 have the head code of each code string block.
  • the index data management table 321 has an entry for each code string block, and each entry includes items of setting display, head code, and index data pointer.
  • the index data management pointer 322 is a pointer that points to an entry in the index data management table. In the example of the figure, the index data management pointer 322 points to the entry 1 corresponding to the head code string block.
  • 1 is set from entry 1 to entry m, and the setting display of the other entries is 0.
  • the entry m corresponds to the last code string block.
  • a head code of the index data management table 321 a code A is set for entry 1
  • a code B is set for entry 2
  • a code C is set for entry m.
  • the index data pointers point to the index data storage areas 324a, 324b, 324c, and 324d of the corresponding code string blocks, as indicated by dotted arrows 344a, 344b, 344c, and 344d.
  • the ID array table 310 is different from the ID array table 310, while the next array number is sorted for each character in the compression suffix array 50.
  • the code position is sorted for each code type. Therefore, when the same code is searched sequentially, the speed can be increased by the cache effect.
  • FIG. 3B is a diagram for explaining the concept of code string search according to an embodiment of the present invention.
  • the search target code string is the search target code string 10a illustrated in FIG. 3A, and is divided into code string blocks as shown in FIG. 3A. Further, the concept of the code string search will be described as the search code string 40a shown in FIG. 3B. Assume that the code-specific ID range table 309 and the ID relation table 310 are generated and the index data management table 321 is generated corresponding to the code string block of the search target code string 10a.
  • the head entry 321 (1) of the index data management table indicated by the arrow 348a is read and stored in the index data storage area 324a by the index data pointer 342a as indicated by the dotted arrow 344a.
  • the code-specific ID range table 309a and the ID relation table 310a are acquired.
  • the entry 309a (A) of the code-specific ID range table 309a corresponding to the code A stored in the head code 341a is read, and as indicated by the dotted arrow 345a, ID1, which is the head code ID, is read and set to the head code ID 346a, which is a temporary storage area.
  • the code ID included in the ID range 336a that is, the code ID4 in the example shown in the figure, is read from the entry 309a (E), and the entry 310a (4) corresponding to the read code ID4.
  • the code ID4 in the example shown in the figure is read from the entry 309a (E)
  • the first code of code A which is the first code set in the code string ID range table 309a, and ID1 are set as the first code ID 346a, which is a temporary storage area. Then, as shown by a two-way dotted arrow 347a, ID2 that is the next code ID of the entry 310a (4) corresponding to code ID4 and ID1 set in the head code ID 346a are compared, and the next code ID is the head. It is determined that it is other than the code ID.
  • the code A which is the second code 332b is read out.
  • ID2 that is the next code ID 337a of the entry 310a (4) corresponding to the code ID4 of the ID relation table 310a indicates the code A of the code-specific ID range table 309a. It is determined that the code ID is included in the range 336b (ID1 to ID2). This determination can be performed by sequentially extracting the code ID range from the top entry of the code-specific ID range table 309a and determining whether the range includes ID2.
  • a code A (hereinafter also referred to as an index code) indicating a code ID range table 309a entry that includes ID2 that is the next code ID 337a in the range of the code ID is temporarily. It is determined that the code A, which is the index code set in the temporary storage area 352a, matches the code A, which is the second code 332b, as indicated by the bidirectional dotted arrow 353a, which is set in the storage area 352a. The This means that the code sequence of code E and code A exists in the first code string block of the search target code string 10a. Since the code position 338a of the entry 310a (4) corresponding to the code ID 4 read from the ID relation table 310a is P3, the top position of the code sequence of the code E and code A is P3. I understand.
  • ID1 that is the next code ID 337b of the entry 310a (2) corresponding to ID2 that is the next code ID 337a is read.
  • the read ID1 is compared with the ID1 previously set in the head code ID 346a, and it is determined that the next code ID and the head code ID are equal. Is done. That is, it is determined that the code A of the code ID2 of the first code string block to be compared with the code A that is the second code 332b is located at the end position of the first code string block.
  • the second entry 321 (2) of the index data management table indicated by the dotted arrow 348b is read, and the code B stored in the head code 341b is stored in the temporary storage area 352b as indicated by the dotted arrow 351b. Is set.
  • the code B is read as the third code 332c as indicated by the dotted arrow 331c, it is determined whether or not it matches the code set in the temporary storage area 352b as indicated by the bidirectional dotted arrow 353b. Is done. That is, it is determined whether the code B which is the third code 332c is the head code of the second code string block. In the illustrated example, a positive determination result is obtained. Therefore, it can be seen that the search target code string 10a hits the search code string EAB.
  • the index data storage area 324b is accessed by the index data pointer 342b as indicated by the dotted arrow 344b, and the ID by code corresponding to the code B stored in the head code 341b as indicated by the dotted arrow 343b.
  • the entry 309b (B) in the range table 309b is read.
  • ID2 that is the first code ID in the code ID range 336f is read and set to the first code ID 346b that is a temporary storage area.
  • ID3 which is the next code ID 337c of the entry 310b (2) corresponding to ID2 which is the head code ID 346b is read.
  • the read ID3 is compared with ID2 previously set to the head code ID 346b, and it is determined that the next code ID is other than the head code ID. Is done.
  • the code C which is the fourth code 332d is read out.
  • ID3 which is the next code ID 337c of the entry 310b (2) corresponding to the code ID2 of the ID relation table 310b
  • ID3 is indicated by the code C of the ID range table 309b for each code. It is determined that it is included in the code ID range 336d (ID3 to ID4). That is, the code indicating the code-specific ID range table 309b including ID3 in the range of the code ID is found to be the code C. Therefore, it can be seen that the search target code string 10a hits the search code string EABC.
  • ID1 that is the next code ID 337d of the entry 310b (3) corresponding to ID3 that is the next code ID 337c is read.
  • the read ID1 is compared with the ID2 previously set in the head code ID 346b, and the next code ID and the head code ID may not be equal.
  • the code position 338b of the entry 310a (2) corresponding to the code ID2 read from the ID relation table 310a is P4, and the entry 310b (2) corresponding to the code ID2 read from the ID relation table 310b. Since the code position 338c is P5 and the code position 338d of the entry 310b (3) corresponding to the code ID3 is P6, it can be seen that the hit positions are the code positions P3, P4, P5, and P6. .
  • the next code ID of the entry in the ID relationship table 310 corresponding to ID1 that is the next code ID 337d is read as shown by the dotted arrow 334e.
  • the determination of whether or not the code ID is within the code ID range of the entry in the code ID range table 309 indicated by the code type of the code is repeated.
  • the code string search according to the embodiment of the present invention is performed.
  • the index data includes an index data management table, an ID management table for each code stored in an index data storage area corresponding to each code string block, and an ID relation table.
  • 4A and 4B are diagrams illustrating a flow of processing for creating index data according to an embodiment of the present invention.
  • the index data creation processing flow shown in FIG. 4A and FIG. 4B includes initial processing and index data corresponding to each code string block (hereinafter referred to as block index data corresponding to each code string block or simply block index data). It may consist of a flow that sequentially executes the creation process.
  • FIG. 4A is a diagram for explaining the processing flow before the process of creating index data according to an embodiment of the present invention, that is, the process of sequentially creating block index data corresponding to each code string block.
  • This preceding process is the initial process described above.
  • a search target code string is set in step S401.
  • the search target code string is set by reading one code string from the set of search target code strings stored in the data storage device by the search target code string reading unit 111 illustrated in FIG. This means setting in the code string setting area.
  • the above-described search target code string setting area is one of the above-described “temporary storage devices corresponding to each process in order to use various values obtained during the process in the subsequent process”. .
  • step S402 the storage area of the index data management table is acquired, and the index data management pointer is positioned at the first entry of the index data management table.
  • step S403 the maximum number of codes in the code string block obtained by dividing the search target code string is set. In the example shown in FIG. 3A, the maximum number of codes is four.
  • step S404 the head position of the code position to be searched is set as the head position of the code string.
  • step S405 the end position of the code string to be searched is set as the end position of the code string, and the process proceeds to step S406 shown in FIG. 4B. This completes the initial process of creating index data.
  • FIG. 4B This completes the initial process of creating index data.
  • the search target code string 10a is set, the index data management pointer 322 is positioned at the head entry of the index data management 321, the maximum code number is 4, and the code string head position is P1.
  • Pn is set at the end position of the code string.
  • FIG. 4B is a diagram for explaining a processing flow at the latter stage of processing for sequentially creating block index data corresponding to each code string block.
  • step S406 a value obtained by subtracting the head position of the code string from the end position of the code string is set in the remaining code number, and in step S407, it is determined whether the remaining code number is larger than the maximum code number. . If the remaining code number is larger than the maximum code number, the process proceeds to step S408, and the position moved by the maximum code number from the head position of the code string is set as the end position of the code string. If the remaining code number is not greater than the maximum code number, the process advances to step S409 to set the end position of the code string at the end position of the code string.
  • steps S406 to S409 described above are performed in order to determine the end of index data creation processing corresponding to each code string block described later, based on the end position of the code string set in step S408 or step S409.
  • step S410 an index data storage area of the code string block that is the current index data creation target is secured, a pointer to the storage area is acquired, and the process proceeds to step S411.
  • the code string block for which the index data is to be created starts from a code positioned at the head position of the code string set in step S404 or step S415 described later.
  • step S411 the index data of the code string block that is the current index data creation target is created, stored in the storage area secured in step S410, and the topmost code is acquired. Details of the process in step S411 and the top code will be described later with reference to FIG. 4C and FIGS. 5A to 5C.
  • step S412 “present” is set in the setting display of the index data management table pointed to by the index data pointer, the top code is set in the top code, and the pointer acquired in step S410 is set in the index data pointer. Note that the top code is set in the process of step S411.
  • step S413 it is determined whether the end position of the code string is the end position of the code string. If the end position of the code string is the end position of the code string, the creation of the index data has been completed, and the process ends. If the end position of the code string is not the end position of the code string, the process proceeds to step S414, the index data management pointer is positioned at the next entry in the index data management table, and the code string end position is set at the head position of the code string in step S415. The code position next to the position is set, and the process returns to step S406. The loop processing from step S406 to step S415 described above is repeated until it is determined in step S413 that the end position of the code string indicates the end position of the code string. If this determination is obtained, the index data for all code strings is obtained. Since the creation of the index data has been completed, the index data creation process is terminated.
  • step S411 shown in FIG. 4B block index data creation processing according to an embodiment of the present invention will be described. Since this block index data creation process is the same for any code string block, and the code string block is also a single code string, in the following description, the code that is currently the target of index data creation
  • the column block may be referred to as a search target code string or a search target code string.
  • FIG. 4C is a diagram illustrating a schematic flow of processing for creating block index data according to an embodiment of the present invention.
  • step S420 the area of the ID range table for each code is secured based on the number of code types to be searched, and the codes included in the search target code string are sequentially read to show the number of appearances and the total number of codes for each code type. Ask for.
  • the total number of codes in the case of the first code string block shown in FIG. 3A is 4, which is equal to the maximum code number set in step S403 shown in FIG. 4A. Details of the processing in step S420 will be described later with reference to FIG. 5A.
  • step S430 based on the number of appearances for each code type, a code ID range for each code type is set in the code-specific ID range table. Details of the processing in step S430 will be described later with reference to FIG. 5B.
  • step S440 the area of the ID relation table is secured based on the total number of codes, and the ID relation table is completed by sequentially reading out the codes included in the search target code string while referring to the code-specific ID range table. The process is terminated. Details of the processing in step S440 will be described later with reference to FIG. 5C.
  • FIG. 5A shows a detailed flow of the processing in step S420 shown in FIG. 4B, and is a diagram for explaining the processing flow for counting the number of appearances for each code type of codes included in the search target code string.
  • a search target code string is set.
  • Setting the search target code string means that the code string block that is currently the target of index data creation is set in a search target code string setting area (not shown).
  • the above-described search target code string setting area is one of the above-described “temporary storage devices corresponding to each process in order to use various values obtained during the process in later processes”. .
  • the expression “set in a search target code string setting area (not shown)” it is described as “set as a search target code string” or simply “set as a search target code string”. Sometimes. The same applies to other than the search target code string.
  • step S502 the number of code types is set.
  • the number of types of codes is determined by the code system and is given in advance.
  • step S503 a storage area for the ID range table for each code is secured in the area secured in step S410 shown in FIG. 4B based on the number of code types set in step S502, and the number of appearances is set to 0. initialize.
  • step S504 the head position of the code string set in step S501 is set in the code position pointer, and in step S505, a value 0 is set in the code number counter.
  • the processes in steps S501 to S505 described above are initial processes.
  • step S506 the code pointed to by the code position pointer is extracted from the code string.
  • step S507 a value 1 is added to the number of appearances of an entry in the ID range table for each code corresponding to the code type of the extracted code (hereinafter also referred to as a code-specific ID range table indicated by the code), and step S508 is performed.
  • the value 1 is added to the code number counter, and the process proceeds to step S509.
  • step S509 it is determined whether the code position pointer is the end position of the code string set in step S408 or step S409 of FIG. 4B. If it is not the end position, the code position pointer is advanced to the next code position in step S510. The process returns to step S506. If the code position pointer is the end position of the code string, the code number counter is set as the total number of codes in step S511, and the process is terminated. Through the above processing, the number of appearances of the code-specific ID range table is set, and the total number of codes is set.
  • FIG. 5B shows a detailed flow of the process in step S430 shown in FIG. 4C, and shows a process flow for setting a code ID range for each code type based on the number of appearances set by the process shown in FIG. 5A. It is a figure explaining.
  • step S521 the head position of the code ID range table is set in the code type pointer, and in step S522, an initial value is set in the code ID counter.
  • step S523 the number of appearances is extracted from the code-specific ID range table indicated by the code type pointer.
  • step S524 it is determined whether the number of appearances extracted is zero.
  • step S525 If the number of appearances is not 0, “Yes” is set in the setting display of the code ID range table pointed to by the code type pointer in step S525, and the value of the code ID counter is set in the head code ID and the code ID counter. .
  • step S526 the number of appearances is added to the code ID counter, and in step S527, a value obtained by subtracting 1 from the value of the code ID counter is set in the tail code ID of the code ID range table pointed to by the code type pointer, and in step S529. Proceed to
  • step S524 if the number of appearances is 0 in the determination in step S524, “None” is set in the setting display of the code ID range table pointed to by the code type pointer in step S528, and the code pointed to by the code type pointer in step S528a.
  • An unset ID is set in the head code ID and the tail code ID of the separate ID range table, and the process proceeds to step S529. As the unset ID, 0 or -1 can be used.
  • step S529 it is determined whether the code type pointer is the end position of the code-specific ID range table. If it is not the end position, the code type pointer is advanced to the position of the next code type in the code-specific ID range table in step S530. The process returns to step S523. If it is the end position, since the setting of the code-specific ID range table has been completed, the processing ends.
  • FIG. 5C shows a detailed flow of the processing in step S430 shown in FIG. 4C, and is a diagram for explaining the processing flow for completing the ID relationship table based on the codes included in the search target code string.
  • step S541 a storage area for the ID relation table is secured in the storage area secured in step S410 of FIG. 4B based on the total number of codes obtained by the process shown in FIG. 5B.
  • step S542 the code position pointer is stored. The head position of the search target code string is set.
  • step S543 the code pointed to by the code position pointer is extracted from the search target code string, and is set as the first code.
  • step S544 the code-specific ID counter in the code-specific ID range table pointed to by the code is read and set in the code ID pointer.
  • step S545 a code ID pointer is set to the topmost code ID, and the process proceeds to step S546.
  • step S546 it is determined whether the code position pointer is the end position of the code string set in step S408 or step S409 of FIG. 4B. If the code position pointer is not the end position of the code string, the processing of steps S547 to S554 is executed. The code position and the next code ID in the ID relation table indicated by the corresponding code ID are set, and the process returns to step S546.
  • step S547 a code position pointer is set at the code position in the ID relation table pointed to by the code ID pointer.
  • step S550 1 is added to the code ID counter in the code ID range table pointed to by the code extracted in step S543 or step S552, and the code position pointer is advanced to the next code position in step S551.
  • step S552 the code pointed to by the code position pointer is extracted from the search target code string, and in step S553, the code-specific ID counter in the code-specific ID range table pointed to by the extracted code is read, and the ID relationship pointed to by the code ID counter Set to the next code ID in the table.
  • step S554 the code ID counter read in step S553 is set in the code ID counter, and the process returns to step S546.
  • the processes in steps S546 to S554 are repeated until the code position pointer points to the end position of the search target code string.
  • the process branches to step S555.
  • step S555 the code position pointer is set in the code position of the ID relation table pointed to by the code ID pointer, and the top code ID set in step S545 is set in the next code ID, and the process is terminated.
  • the index data for code string search according to the embodiment of the present invention is created.
  • the code string search according to the embodiment of the present invention is first the code in the search target code string that matches the head code of the search code string and its position. A code position is obtained, and a code-by-code ID range table corresponding to the code string block is created for each code collation between the code in the search target code string and the code in the search code string from the obtained code position. This is performed using an ID relationship table.
  • the processing flow of the code string search in one embodiment of the present invention has a triple loop.
  • the outermost loop is a loop for each code string block.
  • the search by the search code string is repeated from the first code string block to the last code string block of the search target code string.
  • the control flow of this outermost loop is shown in FIG.
  • the next inner loop is a loop for each code ID of the head code of the search code string.
  • the search by the search code string is repeated over the range of the code ID of the head code of the search code string.
  • FIGS. 7A and 7B The control flow of this loop is shown in FIGS. 7A and 7B.
  • the innermost loop is a loop for collation with the code string block for each code of the search code string.
  • the verification for each code from the head code to the tail code of the search code string is repeated.
  • the control flow of this innermost loop is shown in FIG. 8A for an exact match search, in FIG. 8B for a forward match search, and in FIG. 8C for a search that includes an arbitrary code.
  • FIG. 8D describes a processing flow common to FIGS. 8A to 8C for obtaining a code having the code ID from the code ID.
  • the next inner loop process is called for each code string block of the outermost loop process, and for each code ID of the head code of the search code string
  • the innermost loop process is called to repeat the verification for each code from the first code to the last code of each code in the code string block and the search code string.
  • the search target code string is divided for each code string block, and the above-mentioned verification for each code is repeated in the innermost loop processing, the verification of the code at the end of the search code string is performed. It is possible that the end position of the code string block may be reached before the process ends. Then, it is necessary to continue the above-mentioned collation for each code over the next code string block.
  • the search process for the next code string block whose processing flow is shown in FIGS. 9A and 9B realizes the continuation of the verification for each code.
  • This search processing is called by the innermost loop processing, but the innermost loop processing is called recursively for repeated verification for each code.
  • FIG. 6 is as described above, and is therefore a diagram for explaining the general flow of the entire code string search process in one embodiment of the present invention.
  • the flow shown in FIG. 6 includes an initial process and a loop process in which a search is started by sequentially switching a code string block to be searched from a search target code string from the top to the next code string block.
  • a search code string is set.
  • the search code string is set by setting the search code string read by the search code string reading means 111 shown in FIG. 2B in the temporary storage area, and the start position of the set search code string is given. It is assumed that In step S602, the head entry position of the index data management table is set in the index data management pointer at the search start position which is a temporary storage area. This completes the initial processing described above.
  • step S603 an entry in the index data management table pointed to by the index data pointer at the search start position is extracted.
  • step S604 it is determined whether the setting display of the extracted entry is “Yes”. If the setting display is “present”, the process proceeds to step S605. If the setting display is not “present”, all searches are completed, and the process is terminated.
  • step S605 the index data pointer of the entry extracted in step S603 is extracted, and the code-specific ID range table and ID relation table stored in the index data storage area pointed to by the index data pointer are acquired.
  • the ID range table for each code and the ID relationship table are acquired when the storage areas of the ID range table for each code and the ID relationship table are secured in step S503 shown in FIG. 5A and step S541 shown in FIG. 5C, respectively. This can be realized by setting respective pointers pointing to and using those pointers.
  • step S606 the top code of the entry extracted in step S603 is extracted.
  • step S607 the head code ID is extracted from the ID range table by code pointed to by the head code, and set as the head code ID at the search start position.
  • step S608 the corresponding code string block is searched based on the code-specific ID range table and ID relationship table acquired in step S605. Details of the processing in step S608 will be described later with reference to FIGS. 7A and 7B.
  • step S609 the next entry position in the index data management table is set in the index management data pointer at the search start position, and the process returns to step S603.
  • step S604 The loop processing from step S603 to step S609 described above is repeated until it is determined in step S604 that the index data management table entry setting display is not “present” while the index data management pointer at the search start position is updated in step S609. repeat.
  • the index data management pointer setting process at the search start position in steps S602 and S609 and the start code position setting process in step S607 are performed from the code string block starting the search as described above. Since there is a case where collation for each code is performed over the block, the index data management pointer and the head code position relating to the code string block for starting the search are saved.
  • FIG. 7A is a diagram for explaining the processing flow of the previous stage of code string search performed using a certain code string block as the code string block at the search start position in one embodiment of the present invention.
  • step S701 the start position of the search code string is set as the search start position
  • step S702 the end position of the search code string is set as the search end position.
  • step S703 the search code is extracted from the search code string pointed to by the search head position, and set as the search code at the search head position.
  • step S704 a setting display is extracted from the code-specific ID range table indicated by the search code at the search head position, and in step S705, the setting display for determining whether the extracted setting display is “present” is not “present”. Since the search code at the search start position does not exist in the search target code string, the search process is terminated.
  • step S706 the head code ID is extracted from the code-specific ID range table indicated by the search code at the search head position, and is set as the search start code ID.
  • step S707 the end code ID is extracted from the code-specific ID range table indicated by the search code at the search start position and set as the search end code ID.
  • the search start code ID which is the code ID being processed in the loop processing for each code ID of the head code of the search code string described above, is initialized to the head code ID in the range of the code ID.
  • the processing in step 707 is for making it possible to identify the end of the code ID to be processed. Subsequent to step S707, the process proceeds to step S711 shown in FIG. 7B.
  • FIG. 7B is a diagram illustrating a processing flow of the latter stage of code string search performed using a certain code string block as a code string block at a search start position according to an embodiment of the present invention.
  • the search head position set in step S701 is set as the search progress position.
  • the search progress position indicates the code position of the code to be collated in the collation loop with the code string block for each code of the search code string shown in FIG. 8A and the like described above.
  • the search head Initially set to the position, that is, the start position of the search code string.
  • step S712 the index data management pointer at the search start position set in step S602 shown in FIG.
  • step S713 the head code ID which is a temporary storage area is shown in FIG.
  • the head code ID of the search start position set in step S607 is set.
  • step S714 the search start code ID is saved and the process proceeds to step S715.
  • the search start code ID is saved because there is a possibility that the code string is collated over a plurality of code string blocks as described above in the process of step S715.
  • the process of FIG. 8A and the like is recursively called, and at that time, the first code ID of the ID range table by code pointed to by the first code of the next code string block (corresponding to the next code string block) This is because the search start code ID may be changed.
  • step S715 the above-described search is performed by collating each code from the code in the code string block to the code at the beginning of the search code string to the code at the end. It returns whether the search was successful or unsuccessful. Details of step S715 will be described later with reference to FIG. 8A regarding complete match search, FIG. 8B regarding forward match search, and FIG. 8C regarding search including an arbitrary code.
  • step S716 the search start code ID saved in step S714 is restored.
  • step S717 an entry in the index data management table pointed to by the index data management pointer at the search start position is extracted.
  • step S718 each code stored in the index data storage area pointed to by the index data pointer in the extracted entry is stored.
  • An ID range table and an ID relationship table are acquired.
  • the search start position set in step S602 or step S607 of FIG. The code-specific ID range table and ID relation table are obtained again using the index data management pointer.
  • step S719 it is determined whether the search in step S715 was successful or unsuccessful. If unsuccessful, the process proceeds to step S721. If successful, in step S720, the code position is extracted from the ID relationship table pointed to by the search start code ID, and is output to the search result code position, and the process proceeds to step S721.
  • step S721 it is determined whether the search start code ID matches the search end code ID. If not, the search start code ID is updated to the next code ID in step S722, and the process returns to step S711. If the search start code ID and the search end code ID match, the search of the code ID range in the code-specific ID range table pointed to by the first code of the search code string in the currently processed code string block has been completed. Returning to the processing shown in FIG.
  • step S715 shown to FIG. 7B is demonstrated in detail.
  • the process in step S715 is performed as shown in FIG. 8A, FIG. 8B, or FIG. 8C depending on whether the search mode is a complete match search, a forward match search, or a search including an arbitrary code. It will be illustrated as follows.
  • FIG. 8A is a diagram for explaining the processing flow of an exact match search in one embodiment of the present invention.
  • the search start code ID is set in the code ID pointer in step S810. This search start code ID is either initially set in step S706 shown in FIG. 7A or updated and set in step S722 shown in FIG. 7B.
  • step S811 the next code ID is extracted from the ID relationship table pointed to by the code ID pointer, set as a search code ID, and set as a code ID pointer.
  • step S812 it is determined whether the search progress position is the search end position. If it is not the search end position, the process proceeds to step S813. If it is the search end position, it is confirmed that the collation for each code succeeds to the end of the search code string. Therefore, the search success is returned and the process returns to the loop process shown in FIG. 7B. In step S813, it is determined whether the next code ID extracted in step S811 matches the head code ID. The head code ID is set in step S713 shown in FIG. 7B.
  • step S814 the search progress position is advanced to the position of the next search code in the search code string, and the search is performed from the search code string indicated by the search progress position in step S815.
  • the code is extracted and the process proceeds to step S816.
  • step S816 the code-specific ID range table is searched using the next code ID, and the corresponding index code is extracted.
  • the index code is the code having the next code ID as the code ID as described above with reference to FIG. 3B.
  • the next code ID is included in the range of the code ID in the code-specific ID range table pointed to by the index code. Details of the processing in step S816 will be described later with reference to FIG. 8D.
  • step S817 it is determined whether the search code extracted in step S815 matches the index code extracted in step S816. If they match, the process returns to step S811, and if they do not match, there is a code that could not be verified. Therefore, the search failure is returned and the process returns to the loop process shown in FIG. 7B.
  • step S813 determines whether the next code ID and the head code ID match. If it is determined in step S813 that the next code ID and the head code ID match, the process proceeds to step S818 to search for the next code string block. Details of the processing in step S818 will be described later with reference to FIGS. 9A and 9B.
  • step S819 it is determined whether the search for the next code string block is successful. If successful, search success is returned. If not successful, search failure is returned and the process returns to the loop processing shown in FIG. 7B.
  • FIG. 8B is a diagram for explaining the process flow of the forward match search in one embodiment of the present invention.
  • the processing executed in each step of step S830 to step S838 shown in FIG. 8B is the step number shown in FIG. This is the same as the processing executed in each step of S810 to S818.
  • step S817 of complete match search shown in FIG. 8A if it is determined that the search code does not match the index code, search failure is returned and the process returns to the process shown in FIG. 7B, whereas the forward match search shown in FIG.
  • step S837 even if it is determined that the search code does not match the index code, search success is returned and the process returns to the loop processing shown in FIG. 7B.
  • step S831 code positions are sequentially extracted in addition to the next code ID from the entry in the ID relationship table pointed to by the code ID pointer. When it is determined in step S837 that the search code does not match the index code, step S831 is executed. The code position extracted last may be returned as a search result together with a successful search.
  • the last extracted code position is the code position stored in the same entry in the ID relationship table with the next code ID included in the code ID range of the index code described above.
  • the codes up to the search target code string located at this code position match the search codes in the search code string.
  • step S819 it is determined in step S819 whether the search for the next code string block is successful. If the search is not successful, a search failure is returned and the process returns to the loop processing shown in FIG. 7B. On the other hand, in the forward match search shown in FIG. 8B, the search succeeds immediately after searching for the next code string block in step S838. Then, the processing returns to the loop processing shown in FIG. 7B.
  • step S705 shows the determination processing in step S705 shown in FIG. 7A that the first search code in the search code string exists in the search target code string, and therefore at least the first code in the search code string is included. Since a matching code string exists in the search target code string, the search is returned to success and the process returns to the loop processing shown in FIG. 7B. Since the return type after the determination in step S837 and the processing other than step S838 and subsequent steps are all the same as those shown in FIG. 8A as described above, description thereof will be omitted.
  • FIG. 8C is a diagram illustrating a search processing flow including an arbitrary code according to an embodiment of the present invention.
  • the arbitrary code is a code that is collated with an arbitrary code in the search target code string. If the search code string includes an arbitrary code and a code string that matches all the codes other than the arbitrary code exists in the search target code string, the search target code string is hit with the search code string including the arbitrary code.
  • step S850 to S859 shown in FIG. 8C is the same as the processing in step S855a between step S855 and step S856. Is the same as the process executed in the steps S810 to S819 shown in FIG. 8A for the step number obtained by subtracting 40 from the step number.
  • step S855a it is determined whether the search code extracted in step S855 is an arbitrary code. If it is determined in step S855a that the code is an arbitrary code, the process returns to step S851 without performing the matching determination process between the search code and the index code in steps S856 and S857. If it is not determined in step S855a that the code is an arbitrary code, the process proceeds to step S856. Except for the determination process in step S855a described above, all the steps are the same as those shown in FIG.
  • FIG. 8D is a diagram illustrating a processing flow of processing for converting a code ID into a code according to an embodiment of the present invention.
  • an initial value is set in the code type pointer in step S870.
  • the code type pointer has already been described with reference to FIG. 3A.
  • the code type pointer 311a points to an entry in the ID management table 309a for each code stored in the index data storage area 324a.
  • the code type pointer for setting the initial value in step S870 is for the code-specific ID range table acquired in step S605 shown in FIG. 6 or step S911 shown in FIG. 9B described later.
  • step S871 the head code ID and tail code ID are extracted from the entry in the code ID range table pointed to by the code type pointer, and in step S872, it is determined whether the search code ID is within the range of the head code ID and tail code ID. .
  • step S873 If the search code ID is not within the range of the head code ID and the tail code ID, it is determined in step S873 whether the code type pointer is the end position of the code-specific ID range table. The process advances to the next position in the ID range table for each code and returns to step S871. If it is determined in step S873 that the code type pointer is the end position of the code-specific ID range table, the process advances to step S876 to set an undetermined code in the index code and the process ends.
  • step S872 if it is determined in step S872 that the search code ID is within the range of the head code ID and the tail code ID, the process proceeds to step S875.
  • step S875 the code type pointer is set in the index code, and the process ends.
  • the value of the code type pointer is associated with a specific code type including the code itself.
  • setting the code type pointer in the index code here means setting the specific code type associated with the value of the code type pointer in the index code which is a temporary storage area.
  • the index code search has been described with reference to the so-called linear search method in which the search code ID and the code ID range are matched while sequentially updating the code type pointer from the initial value.
  • the search method is not limited to this, and it is obvious that any search method such as a binary search method can be adopted.
  • FIG. 9A is a diagram for explaining the first stage of the processing flow for searching for the next code string block in the embodiment of the present invention.
  • step S901 the next entry position of the index data management table is set in the index data management pointer.
  • the index data management pointer at the search start position is set as the index data management pointer in step S712 shown in FIG. 7B.
  • step S902 an entry in the index data management table pointed to by the index data management pointer is extracted.
  • step S903 it is determined whether the setting display of the extracted entry is “Yes”.
  • step S904 If the setting display is “Yes”, the process proceeds to step S904. If the setting display is not “Yes”, there are no more code string blocks, and verification for each code is interrupted. The process returns to the process of FIG. 8A, FIG. 8B or FIG.
  • step S903 it is determined that the entry setting display is “Yes”, and when the process proceeds to step S904, the head code of the entry in the index management table taken out in step S902 is taken out and set as the head code which is a temporary storage area. To do.
  • step S905 the search progress position is advanced to the position of the next search code in the search code string.
  • step S906 the search code is extracted from the search code string indicated by the search progress position, and the process proceeds to step S907.
  • step S907 it is determined whether the head code set in step S904 matches the search code extracted in step S906. This determination is a comparison between the code at the head position of the next code string block and the code at the search progress position of the search code string. If this determination result is negative, search failure is returned and the processing returns to FIG. 8A, FIG. 8B or FIG. 8C. On the other hand, if the determination result in step S907 is affirmative, the process proceeds to step S911 and subsequent steps shown in FIG. 9B, and collation for each code is further advanced.
  • FIG. 9B is a diagram for explaining the latter part of the processing flow of the search for the next code string block in the embodiment of the present invention.
  • step S911 the code-specific ID range table and ID relation table stored in the storage area of the index data pointed to by the index data pointer of the entry previously extracted in step S902 shown in FIG. 9A are acquired.
  • step S912 the head code ID is extracted from the code-specific ID table pointed to by the head code set in step S904, set to the head code ID which is a temporary storage area, and in step S913, the head code ID is set as the search start code ID. Then, the process proceeds to step S914.
  • step S914 the process shown in FIG. 8A, FIG. 8B, or FIG. 8C is recursively called, and a search is performed by collating each code from the first code to the last code of each code in the code string block and the search code string. Do. It returns whether the search was successful or unsuccessful.
  • step S915 if the search in step S914 is successful, search success is returned, and if it is unsuccessful, search failure is returned, and the process returns to the process shown in FIG. 8A, FIG. 8B, or FIG.
  • the search target code string is one up to the second code string block of those shown in FIG. 3A, and the search code string is ABC.
  • the search target code string may be referred to as a search target code string 10a in the same manner as in FIG. 3A.
  • FIGS. 10A and 10B are diagrams for explaining the flow of processing from the first code string block of the search target code string.
  • the outermost loop process shown in FIG. 6 corresponds to the first loop process.
  • FIG. 10A explains the flow of search for the first code string block among them.
  • a block surrounded by a dotted line denoted by reference numeral 701a describes a flow of processing each search code of the search code string ABC from the top.
  • the block 701a indicates a change in the code of the search progress position.
  • a block surrounded by a dotted line with a reference numeral 702a includes a code ID range in the code-specific ID range table 309a pointed to by the code at the search progress position and a code-specific ID range pointed to by the code A at the head position of the code string block ID1 which is the head code ID of the table 309a is described.
  • a block surrounded by a dotted line denoted by reference numeral 703a describes a flow for sequentially obtaining the next code from the ID relation table 310a. Also, the processing steps shown in FIGS. 6 to 9B related to the processing flow shown in the figure are shown in parentheses in the figure.
  • step S603 of FIG. 6 the drawing number notation is omitted
  • the top entry 704a of the index data management table is displayed. It is taken out.
  • step S605 the code-specific ID range table 309a and the ID relation table 310a stored in the index data storage area 705a are acquired based on the index data pointer 733a of the entry.
  • the entry 309a (A) in the code-specific ID range table 309a corresponding to the code A stored in the head code 732a of the entry 704a is read.
  • the head code ID ID1 is read and set to the head code ID 742a.
  • the code A located at the head of the search code string is extracted in step S703 as indicated by the block 701a, and as indicated by the arrow 723a to the block 702a, the head code ID of the code-specific ID range table 309a indicated by the code A is shown.
  • ID1 is extracted in step S706 and set as the search start code ID.
  • ID2 which is the tail code ID is extracted in step S707 and set as the search end code ID.
  • ID3 which is the next code ID of the ID relationship table 310a pointed to by ID1 is extracted in steps S810 and S811.
  • step S813 as shown by a bidirectional dotted arrow 736a between ID3 which is the next code ID of the ID relation table 310a pointed to by ID1 in block 703a and the head code ID 742a in block 702a, the next code is shown in step S813. It is determined that ID3, which is an ID, is different from ID1, which is the head code ID.
  • step S814 the code at the next code position becomes the processing target in step S814, and code B is extracted in step S815.
  • a dotted arrow 755b between ID3 which is the next code ID of the ID relation table 310a pointed to by ID1 in the block 703a and the ID range table 309a by code in the block 702a
  • step S816 the ID range table 309a by code is shown.
  • code ID range including ID3 which is the next code ID and in the example shown in the figure, code B which is the code indicating the entry is temporarily stored as indicated by a dotted arrow 751a. It is set in area 752a.
  • step S817 it is determined that the code B set in the temporary storage area 752a matches the code B extracted in step S815.
  • ID4 which is the next code ID of the ID relation table 310a pointed to by ID3 is extracted in step S811.
  • step S813 as shown by a bidirectional dotted arrow 736b between ID4 which is the next code ID of the ID relation table 310a pointed to by ID3 in block 703a and the head code ID 742a in block 702a, the next code is shown in step S813. It is determined that ID4, which is the ID, is different from ID1, which is the head code ID.
  • the code at the next code position becomes the processing target in step S814, and the code C is extracted in step S815.
  • ID4 which is the next code ID of the ID relationship table 310a pointed to by ID3 in block 703a
  • ID range table 309a by code in block 702a in step S816, the ID range table 309a by code is shown.
  • a code E which is a code indicating the entry is temporarily stored as indicated by a dotted arrow 751b. It is set in the area 752b.
  • step S817 it is determined that the code E set in the temporary storage area 752b does not match the code C extracted in step S815, and the search fails. Therefore, the search failure is returned and the processing returns to the loop processing shown in FIG. 7B. That is, the code string from the code A whose code ID is ID1 among the code string blocks at the head of the search target code string 10a does not match the search code string ABC. This is consistent with the fact that the code sequence of 3 codes from the code A whose code ID is ID1 in the first code sequence block of the search target code sequence 10a is ABE and not ABC as shown in FIG. 3A. is doing.
  • FIG. 10B shows a flow in which the search code ID ABC of the search code string ABC is searched from the top code string block as ID2 which is the code ID next to ID1 of code A in step S722.
  • the process shown in FIG. 10A is the first process
  • the process shown in FIG. 10B is the second process.
  • the search target code string and the search code string are collated over the next code string block after the first code string block.
  • the search start code ID is updated from ID1 to ID2 in step S722 of the loop processing shown in FIG. 7B.
  • ID1 which is the next code ID of the ID relation table 310a pointed to by ID2 is extracted in steps S810 and S811.
  • step S813 as shown by a bidirectional dotted arrow 736c between ID1 which is the next code ID of the ID relationship table 310a pointed to by ID2 in block 703a and the head code ID 742a in block 702a, the next code It is determined that ID1 that is the ID matches ID1 that is the head code ID.
  • step S901 the entry 704b next to the first entry 704a in the index data management table is extracted. Then, the code B stored in the head code 732b of the entry 704b is set to the head code ID 741b in step S904 as indicated by an arrow 738a in the figure.
  • step S905 the code at the next code position is processed in step S905, and the code B next to the first code A from the search code string in step S906. Is taken out.
  • step S907 it is determined that the code B, which is the code positioned next to the code A, matches the code B set in the head code 741.
  • step S911 the code-specific ID range table 309b and the ID relation table 310b stored in the index data storage area 705b are acquired based on the index data pointer 733b of the entry 704b.
  • step S912 which is the head code ID is extracted from the ID-specific ID range table 309b pointed to by the code B set in the head code 741b, and is set as the head code ID 742b.
  • step S913 which is the next code ID of the ID relation table 310b pointed to by ID2 is extracted in step S913 and step S811 of the process shown in FIG. 8A recursively called.
  • step S813 as shown by a bidirectional dotted arrow 736d between ID3 which is the next code ID of the ID relation table 310b pointed to by ID2 of the block 703b and the head code ID 742b of the block 702b, in step S813 It is determined that ID3 which is an ID is different from ID2 which is the head code ID.
  • the code at the next code position becomes the processing target in step S814, and the code C is extracted in step S815.
  • the ID range table 309a by code is shown.
  • the code ID range including ID3 which is the next code ID is searched, and in the example shown in the figure, as indicated by the dotted arrow 751d, the code C indicating the entry is temporarily stored. It is set in area 752d.
  • step S817 it is determined that the code C set in the temporary storage area 752d matches the code C extracted in step S815.
  • step S720 as indicated by the arrow 728a, the code position P4 of the ID relationship table 310a pointed to by ID2 which is the search start code ID is set at the search result code position indicated by reference numeral 705b.
  • search start code ID ID2 is the search end code ID set in step S707, the search using the first code string block as the search start position ends, and the process returns to the loop processing shown in FIG.
  • the search start position is advanced by one, that is, the search is performed from the second code string block from the top.
  • FIG. 10C is a diagram for explaining the flow of processing from the second code string block of the search target code string, and the outermost loop process shown in FIG. 6 corresponds to the second loop process.
  • the processing flow described below is the same as that described above with reference to FIG. 10A.
  • the value of the index data management pointer at the search start position is updated in step S609, and the top entry 704b of the index data management table is extracted in step S603. .
  • step S605 the code-specific ID range table 309b and the ID relation table 310b stored in the index data storage area 705b are acquired based on the index data pointer 733b of the entry.
  • the code A located at the head of the search code string is extracted again in step S703 as shown in block 701a.
  • ID1 that is the first code ID of the code-specific ID range table 309b pointed to by the code A is extracted in step S706 and set as the search start code ID.
  • ID1 which is the tail code ID, is extracted in step S707 and set as the search end code ID.
  • ID4 which is the next code ID of the ID relationship table 310b pointed to by ID1 is extracted in steps S810 and S811.
  • step S813 as shown by a bidirectional dotted arrow 736e between ID4 which is the next code ID of the ID relation table 309b pointed to by ID1 in block 703b and the head code ID 742b in block 702b, in step S813 It is determined that ID3, which is an ID, is different from ID1, which is the head code ID.
  • step S814 the code at the next code position becomes the processing target in step S814, and code B is extracted in step S815.
  • ID4 which is the next code ID of the ID relation table 310b pointed to by ID1 in block 703b and the ID range table 309b by code in block 702b
  • step S816 the ID range table 309b by code is shown.
  • the code ID range including ID4 which is the next code ID and in the example shown in the figure, the code C indicating the entry is temporarily stored as indicated by the dotted arrow 751e. It is set in area 752e.
  • step S817 it is determined that the code C set in the temporary storage area 752e and the code B extracted in step S815 do not match, resulting in a search failure. Therefore, the search failure is returned and the processing returns to the loop processing shown in FIG. 7B.
  • step S604. Since the search start code ID ID1 is the search end code ID, the processing is ended by the determination in step S721 shown in FIG. 7B, and the processing returns to the loop processing shown in FIG. 6, and examples shown in FIGS. 10A to 10C. Since the search target code string is limited to the second code string block, the end of the entire search process is determined in step S604.
  • the code string search device of the present invention has a storage means for storing an index data management table, an ID range table for each code, and an ID relation table, and a program for causing the computer to execute the processes shown in FIGS. 6 to 9B. It is clear that it can be constructed.
  • the index data creating apparatus and method of the present invention can be realized by a program for causing a computer to execute the process of creating index data for code string search shown in FIGS. 4A to 5C and its equivalent. it is obvious.
  • the program and a computer-readable recording medium on which the program is recorded are included in the embodiment of the present invention.
  • a data structure of index data for code string search of the present invention and a computer-readable recording medium on which index data having the data structure is recorded are also included in the embodiment of the present invention.
  • the code-specific ID range table and ID relationship table and the index data management table for managing them, which are new index data structures provided by the present invention described in detail above, the load of creating index data is reduced, The code string search can be performed efficiently. Further, according to the present invention, since index data can be divided and stored in a plurality of storage areas, the size of the code string block can be reduced according to the hardware environment to be used even for a large amount of index data. It can also be made easier to access and maintain the index data.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

任意のコード列の検索を行うことができ、従来よりも短時間で作成することのできる索引のデータ構造を求め、それを用いたコード列検索手法を提供する。 検索対象のコード列を複数のブロックに分割したコード列ブロックに対応して、コード毎にそのコードIDの範囲を格納したコード別ID範囲表と各コードIDの次に位置する次コードIDを格納したID関係表を作成し、検索コード列の先頭コードのコードID範囲に含まれるコードIDに対応して格納された次コードIDをID関係表から読み出し、該次コードに対応して格納された次コードIDを順次ID関係表から読み出し、該読み出した次コードIDをコードIDの範囲に含むコードをコード別ID範囲読出表から探索し、該探索されたコードと先頭コード以降の検索コード列のコードを順次照合する。

Description

コード列検索装置、検索方法及びプログラム
 本発明は、ビット列で構成される文字コードあるいは文字コード列を検索する文字列検索のように、コンピュータにより、ビット列で構成されるコードあるいはコード列を検索するコード列検索に関するものである。
 近年、ビジネス文書を作成するためにワードプロセッサを使用することが通例となり、またインターネットが普及したことにより、ビット列からなる文字コードを用いた、コンピュータで処理可能な電子文書が世の中に大量に存在するようになっている。そのため、これら大量の電子文書の中からコンピュータを利用して必要なものを探し出すために、各種の文字列検索手法が開発されている。
 これらの文字列検索手法においては、高速な検索を実現するために予め索引を作成することが一般的である。索引としては、例えば、文書中の単語を抽出し、単語毎にそれの含まれている文書名を対応付けた転置インデックスがよく知られている。この転置インデックスはサイズが比較的小さく、検索が高速であり、インデックスの構成も簡単であるという特徴を持っている。しかしながら、単語の抽出が難しい言語もある。また、複数の単語の組み合わせの検索を行おうとすると、文書中の単語位置を突き合わせる処理が必要になるという欠点も存在する。そして、一文中の任意の文字列を検索することも難しい。
 そこで、任意の文字列を検索可能とする接尾辞配列という索引が開発されている。下記特許文献1及び非特許文献1には、接尾辞配列とそれを用いた検索手法が開示されている。
図1Aは、上述の接尾辞配列に関する従来の検索方法の例を説明するものである。図1Aには、検索対象の文字列10が例示されている。文字列10は、アルファベットの文字A、B、C、Eと区切り文字$で構成されている。文字Aは文字列10の文字位置1、4、7に位置している。文字Bは文字列10の文字位置2、5に位置している。文字Cは文字列10の文字位置6、8に位置している。文字Eは文字列10の文字位置3に位置している。区切り文字$は、文字列10の末尾の位置である文字位置9に位置している。
 さらに図1Aには、文字列10に対応する、文字位置順の接尾辞20、辞書順の接尾辞20a及び接尾辞配列30が記載されている。
 文字列10は、文字一巡の接尾辞20に示すようにその部分文字列として9個の接尾辞を持つと考えることができる。各接尾辞の先頭文字の文字位置順に接尾辞を並べた文字位置順の接尾辞20を辞書順にソートすることにより、辞書順の接尾辞20aが得られる。このとき、辞書順に並べ替えた接尾辞の先頭文字の文字位置を配列に格納することにより、接尾辞配列30が得られる。この接尾辞配列により、検索文字列のパターンと一致する検索対象文字列中の部分文字列の先頭の文字位置を求めることができる。
 図1Bに示すのは、従来の検索方法例の圧縮接尾辞配列による文字列検索の概念を説明するものであり、検索文字列40と接尾辞配列30に対応する圧縮接尾辞配列(概念図)50が示されている。圧縮接尾辞配列(概念図)50の配列番号(i)には、次の配列番号(Ψ)が格納されている。次の配列番号(Ψ)は、接尾辞配列30の配列番号(i)に格納された文字位置に1を加えた文字位置が格納された接尾辞配列30の配列番号である。
 配列に格納するものを文字位置から次の配列番号(Ψ)に変更することにより、文字毎に格納される値は図に示すように昇順になる。したがって、各配列要素に格納する値は次の配列番号(Ψ)そのものではなく1つ前の配列要素に格納された値の増分とすることができるのでビット幅を狭くすることができ、情報量を圧縮することができる。
 検索の概念については、例示された検索文字列40の各文字から圧縮接尾辞配列(概念図)50の配列番号(i)への点線の矢印と配列番号(i)の太字で示す3、6、9と次の配列番号(Ψ)の太字で示す6、9との間の矢印の検索ステップで示している。すなわち、検索文字列40の先頭の文字Aに対応する配列番号から例えば3が選ばれ、配列番号3の次の配列番号6が検索文字列40の2番目の文字Bに対応する配列番号であり、配列番号6の次の配列番号9が検索文字列40の3番目の文字Eに対応する配列番号であることにより、検索対象の文字列10が検索文字列40による検索でヒットすることがわかる。
特許第3、672、242号公報
定兼、「圧縮接尾辞に関する考察」、電子情報通信学会技術研究報告(2000-7-19)Vol.100,No.226,p49-56
 文字列検索に圧縮接尾辞配列を用いることにより、任意の文字列の検索を行うことができ、配列の容量も削減することができる。しかし、圧縮接尾辞配列を作成するには、その前に検索対象の文字列から接尾辞を作成しその接尾辞を辞書順にソートして接尾辞配列を作成する必要があり、検索対象の文字列から圧縮接尾辞配列を作成する処理時間が大きなものとなる。
 そこで本発明の解決しようとする課題は、文字列に限らず、任意のコード列の検索を行うことができる索引データの作成時間を従来のものよりも短縮することである。そして、本発明の目的は、任意のコード列の検索を行うことができ、従来よりも短時間で作成することのできる索引のデータ構造を求め、それを用いたコード列検索手法を提供することである。
 本発明によれば、検索対象コード列をいくつかのブロック(以下、コード列ブロックということがある。)に分割し、コード列ブロック毎に、コード列ブロックに位置する全ての各コードを一意に識別するコードIDが、異なるコードの値(以下、誤解の恐れのない場合には、単にコードという場合がある。また、逆に異なるコード値であることを強調して、コード種別ということもある。)間でコードIDの範囲が重ならないように、上記全ての各コードに付与されるものとする。例えばコード毎にコード列ブロック中に出現する順に昇順のコードIDを付与することを、コード種別毎に最初のコードIDの値をそれまで付与されたコードIDより大きい値として繰り返すことにより、上記コードIDの付与を実現することができる。
 そして本発明によれば、各コード列ブロックに対応してコード毎にそのコードIDの範囲を格納したコード別ID範囲表と各コードIDの次に位置するコードIDである次コードIDを格納したID関係表を作成し、コード別ID範囲表とID関係表を用いてコード列検索を実施する。
本発明の、検索コード列による検索対象コード列のコード列検索によれば、先頭のコード列ブロックのコード別ID範囲表から検索コード列を構成するコードのコードIDの範囲を読み出し、検索コード列の先頭のコードのコードID範囲に含まれるコードIDに対応して格納された次コードIDをコード列ブロック毎に作成されたID関係表から読み出すとともに該次コードIDに対応して格納された次コードIDを順次ID関係表から読み出し、ID関係表から読み出した次コードIDをそのコードID範囲に含むコード別ID範囲表のエントリに対応するコードを求め、該求められたコードと検索コード列中の次のコードと一致するか順次照合し、この照合を後続のコード列ブロックに対して同様に行う。
 本発明によれば、簡単な構造のコード別ID範囲表とID関係表を用いて検索を実施することができるので、接尾辞配列を作成する必要がなく、コンピュータの索引作成の処理負担を小さくすることができる。
接尾辞配列に関する従来の検索方法の例を説明する図である。 従来の検索方法例の圧縮接尾辞配列を説明する図である。 本発明の一実施の形態における索引用のデータ構造を作成するための機能ブロックを説明する図である。 本発明の一実施の形態におけるコード列検索のための機能ブロックを説明する図である。 本発明の一実施の形態におけるハードウェア構成例を説明する図である。 本発明の一実施形態における索引データの構造を説明する図である。 本発明の一実施の形態におけるコード列検索の概念を説明する図である。 本発明の一実施形態におけるコード列ブロックの索引データを作成する前段の処理フローを説明する図である。 本発明の一実施形態におけるコード列ブロックの索引データを作成する後段の処理フローを説明する図である。 本発明の一実施形態におけるコード列ブロックの索引データを作成する処理の概略フローを説明する図である。 本発明の一実施形態における検索対象のコード列に含まれるコードのコード種別毎の出現回数を計数する処理フローを説明する図である。 本発明の一実施形態における出現回数をもとにコード別ID範囲表のコードID範囲を設定する処理フローを説明する図である。 本発明の一実施形態における検索対象コード列に含まれるコードをもとにID関係表を完成させる処理フローを説明する図である。 本発明の一実施形態におけるコード列検索の処理全体の概略フローを説明する図である。 本発明の一実施形態における、あるコード列ブロックを検索開始位置とするコード列検索の前段の処理フローを説明する図である。 本発明の一実施形態における、あるコード列ブロックを検索開始位置とするコード列検索の後段の処理フローを説明する図である。 本発明の一実施の形態における完全一致検索の処理フローを説明する図である。 本発明の一実施の形態における前方一致検索の処理フローを説明する図である。 本発明の一実施の形態における任意コードを含む検索の処理フローを説明する図である。 本発明の一実施の形態におけるコードIDをコードに変換する処理フローを説明する図である。 本発明の一実施の形態における次のコード列ブロックの検索の前段の処理フローを説明する図である。 本発明の一実施の形態における次のコード列ブロックの検索の後段の処理フローを説明する図である。 本発明の一実施の形態における先頭のコード列ブロックからの検索の処理の流れを説明する図である。 本発明の一実施の形態における次のコード列ブロックの検索へ移行する流れを説明する図である。 本発明の一実施の形態における先頭から2番目のコード列ブロックからの検索の処理の流れを説明する図である。
以下、本発明を実施するための最良の形態を、図面を参照しながら説明する。
図2Aは、本発明の一実施の形態における索引用のデータ構造を作成するための機能ブロックを説明する図である。索引データ作成管理手段104は、索引データ作成手段105による検索対象コード列を分割したブロック(コード列ブロック)毎の索引データの作成を管理し、索引データ管理表を作成する。索引データ作成手段105は、検索対象コード列読出手段101、コード別ID範囲表生成手段102及びID関係表生成手段103を含む。
検索対象コード列が検索対象コード列読出手段101で読み出され、コード別ID範囲表生成手段102とID関係表生成手段103に渡される。コード別ID範囲表生成手段102は、コード毎にそのコードIDの範囲を格納したコード別ID範囲表を作成し、ID関係表生成手段103は、各コードIDの次に位置するコードIDである次コードIDを格納したID関係表を生成する。
 図2Bは、本発明の一実施の形態におけるコード列検索を行うための機能ブロックを説明する図である。コード列検索管理手段116は、コード列検索手段117による検索対象コード列のコード列ブロック毎の検索を管理する。コード列検索手段117は、検索コード列読出手段111、コード別ID範囲読出手段112、ID関係読出手段113、コード種別探索手段114及びコード種別照合手段115を含む。
まず、検索コード列の先頭のコードが検索コード列読出手段111で読み出され、コード別ID範囲読出手段112に渡される。コード別ID範囲読出手段112は、コード別ID範囲表生成手段102で生成されたコード別ID範囲表より、検索コード列読出手段111から渡された先頭のコードのコードIDの範囲を読み出してID関係読出手段113に渡す。
ID関係読出手段113は、コード別ID範囲読出手段112から渡された検索コード列の先頭のコードのコードID範囲に含まれるコードIDに対応して格納された次コードIDを、ID関係表生成手段103で生成されたID関係表から読み出すとともに、該次のコードに対応して格納された次コードIDを順次ID関係表から読み出してコード種別探索手段114に渡す。
コード種別探索手段114は、コード別ID範囲表を用いて、ID関係読出手段113から渡された次コードIDをそのコードIDの範囲に含むコード種別を探索してコード種別照合手段115に渡す。
コード種別照合手段115は、検索コード列読出手段111で読み出されたコード種別とコード種別探索手段114で探索されたコード種別を照合して検索結果を出力する。
図2Cは、本発明の一実施の形態におけるハードウェア構成例を説明する図である。
 本発明の検索装置による検索処理及び索引生成処理は中央処理装置302及びキャッシュメモリ303を少なくとも備えたデータ処理装置301によりデータ格納装置308を用いて実施される。索引データ管理表321の格納領域と、コード列ブロックに対応するコード別ID範囲表309とID関係表310を格納する索引データの格納領域324を含むデータ格納装置308は、主記憶装置305または外部記憶装置306で実現することができ、あるいは通信装置307を介して接続された遠方に配置された装置を用いることも可能である。
図2A及び図2Bを参照して説明したコード列検索手段117等の各機能ブロックは、図2Cに例示するハードウェアと後に説明するステップを備えたソフトウェアにより実現可能である。
図2Cの例示では、主記憶装置305、外部記憶装置306及び通信装置307が一本のバス304によりデータ処理装置301に接続されているが、接続方法はこれに限るものではない。また、主記憶装置305をデータ処理装置301内のものとすることもできる。
 また、特に図示されてはいないが、処理の途中で得られた各種の値を後の処理で用いるためにそれぞれの処理に応じた一時記憶領域が用いられることは当然である。以下の説明では、一時記憶領域に格納されたあるいは設定された値を一時記憶領域の名前で呼ぶことがある。
 次に、本発明の一実施態様における検索手法の概要を説明する。
 図3Aは、本発明の一実施の形態における索引データの構造を説明する図である。図3Aには、索引データを作成する対象となる検索対象のコード列の例として、検索対象コード列10aが記載されている。検索対象コード列10aは、コードA、B、E、A、B、C、A、・・・、C、Bの英文字の文字コードから構成されている。それぞれの文字コードの下に記載されたP1~P8、・・・、Pn-1、Pnは、検索対象コード列10aにおけるコードの位置を表している。コード位置ポインタ11は、検索対象コード列10aにおけるコードの位置を示すポインタであり、図の例ではコード位置P1を指している。
図に示す例では、検索対象コード列10aは4つのコード毎に分割されている。したがって、矢印12で示すように、2番目のコード列ブロックの先頭位置はP5である。また、矢印13で示すように、2番目のコード列ブロックの末尾位置はP8である。矢印14で示すコード位置Pnは、終端位置と定義する。最後のコード列ブロックだけは、2つのコードで構成されている。
個々のコード列ブロックに対して、索引データとして、コード別ID範囲表とID関係表が生成される。
 さらに図3Aには、検索対象コード列10aに対応する、コード列検索のための索引のデータ構造例が記載されている。検索対象コード列10aとそのコード列ブロックに対応して生成される索引データ管理表321と、先頭のコード列ブロックに対応する索引データの格納領域324aに格納されたコード別ID範囲表309aとID関係表310a、2番目のコード列ブロックに対応する索引データの格納領域324bに格納されたコード別ID範囲表309bとID関係表310b、3番目のコード列ブロックに対応する索引データの格納領域324c、及び最後のコード列ブロックに対応する索引データの格納領域324dに格納されたコード別ID範囲表309dとID関係表310dが例示されている。索引データの格納領域324cに格納された索引データの表記は省略されている。なお、以下においては、「コード別ID範囲表309」、「ID関係表310」のように表記して共通事項を説明することがある。また、他の符号についても同様に表記する場合がある。
 コード別ID範囲表309のエントリは、索引データを作成する対象である検索対象コード列に出現する異なるコードの種別毎に作成される。コード別ID範囲表309の左側に表示しているように、図に示す例では、アルファベットのうち、コードA~Eからなるコード列である検索対象コード列が索引データを作成する対象であり、各コードに対応してエントリが作成されている。コード種別ポインタ311は、コード別ID範囲表309のエントリを指すポインタである。図の先頭のコード列ブロックに対応するコード別ID範囲表309aの例では、コード種別ポインタ311aがコードAに対応するエントリを指している。同様に、2番目のコード列ブロックに対応するコード別ID範囲表309bの例では、コード種別ポインタ311bがコードAに対応するエントリを指している。また、最後のコード列ブロックに対応するコード別ID範囲表309dの例では、コード種別ポインタ311dがコードAに対応するエントリを指している。
 なお、各コードはビット列で構成されることから、そのビット列のビット値により表現される値を持つ。したがって、コード別ID範囲表309の各コードに対応するエントリの位置は各コードの値と対応付けることができることは明らかである。つまり、コード種別ポインタ311のとる値をコードそのものとすることもできる。そこで、以下の説明においては、各コードに対応するエントリを、各コードの指すエントリと表記することがある。
 コード別ID範囲表309aの下側に表示しているように、コード別ID範囲表309aのエントリは、設定表示、出現回数、先頭コードID、末尾コードID、コード別IDカウンタの項目で構成されている。
設定表示は、対応するコード列ブロックにそのコードが出現するかを1あるいは0で示すものである。コード別ID範囲表309aの例では、先頭のコード列ブロックにはコードCとコードDが出現しないので、コードCとコードDのエントリは0であり、他のエントリは1である。コード別ID範囲表309bの例では、2番目のコード列ブロックにはコードDとコードEが出現しないので、コードDとコードEのエントリは0であり、他のエントリは1である。コード別ID範囲表309Dの例では、最後のコード列ブロックにはコードBとコードCしか出現しないので、コードBとコードCのエントリは1であり、他のエントリは0である。
出現回数は、対応するコード列ブロックにそのコードが出現する回数である。コード別ID範囲表309aの例では、コードAからコードEに対して、2、1、0、0、1が格納されている。コード別ID範囲表309bの例では、コードAからコードEに対して、1、1、2、0、0が格納されている。コード別ID範囲表309dの例では、コードAからコードEに対して、0、1、1、0、0が格納されている。
 先頭コードID及び末尾コードIDは、コード別のコードIDの範囲を示すものである。コードIDは、コード間で重ならないように、コード毎にコード列ブロック中の出現順に付与されたものである。
コード別ID範囲表309aの例では、コードAについては出現回数が2であるのでコードIDの範囲はID1からID2であり、次のコードBについては出現回数が1であるので先頭コードと末尾コードは共にID3である。コードC及びコードDについては出現回数が0であるから、先頭コードIDと末尾コードIDは共に未設定である。コードEについては出現回数が1であるので先頭コードと末尾コードは共にID4である。
 以下同様に、コード別ID範囲表309bの例では、コードAの先頭コードと末尾コードは共にID1、コードBの先頭コードと末尾コードは共にID2、コードCについては出現回数が2であるのでコードIDの範囲はID3からID4である。
 また、コード別ID範囲表309dの例では、コードBの先頭コードと末尾コードは共にID1、コードCの先頭コードと末尾コードは共にID2である。
 なお、ID1等の値は具体的には1から始まる整数値とすることが好適であるが、それに限ることなく、コード別のID範囲を識別することのできるものであればよい。また、図の例では、コードIDの範囲を先頭コードIDと末尾コードIDで示しているが、可変長データとなることをいとわなければ、すべてのコードIDを列挙することで示すこともできる。
コード別IDカウンタは、コード別ID範囲表を生成したのちID関係表を生成するときに必要なカウンタであり、索引データとして必要なものではない。したがって、異なるコードの種別毎にコード別ID範囲表とは別のカウンタとして設けることもできる。
 ID関係表310のエントリは、コード列ブロックのコードに対してつけられたコードID毎に作成される。ID関係表310の左側に表示しているように、図に示す例では最後のコード列ブロックのリンク表310dを除いて、コードID1~コードID4に対応してエントリが作成されている。各エントリは、コード位置と次コードIDの項目から構成されている。コードIDポインタ312は、ID関係表310のエントリを指すポインタであり、図の例では、いずれのID関係表310においてもID1を指している。
 各コードIDのエントリのコード位置は、そのコードIDのコードの位置する検索対象コード列10aにおけるコード位置である。ID関係表310aでは、ID1に対してP1、ID2に対してP4、ID3に対してP2、ID4に対してP3が格納されている。
 図の点線の矢印313a(A)で示すように、ID関係表310aの1~2番目のエントリはコードAに対応するものである。同様に、点線の矢印313a(B)で示すように、3番目のエントリはコードBに、点線の矢印313a(E)で示すように、4番目のエントリはコードEに対応する。
 各コードIDのエントリの次コードIDは、コード列ブロックにおけるそのコードIDのコードの次に位置するコードのコードIDである。なお、コード列ブロックの末尾位置のコードに対しては、先頭位置のコードのコードIDが格納される。したがって、ID関係表310aでは、次コードIDとして、ID1に対してID3、ID2に対してID1、ID3に対してID4、ID4に対してID2が格納されている。
ID関係表310bでは、ID1に対してP7、ID2に対してP5、ID3に対してP6、ID4に対してP8が格納されている。
 図の点線の矢印313b(A)で示すように、ID関係表310bの1番目のエントリはコードAに対応するものである。同様に、点線の矢印313b(B)で示すように、2番目のエントリはコードBに、点線の矢印313b(C)で示すように、3~4番目のエントリはコードCに対応する。
 また、次コードIDとして、ID1に対してID4、ID2に対してID3、ID3に対してID1、ID4に対してID2が格納されている。
ID関係表310dでは、ID1に対してPn、ID2に対してPn-1が格納されている。
図の点線の矢印313d(B)で示すように、ID関係表310dの1番目のエントリはコードBに対応するものである。同様に、点線の矢印313d(C)で示すように、2番目のエントリはコードCに対応する。
また、次コードIDとして、ID1に対してID2、ID2に対してID1が格納されている。
 ID関係表310は、コードIDで表した2つのコードがコード列ブロックにおいて連続した位置関係にあることを索引データとして保持している。前方のコード列ブロックの末尾位置のコードと後方のコード列ブロックの先頭位置のコードの関係は、索引データ管理表321に各コード列ブロックの先頭コードをもつことで管理される。
図に示すように、索引データ管理表321は、コード列ブロック毎のエントリを有し、各エントリは設定表示、先頭コード、索引データポインタの項目から構成されている。索引データ管理ポインタ322は、索引データ管理表のエントリを指すポインタである。図の例では、索引データ管理ポインタ322は、先頭のコード列ブロックに対応するエントリ1を指している。
索引データ管理表321の設定表示には、エントリ1からエントリmまで1が設定され、それ以外のエントリの設定表示は0である。エントリmは最後のコード列ブロックに対応するものである。また、索引データ管理表321の先頭コードとして、エントリ1にはコードAが、エントリ2にはコードBが、エントリmにはコードCが設定されている。
索引データポインタは、点線の矢印344a、344b、344c、344dが示すように、それぞれ対応するコード列ブロックの索引データの格納領域324a、324b、324c、324dを指している。
ID関係表310を図1Bに示す従来例の圧縮接尾辞配列50と比較すると、圧縮接尾辞配列50では文字毎に次の配列番号がソートされているのに対して、ID関係表310では異なるコードの種別毎にコード位置がソートされている。したがって、同一コードを逐次検索する場合には、キャッシュ効果により高速化を図ることができる。
 図3Bは、本発明の一実施の形態におけるコード列検索の概念を説明する図である。
 検索対象コード列は、図3Aに例示した検索対象コード列10aとし、図3Aに示すようにコード列ブロックに分割されているものとする。また、検索コード列は図3Bに示す検索コード列40aとして、コード列検索の概念を説明する。検索対象コード列10aのコード列ブロックに対応して、コード別ID範囲表309とID関係表310が生成されており、また索引データ管理表321が生成されているものとする。
 検索を開始する前に、矢印348aで示す索引データ管理表の先頭のエントリ321(1)が読み出され、点線の矢印344aが示すように索引データポインタ342aにより索引データの格納領域324a内に格納されたコード別ID範囲表309aとID関係表310aが取得される。さらに、点線の矢印343aで示すように、先頭コード341aに格納されたコードAに対応する、コード別ID範囲表309aのエントリ309a(A)が読み出され、点線の矢印345aに示すように、先頭コードIDであるID1が読み出されて、一時記憶領域である先頭コードID346aに設定されている。
 検索コード列40aには、図に示すように、先頭からコードE、コードA、コードB、コードCが位置している。そこで、図に点線の矢印331aで示すように、1番目のコード332aであるコードEが読み出される。次に点線の矢印333aで示すように、先頭のコード列ブロックに対応するコード別ID範囲表309aのコードEに対応するエントリ309a(E)が読み出される。(もし、先頭のコード列ブロックに検索コード列40aの先頭のコードが存在しなければ、その先頭のコードが存在するコード列ブロックに対応する索引データまで読み飛ばす。)
そして点線の矢印334aで示すように、エントリ309a(E)からID範囲336aに含まれるコードID、図の例ではコードID4が読み出され、読み出されたコードID4に対応するエントリ310a(4)がID関係表310aから読み出される。
 一方、コード列ID範囲表309aに設定されている先頭のコードであるコードAの先頭コード、ID1が一時記憶領域である先頭コードID346aに設定されている。
 そして、双方向の点線の矢印347aで示すように、コードID4に対応するエントリ310a(4)の次コードIDであるID2と先頭コードID346aに設定されているID1が比較され、次コードIDは先頭コードID以外であると判定される。
 すると次に点線の矢印331bで示すように、2番目のコード332bであるコードAが読み出される。
一方、双方向の点線の矢印335bで示すように、ID関係表310aのコードID4に対応するエントリ310a(4)の次コードID337aであるID2が、コード別ID範囲表309aの、コードAの指すコードIDの範囲336b(ID1~ID2)に含まれていることが判定される。この判定は、コード別ID範囲表309aの先頭のエントリから順次コードIDの範囲を取り出してその範囲にID2が含まれるかを判定することにより行うことができる。
図の点線の矢印351aで示すように、次コードID337aであるID2をそのコードIDの範囲に含むコード別ID範囲表309aのエントリを指すコードA(以下、索引コードということがある。)が一時記憶領域352aに設定され、双方向の点線の矢印353aで示すように、一時記憶領域352aに設定された索引コードであるコードAが2番目のコード332bであるコードAと一致することが判定される。
このことは、コードE、コードAのコードの並びが、検索対象コード列10aの先頭のコード列ブロックに存在することを意味している。また、ID関係表310aから読み出されたコードID4に対応するエントリ310a(4)のコード位置338aがP3であることから、そのコードE、コードAのコードの並びの先頭位置がP3であることが分かる。
 さらに点線の矢印334bで示すように、次コードID337aであるID2に対応するエントリ310a(2)の次コードID337bであるID1が読み出される。そして、双方向の点線の矢印347bに示すように、この読み出されたID1と、先に先頭コードID346aに設定されたID1の比較がおこなわれ、次コードIDと先頭コードIDが等しいことが判定される。すなわち、2番目のコード332bであるコードAと照合する先頭のコード列ブロックのコードID2のコードAは、先頭のコード列ブロックの末尾位置に位置するものであることが判定される。
すると、点線の矢印348bで示す索引データ管理表の2番目のエントリ321(2)が読み出され、その先頭コード341bに格納されたコードBが点線の矢印351bで示すように一時記憶領域352bに設定される。そして、点線の矢印331cで示すようにコードBが3番目のコード332cとして読み出されると、双方向の点線の矢印353bで示すように、一時記憶領域352bに設定されたコードと一致するかが判定される。すなわち、3番目のコード332cであるコードBが2番目のコード列ブロックの先頭コードであるかが判定される。図の例では、肯定的な判定結果が得られる。したがって、検索対象コード列10aは検索コード列EABでヒットすることがわかる。
そこで、点線の矢印344bが示すように索引データポインタ342bにより索引データの格納領域324bがアクセスされ、点線の矢印343bで示すように、先頭コード341bに格納されたコードBに対応する、コード別ID範囲表309bのエントリ309b(B)が読み出される。点線の矢印345cに示すように、そのコードIDの範囲336fの先頭コードIDであるID2が読み出されて、一時記憶領域である先頭コードID346bに設定される。
次に、点線の矢印334cで示すように、先頭コードID346bであるID2に対応するエントリ310b(2)の次コードID337cであるID3が読み出される。そして、双方向の点線の矢印347cに示すように、この読み出されたID3と、先に先頭コードID346bに設定されたID2の比較がおこなわれ、次コードIDは先頭コードID以外であると判定される。
すると次に点線の矢印331dで示すように、4番目のコード332dであるコードCが読み出される。
一方、双方向の点線の矢印335dで示すように、ID関係表310bのコードID2に対応するエントリ310b(2)の次コードID337cであるID3が、コード別ID範囲表309bの、コードCの指すコードIDの範囲336d(ID3~ID4)に含まれていることが判定される。すなわち、ID3をそのコードIDの範囲に含むコード別ID範囲表309bを指すコードはコードCであることが見出される。
したがって、検索対象コード列10aは、検索コード列EABCでヒットすることがわかる。
この判定に続いて、点線の矢印334dで示すように、次コードID337cであるID3に対応するエントリ310b(3)の次コードID337dであるID1が読み出される。そして、双方向の点線の矢印347dに示すように、この読み出されたID1と、先に先頭コードID346bに設定されたID2の比較がおこなわれ、次コードIDと先頭コードIDが等しくないことが判定される。
そして、ID関係表310aから読み出されたコードID2に対応するエントリ310a(2)のコード位置338bがP4であること、ID関係表310bから読み出されたコードID2に対応するエントリ310b(2)のコード位置338cはP5であること、コードID3に対応するエントリ310b(3)のコード位置338dはP6であることから、上述のヒット位置はコード位置P3、P4、P5、P6であることが分かる。
検索コード列40aの図示しない5番目のコードについても、点線の矢印334eに示すように、次コードID337dであるID1に対応するID関係表310のエントリの次コードIDが読み出され、5番目のコードのコード種別の指すコード別ID範囲表309のエントリのコードIDの範囲内であるかの判定等が繰り返される。
 以上のようにして、本発明の一実施の形態によるコード列検索が実施される。
 次に、本発明の一実施の形態における索引データの作成処理を説明する。索引データは、図3Aに例示するように、索引データ管理表と、各コード列ブロックに対応する索引データの格納領域に格納されるコード別ID管理表とID関係表から構成される。
 図4A及び図4Bは、本発明の一実施形態における索引データを作成する処理のフローを説明する図である。図4A及び図4Bに示す索引データの作成処理フローは、初期処理のものと、各コード列ブロックに対応する索引データ(以下、各コード列ブロックに対応するブロック索引データ、あるいは単にブロック索引データということがある。)の作成処理を順次実行するフローから構成される。
 図4Aは、本発明の一実施形態における索引データを作成する処理、すなわち、各コード列ブロックに対応するブロック索引データを順次作成する処理の前段の処理フローを説明する図である。この前段の処理は、先に述べた初期処理である。
 図4Aに示すように、ステップS401において、検索対象コード列を設定する。検索対象コード列の設定は、データ格納装置に格納された検索対象となるコード列の集合から、1つのコード列を図2Aに例示する検索対象コード列読出手段111で読み出して、図示しない検索対象コード列設定エリアに設定することを意味する。なお、上述の検索対象コード列設定エリアは、先に述べた「処理の途中で得られた各種の値を後の処理で用いるためにそれぞれの処理に応じた一時記憶装置」の1つである。以下の説明では、「図示しない検索対象コード列設定エリアに設定する」のような表現に変えて、「検索対象コード列として設定する」あるいは単に「検索対象コード列に設定する」のように記述することもある。検索対象コード列以外についても同様である。
 次にステップS402において、索引データ管理表の格納領域を取得するとともに、索引データ管理ポインタを索引データ管理表の先頭エントリに位置付ける。ステップS403に進み、検索対象コード列を分割したコード列ブロックの最大コード数を設定する。図3Aに示す例では、最大コード数は4である。次のステップS404では、コード列の先頭位置に、検索対象のコード位置の先頭位置を設定する。さらにステップS405ではコード列の終端位置に、検索対象のコード列の終端位置を設定し、図4Bに示すステップS406に移行する。
以上で索引データ作成処理の初期処理が終了する。図3Aの例示では、検索対象コード列10aが設定され、索引データ管理ポインタ322は索引データ管理用321の先頭のエントリに位置付けられ、最大コード数には4が、コード列の先頭位置にはP1が、コード列の終端位置にはPnが設定される。
 図4Bは、各コード列ブロックに対応するブロック索引データを順次作成する処理の後段の処理フローを説明する図である。
 図に示すように、ステップS406において、残りコード数に、コード列の終端位置からコード列の先頭位置を減じた値を設定し、ステップS407で、残りコード数は最大コード数より大きいか判定する。
残りコード数が最大コード数より大きければステップS408に進み、コード列の末尾位置に、コード列の先頭位置から最大コード数分だけ移動した位置を設定する。また、残りコード数が最大コード数より大きくなければステップS409に進み、コード列の末尾位置に、コード列の終端位置を設定する。
 上述のステップS406~ステップS409の処理は、後述の各コード列ブロックに対応する索引データの作成処理の終了を、ステップS408あるいはステップS409で設定したコード列の末尾位置で判定するために行われる。
 次にステップS410において、現在索引データ作成対象となっているコード列ブロックの索引データの格納領域を確保するとともに、該格納領域のポインタを取得し、ステップS411に進む。索引データ作成対象のコード列ブロックは、ステップS404あるいは後述のステップS415で設定されるコード列の先頭位置に位置するコードから始まるものである。
 ステップS411では、現在索引データ作成対象となっているコード列ブロックの索引データを作成し、ステップS410で確保した格納領域に格納するとともに、最先頭コードを取得する。ステップS411の処理の詳細、及び最先頭コードについては、後に図4C、及び図5A~図5Cを参照して説明する。
 次にステップS412で、索引データポインタの指す索引データ管理表の設定表示に「あり」を、先頭コードに最先頭コードを、索引データポインタにステップS410で取得したポインタを、それぞれ設定する。なお、最先頭コードは、ステップS411の処理において設定されているものである。
 次にステップS413で、コード列の末尾位置はコード列の終端位置か判定する。コード列の末尾位置がコード列の終端位置であれば索引データの作成は完了しているので処理を終了する。コード列の末尾位置がコード列の終端位置でなければ、ステップS414へ進み、索引データ管理ポインタを索引データ管理表の次のエントリに位置付け、ステップS415でコード列の先頭位置に、コード列の末尾位置の次のコード位置を設定してステップS406に戻る。
 以上のステップS406~ステップS415のループ処理を、ステップS413においてコード列の末尾位置がコード列の終端位置を指していると判定されるまで繰り返し、該判定が得られると全てのコード列に対する索引データの作成が完了しているので、索引データ作成の処理を終了する。
次に、図4Bに示すステップS411の詳細な説明として、本発明の一実施の形態におけるブロック索引データの作成処理を説明する。このブロック索引データの作成処理はどのコード列ブロックに対しても同じであり、コード列ブロックも一つのコード列であることから、以下の説明においては、現在索引データ作成の対象となっているコード列ブロックを、検索対象コード列、あるいは検索対象のコード列という場合もある。
 図4Cは、本発明の一実施形態におけるブロック索引データを作成する処理の概略フローを説明する図である。
まず、ステップS420において、検索対象のコード種別数をもとにコード別ID範囲表の領域を確保すると共に、検索対象コード列に含まれるコードを順次読み出してコード種別毎の出現回数とコードの総数を求める。図3Aに示す先頭のコード列ブロックの場合のコードの総数は、図4Aに示すステップS403で設定した最大コード数と等しい4である。
ステップS420の処理の詳細は、後に図5Aを参照して説明する。
 次に、ステップS430で、コード種別毎の出現回数をもとに、コード別ID範囲表にコード種別毎のコードIDの範囲を設定する。ステップS430の処理の詳細は、後に図5Bを参照して説明する。
次にステップS440で、コード総数をもとにID関係表の領域を確保すると共に、コード別ID範囲表を参照しながら、検索対象コード列に含まれるコードを順次読み出してID関係表を完成させ、処理を終了する。ステップS440の処理の詳細は、後に図5Cを参照して説明する。
図5Aは、図4Bに示すステップS420の処理の詳細なフローを示すものであり、検索対象のコード列に含まれるコードのコード種別毎の出現回数を計数する処理フローを説明する図である。
 図に示すように、ステップS501において、検索対象コード列を設定する。検索対象コード列の設定は、現在索引データ作成の対象となっているコード列ブロックを、図示しない検索対象コード列設定エリアに設定することを意味する。なお、上述の検索対象コード列設定エリアは、先に述べた「処理の途中で得られた各種の値を後の処理で用いるためにそれぞれの処理に応じた一時記憶装置」の1つである。以下の説明では、「図示しない検索対象コード列設定エリアに設定する」のような表現に変えて、「検索対象コード列として設定する」あるいは単に「検索対象コード列に設定する」のように記述することもある。検索対象コード列以外についても同様である。
 次にステップS502において、コードの種別数を設定する。コードの種別数は、コード体系により決定されるものであり、予め与えられるものとする。次にステップS503に進み、図4Bに示すステップS410で確保した領域内に、ステップS502で設定したコードの種別数をもとにコード別ID範囲表の格納領域を確保し、出現回数を0に初期化する。続いてステップS504でコード位置ポインタに、ステップS501で設定したコード列の先頭位置を設定し、ステップS505でコード数カウンタに値0を設定する。以上のステップS501~ステップS505の処理は、初期処理である。
 初期処理に続いてステップS506に進み、コード列より、コード位置ポインタの指すコードを取り出す。次にステップS507で、取り出したコードのコード種別に対応するコード別ID範囲表のエントリ(以下、コードの指すコード別ID範囲表ということがある。)の出現回数に値1を加え、ステップS508でコード数カウンタに値1を加えてステップS509に進む。
 ステップS509では、コード位置ポインタが、図4BのステップS408あるいはステップS409で設定されたコード列の末尾位置であるか判定し、末尾位置でなければステップS510でコード位置ポインタを次のコード位置に進めてステップS506に戻る。コード位置ポインタがコード列の末尾位置であれば、ステップS511でコード総数にコード数カウンタを設定して処理を終了する。
以上の処理により、コード別ID範囲表の出現回数が設定されると共に、コード総数が設定される。
 図5Bは、図4Cに示すステップS430の処理の詳細なフローを示すものであり、図5Aに示す処理により設定された出現回数をもとにコード種別毎のコードID範囲を設定する処理フローを説明する図である。
 まずステップS521において、コード種別ポインタに、コード別ID範囲表の先頭位置を設定し、次にステップS522において、コードIDカウンタに初期値を設定する。次にステップS523に進み、コード種別ポインタの指すコード別ID範囲表より、出現回数を取り出し、ステップS524で、取り出した出現回数が0か判定する。
 出現回数が0でなければ、ステップS525でコード種別ポインタの指すコード別ID範囲表の設定表示に「あり」を設定すると共に、先頭コードIDとコード別IDカウンタにコードIDカウンタの値を設定する。次にステップS526でコードIDカウンタに出現回数を加え、ステップS527でコード種別ポインタの指すコード別ID範囲表の末尾コードIDに、コードIDカウンタの値より1を減じた値を設定してステップS529に進む。
 一方、ステップS524の判定で出現回数が0となった場合は、ステップS528でコード種別ポインタの指すコード別ID範囲表の設定表示に「なし」を設定し、ステップS528aでコード種別ポインタの指すコード別ID範囲表の先頭コードIDと末尾コードIDに未設定IDを設定してステップS529に進む。未設定IDとしては、0や-1を使うことができる。
 ステップS529では、コード種別ポインタはコード別ID範囲表の終端位置であるか判定し、終端位置でなければステップS530でコード種別ポインタを、コード別ID範囲表の次のコード種別の位置に進めてステップS523に戻る。終端位置であれば、コード別ID範囲表の設定は完了しているので、処理を終了する。
 図5Cは、図4Cに示すステップS430の処理の詳細なフローを示すものであり、検索対象コード列に含まれるコードをもとにID関係表を完成させる処理フローを説明する図である。
 まずステップS541で、図4BのステップS410で確保した格納領域内に、図5Bに示す処理により求めたコード総数をもとにID関係表の格納領域を確保し、ステップS542で、コード位置ポインタに、検索対象コード列の先頭位置を設定する。次にステップS543で、検索対象コード列より、コード位置ポインタの指すコードを取り出すとともに、最先頭コードに設定する。そして、ステップS544で、コードの指すコード別ID範囲表のコード別IDカウンタを読み出し、コードIDポインタに設定する。次にステップS545で、最先頭コードIDに、コードIDポインタを設定し、ステップS546に進む。
 ステップS546では、コード位置ポインタは、図4BのステップS408あるいはステップS409で設定されたコード列の末尾位置か判定し、コード列の末尾位置でなければ、ステップS547~ステップS554の処理を実行し、該当するコードIDの指すID関係表のコード位置と次コードIDを設定してステップS546に戻る。
まずステップS547では、コードIDポインタの指すID関係表のコード位置に、コード位置ポインタを設定する。
次にステップS550で、ステップS543あるいは後記ステップS552で取り出したコードの指すコード別ID範囲表のコード別IDカウンタに1を加え、ステップS551で、コード位置ポインタを次のコード位置に進める。
次にステップS552において検索対象コード列より、コード位置ポインタの指すコードを取り出し、ステップS553で、該取り出したコードの指すコード別ID範囲表のコード別IDカウンタを読み出し、コードIDカウンタの指すID関係表の次コードIDに設定する。
次にステップS554において、ステップS553で読み出したコード別IDカウンタをコードIDカウンタに設定してステップS546に戻る。以上のステップS546~ステップS554の処理をコード位置ポインタが検索対象コード列の末尾位置を指すまで繰り返し、コード位置ポインタが検索対象コード列の末尾位置、または、終端位置になるとステップS555に分岐する。ステップS555では、コードIDポインタの指すID関係表の、コード位置にコード位置ポインタを、次コードIDにステップS545で設定した最先頭コードIDを設定して処理を終了する。
以上図4A~図5Cを参照して詳細に説明した処理により、本発明の一実施の形態におけるコード列検索のための索引データが作成される。
 次に、図6~図9Bを参照して、本発明の一実施の形態におけるコード列検索の処理を説明する。本発明の一実施の形態におけるコード列検索は、先に図3Bを参照してその概念を説明したとおり、まず検索コード列の先頭コードと一致する検索対象コード列中のコードとその位置であるコード位置を求め、次に求めたコード位置からの検索対象コード列中のコードと検索コード列中のコードとの1コード毎の照合を、コード列ブロック対応に作成されたコード別ID範囲表とID関係表を用いて行うものである。
 そこで、図6~図9Bを参照した具体的説明に入る前に、本発明の一実施の形態におけるコード列検索処理の処理フローの概要と各図面に記載した処理の関係について説明する。
 本発明の一実施の形態におけるコード列検索の処理フローは、3重のループを有する。
最外側のループは、コード列ブロック毎のループである。検索対象コード列の先頭のコード列ブロックから終端のコード列ブロックまで検索コード列による検索を繰り返す。この最外側のループの制御フローは、図6に示されている。
 次の内側のループは、検索コード列の先頭コードのコードID毎のループである。あるコード列ブロックにおいて、検索コード列の先頭コードのコードIDの範囲に亘って検索コード列による検索を繰り返す。このループの制御フローは図7A及び図7Bに示されている。
 最内側のループは、検索コード列の1コード毎のコード列ブロックとの照合のループである。検索コード列の先頭のコードから末尾のコードまでの1コード毎の照合が繰り返される。この最内側のループの制御フローは、完全一致検索に関しては図8Aに、前方一致検索に関しては図8Bに、任意コードを含む検索に関しては図8Cに示されている。
 また、図8Dには、図8A~図8Cに共通な、コードIDから該コードIDを有するコードを求める処理フローが記載されている。
 本発明の一実施の形態におけるコード列検索処理の処理フローによれば、最外側のループ処理のコード列ブロック毎に次の内側のループ処理が呼び出され、検索コード列の先頭コードのコードID毎に最内側のループ処理が呼び出されてコード列ブロック中の各コードと検索コード列の先頭のコードから末尾のコードまでの1コード毎の照合が繰り返される。
そして、本発明においては、検索対象コード列がコード列ブロック毎に分割されており、最内側のループ処理において、上記1コード毎の照合を繰り返しているとき、検索コード列の末尾のコードの照合が終わらないうちに、当該コード列ブロックの末尾位置に至ることがありうる。すると、次のコード列ブロックに亘っての上記1コード毎の照合の繰り返しを継続する必要がある。
 この1コード毎の照合の繰り返しの継続を実現するのが図9A及び図9Bにその処理フローを示す次のコード列ブロックに対する検索処理である。この検索処理は最内側のループ処理により呼び出されるが、1コード毎の照合の繰り返しのために再帰的に当該最内側のループ処理を呼び出す。
 図6は、先に述べたとおりのものであり、したがって、本発明の一実施の形態におけるコード列検索の処理全体の概略フローを説明する図である。図6に示すフローは、初期処理と、検索対象コード列のうち検索を開始するコード列ブロックを先頭から次のコード列ブロックに順次切り替えて検索するループ処理からなるものである。
 まず、ステップS601において、検索コード列を設定する。この検索コード列の設定は、図2Bに示す検索コード列読出手段111により読み出された検索コード列を一時記憶領域に設定することにより行われ、その設定された検索コード列の先頭位置は与えられているものとする。
 次にステップS602において、一時記憶領域である検索開始位置の索引データ管理ポインタに、索引データ管理表の先頭のエントリ位置を設定する。
 以上で先に述べた初期処理が終了する。
 次にステップS603に進み、検索開始位置の索引データポインタの指す索引データ管理表のエントリを取り出し、ステップS604において、該取り出したエントリの設定表示は「あり」であるかを判定する。設定表示が「あり」であればステップS605に進み、設定表示が「あり」でなければ全ての検索は終了しているので、処理を終了する。
ステップS605では、ステップS603で取り出したエントリの索引データポインタを取り出し、索引データポインタの指す索引データの格納領域内に格納されたコード別ID範囲表とID関係表を取得する。このコード別ID範囲表とID関係表の取得は、図5Aに示すステップS503及び図5Cに示すステップS541においてそれぞれコード別ID範囲表とID関係表の格納領域を確保したときにそれらの先頭アドレスを指すそれぞれのポインタを設定しておき、それらのポインタを利用することで実現することができる。
 次にステップS606において、ステップS603で取り出したエントリの先頭コードを取り出す。そして、ステップS607で該先頭コードの指すコード別ID範囲表より先頭コードIDを取り出し、検索開始位置の先頭コードIDに設定する。
次にステップS608において、ステップS605で取得したコード別ID範囲表とID関係表をもとに、該当するコード列ブロックを検索する。ステップS608の処理の詳細は、後に図7A及び図7Bを参照して説明する。
次にステップS609で、検索開始位置の索引管理データポインタに索引データ管理表の次のエントリ位置を設定してステップS603に戻る。
上述のステップS603~ステップS609のループ処理を、ステップS609において検索開始位置の索引データ管理ポインタを更新しながらステップ604で索引データ管理表のエントリの設定表示が「あり」ではないと判定されるまで繰り返す。
なお、上述のステップS602、S609の検索開始位置の索引データ管理ポインタの設定処理及びステップS607の先頭コード位置の設定処理は、先に述べたように検索を開始するコード列ブロックから次のコード列ブロックに亘って1コード毎の照合が行われる場合があるので、検索を開始するコード列ブロックに係わる索引データ管理ポインタ及び先頭コード位置を退避するためのものである。
次に、図7A及び図7Bを参照して、図6に示すステップS608の検索処理について詳細に説明する。
図7Aは、本発明の一実施の形態における、あるコード列ブロックを検索開始位置のコード列ブロックとして行われるコード列検索の前段の処理フローを説明する図である。
まず、ステップS701において、検索先頭位置に、検索コード列の先頭位置を設定し、ステップS702で、検索末尾位置に、検索コード列の末尾位置を設定する。
 次にステップS703で、検索先頭位置の指す検索コード列より検索コードを取り出し、検索先頭位置の検索コードに設定する。ステップS704で、検索先頭位置の検索コードの指すコード別ID範囲表より、設定表示を取り出し、ステップS705で該取り出した設定表示は「あり」であるか判定する
設定表示が「あり」でなければ、検索先頭位置の検索コードが検索対象コード列中に存在しないということであるから、検索処理を終了する。
ステップS705での判定が設定表示は「あり」であれば、ステップS706に進み、検索先頭位置の検索コードの指すコード別ID範囲表より先頭コードIDを取り出し、検索開始コードIDに設定する。次にステップS707で、検索先頭位置の検索コードの指すコード別ID範囲表より末尾コードIDを取り出して検索終了コードIDに設定する。
ステップS706の処理は、先に述べた検索コード列の先頭コードのコードID毎のループ処理における処理中のコードIDである検索開始コードIDを、コードIDの範囲の先頭コードIDに初期設定するものであり、ステップ707の処理は、処理対象のコードIDの終端を識別可能とするためのものである。
ステップS707に引き続き、図7Bに示すステップS711に進む。
図7Bは、本発明の一実施の形態における、あるコード列ブロックを検索開始位置のコード列ブロックとして行われるコード列検索の後段の処理フローを説明する図である。
ステップS711では、検索進行位置にステップS701で設定した検索先頭位置を設定する。検索進行位置は、先に述べた図8A等に示す検索コード列の1コード毎のコード列ブロックとの照合ループにおける、照合対象のコードのコード位置を示すものであり、ステップS711では、検索先頭位置、すなわち検索コード列の先頭位置に初期設定される。
次にステップS712において、索引データ管理ポインタに、図6に示すステップS602で設定した検索開始位置の索引データ管理ポインタを設定し、ステップS713で一時記憶領域である先頭コードIDに、図6に示すステップS607で設定した検索開始位置の先頭コードIDを設定する。さらにステップS714において、検索開始コードIDを退避してステップS715に進む。
ここで検索開始コードIDを退避するのは、ステップS715の処理において、先に述べたように複数のコード列ブロックに亘ってコード列の照合が行われる可能性がある。その場合には再帰的に図8A等の処理が呼び出され、その際に次のコード列ブロックの先頭のコードの指すコード別ID範囲表(次のコード列ブロックに対応したもの)の先頭コードIDに検索開始コードIDが変更される可能性があるからである。
ステップS715では、先に述べた、コード列ブロック中の各コードと検索コード列の先頭のコードから末尾のコードまでの1コード毎の照合による検索を行う。そして、検索が成功であったか失敗であったかを返す。ステップS715の詳細については、完全一致検索に関しては図8A、前方一致検索に関しては図8B、任意コードを含む検索に関しては図8Cを参照して後に説明する。
次にステップS716において、ステップS714で退避した検索開始コードIDを復元する。そしてステップS717において、検索開始位置の索引データ管理ポインタの指す索引データ管理表のエントリを取り出し、ステップS718で、該取り出したエントリの索引データポインタの指す索引データの格納領域内に格納されたコード別ID範囲表とID関係表を取得する。上記ステップS717とステップS718の処理は、先に述べたように、ステップS715の処理において複数のコード列ブロックに亘ってコード列の照合が行われる可能性があり、その場合には、図6に示すステップS605で取得したコード別ID範囲表とID関係表とは別のコード別ID範囲表とID関係表が用いられているので、図6のステップS602あるいはステップS607で設定した検索開始位置の索引データ管理ポインタを用いて再度コード別ID範囲表とID関係表を取得するものである。
次にステップS719に進み、ステップS715における検索は成功であったか失敗であったかを判定する。失敗であればステップS721に進み、成功であれば、ステップS720で、検索開始コードIDの指すID関係表よりコード位置を取り出し、検索結果コード位置に出力してステップS721に進む。
ステップS721では、検索開始コードIDは検索終了コードIDと一致するか判定し、一致しなければ、ステップS722で、検索開始コードIDを次のコードIDに更新してステップS711に戻る。
検索開始コードIDと検索終了コードIDが一致すれば、現在処理中のコード列ブロックにおける、検索コード列の先頭コードが指すコード別ID範囲表のコードIDの範囲の検索が終了しているので、図6に示す処理に戻る。
次に、図8A、図8B及び図8Cを参照して、図7Bに示すステップS715の処理について詳細に説明する。先に述べたように、検索の態様が完全一致検索であるか、前方一致検索であるか、あるいは任意コードを含む検索であるかによって、ステップS715の処理は、図8A、図8Bあるいは図8Cに例示するものとなる。
図8Aは、本発明の一実施の形態における、完全一致検索の処理フローを説明する図である。
 図に示すように、ステップS810でコードIDポインタに検索開始コードIDを設定する。この検索開始コードIDは、図7Aに示すステップS706で初期設定されたか、あるいは図7Bに示すステップS722で更新され設定されたものである。次にステップS811において、コードIDポインタの指すID関係表より次コードIDを取り出し、検索コードIDに設定するとともに、コードIDポインタに設定する。
次にステップS812で検索進行位置は検索末尾位置か判定し、検索末尾位置でなければステップS813に進み、検索末尾位置であれば、1コード毎の照合が検索コード列の末尾まで成功したことになるので、検索成功を返して図7Bに示すループ処理に戻る。
ステップS813では、ステップS811で取り出した次コードIDは先頭コードIDと一致するか判定する。先頭コードIDは、図7Bに示すステップS713で設定したものである。次コードIDと先頭コードIDが一致しなければ、ステップS814に進み、検索進行位置を、検索コード列の次の検索コードの位置に進め、ステップS815で、検索進行位置の指す検索コード列より検索コードを取り出して、ステップS816に進む。
ステップS816では、次コードIDによりコード別ID範囲表を検索し、該当する索引コードを取り出す。索引コードは先に図3Bを参照した説明において述べたもので、次コードIDをコードIDとして持つコードである。索引コードの指すコード別ID範囲表のコードIDの範囲に次コードIDは含まれる。ステップS816の処理の詳細は、後に図8Dを参照して説明する。
 そしてステップS817において、ステップS815で取り出した検索コードがステップS816で取り出した索引コードと一致するか判定し、一致すればステップS811に戻り、一致しなければ照合が取れなかったコードが存在したことになるので、検索失敗を返して図7Bに示すループ処理に戻る。
 一方、ステップS813で、次コードIDと先頭コードIDが一致すると判定されると、ステップS818に進み、次のコード列ブロックを検索する。ステップS818の処理の詳細は、後に図9A及び図9Bを参照して説明する。
 次にステップS819において、次のコード列ブロックの検索は成功であるか判定する。成功であれば検索成功を返し、成功でなければ検索失敗を返して図7Bに示すループ処理に戻る。
 図8Bは、本発明の一実施の形態における前方一致検索の処理フローを説明する図である。図8Aに示す完全一致検索の処理フローと比較すると、図8Bに示すステップS830~ステップS838の各ステップで実行する処理自体は、そのステップ番号から20を引いたステップ番号の、図8Aに示すステップS810~ステップS818の各ステップで実行する処理と同じである。
しかし、図8Aに示す完全一致検索のステップS817では、検索コードは索引コードと一致しないと判定すると検索失敗を返して図7Bに示す処理に戻るのに対して、図8Bに示す前方一致検索のステップS837では、検索コードは索引コードと一致しないと判定しても、検索成功を返して図7Bに示すループ処理に戻る。
なお、ステップS831において、コードIDポインタの指すID関係表のエントリより、次コードIDに加えてコード位置を順次取り出しておき、ステップS837において検索コードは索引コードと一致しないと判定したとき、ステップS831で最後に取り出したコード位置を、検索成功と共に検索結果として返してもよい。この最後に取り出したコード位置は、上述の索引コードのコードID範囲に含まれる次コードIDとID関係表の同一エントリに格納されたコード位置である。このコード位置に位置する検索対象コード列のコードまでは、検索コード列の検索コードと一致している。上記最後に取り出したコード位置と、図7Bに示すステップS720で検索開始コードの指すID関係表から取り出すコード位置を検索結果コード位置として出力することにより、検索コード列と前方一致する検索対象コード列のコード位置の範囲を知ることができる。
 また、図8Aに示す完全一致検索のステップS818で次のコード列ブロックを検索したのち、ステップS819で次のコード列ブロックの検索は成功であるか判定し、成功であれば検索成功を返し、成功でなければ検索失敗を返して図7Bに示すループ処理に戻るのに対して、図8Bに示す前方一致検索においては、ステップS838で次のコード列ブロックを検索したのち、直ちに検索成功を返して図7Bに示すループ処理に戻る。
 これは、図7Aに示すステップS705の判定処理により、検索コード列中の先頭の検索コードが検索対象コード列中に存在することが保証されており、したがって、少なくとも検索コード列の先頭のコードまでは一致するコード列が検索対象コード列に存在するので、検索成功を返して図7Bに示すループ処理に戻る。
 上述のステップS837での判定後のリターン種別及びステップS838以降の処理以外に関しては、先に述べたように全て図8Aに示すものと同じであるので、その説明は省略する。
 図8Cは、本発明の一実施の形態における任意コードを含む検索の処理フローを説明する図である。ここで任意コードとは、検索対象コード列の任意のコードと照合するコードである。検索コード列が任意コードを含み、任意コード以外の全てのコードが一致するコード列が検索対象コード列に存在すれば、その検索対象コード列は、前記任意コードを含む検索コード列でヒットする。
図8Cに示すフローを図8Aに示す完全一致検索の処理フローと比較すると、図8Cに示すステップS850~ステップS859の各ステップで実行する処理は、ステップS855aの処理がステップS855とステップS856の間に挿入されている以外は、そのステップ番号から40を引いたステップ番号の、図8Aに示すステップS810~ステップS819の各ステップで実行する処理と全く同じである。
 ステップS855aでは、ステップS855で取り出した検索コードは任意コードか判定する。ステップS855aで任意コードと判定されると、ステップS856及びステップS857の検索コードと索引コードの一致判定処理を経ることなくステップS851に戻る。ステップS855aで任意コードと判定されなければ、ステップS856に進む。
上述のステップS855aでの判定処理以外は、先に述べたように全て図8Aに示すものと同じであるので、その説明は省略する。
次に、図8Aに示すステップS816、図8Bに示すステップS836、あるいは図8Cに示すステップS856の次コードIDによりコード別ID範囲表を探索し、該当する索引コードを取り出す処理、すなわちコードIDをコードに変換する処理について詳細に説明する。
図8Dは、本発明の一実施の形態におけるコードIDをコードに変換する処理の処理フローを説明する図である。
図に示すように、ステップS870で、コード種別ポインタに初期値を設定する。コード種別ポインタは、先に図3Aを参照して説明したものである。例えば図3Aに示すように、コード種別ポインタ311aは、索引データの格納領域324aに格納されたコード別ID管理表309aのエントリを指す。ステップS870で初期値を設定するコード種別ポインタは、図6に示すステップS605あるいは後述の図9Bに示すステップS911において取得されたコード別ID範囲表についてのものである。
次にステップS871において、コード種別ポインタの指すコード別ID範囲表のエントリから先頭コードIDと末尾コードIDを取り出し、ステップS872で、検索コードIDは先頭コードIDと末尾コードIDの範囲内か判定する。
検索コードIDが先頭コードIDと末尾コードIDの範囲内でなければ、ステップS873においてコード種別ポインタはコード別ID範囲表の終端位置か判定し、終端位置でなければステップS874でコード種別ポインタを、コード別ID範囲表の次の位置に進めてステップS871に戻る。ステップS873で、コード種別ポインタはコード別ID範囲表の終端位置であると判定されると、ステップS876に進み、索引コードに未確定コードを設定して処理を終了する。
一方、ステップS872において、検索コードIDは先頭コードIDと末尾コードIDの範囲内であると判定されると、ステップS875に進む。
ステップS875では、索引コードにコード種別ポインタを設定して処理を終了する。先に図3Bを参照したコード列検索の概念の説明において述べたことから理解されるように、コード種別ポインタの値は、特定のコード種別と、該コード自体とすることを含めて関連付けられることから、ここでの索引コードにコード種別ポインタを設定するとは、コード種別ポインタの値に関連付けられた特定のコード種別を一時記憶領域である索引コードに設定することを意味するものである。
以上、索引コードの探索について、コード種別ポインタを初期値から順次更新しながら検索コードIDとコードIDの範囲とのマッチングを行ういわゆる線形探索法によるものを例示して説明した。しかし、探索手法はそれに限ることなく、二分探索法等の任意の探索手法が採用可能であることは明らかである。
次に、図8Aに示すステップS818、図8Bに示すステップS838、あるいは図8Cに示すステップS858の次のコード列ブロックの検索処理について詳細に説明する。
図9Aは、本発明の一実施の形態における次のコード列ブロックの検索の処理フローの前段を説明する図である。
図に示すように、ステップS901で、索引データ管理ポインタに索引データ管理表の次のエントリ位置を設定する。このとき索引データ管理ポインタには、図7Bに示すステップS712において、検索開始位置の索引データ管理ポインタが設定されている。次にステップS902に進み、該索引データ管理ポインタの指す索引データ管理表のエントリを取り出し、ステップS903において、該取り出したエントリの設定表示は「あり」であるかを判定する。
設定表示が「あり」であればステップS904に進み、設定表示が「あり」でなければそれ以上コード列ブロックは存在せず、1コード毎の照合が途中で中断されることになるので、検索失敗を返して図8A、図8Bあるいは図8Cの処理に戻る。
一方、ステップS903においてエントリの設定表示は「あり」であると判定され、ステップS904に進むと、ステップS902で取り出した索引管理表のエントリの先頭コードを取り出し、一時記憶領域である先頭コードに設定する。次にステップS905で、検索進行位置を、検索コード列の次の検索コードの位置に進め、ステップS906で、検索進行位置の指す検索コード列より検索コードを取り出し、ステップS907に進む。
ステップS907では、ステップS904で設定した先頭コードとステップS906で取り出した検索コードが一致するかを判定する。この判定は、次のコード列ブロックの先頭位置のコードと検索コード列の検索進行位置にあるコードとの照合である。この判定結果が否定的なものであれば、検索失敗を返して図8A、図8Bあるいは図8Cに示す処理に戻る。
一方、ステップS907での判定結果が肯定的なものであれば、図9Bに示すステップS911以降の処理に進み、1コード毎の照合をさらに進める。
図9Bは、本発明の一実施の形態における次のコード列ブロックの検索の処理フローの後段を説明する図である。
ステップS911では、図9Aに示すステップS902で先に取り出したエントリの索引データポインタの指す索引データの格納領域内に格納されたコード別ID範囲表とID関係表を取得する。
次にステップS912で、ステップS904で設定した先頭コードの指すコード別ID表より先頭コードIDを取り出し、一時記憶領域である先頭コードIDに設定し、ステップS913で該先頭コードIDを検索開始コードIDに設定してステップS914に進む。
ステップS914では、図8A、図8Bあるいは図8Cに示す処理を再帰的に呼び出し、コード列ブロック中の各コードと検索コード列の先頭のコードから末尾のコードまでの1コード毎の照合による検索を行う。そして、検索が成功であったか失敗であったかを返す。
ステップS915では、ステップS914での検索が成功であれば検索成功を、失敗であれば検索失敗を返して、図8A、図8Bあるいは図8Cに示す処理に戻る。
以上、本発明の実施形態について詳細に説明した。以下においては、本発明についての理解をさらに容易にするために、図10A~図10Cを参照して本発明の一実施の形態におけるコード列検索のうち完全一致検索の処理の流れについて説明する。図10A~図10Cに例示すものは、検索対象コード列を図3Aに示すもののうち2番目までのコード列ブロックまでのものとし、検索コード列をABCとしたものである。以下において、上記検索対象コード列を、図3Aの表記と同様に、検索対象コード列10aと表記することがある。
図10Aと図10Bは、検索対象コード列の先頭のコード列ブロックからの処理の流れを説明する図であり、図6に示す最外側のループ処理については、1順目のループ処理に相当する。
図10Aは、そのうちの先頭のコード列ブロックを対象とした検索の流れを説明するものである。
図において、符号701aを付した点線で囲ったブロックには、検索コード列ABCの各検索コードを先頭から処理する流れが記載されている。言い換えれば、該ブロック701aは、検索進行位置のコードの変化を示すものである。符号702aを付した点線で囲ったブロックには、その検索進行位置のコードの指すコード別ID範囲表309aのコードIDの範囲と、コード列ブロックの先頭位置にあるコードAの指すコード別ID範囲表309aの先頭コードIDであるID1が記載されている。符号703aを付した点線で囲ったブロックには、ID関係表310aから順次次コードを求める流れが記載されている。
また、図中括弧書きで示しているのは、図に示す処理の流れに関連する図6~図9Bに示す処理ステップである。
 検索を開始する前の処理として、図の矢印731aに示すように、図6の(以下の説明では、図面番号の表記は省略する。)ステップS603で、索引データ管理表の先頭のエントリ704aが取り出される。そして、図の矢印734aに示すように、ステップS605で該エントリの索引データポインタ733aに基づき索引データの格納領域705a内に格納されたコード別ID範囲表309aとID関係表310aが取得される。そして、点線の矢印735aに示すように、ステップS606及びS607で、該エントリ704aの先頭コード732aに格納されたコードAに対応する、コード別ID範囲表309aのエントリ309a(A)が読み出され、先頭コードIDであるID1が読み出されて、先頭コードID742aに設定される。 
 最初に検索コード列の先頭に位置するコードAがブロック701aに示すようにステップS703で取り出され、ブロック702aへの矢印723aで示すように、コードAの指すコード別ID範囲表309aの先頭コードIDであるID1がステップS706で取り出されて検索開始コードIDに設定される。また末尾コードIDであるID2がステップS707で取り出されて検索終了コードIDに設定される。
 次に、ブロック702aのID1からブロック703aへの矢印724aで示すように、ID1の指すID関係表310aの次コードIDであるID3がステップS810及びステップS811により取り出される。そして、ブロック703aの、ID1の指すID関係表310aの次コードIDであるID3と、ブロック702aの、先頭コードID742aの間の双方向の点線の矢印736aで示すように、ステップS813において、次コードIDであるID3は先頭コードIDであるID1とは異なることが判定される。
すると、ブロック701aのコードAからコードBへの矢印721aに示すように、ステップS814で次のコード位置のコードが処理対象となり、ステップS815でコードBが取り出される。ブロック703aの、ID1の指すID関係表310aの次コードIDであるID3とブロック702aの、コード別ID範囲表309aの間の点線の矢印755bで示すように、ステップS816でコード別ID範囲表309aのエントリであってそのコードIDの範囲に次コードIDであるID3を含むものが探索され、図の例では、点線の矢印751aで示すように、そのエントリを指すコードであるコードBが一時記憶領域752aに設定される。
 そして、双方向の点線の矢印753bで示すように、ステップS817において、一時記憶領域752aに設定されたコードBとステップS815で取り出されたコードBは一致することが判定される。
 すると次に、ブロック703a内の矢印724bで示すように、ID3の指すID関係表310aの次コードIDであるID4がステップS811で取り出される。そして、ブロック703aの、ID3の指すID関係表310aの次コードIDであるID4と、ブロック702aの、先頭コードID742aの間の双方向の点線の矢印736bで示すように、ステップS813において、次コードIDであるID4は先頭コードIDであるID1とは異なることが判定される。
次にブロック701aのコードBからコードCへの矢印721bに示すように、ステップS814で次のコード位置のコードが処理対象となり、ステップS815でコードCが取り出される。ブロック703aの、ID3の指すID関係表310aの次コードIDであるID4とブロック702aの、コード別ID範囲表309aの間の点線の矢印755cで示すように、ステップS816でコード別ID範囲表309aのエントリであってそのコードIDの範囲に次コードIDであるID4を含むものが探索され、図の例では、点線の矢印751bで示すように、そのエントリを指すコードであるコードEが一時記憶領域752bに設定される。
そして、双方向の点線の矢印753cで示すように、ステップS817において、一時記憶領域752bに設定されたコードEとステップS815で取り出されたコードCは一致しないことが判定され、検索失敗となる。そこで、検索失敗を返して図7Bに示すループ処理に戻る。
 つまり、検索対象コード列10aの先頭のコード列ブロックのうち、コードIDがID1であるコードAからのコード列は、検索コード列ABCと一致しないことを示している。これは、検索対象コード列10aの先頭のコード列ブロックのうち、コードIDがID1であるコードAからの3コードのコード列は、図3Aに示すようにABEであり、ABCではないことに整合している。
 図10Bに示すのは、検索コード列ABCの検索開始コードIDを、ステップS722でコードAのID1の次のコードIDであるID2として先頭のコード列ブロックから検索する流れである。図7Bに示すループ処理では、図10Aに示すものは1順目の処理であり、図10Bに示す処理は2順目の処理である。
 そして、この2順目の処理においては、検索対象コード列と検索コード列間の照合が先頭のコード列ブロックの次のコード列ブロックに亘って行われる。
図10Bのブロック702a内の矢印に示すように、図7Bに示すループ処理のステップS722において、検索開始コードIDがID1からID2に更新される。そして、ブロック702aのID2からブロック703aへの矢印724bで示すように、ID2の指すID関係表310aの次コードIDであるID1がステップS810及びステップS811により取り出される。また、ブロック703aの、ID2の指すID関係表310aの次コードIDであるID1と、ブロック702aの、先頭コードID742aの間の双方向の点線の矢印736cで示すように、ステップS813において、次コードIDであるID1は先頭コードIDであるID1と一致することが判定される。
すると、点線の矢印737aで示すように、ステップS901において、索引データ管理表の先頭のエントリ704aの次のエントリ704bが取り出される。そして、該エントリ704bの先頭コード732bに格納されたコードBが図の矢印738aに示すように、ステップS904で先頭コードID741bに設定される。
一方、ブロック701aのコードAからコードBへの矢印721aに示すように、ステップS905で次のコード位置のコードが処理対象とされ、ステップS906で検索コード列から先頭のコードAの次のコードBが取り出される。そして、双方向の点線の矢印744bで示すように、ステップS907において、コードAの次に位置するコードであるコードBは先頭コード741に設定されたコードBと一致することが判定される。
すると、図の矢印739aに示すように、ステップS911でエントリ704bの索引データポインタ733bに基づき索引データの格納領域705b内に格納されたコード別ID範囲表309bとID関係表310bが取得される。
次に矢印745bに示すように、ステップS912において、先頭コード741bに設定されたコードBの指すコード別ID範囲表309bより先頭コードIDであるID2が取り出され、先頭コードID742bに設定される。
続いて矢印724cで示すように、ID2の指すID関係表310bの次コードIDであるID3が、ステップS913及び再帰的に呼び出された図8Aに示す処理のステップS811により取り出される。そして、ブロック703bの、ID2の指すID関係表310bの次コードIDであるID3と、ブロック702bの、先頭コードID742bの間の双方向の点線の矢印736dで示すように、ステップS813において、次コードIDであるID3は先頭コードIDであるID2と異なることが判定される。
そこで、ブロック701aのコードBからコードCへの矢印721bに示すように、ステップS814で次のコード位置のコードが処理対象となり、ステップS815でコードCが取り出される。ブロック703bの、ID2の指すID関係表310bの次コードIDであるID3とブロック702bの、コード別ID範囲表309bの間の点線の矢印755dで示すように、ステップS816でコード別ID範囲表309aのエントリであってそのコードIDの範囲に次コードIDであるID3を含むものが探索され、図の例では、点線の矢印751dで示すように、そのエントリを指すコードであるコードCが一時記憶領域752dに設定される。
 そして、双方向の点線の矢印753dで示すように、ステップS817において、一時記憶領域752dに設定されたコードCとステップS815で取り出されたコードCは一致することが判定される。
 つまり、検索対象コード列10aのうち、コードIDがID2であるコードAからのコード列は、検索コード列ABCと一致することが示されている。これは、検索対象コード列10aのうち、コードIDがID2であるコードAからのコード列は、図3Aに示すようにABCであることに整合している。
 そこでステップS720で、矢印728aに示すように、符号705bで示す検索結果コード位置に、検索開始コードIDであるID2の指すID関係表310aのコード位置P4を設定する。
 そして、検索開始コードIDであるID2は、ステップS707で設定された検索終了コードIDであることから、先頭のコード列ブロックを検索開始位置とする検索は終了し、図6に示すループ処理に戻り、検索開始位置を1つ進めて、すなわち先頭から2番目のコード列ブロックからの検索を行う。
図10Cは、検索対象コード列の2番目のコード列ブロックからの処理の流れを説明する図であり、図6に示す最外側のループ処理については、2順目のループ処理に相当する。以下説明する処理の流れは、先に図10Aを参照して説明したものと同様なものである。
検索を開始する前の処理として、図の矢印731bに示すように、ステップS609で検索開始位置の索引データ管理ポインタの値が更新され、ステップS603で索引データ管理表の先頭のエントリ704bが取り出される。そして、図の矢印734bに示すように、ステップS605で該エントリの索引データポインタ733bに基づき索引データの格納領域705b内に格納されたコード別ID範囲表309bとID関係表310bが取得される。
 2番目のコード列ブロックからの検索の最初に、検索コード列の先頭に位置するコードAがブロック701aに示すようにステップS703で再度取り出される。そして、ブロック702bへの矢印723eで示すように、コードAの指すコード別ID範囲表309bの先頭コードIDであるID1がステップS706で取り出されて検索開始コードIDに設定される。また末尾コードIDであるID1がステップS707で取り出されて検索終了コードIDに設定される。
 次に、ブロック702bのID1からブロック703bへの矢印724dで示すように、ID1の指すID関係表310bの次コードIDであるID4がステップS810及びステップS811により取り出される。そして、ブロック703bの、ID1の指すID関係表309bの次コードIDであるID4と、ブロック702bの、先頭コードID742bの間の双方向の点線の矢印736eで示すように、ステップS813において、次コードIDであるID3は先頭コードIDであるID1とは異なることが判定される。
すると、ブロック701aのコードAからコードBへの矢印721aに示すように、ステップS814で次のコード位置のコードが処理対象となり、ステップS815でコードBが取り出される。ブロック703bの、ID1の指すID関係表310bの次コードIDであるID4とブロック702bの、コード別ID範囲表309bの間の点線の矢印755eで示すように、ステップS816でコード別ID範囲表309bのエントリであってそのコードIDの範囲に次コードIDであるID4を含むものが探索され、図の例では、点線の矢印751eで示すように、そのエントリを指すコードであるコードCが一時記憶領域752eに設定される。
そして、双方向の点線の矢印753fで示すように、ステップS817において、一時記憶領域752eに設定されたコードCとステップS815で取り出されたコードBは一致しないことが判定され、検索失敗となる。そこで、検索失敗を返して図7Bに示すループ処理に戻る。
 そして、検索開始コードIDであるID1は検索終了コードIDであることから、図7Bに示すステップS721の判定により処理終了となり、図6に示すループ処理にさらに戻り、図10A~図10Cに示す例では、検索対象コード列は2番目のコード列ブロックまでとしたことから、ステップS604において検索処理全体の終了が判定される。
 以上本発明を実施するための形態について詳細に説明したが、本発明の実施の形態はそれに限ることなく種々の変形が可能であることは当業者に明らかである。
 また、本発明のコード列検索装置が、索引データ管理表とコード別ID範囲表とID関係表を格納する記憶手段と、図6~図9Bに示した処理をコンピュータに実行させるプログラムによりコンピュータ上に構築可能なことは明らかである。
 さらに、図4A~図5Cに示したコード列検索のための索引データを作成する処理とその均等物をコンピュータに実行させるプログラムにより、本発明の索引データ作成装置及び方法が実現可能であることも明らかである。そして、それらのプログラムにより、本発明の索引データを作成する手段等がコンピュータ上に実現される。
 したがって、上記プログラム、及びプログラムを記録したコンピュータ読み取り可能な記録媒体は、本発明の実施の形態に含まれる。さらに、本発明のコード列検索のための索引データのデータ構造及びそのデータ構造を有する索引データを記録したコンピュータ読み取り可能な記録媒体も、本発明の実施の形態に含まれる。
 以上詳細に説明した本発明が提供する新しい索引データ構造であるコード別ID範囲表とID関係表及びそれらを管理する索引データ管理表を採用することにより、索引データ作成の負荷を軽減すると共に、効率的にコード列検索を行うことが可能となる。
 また、本発明によれば、索引データを複数の格納領域に分割して格納することができるので、多量の索引データであっても、利用するハードウェア環境に応じてコード列ブロックの大きさを決定し、索引データへのアクセスやメンテナンスを容易にすることもできる。
10  文字列
10a 検索対象コード列
11  コード位置ポインタ
20  文字位置順の接尾辞
20a 辞書順の接尾辞
30  接尾辞配列
40  検索文字列
40a 検索コード列
50  圧縮接尾辞配列
101 検索対象コード列読出手段
102 コード別ID範囲表生成手段
103 ID関係表生成手段
104 索引データ作成管理手段
105 索引データ作成手段
111 検索コード列読出手段
112 コード別ID範囲読出手段
113 ID関係読出手段
114 コード種別探索手段
115 コード種別照合手段
116 コード列検索管理手段
117 コード列検索手段
301 データ処理装置
302 中央処理装置
303 キャッシュメモリ
304 バス
305 主記憶装置
306 外部記憶装置
307 通信装置
308 データ格納装置
309 コード別ID範囲表
310 ID関係表
311 コード種別ポインタ
312 コードIDポインタ
321 索引データ管理表
322 索引データ管理ポインタ
324 索引データの格納領域

Claims (16)

  1.  検索対象である検索対象コード列を検索コード列により検索するコード列検索装置において、
     前記検索対象コード列を複数に分割した部分コード列であるコード列ブロック毎に設けられた、
    前記コード列ブロックに位置する全ての各コードを一意に識別するコードIDの範囲であるコードID範囲を同一種別のコード毎に格納したコード別ID範囲表と、
    前記コードIDに対応して、前記コード列ブロックにおいて該コードIDに係るコードの次に位置するコードのコードIDである次コードIDを格納するとともに、前記コードIDに係るコードが前記コード列ブロックの末尾に位置する場合は前記次コードIDとして前記コード列ブロックの先頭に位置するコードのコードIDを格納するID関係表と、
    前記コード列ブロック毎に設けられたコード別ID範囲表とID関係表を参照して前記検索コード列による検索を実行する検索実行部と、
    前記コード列ブロック毎に該コード列ブロックの先頭に位置する先頭コードを格納した索引データ管理表と、
    前記検索実行部による検索の実行を管理する検索管理部と、
    を備え、
    前記検索実行部は、
    前記検索コード列を読み出す検索コード列読出手段と、
    指定されたコード列ブロックに対応する前記コード別ID範囲表から、前記検索コード列読出手段により読み出された検索コード列を構成する先頭のコードの種別のコードID範囲を読み出すコード別ID範囲読出手段と、
    前記コード別ID範囲読出手段により読み出された前記検索コード列の先頭のコードの種別のコードID範囲に含まれるコードIDに対応して格納された前記次コードIDを前記指定されたコード列ブロックに対応するID関係表から読み出し、以後、読み出された次コードIDに対応して格納された次コードIDを順次前記ID関係表から読み出すとともに、該次コードIDが当該コード列ブロックの先頭のコードのコードIDと等しいか判定するID関係読出手段と、
    前記ID関係読出手段により読み出された次コードIDが当該コード列ブロックの先頭のコードのコードIDと等しくないとき、前記コード別ID範囲表から順次コード種別のコードID範囲を読み出し、該読み出されたコード種別のコードID範囲と前記次コードIDとを照合することにより、前記次コードIDをそのコードID範囲に含むコード種別を探索するコード種別探索手段と、
    前記検索コード列読出手段で読み出されたコードのコード種別と前記コード種別探索手段で探索されたコード種別を照合するコード種別照合手段を備え、
    前記検索管理部は、
    前記検索実行部に先頭のコード列ブロックから前記コード列ブロックを順次指定するとともに、
    前記ID関係読出手段が、読み出した次コードIDが前記コード列ブロックの先頭のコードのコードIDと等しいと判定すると、前記索引データ管理表から前記コード列ブロックの次に位置するコード列ブロックの先頭のコードを読み出し、該先頭のコードと検索コード列中のコードを照合することにより
    該コード列ブロックの次に位置するコード列ブロックを前記検索実行部に指定する
    ことを特徴とするコード列検索装置。
  2. 請求項1に記載のコード列検索装置において、
    前記コード種別探索手段は、前記検索コード列の先頭のコードである第1のコードのコード種別のコードID範囲に含まれるコードIDである先頭コードIDに対応して前記ID関係表に格納された次コードIDを、そのコードID範囲に含むコード種別である索引コードを探索し、前記コード種別照合手段は、前記検索コード列において前記第1のコードの次に位置する第2のコードのコード種別と前記索引コードを照合するものであり、かつ、以後、前記第1のコードと第2のコードの前記検索コード列における位置が前記ID関係読出手段の読出動作により更新されると、前記コード種別探索手段は、該位置の更新された第1のコードのコードIDに対応して前記ID関係表に格納された前記次コードIDをそのコードID範囲に含む索引コードを探索し、前記コード種別照合手段は、該位置の更新された第2のコードのコード種別と前記索引コードを照合するものであり、
    前記検索管理部による前記次に位置するコード列ブロックの前記検索実行部への指定は、前記ID関係読出手段が、前記読み出した次コードIDが前記コード列ブロックの先頭のコードのコードIDと等しいと判定したとき、前記索引データ管理表から前記次に位置するコード列ブロックの前記先頭コードを読み出し、該先頭コードと前記読み出した次コードがそれに対応して格納された前記第1のコードの次に位置するコードとを照合し、前記先頭コードと前記次に位置するコードが一致すると、前記次に位置するコード列ブロックを前記検索実行部に指定するものである、
    ことを特徴とするコード列検索装置。
  3. 請求項2に記載のコード列検索装置において、
     前記ID関係表は、前記コードIDに対応して、前記検索対象コード列において該コードIDに係るコードの位置を示すコード位置を格納しており、
     前記コード種別照合手段は、前記検索コード列読出手段により読み出された先頭のコード以降のコードのコード種別と前記コード種別探索手段により探索された索引コードの照合が前記検索コード列の末尾のコードについてまで成功すると、前記先頭のコードのコードIDに対応して前記ID関係表に格納されたコード位置を検索結果コード位置として出力する、
    ことを特徴とするコード列検索装置。
  4. 請求項3に記載のコード列検索装置において、
     前記ID関係表に前記コードIDに対応して格納された次コードIDとコード位置は、同一種別のコードのコードID毎に連続してコード位置順で格納されている、
     ことを特徴とするコード列検索装置。
  5. 請求項4に記載のコード列検索装置において、
    前記検索コード列の先頭のコードの種別のコードID範囲に含まれる全てのコードIDを前記先頭コードIDとして、前記コード種別探索手段は前記索引コードを探索し、前記コード種別照合手段は前記第2のコードのコード種別と前記索引コードを照合する、
    ことを特徴とするコード列検索装置。
  6.  請求項5に記載のコード列検索装置において、
     前記コード種別照合手段は、前記第2のコードのコード種別と前記索引コードの照合に失敗すると、該索引コードのコードID範囲に含まれる前記次コードIDと前記ID関係表の同一エントリに格納されたコード位置と、前記先頭コードIDに対応して前記ID関係表に格納されたコード位置とを、検索結果コード位置として出力する、
    ことを特徴とするコード列検索装置。
  7.  請求項5に記載のコード列検索装置において、
     前記検索コード列は任意のコードと照合する任意コードを含み、
     前記コード種別探索手段は、該任意コードを前記第1のコードとした前記ID関係読出手段により読み出された次コードIDをそのコードID範囲に含む索引コードの探索に替えて、前記検索コード列において該任意コードの次に位置するコードを前記第1のコードとした前記ID関係読出手段により読み出された次コードIDを、そのコードID範囲に含む索引コードの探索を行う、
     ことを特徴とするコード列検索装置。
  8.  検索対象である検索対象コード列を検索コード列により検索するコード列検索装置であって、前記検索対象コード列を複数に分割した部分コード列であるコード列ブロック毎に設けられた、前記コード列ブロックに位置する全ての各コードを一意に識別するコードIDの範囲であるコードID範囲を同一種別のコード毎に格納したコード別ID範囲表と、前記コードIDに対応して、前記コード列ブロックにおいて該コードIDに係るコードの次に位置するコードのコードIDである次コードIDを格納するとともに、前記コードIDに係るコードが前記コード列ブロックの末尾に位置する場合は前記次コードIDとして前記コード列ブロックの先頭に位置するコードのコードIDを格納するID関係表と、前記コード列ブロック毎に該コード列ブロックの先頭に位置する先頭コードを格納した索引データ管理表と、検索実行部と、検索管理部を備えたコード列検索装置によるコード列検索方法において、
     前記検索実行部は、
    前記検索コード列を読み出す検索コード列読出ステップと、
    指定されたコード列ブロックに対応する前記コード別ID範囲表から、前記検索コード列読出ステップで読み出された検索コード列を構成する先頭のコードの種別のコードID範囲を読み出すコード別ID範囲読出ステップと、
    前記コード別ID範囲読出ステップで読み出された前記検索コード列の先頭のコードの種別のコードID範囲に含まれるコードIDに対応して格納された前記次コードIDを前記指定されたコード列ブロックに対応するID関係表から読み出し、以後、読み出された次コードIDに対応して格納された次コードIDを順次前記ID関係表から読み出すとともに、該次コードIDが当該コード列ブロックの先頭のコードのコードIDと等しいか判定するID関係読出ステップと、
    前記ID関係読出ステップで読み出された次コードIDが当該コード列ブロックの先頭のコードのコードIDと等しくないとき、前記コード別ID範囲表から順次コード種別のコードID範囲を読み出し、該読み出されたコード種別のコードID範囲と前記次コードIDとを照合することにより、前記次コードIDをそのコードID範囲に含むコード種別を探索するコード種別探索ステップと、
    前記検索コード列読出ステップで読み出されたコードのコード種別と前記コード種別探索ステップで探索されたコード種別を照合するコード種別照合ステップと、
    を実行し、
    前記検索管理部は、
    前記検索実行部に先頭のコード列ブロックから前記コード列ブロックを順次指定する検索開始位置指定ステップと、
    前記ID関係読出ステップにおいて、読み出した次コードIDが前記コード列ブロックの先頭のコードのコードIDと等しいと判定されると、前記索引データ管理表から前記コード列ブロックの次に位置するコード列ブロックの先頭コードを読み出し、該先頭コードと検索コード列中のコードを照合することにより該コード列ブロックの次に位置するコード列ブロックを前記検索実行部に指定する次コード列指定ステップと、
    を実行することを特徴とするコード列検索方法。
  9. 請求項8に記載のコード列検索方法において、
    前記コード種別探索ステップは、前記検索コード列の先頭のコードである第1のコードのコード種別のコードID範囲に含まれるコードIDである先頭コードIDに対応して前記ID関係表に格納された次コードIDを、そのコードID範囲に含むコード種別である索引コードを探索し、前記コード種別照合ステップは、前記検索コード列において前記第1のコードの次に位置する第2のコードのコード種別と前記索引コードを照合するものであり、かつ、以後、前記第1のコードと第2のコードの前記検索コード列における位置が前記ID関係読出ステップの読出動作により更新されると、前記コード種別探索ステップにおいて、該位置の更新された第1のコードのコードIDに対応して前記ID関係表に格納された前記次コードIDをそのコードID範囲に含む索引コードを探索し、前記コード種別照合ステップにおいて、該位置の更新された第2のコードのコード種別と前記索引コードを照合するものであり、
    前記次コード列指定ステップは、
    前記ID関係読出ステップにおいて、前記読み出した次コードIDが前記コード列ブロックの先頭のコードのコードIDと等しいと判定されたとき、前記索引データ管理表から前記次に位置するコード列ブロックの前記先頭コードを読み出し、該先頭コードと前記読み出した次コードがそれに対応して格納された前記第1のコードの次に位置するコードとを照合し、双方が一致すると、前記次に位置するコード列ブロックを前記検索実行部に指定するものである、
    ことを特徴とするコード列検索方法。
  10. 請求項9に記載のコード列検索方法において、
    前記ID関係表は、前記コードIDに対応して、前記検索対象コード列において該コードIDに係るコードの位置を示すコード位置を格納しており、
     前記コード種別照合ステップは、前記検索コード列読出ステップで読み出された先頭のコード以降のコードのコード種別と前記コード種別探索ステップで探索された索引コードの照合が前記検索コード列の末尾のコードについてまで成功すると、前記先頭のコードのコードIDに対応して前記ID関係表に格納されたコード位置を検索結果コード位置として出力する、
    ことを特徴とするコード列検索方法。
  11. 請求項10に記載のコード列検索方法において、
    前記検索コード列の先頭のコードの種別のコードID範囲に含まれる全てのコードIDを前記先頭コードIDとして、前記コード種別探索ステップは前記索引コードを探索し、前記コード種別照合ステップは前記第2のコードのコード種別と前記索引コードを照合する、
    ことを特徴とするコード列検索方法。
  12.  検索対象である検索対象コード列を検索コード列により検索するコード列検索装置であって、前記検索対象コード列を複数に分割した部分コード列であるコード列ブロック毎に設けられた、前記コード列ブロックに位置する全ての各コードを一意に識別するコードIDの範囲であるコードID範囲を同一種別のコード毎に格納したコード別ID範囲表と、前記コードIDに対応して、前記コード列ブロックにおいて該コードIDに係るコードの次に位置するコードのコードIDである次コードIDを格納するとともに、前記コードIDに係るコードが前記コード列ブロックの末尾に位置する場合は前記次コードIDとして前記コード列ブロックの先頭に位置するコードのコードIDを格納するID関係表と、前記コード列ブロック毎に該コード列ブロックの先頭に位置する先頭コードを格納した索引データ管理表と、検索実行部と、検索管理部を備えたコード列検索装置の機能をコンピュータに実現させるコード列検索プログラムにおいて、
     コンピュータに、
     前記検索実行部の機能として、
    前記検索コード列を読み出す検索コード列読出機能、
    指定されたコード列ブロックに対応する前記コード別ID範囲表から、前記検索コード列読出機能により読み出された検索コード列を構成する先頭のコードの種別のコードID範囲を読み出すコード別ID範囲読出機能、
    前記コード別ID範囲読出機能により読み出された前記検索コード列の先頭のコードの種別のコードID範囲に含まれるコードIDに対応して格納された前記次コードIDを前記指定されたコード列ブロックに対応するID関係表から読み出し、以後、読み出された次コードIDに対応して格納された次コードIDを順次前記ID関係表から読み出すとともに、該次コードIDが当該コード列ブロックの先頭のコードのコードIDと等しいか判定するID関係読出機能、
    前記ID関係読出機能により読み出された次コードIDが当該コード列ブロックの先頭のコードのコードIDと等しくないとき、前記コード別ID範囲表から順次コード種別のコードID範囲を読み出し、該読み出されたコード種別のコードID範囲と前記次コードIDとを照合することにより、前記次コードIDをそのコードID範囲に含むコード種別を探索するコード種別探索機能、
    前記検索コード列読出機能により読み出されたコードのコード種別と前記コード種別探索機能により探索されたコード種別を照合するコード種別照合機能、
    を実現させ、
    前記検索管理部の機能として、
    前記検索実行部に先頭のコード列ブロックから前記コード列ブロックを順次指定する検索開始位置指定機能、
    前記ID関係読出機能により、読み出した次コードIDが前記コード列ブロックの先頭のコードのコードIDと等しいと判定されると、前記索引データ管理表から前記コード列ブロックの次に位置するコード列ブロックの先頭コードを読み出し、該先頭コードと検索コード列中のコードを照合することにより該コード列ブロックの次に位置するコード列ブロックを前記検索実行部に指定する次コード列指定機能、
    を実現させることを特徴とするコード列検索プログラム。
  13. 請求項12に記載のコード列検索プログラムにおいて、
    前記コード種別探索機能は、前記検索コード列の先頭のコードである第1のコードのコード種別のコードID範囲に含まれるコードIDである先頭コードIDに対応して前記ID関係表に格納された次コードIDを、そのコードID範囲に含むコード種別である索引コードを探索し、前記コード種別照合機能は、前記検索コード列において前記第1のコードの次に位置する第2のコードのコード種別と前記索引コードを照合するものであり、かつ、以後、前記第1のコードと第2のコードの前記検索コード列における位置が前記ID関係読出機能の読出動作により更新されると、前記コード種別探索機能は、該位置の更新された第1のコードのコードIDに対応して前記ID関係表に格納された前記次コードIDをそのコードID範囲に含む索引コードを探索し、前記コード種別照合機能は、該位置の更新された第2のコードのコード種別と前記索引コードを照合する機能を含み、
    前記次コード列指定機能は、
    前記ID関係読出機能により、前記読み出した次コードIDが前記コード列ブロックの先頭のコードのコードIDと等しいと判定されたとき、前記索引データ管理表から前記次に位置するコード列ブロックの前記先頭コードを読み出し、該先頭コードと前記読み出した次コードがそれに対応して格納された前記第1のコードの次に位置するコードとを照合し、双方が一致すると、前記次に位置するコード列ブロックを前記検索実行部に指定する機能を含む、ことを特徴とするコード列検索プログラム。
  14. 請求項13に記載のコード列検索プログラムにおいて、
    前記ID関係表は、前記コードIDに対応して、前記検索対象コード列において該コードIDに係るコードの位置を示すコード位置を格納しており、
     前記コード種別照合機能は、前記検索コード列読出機能により読み出された先頭のコード以降のコードのコード種別と前記コード種別探索機能により探索された索引コードの照合が前記検索コード列の末尾のコードについてまで成功すると、前記先頭のコードのコードIDに対応して前記ID関係表に格納されたコード位置を検索結果コード位置として出力する機能を含む、
    ことを特徴とするコード列検索プログラム。
  15. 請求項14に記載のコード列検索プログラムにおいて、
    前記検索コード列の先頭のコードの種別のコードID範囲に含まれる全てのコードIDを前記先頭コードIDとして、前記コード種別探索機能は前記索引コードを探索し、前記コード種別照合機能は前記第2のコードのコード種別と前記索引コードを照合する機能を含む、
    ことを特徴とするコード列検索プログラム。
  16.  請求項12~請求項15のいずれか1項に記載のコード列検索プログラムを記録したコンピュータ読み取り可能な記録媒体。
PCT/JP2009/006921 2008-09-28 2009-12-16 コード列検索装置、検索方法及びプログラム WO2010106605A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US13/064,487 US9009655B2 (en) 2008-09-28 2011-03-28 Code string search apparatus, search method, and program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2009-065379 2009-03-18
JP2009065379A JP4429373B1 (ja) 2009-03-18 2009-03-18 コード列検索装置、検索方法及びプログラム

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2009/006922 Continuation WO2010116435A1 (ja) 2008-09-28 2009-12-16 コード列検索装置、検索方法及びプログラム

Related Child Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2009/001292 Continuation WO2010095179A1 (ja) 2008-09-28 2009-03-24 コード列検索装置、検索方法及びプログラム

Publications (1)

Publication Number Publication Date
WO2010106605A1 true WO2010106605A1 (ja) 2010-09-23

Family

ID=42072741

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2009/006921 WO2010106605A1 (ja) 2008-09-28 2009-12-16 コード列検索装置、検索方法及びプログラム

Country Status (2)

Country Link
JP (1) JP4429373B1 (ja)
WO (1) WO2010106605A1 (ja)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04205560A (ja) * 1990-11-30 1992-07-27 Teremateiiku Kokusai Kenkyusho:Kk 情報検索処理方式および検索ファイル作成装置
JPH04242864A (ja) * 1991-01-08 1992-08-31 Chubu Nippon Denki Software Kk 情報検索方式
JPH0561910A (ja) * 1991-09-02 1993-03-12 Fujitsu Sooshiaru Sci Raboratori:Kk 全文インデツクス検索方法
JPH05324722A (ja) * 1992-03-24 1993-12-07 Ricoh Co Ltd 文書検索方式
JPH06149882A (ja) * 1992-11-06 1994-05-31 Fujitsu Ltd 全文データベース検索装置
JPH06162092A (ja) * 1992-11-18 1994-06-10 Fujitsu Ltd 情報検索装置
JPH08190571A (ja) * 1995-01-11 1996-07-23 Hitachi Ltd 文書検索方法
JP4402169B1 (ja) * 2009-02-23 2010-01-20 株式会社エスグランツ コード列検索装置、検索方法及びプログラム
JP4402168B1 (ja) * 2008-09-28 2010-01-20 株式会社エスグランツ コード列検索装置、検索方法及びプログラム

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3672242B2 (ja) * 2001-01-11 2005-07-20 インターナショナル・ビジネス・マシーンズ・コーポレーション パターン検索方法、パターン検索装置、コンピュータプログラム及び記憶媒体

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04205560A (ja) * 1990-11-30 1992-07-27 Teremateiiku Kokusai Kenkyusho:Kk 情報検索処理方式および検索ファイル作成装置
JPH04242864A (ja) * 1991-01-08 1992-08-31 Chubu Nippon Denki Software Kk 情報検索方式
JPH0561910A (ja) * 1991-09-02 1993-03-12 Fujitsu Sooshiaru Sci Raboratori:Kk 全文インデツクス検索方法
JPH05324722A (ja) * 1992-03-24 1993-12-07 Ricoh Co Ltd 文書検索方式
JPH06149882A (ja) * 1992-11-06 1994-05-31 Fujitsu Ltd 全文データベース検索装置
JPH06162092A (ja) * 1992-11-18 1994-06-10 Fujitsu Ltd 情報検索装置
JPH08190571A (ja) * 1995-01-11 1996-07-23 Hitachi Ltd 文書検索方法
JP4402168B1 (ja) * 2008-09-28 2010-01-20 株式会社エスグランツ コード列検索装置、検索方法及びプログラム
JP4402169B1 (ja) * 2009-02-23 2010-01-20 株式会社エスグランツ コード列検索装置、検索方法及びプログラム

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
KUNIHIKO SADAKANE: "Asshuku Setsubiji Hairetsu ni Kansuru Kosatsu", IEICE TECHNICAL REPORT, vol. 100, no. 226, 19 July 2000 (2000-07-19), pages 49 - 56 *

Also Published As

Publication number Publication date
JP4429373B1 (ja) 2010-03-10
JP2010218326A (ja) 2010-09-30

Similar Documents

Publication Publication Date Title
JP4535130B2 (ja) 文字列照合装置および文字列照合プログラム
CN107102981B (zh) 词向量生成方法和装置
JP5376163B2 (ja) 文書管理・検索システムおよび文書の管理・検索方法
US9720976B2 (en) Extracting method, computer product, extracting system, information generating method, and information contents
CN112800769B (zh) 命名实体识别方法、装置、计算机设备和存储介质
JP4402169B1 (ja) コード列検索装置、検索方法及びプログラム
CN108027816B (zh) 数据管理系统、数据管理方法及记录介质
JP2005165598A (ja) 可変長文字列検索装置及び可変長文字列検索方法並びにプログラム
CA2364886C (en) Pattern retrieving method, pattern retrieval apparatus, computer-readable storage medium storing pattern retrieval program, pattern retrieval system, and pattern retrieval program
JP4402168B1 (ja) コード列検索装置、検索方法及びプログラム
JP4714127B2 (ja) 記号列検索方法、プログラムおよび装置ならびにそのトライの生成方法、プログラムおよび装置
JP5190898B2 (ja) コード列検索装置、検索方法及びプログラム
JP2022103676A (ja) 情報処理装置、情報処理方法、プログラム
JP4464459B1 (ja) コード列検索装置、検索方法及びプログラム
JP4429373B1 (ja) コード列検索装置、検索方法及びプログラム
WO2010095179A1 (ja) コード列検索装置、検索方法及びプログラム
JP5077380B2 (ja) 文字列照合装置および文字列照合プログラム
JPH08314966A (ja) 文書検索装置のインデックス作成方法及び文書検索装置
KR102146625B1 (ko) 오토마타 기반 증분적 중위 확률 계산 장치 및 방법
JP6666312B2 (ja) 多次元データ管理システム及び多次元データ管理方法
JP5041003B2 (ja) 検索装置および検索方法
JP2016149160A (ja) 情報生成方法、およびインデックス情報
JPH0652222A (ja) 情報検索処理装置
US7840583B2 (en) Search device and recording medium
JP2020187644A (ja) 情報処理装置、情報処理方法、及び情報処理プログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 09841812

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 09841812

Country of ref document: EP

Kind code of ref document: A1