CN100421114C - Data matching inquiry method based on key words - Google Patents

Data matching inquiry method based on key words Download PDF

Info

Publication number
CN100421114C
CN100421114C CNB2006100744568A CN200610074456A CN100421114C CN 100421114 C CN100421114 C CN 100421114C CN B2006100744568 A CNB2006100744568 A CN B2006100744568A CN 200610074456 A CN200610074456 A CN 200610074456A CN 100421114 C CN100421114 C CN 100421114C
Authority
CN
China
Prior art keywords
pointers
array
execution
inquired
pointer element
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB2006100744568A
Other languages
Chinese (zh)
Other versions
CN1967528A (en
Inventor
艾石
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CNB2006100744568A priority Critical patent/CN100421114C/en
Publication of CN1967528A publication Critical patent/CN1967528A/en
Application granted granted Critical
Publication of CN100421114C publication Critical patent/CN100421114C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

This invention relates to a matching query method based on the keywords, including: Step 11, extracting a substring from inquired string as the matching string; Step 12, searching the corresponding keywords to the said matching string in data storage space; Step 13, extracting the corresponding keyword data from the corresponding data storage space corresponding to the said keywords; Step 14, if the said matching string is the same as the inquired string, outputting the keyword data and finishing, otherwise, executing Step 15; Step 15, from the rear of the said substring in the inquired string, extracting a character, adding after the said substring to constitute a new substring, and using the said new substring as the matching string, and then executing Step 12. Through the data query method in the invention, it improves the efficiency of inquiries, accelerates the speed of inquiries, and reduces the cost of system resources.

Description

Carry out the method for data matching inquiry based on key word
Technical field
The present invention relates to a kind of data enquire method, especially a kind of key word of definite maximum match, and obtain the querying method of the key data of this key word correspondence.
Background technology
In computer communication field, often to be applied to data query based on the maximum match of key word.For example, when carrier class of exploitation is professional, be necessary basically to (caller/called) number analysis.Sometimes the professional characteristic that provides need be carried out maximum match to caller or called number.As everyone knows: the emergency numbers of public security bureau is a unified telephone number normally, for example: 110.No matter anyone dials this telephone number anywhere, and communication network all can establish a communications link at the phone of dialing the people and between apart from the emergency call of dialing the nearest public security bureau of this phone location, rather than is connected with the emergency call of other public security bureaus.This needs a translation process, unified telephone number is translated into the emergency number that distance is dialed the nearest public security bureau of this telephone number position that is:.Providing in the function that is called emergency numbers translation at the mobile communication intelligent network business, specifically is by calling number and prefix are carried out maximum match, routes the call to the emergency numbers after the translation then, realizes above-mentioned function.
At present the data query based on the maximum match of key word is the application data base table, and a designated character string is carried out the maximum match inquiry, inquires all possible matched data, and therefrom select the matching degree maximum as Query Result.For example, if desired to carried out the maximum match inquiry by inquiry string " 8030914909 ", must be with " 8 ", " 80 ", " 803 ", " 8030 ", " 80309 ", " 803091 ", " 8030914 ", " 80309149 ", " 803091490 ", " 8030914909 " carry out matching inquiry for substring, the every pair of substring is inquired about all to compare with all key word in the data space and is judged whether coupling, if there are 100 key words in the data space, then above-mentioned a substring is carried out query script to do 100 times comparison, whole query script will be done 1000 times comparison.
Following method is adopted in existing maximum match inquiry:
Select * from emergency where calling=c_calling or
calling=c_calling[1,10] or calling=c_calling[1,9] or
calling=c_calling[1,8] or calling=c_calling[1,7] or
calling=c_calling[1,6] or calling=c_calling[1,5] or
calling=c_calling[1,4] or calling=c_calling[1,3] or
calling=c_calling[1,2] or calling=c_calling[1,1]
Reality just is to use each condition calling=c_calling[1, n at database when carrying out this SQL statement] in table, inquire about one by one, till finding.
Above-mentioned data enquire method exists following deficiency: because in the process of inquiry, the every pair of substring is inquired about all to compare with all key word in the data space and is judged whether coupling, therefore, search efficiency is very low, inquiry velocity is slow, under the very big situation of data volume, huge to expending of system resource.
Summary of the invention
The objective of the invention is that the search efficiency that exists at above-mentioned querying method of the prior art is low, inquiry velocity slow, the deficiency such as wasteful of system resource, a kind of method of carrying out data matching inquiry based on key word is provided, improve search efficiency, accelerate inquiry velocity, reduce expending of system resource.
For achieving the above object, the invention provides a kind of method of carrying out data matching inquiry based on key word comprises the steps:
Step 101, judge whether to have finished inquiry by all sub-characters in the inquiry string, if then execution in step 107, otherwise execution in step 102;
Step 102, obtain by N character of inquiry string, wherein the initial value of N is 1;
Step 103, judge the array of pointers inquired about whether following to be designated as described be sky by the pointer element of N character of inquiry string, if then execution in step 107, otherwise, execution in step 104;
The following of array of pointers that step 104, judgement are inquired about is designated as by the pointer element of N character of inquiry string whether point to a linked object, if then execution in step 105, otherwise this pointer element is pointed to another array of pointers, execution in step 106;
Step 105, the data query result is updated to the data of storing in the described linked object, the array of pointers that will be inquired about is updated to the array of pointers that the pointer element of storing in the described linked object is pointed to, and N is added 1, and execution in step 101 then;
Step 106, the array of pointers that will be inquired about are updated to described another array of pointers, and N is added 1, and execution in step 101 then;
Step 107, export described Query Result.
The present invention also provides a kind of date storage method that carries out data matching inquiry based on key word to comprise the steps:
Step 201, judge whether to detect last character of the key word of the key data correspondence that will store, if, execution in step 208, if not, execution in step 202;
Step 202, obtain N character of described key word, wherein the initial value of N is 1;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 203, judgement are inquired about is empty, if then execution in step 207, otherwise, execution in step 204;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 204, judgement are inquired about points to a linked object, if then execution in step 205, otherwise this pointer element is pointed to another array of pointers, execution in step 206;
Step 205, described array of pointers of being inquired about is updated to the array of pointers that the pointer element of storing in the described linked object is pointed to, then N is added 1, execution in step 201;
Step 206, described array of pointers of being inquired about is updated to described another array of pointers in the step 204, and N is added 1, execution in step 201 then;
Step 207, the new array of pointers of establishment, and the following pointer element that is designated as N character of described key word of described array of pointers of being inquired about is updated to the pointer element of pointing to described new array of pointers, then described array of pointers of being inquired about is updated to described new array of pointers, N is added 1, execution in step 201;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 208, judgement are inquired about is empty, if then execution in step 212, otherwise, execution in step 209;
Step 209, judge the array of pointers inquired about be designated as with the pointer element of N character of described key word whether point to a linked object down, if then execution in step 210, otherwise this pointer element is pointed to another array of pointers, execution in step 211;
Step 210, be described key data, finish then the Data Update in the described linked object;
Step 211, new linked object of establishment, described key data is stored in this new linked object, the following pointer element that is designated as N character of described key word of described array of pointers of being inquired about is updated to the pointer element of pointing to this new linked object, and the pointer element of described another array of pointers of sensing in the step 209 is stored in this new linked object, finish then;
Step 212, new linked object of establishment, described key data is stored in this new linked object, the following pointer element that is designated as N character of described key word of described array of pointers of being inquired about is updated to the pointer element of pointing to this new linked object, finishes then.
The present invention also provides a kind of and has carried out the data-erasure method of data matching inquiry based on key word, comprises the steps:
Step 301, judge whether to detect last character of the key word of the key data correspondence that will delete, if, execution in step 307, if not, execution in step 302;
Step 302, obtain N character of key word;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 303, judgement are inquired about is empty, if, then finish, otherwise, execution in step 304;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 304, judgement are inquired about points to a linked object, if then execution in step 305, otherwise this pointer element is pointed to another array of pointers, execution in step 306;
Step 305, described array of pointers of being inquired about is updated to the array of pointers that the pointer element in the described linked object is pointed to, N is added 1, execution in step 301 then;
Step 306, described array of pointers of being inquired about is updated to another array of pointers described in the step 304, N is added 1, execution in step 301 then;
If the following pointer element that is designated as N character of described key word of the array of pointers that step 307 is inquired about is pointed to a linked object, then execution in step 308, otherwise finish;
If comprise the pointer element of pointing to another array of pointers in this linked object of step 308, then the following pointer element that is designated as N character of described key word of the array of pointers of being inquired about is updated to and comprises the pointer element of pointing to another array of pointers in this linked object, and delete this linked object, finish then; If do not comprise the pointer element of pointing to another array of pointers in this linked object, then directly delete this linked object, finish then.
By data enquire method provided by the invention, improved search efficiency, accelerated inquiry velocity, reduced expending of system resource.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Description of drawings
Fig. 1 is the process flow diagram that carries out the method for data matching inquiry based on key word of the present invention;
Fig. 2 is the key data Stored Procedure figure that carries out the method for data matching inquiry based on key word of the present invention;
Fig. 3 is the key data deletion process flow diagram that carries out the method for data matching inquiry based on key word of the present invention;
Fig. 4 is the data store organisation synoptic diagram of specific embodiments of the invention;
Fig. 5 is the process flow diagram of specific embodiments of the invention data query;
Fig. 6 is the process flow diagram of specific embodiments of the invention data storage;
Fig. 7 is the process flow diagram of specific embodiments of the invention data deletion.
Embodiment
In order to realize the inquiry of fast data, the present invention uses KCT (Key Content Tree, content tree based on key word) Shu data structure is come storage key and the data corresponding with key word, as shown in Figure 1, based on the data store organisation of KCT tree, data enquire method of the present invention comprises the steps:
Step 11: from being extracted a substring the inquiry string as matching string; The substring of described extraction originates in first character of described character string of being inquired about;
Step 12: in data space, search and the corresponding key word of described matching string;
Step 13: from the pairing data space of described key word, extract corresponding key data;
Step 14: if finish after described matching string with identical by inquiry string, is then exported key data; Otherwise execution in step 15;
Step 15:, extracted a character and be combined in after the described substring by the back of substring described in the inquiry string from described, constitute new substring, with described new substring as matching string, execution in step 12.
When carrying out above-mentioned querying flow, can also comprise the Stored Procedure of key data, as shown in Figure 2, comprise the steps:
Step 21, in data space, search the key word of the key data correspondence that will store, if find this key word, execution in step 22, otherwise, execution in step 25;
Step 22, judge in the data space of this key word correspondence whether have data, if having, then execution in step 23, if do not have, then execution in step 24;
Step 23, the key data that the data space of this key word correspondence is stored are updated to the key data that will store, finish;
Step 24, the key data that will store are stored in the data space of this key word correspondence, finish;
Step 25, described key word is stored in the described data space, and open up the data space of this key word correspondence in this data space, the key data that will store stores in the data space of this key word correspondence, finishes.
When carrying out above-mentioned querying flow, can also comprise the deletion flow process of key data, as shown in Figure 3, comprise the steps:
Step 31, in data space, search the key word of the key data correspondence that will delete, if find this key word, execution in step 32, otherwise, finish;
Step 32, judge in the data space of this key word correspondence whether have data, if having, then execution in step 33, if do not have, then finish;
The key data deletion of storing in step 33, the data space with this key word correspondence finishes.
Specific embodiment
In the key word that uses maximum match, usually each all is 0~9 numerical character, therefore in the application of reality, the general data structure of using ten fork trees is come storage key and corresponding data, this data store organisation as shown in Figure 4, in ten fork trees, each node has 10 child nodes, and each node can be realized with the array of pointers that comprises 10 pointer element.A numeral on the subscript indication key word of each pointer element of array of pointers.Have two kinds in the pointer of storing in the array of pointers is pointed, first kind of array of pointers that is meant the node correspondence of downward one deck, another kind is to point to a linked object, store two parts content in this linked object, a part is the data of key word correspondence, and another part is the pointer of the array of pointers of next node layer of sensing.Below by an example, the data structure of the data of storage key and correspondence thereof is described, as shown in the table:
Table 1:
Key word Data
63 V1
6346 V2
As shown in Figure 4, the data V1 of key word 63 correspondences is stored in and is designated as down among the array of pointers 1-2 of the 2nd row among the linked object 2-1 that 3 pointer element points to, owing in the data store organisation of ten fork trees, also have key word 6346, also to comprise a pointer C1 who points to the array of pointers 1-3 of the 3rd node layer in this linked object.The data V2 of key word 6346 correspondences then is stored in and is designated as down among the array of pointers 1-4 of the 4th row among the linked object 2-2 that 6 pointer element points to.Based on above-mentioned data structure,, just can find the corresponding data of key word with digital corresponding element in the key word by subscript in the array of pointers of visiting each node because each numeral in the key word is corresponding with the subscript of array in the data structure.
Based on the data store organisation of present embodiment, its data query flow process comprises the steps: as shown in Figure 5
Step 101, judge whether to have finished inquiry by all sub-characters in the inquiry string, if, then finish inquiry, otherwise execution in step 102;
Step 102, obtain by N character of inquiry string, wherein the initial value of N is 1;
Step 103, judge the array of pointers inquired about whether following to be designated as described be empty by the pointer element of N character of inquiry string, if, then end, otherwise, execution in step 104;
The following of array of pointers that step 104, judgement are inquired about is designated as by the pointer element of N character of inquiry string whether point to a linked object, if then execution in step 105, otherwise, execution in step 106; In fact, in this step, under situation about not being judged as not, the array of pointers of being inquired about following is designated as described pointer element by N character of inquiry string and points to another array of pointers.Two judgements in the step 103 and 104 are actually the selection of carrying out three kinds of situations, if that is: following being designated as by the pointer element of N character of inquiry string of the array of pointers of being inquired about pointed to a linked object, then execution in step 105, point to another array of pointers if be designated as described pointer element by N character of inquiry string by the array of pointers of being inquired about following, then execution in step 106, if by the array of pointers of being inquired about following be designated as described by the pointer element of N character of inquiry string for empty, then finish to inquire about; Therefore, on decision operation, multiple sequential combination can be arranged, be not limited to the flow process in the present embodiment.
Step 105, the data query result is updated to the data of storing in the described linked object, the array of pointers that will be inquired about is updated to the array of pointers of the pointed of storing in the described linked object, and N is added 1, and execution in step 101 then; Maximum match inquiry to find exactly with by the corresponding storage data of the highest key word of inquiry string matching degree as final query result, for example, the data that in the KCT tree, have 654 correspondences, the data that also have 65478 correspondences, then in to 654789 maximum match inquiry, will successively obtain the both keyword data, then the data with 65478 correspondences are final query result.
Step 106, the array of pointers that will be inquired about are updated to described another array of pointers, and N is added 1, and execution in step 101 then;
In the data storage of reality, if the following pointer element of X that is designated as in the array of pointers of N node layer is for empty, explanation is in key word, the word key word of N element combination does not backward have corresponding storage data, for example, key word 89624, if inquire following in the array of pointers of the 3rd layer of correspondence be designated as 6 element for empty, illustrate that then key word 896,8962,89624 does not all have corresponding data storage.In addition, because this method is to inquire about at the situation that is numeral entirely by inquiry string, so, for fear of maloperation, before described step 101, also comprise: judge describedly whether only comprise numeral in by inquiry string, if, then execution in step 101, otherwise finish.
Below character string 6356123 and 6346123 being carried out matching inquiry is that example further specifies concrete query script: key word 63 and 6346 and corresponding key data are arranged among the KCT, 6356123 can only match 63,6346123 can match 6346 key words.
1) carry out matching inquiry to 6356123: visit following 6 the pointer element that is designated as of the array of pointers 1-1 of the 1st node layer, this pointer element is pointed to the array of pointers 1-2 of next node layer; Following 3 the pointer element that is designated as of access pointer array 1-2 then, this pointer element is pointed to a linked object 2-1, visit this linked object, data V1 is therefrom proposed out, and, inquire about backward more successively, after whole character string has all been inquired about by the array of pointers 1-3 that pointer C1 finds next node layer, only get access to V1, therefore with V1 as final query result.
2) carry out matching inquiry to 6346123: visit following 6 the pointer element that is designated as of the array of pointers 1-1 of the 1st node layer, this pointer element is pointed to the array of pointers 1-2 of next node layer; Following 3 the pointer element that is designated as of access pointer array 1-2 then, this pointer element is pointed to a linked object 2-1, visit this linked object, therefrom extract data V1 temporarily as the Query Result of the maximum match of 6346 correspondences, because key word 3 is not last numeral in the key word, so also will continue downward inquiry again, extract pointer C1 among this linked object 2-1, the array of pointers 1-3 that this pointed is the 3rd layer, be designated as 4 pointer element among the access pointer array 1-3 down, this pointer element is pointed to the array of pointers 1-4 of next node layer, be designated as 6 pointer element among the access pointer array 1-4 down, this pointer element is pointed to linked object 2-2, owing to inquired last numeral of key word, so the V2 among the extraction linked object 2-2 is as final query result, do not point to a linked object if be designated as down 6 pointer element among the array of pointers 1-4, inquiry backward more successively, after whole character string has all been inquired about, do not get access to new key data again, therefore, with V2 as final query result.
Based on the data store organisation of present embodiment, the Stored Procedure of its data comprises the steps: as shown in Figure 6
Step 201, judge whether to detect last character of the key word of the key data correspondence that will store, if, execution in step 208, if not, execution in step 202;
Step 202, obtain N character of described key word, wherein the initial value of N is 1;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 203, judgement are inquired about is empty, if then execution in step 207, otherwise, execution in step 204;
The following of array of pointers that step 204, judgement are inquired about is designated as by the pointer element of N character of inquiry string whether point to a linked object, if then execution in step 205, otherwise, execution in step 206; In fact, in this step, under situation about not being judged as not, the array of pointers of being inquired about following is designated as described pointer element by N character of inquiry string and points to another array of pointers.Two judgements in the step 203 and 204 are actually the selection of carrying out three kinds of situations, if that is: following being designated as by the pointer element of N character of inquiry string of the array of pointers of being inquired about pointed to a linked object, then execution in step 205, point to another array of pointers if be designated as described pointer element by N character of inquiry string by the array of pointers of being inquired about following, then execution in step 206, describedly be sky by the pointer element of N character of inquiry string if be designated as by the array of pointers of being inquired about following, then execution in step 207; Therefore, on decision operation, multiple sequential combination can be arranged, be not limited to the flow process in the present embodiment.
Step 205, be updated to the array of pointers of the pointed of storing in the described linked object by the inquiry array, then N added 1, execution in step 201 described;
Step 206, the array of pointers that will be inquired about are updated to described another array of pointers, and N is added 1, and execution in step 201 then;
Step 207, the new array of pointers of establishment, and the following pointer element that is designated as N character of described key word of described array of pointers of being inquired about is updated to the pointer that points to described new array of pointers, be updated to described new array of pointers with described by the inquiry array then, N is added 1, execution in step 201;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 208, judgement are inquired about is empty, if then execution in step 212, otherwise, execution in step 209;
The following of array of pointers that step 209, judgement are inquired about is designated as by the pointer element of N character of inquiry string whether point to a linked object, if then execution in step 210, otherwise, execution in step 211; In fact, in this step, under situation about not being judged as not, the array of pointers of being inquired about following is designated as described pointer element by N character of inquiry string and points to another array of pointers.Two judgements in the step 208 and 208 are actually the selection of carrying out three kinds of situations, if that is: following being designated as by the pointer element of N character of inquiry string of the array of pointers of being inquired about pointed to a linked object, then execution in step 210, point to another array of pointers if be designated as described pointer element by N character of inquiry string by the array of pointers of being inquired about following, then execution in step 211, describedly be sky by the pointer element of N character of inquiry string if be designated as by the array of pointers of being inquired about following, then execution in step 212; Therefore, on decision operation, multiple sequential combination can be arranged, be not limited to the flow process in the present embodiment.
Step 210, be described key data, finish then the Data Update in the described linked object;
Step 211, new linked object of establishment, described key data is stored in this linked object, the following pointer element that is designated as N character of described key word of described array of pointers of being inquired about is updated to the pointer that points to this linked object, and the pointer of described another array of pointers of sensing is stored in this linked object, finish then;
Step 212, new linked object of establishment, described key data is stored in this linked object, the following pointer element that is designated as N character of described key word of described array of pointers of being inquired about is updated to the pointer that points to this linked object, finishes then;
In fact the process of storage has comprised the position of location storage, with data storage two parts, in fact the memory location, location is the same with the query script of data, the cyclic process of above-mentioned steps 202-207 is exactly the process of memory location, location, and step 208-212 is for having located the process of the data storage behind the memory location.
In addition, in storing process, also can whether only comprise numeral to the key word that will store the data correspondence and test, be specially and before described step 201, also comprise judging whether only comprise numeral in the described key word, if then execution in step 201, otherwise finish.
Based on the data store organisation of present embodiment, the deletion flow process of its data comprises the steps: as shown in Figure 7
Step 301, judge whether to detect last character of the key word of the key data correspondence that will delete, if, execution in step 307, if not, execution in step 302;
Step 302, obtain N character of key word;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 303, judgement are inquired about is empty, if, then finish, otherwise, execution in step 304;
The following of array of pointers that step 304, judgement are inquired about is designated as by the pointer element of N character of inquiry string whether point to a linked object, if then execution in step 305, otherwise, execution in step 306; In fact, in this step, under situation about not being judged as not, the array of pointers of being inquired about following is designated as described pointer element by N character of inquiry string and points to another array of pointers.Two judgements in the step 303 and 304 are actually the selection of carrying out three kinds of situations, if that is: following being designated as by the pointer element of N character of inquiry string of the array of pointers of being inquired about pointed to a linked object, then execution in step 305, point to another array of pointers if be designated as described pointer element by N character of inquiry string by the array of pointers of being inquired about following, then execution in step 306, if by the array of pointers of being inquired about following be designated as described by the pointer element of N character of inquiry string for empty, then end; Therefore, on decision operation, multiple sequential combination can be arranged, be not limited to the flow process in the present embodiment.
Step 305, described array of pointers of being inquired about is updated to the array of pointers of the pointed in the described linked object, N is added 1, execution in step 301 then;
Step 306, described array of pointers of being inquired about is updated to described another array of pointers, N is added 1, execution in step 301 then;
If the following pointer element that is designated as N character of described key word of the array of pointers that step 307 is inquired about is pointed to a linked object, then execution in step 308, otherwise finish;
If comprise the pointer that points to another array of pointers in this linked object of step 308, then the following pointer element that is designated as N character of described key word of the array of pointers of being inquired about is updated to and comprises the pointer that points to another array of pointers in this linked object, and delete this linked object, finish then; If do not comprise the pointer that points to another array of pointers in this linked object, then directly delete this linked object, finish then.
The process of deletion has also comprised position and deleted data two parts of the data that will delete the location, and the position of the data that the location will be deleted is consistent with position fixing process in the storing process, does not give unnecessary details at this.
Before described step 301, can also comprise:
Judge in the described key word whether only comprise numeral, be that then execution in step 301, otherwise finish.
Querying method of the present invention can be applied in a lot of occasions, and the emergency numbers translation of for example mentioning in the background technology is as shown in the table, emergency numbers can be carried out following configuration:
Table 2:
Emergency numbers Area code The number of translation
100 080 0805667890
100 022 0229089780
100 011 0115678902
101 080 0803456779
101 022 0227658902
101 011 0115980789
Wherein area code is exactly a key word, and the number of translation is exactly the data of this key word correspondence, for satisfying this characteristic, need distribute a KCT for each emergency numbers.So, emergency numbers 100 corresponding KCT, 101 corresponding KCT.The data of the key word of 100 correspondences and key word correspondence are as follows:
Table 3:
Key Value
080 0805667890
022 0229089780
011 0115678902
Like this after the server of intelligent network is received the 110 warning numbers that a user terminal dials, carry out the data query of maximum match according to the number of this terminal, for example the number of this terminal is 0805645369, in the data query that carries out maximum match, will obtain 0803456779 (this number is police station's number of user terminal location) of 080 correspondence, like this alarm call directly is transferred to this police station.
The Another application scene is a session management.If session id is an integer, it just can be used as key word, and session related data is exactly the data of this key word correspondence.Can look into fast by data enquire method of the present invention and be permitted, find the data of session id correspondence.
It should be noted last that, above embodiment is only unrestricted in order to technical scheme of the present invention to be described, although the present invention is had been described in detail with reference to preferred embodiment, those of ordinary skill in the art is to be understood that, can make amendment or be equal to replacement technical scheme of the present invention, and not break away from the spirit and scope of technical solution of the present invention.

Claims (3)

1. one kind is carried out the method for data matching inquiry based on key word, it is characterized in that, comprises the steps:
Step 101, judge whether to have finished inquiry by all sub-characters in the inquiry string, if then execution in step 107, otherwise execution in step 102;
Step 102, obtain by N character of inquiry string, wherein the initial value of N is 1;
Step 103, judge the array of pointers inquired about whether following to be designated as described be sky by the pointer element of N character of inquiry string, if then execution in step 107, otherwise, execution in step 104;
The following of array of pointers that step 104, judgement are inquired about is designated as by the pointer element of N character of inquiry string whether point to a linked object, if then execution in step 105, otherwise this pointer element is pointed to another array of pointers, execution in step 106;
Step 105, the data query result is updated to the data of storing in the described linked object, the array of pointers that will be inquired about is updated to the array of pointers that the pointer element of storing in the described linked object is pointed to, and N is added 1, and execution in step 101 then;
Step 106, the array of pointers that will be inquired about are updated to described another array of pointers, and N is added 1, and execution in step 101 then;
Step 107, export described Query Result.
2. one kind is carried out the date storage method of data matching inquiry based on key word, it is characterized in that, comprises the steps:
Step 201, judge whether to detect last character of the key word of the key data correspondence that will store, if, execution in step 208, if not, execution in step 202;
Step 202, obtain N character of described key word, wherein the initial value of N is 1;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 203, judgement are inquired about is empty, if then execution in step 207, otherwise, execution in step 204;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 204, judgement are inquired about points to a linked object, if then execution in step 205, otherwise this pointer element is pointed to another array of pointers, execution in step 206;
Step 205, described array of pointers of being inquired about is updated to the array of pointers that the pointer element of storing in the described linked object is pointed to, then N is added 1, execution in step 201;
Step 206, described array of pointers of being inquired about is updated to described another array of pointers in the step 204, and N is added 1, execution in step 201 then;
Step 207, the new array of pointers of establishment, and the following pointer element that is designated as N character of described key word of described array of pointers of being inquired about is updated to the pointer element of pointing to described new array of pointers, then described array of pointers of being inquired about is updated to described new array of pointers, N is added 1, execution in step 201;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 208, judgement are inquired about is empty, if then execution in step 212, otherwise, execution in step 209;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 209, judgement are inquired about points to a linked object, if then execution in step 210, otherwise this pointer element is pointed to another array of pointers, execution in step 211;
Step 210, be described key data, finish then the Data Update in the described linked object;
Step 211, new linked object of establishment, described key data is stored in this new linked object, the following pointer element that is designated as N character of described key word of described array of pointers of being inquired about is updated to the pointer element of pointing to this new linked object, and the pointer element of described another array of pointers of sensing in the step 209 is stored in this new linked object, finish then;
Step 212, new linked object of establishment, described key data is stored in this new linked object, the following pointer element that is designated as N character of described key word of described array of pointers of being inquired about is updated to the pointer element of pointing to this new linked object, finishes then.
3. one kind is carried out the data-erasure method of data matching inquiry based on key word, it is characterized in that, comprises the steps:
Step 301, judge whether to detect last character of the key word of the key data correspondence that will delete, if, execution in step 307, if not, execution in step 302;
Step 302, obtain N character of key word;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 303, judgement are inquired about is empty, if, then finish, otherwise, execution in step 304;
Whether the following pointer element that is designated as N character of described key word of the array of pointers that step 304, judgement are inquired about points to a linked object, if then execution in step 305, otherwise this pointer element is pointed to another array of pointers, execution in step 306;
Step 305, described array of pointers of being inquired about is updated to the array of pointers that the pointer element in the described linked object is pointed to, N is added 1, execution in step 301 then;
Step 306, described array of pointers of being inquired about is updated to another array of pointers described in the step 304, N is added 1, execution in step 301 then;
If the following pointer element that is designated as N character of described key word of the array of pointers that step 307 is inquired about is pointed to a linked object, then execution in step 308, otherwise finish;
If comprise the pointer element of pointing to another array of pointers in this linked object of step 308, then the following pointer element that is designated as N character of described key word of the array of pointers of being inquired about is updated to and comprises the pointer element of pointing to another array of pointers in this linked object, and delete this linked object, finish then; If do not comprise the pointer element of pointing to another array of pointers in this linked object, then directly delete this linked object, finish then.
CNB2006100744568A 2006-04-21 2006-04-21 Data matching inquiry method based on key words Expired - Fee Related CN100421114C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006100744568A CN100421114C (en) 2006-04-21 2006-04-21 Data matching inquiry method based on key words

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100744568A CN100421114C (en) 2006-04-21 2006-04-21 Data matching inquiry method based on key words

Publications (2)

Publication Number Publication Date
CN1967528A CN1967528A (en) 2007-05-23
CN100421114C true CN100421114C (en) 2008-09-24

Family

ID=38076301

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100744568A Expired - Fee Related CN100421114C (en) 2006-04-21 2006-04-21 Data matching inquiry method based on key words

Country Status (1)

Country Link
CN (1) CN100421114C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425739B (en) * 2013-07-09 2016-09-14 国云科技股份有限公司 A kind of character string matching method
CN105426519B (en) * 2015-12-04 2018-12-14 河海大学 A kind of small-scale index datastore method for off-line search
CN110969816A (en) * 2019-12-26 2020-04-07 湖北创想云科技有限公司 Online alarm system and alarm method
CN113821211B (en) * 2021-09-17 2023-06-27 杭州迪普科技股份有限公司 Command parsing method and device, storage medium and computer equipment
CN116303405B (en) * 2023-05-12 2023-11-10 深圳竹云科技股份有限公司 Data duplicate checking method and device and computer equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030025621A1 (en) * 2001-08-02 2003-02-06 Jan Christoffersson Method and apparatus for fast longest match search
CN1435031A (en) * 1999-12-10 2003-08-06 睦塞德技术公司 Method and apparatus for longest match address lookup
US20040008634A1 (en) * 2002-05-31 2004-01-15 Vijay Rangarajan Method and apparatus for generating and using enhanced tree bitmap data structures in determining a longest prefix match
CN1477559A (en) * 2002-08-23 2004-02-25 华为技术有限公司 Method for implementing long character string prefix matching

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1435031A (en) * 1999-12-10 2003-08-06 睦塞德技术公司 Method and apparatus for longest match address lookup
US20030025621A1 (en) * 2001-08-02 2003-02-06 Jan Christoffersson Method and apparatus for fast longest match search
US20040008634A1 (en) * 2002-05-31 2004-01-15 Vijay Rangarajan Method and apparatus for generating and using enhanced tree bitmap data structures in determining a longest prefix match
CN1477559A (en) * 2002-08-23 2004-02-25 华为技术有限公司 Method for implementing long character string prefix matching

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
数据结构Trie及其应用. 郑丽英.现代计算机,第总第193期. 2004
数据结构Trie及其应用. 郑丽英.现代计算机,第总第193期. 2004 *

Also Published As

Publication number Publication date
CN1967528A (en) 2007-05-23

Similar Documents

Publication Publication Date Title
CN107784044B (en) Table data query method and device
CN101398844B (en) Resource file searching method and mobile terminal
CN101330657B (en) Address list system and implementing method thereof
CN100589644C (en) Calling process system and method thereof
CN100421114C (en) Data matching inquiry method based on key words
CN103345521A (en) Method and device for processing key values in hash table database
CN101986672B (en) Message processing method and device
CN109408594B (en) Cross-chain data retrieval system based on block chain
CN101320376B (en) Database search method, system and mobile communication terminal
CN101420681B (en) Method and apparatus for processing multi-channel request subscription under service management platform
CN104035943A (en) Data storage method and corresponding server
EP1781005B9 (en) Centralized personal directory scheme for communications networks
CN102214214B (en) Method and device for processing data relationship and mobile communication terminal
CN101072252A (en) Method and device for identifying mobile phone number territoriality for mobile communication terminal
CN115686497A (en) Business development data management method, development engine, electronic device, and storage medium
CN107729457A (en) The method, apparatus and storage medium of a kind of information intelligent retrieval
CN102523537A (en) Communication service processing method based on enterprise switchboard system and enterprise switchboard system
CN102567121A (en) Method and device for realizing converged communication
CN101645994A (en) Group telephone system, center machine and calling method
CN101692235A (en) Method, device and mobile terminal for data query
CN106850922B (en) Processing method, system and equipment for communication number
CN110569456B (en) WEB end data offline caching method and device and electronic equipment
KR100693721B1 (en) Method and apparatus for accelerating the DB using hashing algorithm
CN106960028A (en) The management method and managing device of a kind of terminal document
CN105007569A (en) Method of obtaining Internet resources by a terminal on the basis of a wireless identifier

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20080924

Termination date: 20130421