Home number segment query method, electronic equipment and computer readable storage medium
By positioning the number to be queried to an independent atomic number segment and querying the corresponding original number segment, the problem of complexity and low efficiency of medium-sized segment query in 5G networks is solved, and an efficient and simplified home number segment query process is achieved.
Patent Information
- Application Number
- CN202311808517.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-25
- Publication Date
- 2025-06-27
AI Technical Summary
In 5G networks, when NRF network elements discover storage segment information through NFS services, the process of querying which segments a certain number belongs to is complex and inefficient, especially due to the intersecting and mutual inclusion of the original segments, the query requires multiple interactions and low performance.
By positioning the number to be queried to an independent atomic number segment and querying the original number segment corresponding to the atomic number segment, the home number segment query is realized. This method is based on the preset atomic segment index, avoiding the complex association between the original segments and simplifying the query process.
Query results can be obtained through one positioning, which significantly improves query efficiency and performance, avoids multiple queries and complex operations, and simplifies the operation process.
Smart Images

Figure CN120216542A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communications, and particularly to a method for querying home number segments, an electronic device, and a computer-readable storage medium. Background Art
[0002] In 5G (the 5th generation mobile communication technology), the NRF (Network Repository Function) network element is mainly used for service discovery between NFSs (Network File Systems). This network element stores the number segment information of external network elements, mainly storing: the starting number and the ending number of the number segment, and there may be relationships such as irrelevant, inclusive, equal, and intersecting between number segments. It is often necessary to query which number segments a certain number belongs to, and occasionally a certain number segment is deleted. Summary of the Invention
[0003] Embodiments of the present disclosure provide a method for querying home number segments, an electronic device, and a computer-readable storage medium.
[0004] In a first aspect, embodiments of the present disclosure provide a method for querying home number segments, the method including:
[0005] Obtaining a number to be queried;
[0006] Determining the atomic number segment to which the number to be queried belongs according to the index of the preset atomic number segments; the atomic number segments are obtained by splitting the original number segments, and the atomic number segments are independent of each other;
[0007] Obtaining the original number segment corresponding to the determined atomic number segment as the original number segment to which the number to be queried belongs.
[0008] In a second aspect, embodiments of the present disclosure provide an electronic device, the electronic device including:
[0009] One or more processors;
[0010] A memory having one or more programs stored thereon, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method for querying home number segments;
[0011] One or more input / output I / O interfaces connected between the processor and the memory and configured to implement information interaction between the processor and the memory.
[0012] In a third aspect, embodiments of the present disclosure provide a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for querying home number segments is implemented.
[0013] Based on the pre - obtained atomic number segments, the embodiments of the present disclosure first locate the number to be queried into mutually independent atomic number segments, and then query the original number segment corresponding to the atomic number segment, so that the query of the attribution number segment can obtain the required query result through only one query on the basis of a single index. This avoids many problems such as the implementation difficulty, high complexity, and cumbersome operation due to multiple queries caused by the inter - cross and inter - inclusion relationships between the original number segments, and improves the query efficiency and query performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In the drawings of the embodiments of the present disclosure:
[0015] Figure 1 is a flowchart of the method for querying the attribution number segment provided by the embodiments of the present disclosure;
[0016] Figure 2 is a schematic diagram of the associated relationship of the original number segments for business warehousing storage provided in the related art;
[0017] Figure 3 is a schematic diagram of the method for determining whether there is an associated relationship between the new original number segment and the existing atomic number segments provided by the embodiments of the present disclosure;
[0018] Figure 4 is a schematic diagram of the original number segment and the corresponding atomic number segment provided by the embodiments of the present disclosure;
[0019] Figure 5 is provided by the embodiments of the present disclosure in Figure 6 schematic diagram of the atomic number segments after adding the original number segment m on the basis;
[0020] Figure 6 is a block diagram of the composition of the electronic device provided by the embodiments of the present disclosure;
[0021] Figure 7 is a block diagram of the composition of the computer - readable storage medium provided by the embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0022] To enable those skilled in the art to better understand the technical solutions of the present disclosure, the communication perception data processing method and computer - readable storage medium provided by the embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0023] The drawings of the embodiments of the present disclosure are used to provide a further understanding of the embodiments of the present disclosure, and constitute a part of the specification. Together with the detailed embodiments, they are used to explain the present disclosure and do not constitute a limitation to the present disclosure. By describing the detailed embodiments with reference to the drawings, the above - mentioned and other features and advantages will become more obvious to those skilled in the art.
[0024] In the case of no conflict, the embodiments of the present disclosure and the features in the embodiments may be combined with each other.
[0025] The terms used in the present disclosure are only for describing specific embodiments and are not intended to limit the present disclosure. As used in the present disclosure, the term "and / or" includes any and all combinations of one or more related listed items. As used in the present disclosure, the singular forms "a" and "the" are also intended to include the plural forms unless the context clearly indicates otherwise. As used in the present disclosure, the terms "comprising", "made of", specify the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their groups.
[0026] Unless otherwise defined, all terms (including technical and scientific terms) used in the present disclosure have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in common dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless the present disclosure clearly so defines.
[0027] Currently, the solutions for querying the home number segment according to the number include:
[0028] UDR (Unified Data Repository, unified data warehouse function): a self-developed in-memory database, mainly for storing user data of the core network. This database mainly uses B-tree indexes and builds indexes on the start number and end number of the number segment. When querying, due to read-write concurrency, locking is required during number segment query, and the number of records queried each time is limited. Moreover, there are the following problems with the current NRF using the UDR in-memory database: when querying the home number segment according to the number, due to locking, the number of records to be queried needs to be limited, so the service needs to interact with the in-memory database multiple times. Secondly, when there are many home number segments with inclusion relationships, multiple traversals and comparisons of indexes are required, which will bring problems to query performance.
[0029] In short, the B-tree index of the current UDR requires multiple comparisons and queries, resulting in low performance.
[0030] Based on the pre-obtained atomic number segments, the embodiments of the present disclosure first locate the number to be queried to independent atomic number segments, and then query the original number segment corresponding to the atomic number segment, so that the home number segment query can obtain the required query results through only one query based on a single index, avoiding many problems such as the difficulty in realizing query based on the original number segments due to the cross and inclusion relationships between the original number segments, high complexity, and the need for multiple queries and cumbersome operations, and improving the query efficiency and query performance.
[0031] The method for querying the attribution number segment in the embodiments of the present disclosure can be executed by any electronic device that needs to query the number segment, such as a terminal device or a server. The terminal device may include, but is not limited to: in-vehicle devices, user equipment (UE), mobile devices, computing devices, wearable devices, etc. For example, it includes, but is not limited to, cellular phones, cordless phones, personal digital assistants (PDA), portable computers, etc. The method for querying the attribution number segment can be implemented by a processor calling computer-readable program instructions stored in a memory, or can be implemented by a server.
[0032] The following provides a detailed introduction to the solution of the embodiments of the present disclosure.
[0033] The embodiments of the present disclosure provide a method for querying the attribution number segment, as Figure 1 shown, the method may include steps S11-S13:
[0034] S11. Obtain the number to be queried;
[0035] S12. Determine the atomic number segment to which the number to be queried belongs according to the index of the preset atomic number segment; the atomic number segments are obtained based on the original number segments and are independent of each other;
[0036] S13. Obtain the original number segment corresponding to the determined atomic number segment as the original number segment to which the number to be queried belongs.
[0037] It is known that the original number segments stored in the current business database include various relationships, such as various relationships like irrelevant, intersecting, containing, equal, etc. The following uses the Figure 2 original number segments shown: a1, b1, c1, d1, e1, f1, g1, h1 to illustrate the above several relationships:
[0038] Irrelevant: For example, a1 and b1 are irrelevant (or have no association relationship), a1.end < b1.start, where end represents the starting number of the original number segment and start represents the ending number of the original number segment;
[0039] Intersecting: For example, c1 and d1 intersect, c1.end >= d1.start & c1.start <= d1.end;
[0040] Containing: For example, f1 contains e1, (e1.start >= f1.start & e1.end < f1.end), or, (e1.start > f1.start & e1.end <= f1.end);
[0041] Equal: For example, g1 is equal to h1, g1.start == h1.start and g1.end == h1.end.
[0042] In the embodiments of the present disclosure, since there may be intersection relationships, inclusion relationships, and other complex relationships among the current multiple original number segments, the current attribution number segment query scheme is difficult and cumbersome. Therefore, in order to eliminate the query problems caused by the complex relationships among the multiple original number segments, the solution of the embodiments of the present disclosure splits the original number segments of the service into independent atomic number segments, creates indexes on the atomic number segments, and maintains a correspondence between the atomic number segments and the original number segments. After accurately positioning to an independent atomic number segment according to the starting number of the number to be queried, the original number segment to which the number belongs can be obtained through the correspondence between the atomic number segment and the original number segment.
[0043] In the embodiments of the present disclosure, the attribution number segment query only requires one positioning and does not need to query all the original number segments greater than the starting number, which greatly improves the query efficiency.
[0044] In the embodiments of the present disclosure, before positioning the number to be queried to the corresponding atomic number segment according to the index of the preset atomic number segment, the method may further include:
[0045] Splitting the original number segment into atomic number segments; creating indexes for each atomic number segment and establishing a correspondence between each atomic number segment and the original number segment.
[0046] In the embodiments of the present disclosure, before performing the attribution field query, the original number segment of the service is first split so that the split atomic number segments are independent of each other, so that one positioning can be achieved when positioning the number to be queried. In addition, indexes for each atomic number segment are created to facilitate positioning the number to be queried to the corresponding atomic field through the index; and the correspondence between the obtained atomic fields and the original number segments is obtained, so that based on this correspondence, the corresponding original number segment can be found after positioning the atomic number segment.
[0047] In the embodiments of the present disclosure, splitting the original number segment into atomic number segments may include:
[0048] Obtaining a new original number segment;
[0049] Splitting the new original number segment into atomic number segments according to the relationship between the new original number segment and the existing atomic number segments.
[0050] In the embodiments of the present disclosure, splitting the new original number segment into atomic number segments according to the relationship between the new original number segment and the existing atomic number segments may include:
[0051] In the case where there is no existing atomic number segment, or in the case where there is an existing atomic number segment and there is no association relationship between the new original number segment and the existing atomic number segment, the new original number segment is taken as a new atomic number segment.
[0052] In the case where there is the existing atomic number segment and there is an association relationship between the new original number segment and the existing atomic number segment, the new original number segment is split into atomic number segments according to the association relationship.
[0053] In the embodiments of the present disclosure, before splitting the new original number segment into atomic number segments according to the relationship between the new original number segment and the existing atomic number segment, it is first determined whether there is an existing atomic number segment. If there is no existing atomic number segment, it means that the new original number segment is the first original number segment. In the case where the new original number segment is the first original number segment, the new original number segment itself can be taken as the atomic number segment corresponding to the new original number segment.
[0054] In the embodiments of the present disclosure, if there is an existing atomic number segment, indicating that the obtained new original number segment is not the first original number segment, it can be determined whether there is an association relationship between the new original number segment and the existing atomic number segment.
[0055] In the embodiments of the present disclosure, in the case where there is no association relationship between the new original number segment and the existing atomic number segment, the new original number segment itself is also taken as the atomic number segment corresponding to the new original number segment.
[0056] In the embodiments of the present disclosure, splitting the new original number segment into atomic number segments according to the relationship between the new original number segment and the existing atomic number segment includes:
[0057] Determine whether there is an existing atomic number segment, and in the case where there is an existing atomic number segment, determine whether there is an association relationship between the new original number segment and the existing atomic number segment;
[0058] In the case where there is an existing atomic number segment and there is an association relationship between the new original number segment and the existing atomic number segment, the new original number segment is split into atomic number segments according to the association relationship. In the embodiments of the present disclosure, the split atomic number segments have the following characteristics:
[0059] 1. The numbers of all atomic number segments are between the target start number with the smallest value and the target end number with the largest value among the start numbers and end numbers corresponding to all original number segments;
[0060] 2. Starting from the target starting number, traverse the starting number and ending number of each original number segment. When traversing to any starting number or ending number, if there is a corresponding original number segment between the traversed starting number or ending number and the previously traversed starting number or ending number, take the numbers of this original number segment as an atomic number segment.
[0061] In the embodiments of the present disclosure, according to the above characteristics, it can be known that each atomic number segment is determined based on the starting number and ending number of the original number segment.
[0062] In the embodiments of the present disclosure, the method for obtaining the atomic number segment will be introduced in detail below.
[0063] In the embodiments of the present disclosure, before that, first determine whether there is an association relationship between the new original number segment and the existing atomic number segments.
[0064] In the embodiments of the present disclosure, the association relationship may include, but is not limited to, any one or more of the following: intersection relationship, inclusion relationship, and equality relationship.
[0065] In the embodiments of the present disclosure, as Figure 3 shown, determining whether there is an association relationship between the new original number segment and the existing atomic number segments may include steps S31 - S33:
[0066] S31. Obtain the starting number and ending number of the new original number segment.
[0067] S32. Determine the positional relationship between the starting number and ending number of the new original number segment and the numbers included in the existing atomic number segments.
[0068] In the embodiments of the present disclosure, determining the positional relationship between the starting number and / or ending number of the new original number segment and the numbers included in the existing atomic number segments may include steps A - C:
[0069] Step A. Traverse the numbers between the starting number and ending number of the new original number segment.
[0070] Step B. For any traversed number, perform the following operations: detect whether the arbitrary number belongs to the numbers of the existing atomic number segments; when the arbitrary number belongs to the numbers of the existing atomic number segments, compare the starting number and ending number of the atomic number segment to which the arbitrary number belongs with the starting number and ending number of the new original number segment; determine the positional relationship between the new original number segment and the atomic number segment to which the arbitrary number belongs according to the size relationship, and enter step C; when the arbitrary number does not belong to the numbers of any existing atomic number segments, continue to traverse the next number, and perform step B for the next number.
[0071] Step C: Detect whether the ending number of the atomic number segment to which the arbitrary number belongs is less than the ending number of the new original number segment. If the ending number of the atomic number segment to which the arbitrary number belongs is less than the ending number of the new original number segment, continue traversing from the first number after the ending number of the atomic number segment to which the arbitrary number belongs, and return to Step B; if the ending number of the atomic number segment to which the arbitrary number belongs is greater than or equal to the ending number of the new original number segment, end the traversal and save the positional relationship between each atomic number segment traversed and the new original number segment.
[0072] In the embodiments of the present disclosure, the positional relationship may include any one of the following two cases:
[0073] 1. At least one number corresponding to any atomic number segment is included between the starting number and the ending number of the new original number segment;
[0074] Both the starting number and the ending number of the new original number segment are located within the atomic number segment;
[0075] All the numbers within the atomic number segment are located between the starting number and the ending number of the new original number segment;
[0076] The starting number of the new original number segment is located within the atomic number segment, and the ending number is located within another atomic number segment;
[0077] Any one of the starting number and the ending number of the new original number segment is located within the atomic number segment, and the other is located outside all the atomic number segments; and,
[0078] The new original number segment completely coincides with the atomic number segment.
[0079] 2. No number corresponding to any atomic number segment is included between the starting number and the ending number of the new original number segment.
[0080] In the embodiments of the present disclosure, based on the above positional relationship, it can be known that determining the positional relationship between the new original number segment and the atomic number segment to which the arbitrary number belongs according to the size relationship in Step B may include:
[0081] When the starting number of the new original number segment is greater than the starting number of the original number segment and the ending number of the new original number segment is less than the ending number of the original number segment, it is determined that both the starting number and the ending number of the new original number segment are located within the atomic number segment;
[0082] When the starting number of the original number segment is greater than the starting number of the new original number segment and the ending number of the original number segment is less than the ending number of the new original number segment, it is determined that all the numbers within the atomic number segment are located between the starting number and the ending number of the new original number segment;
[0083] In the case where the starting number of the new original number segment is greater than the starting number of the atomic number segment and less than the ending number of the original number segment, it is determined that the starting number of the new original number segment is within the atomic number segment. In the case where the ending number of the new original number segment is greater than the starting number of another atomic number segment and less than the ending number of the other original number segment, it is determined that the ending number of the new original number segment is within the other atomic number segment;
[0084] In the case where one of the starting number and the ending number of the new original number segment is greater than the starting number of the atomic number segment and less than the ending number of the original number segment, and the other is not within any atomic number, it is determined that one of the starting number and the ending number of the new original number segment is within the atomic number segment, and the other is outside all atomic number segments;
[0085] In the case where the starting number of the new original number segment is the same as the starting number of the atomic number segment, and the ending number of the new original number segment is also the same as the ending number of the atomic number segment, it is determined that the new original number segment completely coincides with the atomic number segment.
[0086] S33. Determine whether there is an association relationship between the new original number segment and the existing atomic number segments according to the positional relationship.
[0087] In the embodiments of the present disclosure, determining whether there is an association relationship between the new original number segment and the existing atomic number segments according to the positional relationship includes:
[0088] In the case where the numbers corresponding to any atomic number segment are not included between the starting number and the ending number of the new original number segment, it is determined that there is no association relationship between the new original number segment and the existing original number segments;
[0089] In the case where at least one number corresponding to any atomic number segment is included between the starting number and the ending number of the new original number segment, it is determined that there is an association relationship between the new original number segment and the existing original number segments.
[0090] In the embodiments of the present disclosure, since the existing atomic number segments have covered all the numbers included in the existing original number segments, therefore, in the case where the numbers corresponding to any atomic number segment are not included between the starting number and the ending number of the new original number segment, it means that the numbers in the new original number segment are all newly added numbers and have no association relationship with the numbers in the existing atomic number segments, or in other words, have no relationship. Therefore, the new original number segment has no intersection, equality, inclusion and other association relationships with the existing atomic number segments.
[0091] In an embodiment of the present disclosure, when at least one number corresponding to any atomic number segment is included between the starting number and the ending number of a new original number segment, if it is stated that at least one number is the same as the number within the new original number segment, then there may be an intersection, equality, inclusion, or other association relationships between the new original number segment and the atomic number segment containing the at least one number.
[0092] In an embodiment of the present disclosure, determining the association relationship between a new original number segment and an existing atomic number segment according to the positional relationship includes:
[0093] When both the starting number and the ending number of the new original number segment are within the same atomic number segment, and / or when all the numbers within any one atomic number segment are between the starting number and the ending number of the new original number segment, it is determined that there is an inclusion relationship between the new original number segment and the existing atomic number segment;
[0094] When the starting number of the new original number segment is within one atomic number segment and the ending number is located in another atomic number segment, and / or when any one of the starting number and the ending number is within one atomic number segment and the other is outside all atomic number segments, it is determined that there is an intersection relationship between the new original number segment and the existing atomic number segment;
[0095] When the starting number of the new original number segment is the same as the starting number of any one atomic number segment and the ending number of the new original number segment is also the same as the ending number of the atomic number segment, it is determined that there is an equality relationship between the new original number segment and the existing original number segment.
[0096] In an embodiment of the present disclosure, since there is the above-mentioned association relationship between the new original number segment and the existing atomic number segment, the relationship between the new original number segment and the existing atomic number segment is relatively complex, so the determination method of the atomic number segment is also relatively complex; when there is no such association relationship between the new original number segment and the existing atomic number segment, the relationship between the new original number segment and the existing atomic number segment is simple and can be considered irrelevant. Therefore, the schemes for splitting the new original number segment to obtain new atomic number segments are different in the two cases, and corresponding schemes can be adopted for atomic number segment splitting in the above two cases respectively.
[0097] In an embodiment of the present disclosure, when there is no association relationship between the new original number segment and the existing original number segment, the new original number segment is used as a new atomic number segment.
[0098] In the embodiments of the present disclosure, when there is no association relationship between the new original number segment and the existing atomic number segments, the numbers of the new original number segment and the existing original number segments may be consecutive or there may be several numbers in between. Here, two original number segments without an association relationship are taken as examples for illustration. For example, Figure 5 the original number segment g and the original number segment h shown, there is 1 number in between the end number of the original number segment g and the start number of the original number segment h; the new original number segment and the existing original number segments may also be consecutive (i.e., there is no number in between), for example, Figure 5 the original number segment a and the original number segment b shown, the next number after the end number of the original number segment a is the start number of the original number segment b.
[0099] In the embodiments of the present disclosure, since there is no association relationship between the newly added original number segment and the existing atomic number segments, therefore, the corresponding atomic number segment of this original number segment can be directly added, and the number segment corresponding to this original number segment can be directly used as a new atomic number segment.
[0100] In the embodiments of the present disclosure, when there is an association relationship between the new original number segment and the existing atomic number segments, the atomic number segment of the new original number segment can be split according to the association relationship.
[0101] In the embodiments of the present disclosure, the association relationship may include any one or more of the following: an intersection relationship, an inclusion relationship, and an equality relationship.
[0102] In the embodiments of the present disclosure, when the association relationship between the new original number segment and any first atomic number segment is an inclusion relationship, splitting the atomic number segment of the new original number segment according to this association relationship may include:
[0103] If the first atomic number segment is included in the new original number segment, then the new original number segment is divided according to the positions of the start number and the end number of the first atomic number segment in the new original number segment to obtain multiple sub-original number segments, and an atomic number segment is respectively created for each sub-original number segment to establish the corresponding relationship between the new original number segment and the created atomic number segments.
[0104] In the embodiments of the present disclosure, after obtaining multiple sub-original number segments, the first sub-original number segment corresponding to the first atomic number segment can be determined from the multiple sub-original number segments, and atomic number segments corresponding to other sub-original number segments except the first sub-original number segment in the multiple sub-original number segments are created, and the created atomic number segments and the first atomic number segment are both used as the atomic number segments included in the new original number segment, so that the corresponding relationship between the new original number segment and the atomic number segments can be determined.
[0105] In an embodiment of the present disclosure, when the association relationship between the new original number segment and any first atomic number segment is an inclusion relationship, splitting the new original number segment into atomic number segments according to the association relationship may further include:
[0106] If the new original number segment is included in the first atomic number segment, the first atomic number segment is split according to the positions of the start number and the end number of the new original number segment within the first atomic number segment, so as to establish the corresponding relationship between the atomic number segments obtained after splitting and the new original number segment.
[0107] In an embodiment of the present disclosure, the first atomic number segment can be split into two or three atomic number segments; and the atomic number segment corresponding to the number of the new original number segment among the atomic number segments obtained after splitting is used as the atomic number segment included in the new original number segment, so that the corresponding relationship between the new original number segment and the atomic number segment can be determined.
[0108] In an embodiment of the present disclosure, when the association relationship between the new original number segment and any second atomic number segment is an intersection relationship, splitting the new original number segment into atomic number segments according to the association relationship includes:
[0109] Determine the intersection region between the new original number segment and the second atomic number segment;
[0110] According to the start position or the end position of the intersection region within the second atomic number segment (since when the new original number segment intersects with the second atomic number segment, either the start position of the new original number segment falls within the second atomic number segment or the end position of the new original number segment falls within the second atomic number segment, therefore, the start position or the end position of the intersection region within the second atomic number segment is substantially the start position or the end position where the new original number segment falls within the second atomic number segment, this start position is the position where the start number of the new original number segment is located, and this end position is the position where the end number of the new original number segment is located), the second atomic number segment is split to establish the corresponding relationship between the atomic number segments obtained after splitting and the new original number segment.
[0111] In an embodiment of the present disclosure, when the association relationship between the new original number segment and any third atomic number segment is an equality relationship, splitting the new original number segment into atomic number segments according to the association relationship includes:
[0112] Taking the third atomic number segment as the atomic number segment included in the new original number segment to establish the corresponding relationship between the new original number segment and the atomic number segment.
[0113] In an embodiment of the present disclosure, through the above solutions, the corresponding atomic number segments can be split from any obtained original number segment.
[0114] In the embodiments of the present disclosure, after splitting out atomic number segments, an index of the atomic number segments and the corresponding relationship between the atomic number segments and the original number segments can be obtained.
[0115] In the embodiments of the present disclosure, creating an index for each atomic number segment includes:
[0116] In the case where the obtained original number segment is the first original number segment, determining the starting number and the ending number of the atomic number segment; using the corresponding starting number and / or ending number of the atomic number segment as the index of the atomic number segment;
[0117] In the case where the obtained original number segment is not the first original number segment, updating the index of the split atomic number segment and creating a new index for the newly split atomic number segment.
[0118] In the embodiments of the present disclosure, as Figure 4 shown, where the number segments in lowercase letters are the original number segments, and the number segments in uppercase letters are the split atomic number segments, and each cell represents a unit number. For example, each cell represents 1 number, where Figure 4 the cells in Figure 4 can be counted starting from 0 and counting up to 19, then
[0119] Table 1
[0120] Segment name of the original number segment start-end a 0-2 b 3-5 c 6-8 d 9-12 e 13-15 f 16-19 g 2-4 h 6-7 i 8-12 j 16-19 k 0-13 l 3-19
[0121] In the embodiments of the present disclosure, the index of the atomic number segment can refer to the starting number (start) and the ending number (end) corresponding to each atomic number segment. As shown in Table 2, they are the indexes corresponding to A, B, C, D, E, F, G, H, I, J.
[0122] Table 2
[0123]
[0124]
[0125] In the embodiments of the present disclosure, as the original number segments increase or decrease, the existing atomic number segments may be split or deleted, and new atomic number segments may be added. Therefore, the indexes of the original number segments and the atomic number segments can be continuously updated as the original number segments and the atomic number segments change. For a detailed embodiment, reference can be made to the subsequent Embodiment 1.
[0126] In an embodiment of the present disclosure, establishing a correspondence between each atomic segment and the original segment may include:
[0127] When the obtained original segment is the first original segment, determining the atomic segments included in the original segment; and / or determining the original segments to which the atomic segments belong.
[0128] In an embodiment of the present disclosure, establishing a correspondence between each atomic segment and the original segment may further include:
[0129] When the obtained original segment is not the first original segment, performing any one or more of the following:
[0130] Obtaining all the atomic segments included in the new original segment;
[0131] Updating the atomic segments included in the existing original segment;
[0132] Updating all the original segments to which the split atomic segments belong; and,
[0133] Obtaining all the original segments to which the newly obtained atomic segments after splitting belong.
[0134] In an embodiment of the present disclosure, the above correspondence can be represented in any form, and no limitation is imposed on the detailed representation method. For example, the correspondence between the atomic segment and the original segment can be represented in the form of a linked list.
[0135] In an embodiment of the present disclosure, establishing a correspondence between each of the atomic segments and the original segment may further include:
[0136] When the obtained original segment is the first original segment, establishing a first linked list on the atomic segment, where the first linked list contains all the original segments to which the atomic segment belongs; and / or establishing a second linked list on the original segment, where the second linked list contains all the atomic segments included in the original segment.
[0137] In an embodiment of the present disclosure, establishing a correspondence between each of the atomic segments and the original segment may further include:
[0138] When the obtained original segment is not the first original segment, performing any one or more of the following:
[0139] Creating a second linked list of the new original segment according to all the atomic segments included in the new original segment;
[0140] Updating the second linked list of all the original segments to which the split atomic segments belong;
[0141] Updating the first linked list of the split atomic segments; and,
[0142] Create the first linked list of corresponding atomic number segments according to all the original number segments to which the new atomic number segments obtained after splitting belong.
[0143] In the embodiments of the present disclosure, as Figure 4 shown, based on Figure 4 the original number segments a, b, c, d, e, f, g, h, i, j, k, l, all the corresponding atomic number segments have been obtained after splitting: A, B, C, D, E, F, G, H, I, J. Among them, the correspondence between the original number segments a, b, c, d, e, f, g, h, i, j, k, l and the atomic number segments: A, B, C, D, E, F, G, H, I, J (such as the first linked list and the second linked list) can be shown in Table 3 and Table 4.
[0144] In the embodiments of the present disclosure, as shown in Table 3, the atomic number segments respectively included in the original number segments a, b, c, d, e, f, g, h, i, j, k, l of the service, that is, the second linked list corresponding to each original number segment.
[0145] Table 3
[0146] Segment name of the original number segment start-end Associated atomic number segment (second linked list) a 0-2 A->B b 3-5 C->D c 6-8 E->F d 9-12 G e 13-15 H->I f 16-19 J g 2-4 B->C h 6-7 E i 8-12 F->G j 16-19 J k 0-13 A->B->C->D->E->F->G->H l 3-19 C->D->E->F->G->H->I->J
[0147] In the embodiments of the present disclosure, as shown in Table 4, the original number segments to which the multiple atomic number segments A, B, C, D, E, F, G, H, I, J obtained after splitting belong, that is, the first linked list corresponding to each atomic number segment.
[0148] Table 4
[0149] Segment name of the atomic number segment start-end Associated original number segment (first linked list) A 0-1 a->k B 2-2 a->g->k C 3-4 b->g->k->l D 5-5 b->k->l E 6-7 c->h->k->l F 8-8 c->i->k->l G 9-12 d->i->k->l H 13-13 e->k->l I 15-16 e->l J 17-19 f->j->l
[0150] In the embodiments of the present disclosure, as the original number segments increase or decrease, the existing atomic number segments may be split or deleted, and new atomic number segments may be added. Therefore, the linked lists of the original number segments and the atomic number segments can be continuously updated as the original number segments and the atomic number segments change. For detailed embodiments, reference can be made to the subsequent Embodiment 1.
[0151] In the embodiments of the present disclosure, a detailed embodiment of adding a new original number segment is given below to illustrate the solution of the embodiments of the present disclosure.
[0152] Embodiment 1
[0153] In the embodiments of the present disclosure, as Figure 5 shown, assume that a new original number segment m is added, and the starting number and the ending number of the original number segment m are obtained as 1 and 6 respectively. Then the original number segment m is the number segment between 1 and 6.
[0154] According to the starting number 1 and the ending number 6 of the original number segment m, and the numbers (0 - 19) included in the existing atomic number segments, it can be known that there must be an associated relationship between m and the existing atomic number segments. In specific operations, a traversal method can be adopted to traverse the numbers between the starting number 1 and the ending number 6 of the original number segment m to determine the atomic number segment corresponding to each number and the associated relationship between the original number segment and the atomic number segment.
[0155] 1. Locate the atomic number segment A according to m.start, and A.start < m.start, A.end < m.end, indicating that there is an intersection relationship between m and A. Here, m.start is the starting number of m, m.end is the ending number of m, and A.end is the ending number of A.
[0156] 2. Based on the intersection relationship between m and A, A can be split into two parts according to the starting number 1 of m, that is, A = A + A', as Figure 5 shown in Table 5:
[0157] Table 5
[0158] Segment name of the atomic number segment start-end Associated original number segment (first linked list) A 0-0 a->k A' 1-1 a->k->m
[0159] Based on the splitting of the atomic number segment A, create the first linked list of A' and the second linked list of m, and add A' to the second linked list of m, and update the second linked list of all the original number segments described by A:
[0160] As shown in Table 6, A' is added to m:
[0161] Table 6
[0162] Segment name of the original number segment start-end Associated atomic number segment (second linked list) m 1-6 A'
[0163] As shown in Table 7, add the association of the original number segments associated with the original A with A':
[0164] Table 7
[0165] Segment name of the original number segment start-end Associated atomic number segment (second linked list) a 0-2 A->B->A' k 0-13 A->B->C->D->E->F->G->H->A'
[0166] 3. Continue to traverse the numbers after A' to find the atomic number segment B. Based on m.start < B.start, B.end < m.end, B.start refers to the starting number of B, and B.end refers to the ending number of B. Therefore, B is included in m, then directly take B as the atomic number segment included in m and add m to the first linked list of B.
[0167] B is associated with m, as shown in Table 8:
[0168] Table 8
[0169] Segment name of the atomic number segment start-end Associated original number segment (first linked list) B 2-2 a->g->k->m
[0170] Add B to m as shown in Table 9:
[0171] Table 9
[0172] Segment name of the original number segment start-end Associated atomic number segment (second linked list) m 1-6 A'->B
[0173] 4. Continue to traverse the numbers after B and also obtain the atomic number segments C and D contained in m.
[0174] C and D are associated with m as shown in Table 10:
[0175] Table 10
[0176] Segment name of the atomic number segment start-end Associated original number segment (first linked list) C 3-4 b->g->k->l->m D 5-5 b->k->l->m
[0177] Add C and D to m as shown in Table 11:
[0178] Table 11
[0179] Segment name of the original number segment start-end Associated atomic number segment (second linked list) m 1-6 A'->B->C->D
[0180] Since the atomic number segments B, C, and D are not split, the second linked list of the original number segments corresponding to B, C, and D does not need to be adjusted.
[0181] 5. Continue to traverse the numbers after D, find the atomic number segment E, and E.start < m.end & E.end > m.end, where E.start refers to the starting number of E, E.end refers to the ending number of E, and m.end is the end point of this traversal. Based on E.start < m.end & E.end > m.end, it can be determined that m and E have an intersecting relationship, and then the atomic number segment E can be split according to the position of the ending number of m.
[0182] Split E = E + E' as shown in Table 12:
[0183] Table 12
[0184] Segment name of the atomic number segment start-end Associated original number segment (first linked list) E 6-6 c->h->k->l->m E' 7-7 c->h->k->l
[0185] Modify the original number segment m as shown in Table 13:
[0186] Table 13
[0187] Segment name of the original number segment start-end Associated atomic number segment (second linked list) m 1-6 A'->B->C->D->E
[0188] Modify the second linked list of the original number segment to which the atomic number segment E belongs as shown in Table 14:
[0189] Table 14
[0190]
[0191]
[0192] In an embodiment of the present disclosure, after splitting the obtained original number segment into atomic number segments, the method may further include:
[0193] In the case of deleting any one or more existing original number segments, update the corresponding relationship of the atomic number segments corresponding to the deleted existing original number segments.
[0194] In an embodiment of the present disclosure, updating the corresponding relationship of the atomic number segments corresponding to the deleted existing original number segments may include:
[0195] Obtain all the atomic number segments corresponding to any deleted fourth original number segment;
[0196] Delete the fourth original number segment recorded in the first linked list of all the obtained atomic number segments.
[0197] In an embodiment of the present disclosure, a detailed embodiment of deleting an original number segment is given below to illustrate the solution of the embodiment of the present disclosure.
[0198] Embodiment 2
[0199] In an embodiment of the present disclosure, as Figure 4 、 Figure 5 shown, assume that the original number segment k is deleted, and the starting number and ending number of the original number segment k are obtained as 0 and 13 respectively, then the original number segment k is the number segment between 0 and 13.
[0200] 1. Find the position of the original number segment k according to the index, then find the original number segment k, and query the information of the corresponding number segment (such as the information in the second linked list), as shown in Table 15:
[0201] Table 15
[0202] Segment name of the original number segment start-end Associated atomic number segment (second linked list) k 0-13 A->B->C->D->E->F->G->H
[0203] 2. Obtain the information of all the atomic number segments included in k (such as the information in the first linked list), as shown in Table 16:
[0204] Table 16
[0205] Segment name of the atomic number segment start-end Associated original number segment (first linked list) A 0-1 a->k B 2-2 a->g->k C 3-4 b->g->k->l D 5-5 b->k->l E 6-7 c->h->k->l F 8-8 c->i->k->l G 9-12 d->i->k->l H 13-13 e->k->l
[0206] 3. Delete k associated in the first linked list of all the atomic number segments included in k, as shown in Table 17:
[0207] Table 17
[0208]
[0209]
[0210] In an embodiment of the present disclosure, after updating the association relationship of atomic segments associated with existing original segments to be updated and deleted, the method may further include:
[0211] After deleting any one or more original segments recorded in the first linked list of any atomic segment, if the any atomic segment is no longer associated with any original segment, delete the any atomic segment.
[0212] In an embodiment of the present disclosure, if a certain atomic segment is no longer associated with any original segment, then the atomic segment has no meaning of existence. Therefore, in order to save memory, the atomic segment can be deleted.
[0213] In an embodiment of the present disclosure, based on the above solution, atomic segments of any original segment can be obtained, and the association relationship between the atomic segments and the original segments can be maintained according to the addition and deletion of the original segments.
[0214] In an embodiment of the present disclosure, based on the split atomic segments, when querying the home segment of any number, the atomic segment to which the number belongs can be first queried based on the index of the atomic segment, and then all the original segments associated with the atomic segment can be obtained based on the association relationship between the atomic segment and the original segment, so as to obtain the original segment to which the number belongs, that is, all the original segments associated with the atomic segment. A detailed embodiment of the home segment query method is given below.
[0215] Embodiment 3
[0216] In an embodiment of the present disclosure, for example, query the home segment of number 11:
[0217] 1) Locate the atomic segment according to the index on the atomic segment, and directly locate to the G segment (9 - 12) as shown in Figure 4 、 Figure 5 .
[0218] 2) Retrieve the second linked list of atomic segment G, obtain the association relationship of G, so as to directly find out all the associated original segments of G: d, i, k, l, and thus it can be determined that the segments to which 11 belongs are: d, i, k, l.
[0219] In an embodiment of the present disclosure, outputting the original segments d, i, k, l associated with G is the query result.
[0220] In an embodiment of the present disclosure, for the home segment query method of the solution of the embodiment of the present disclosure, as long as the atomic segment is located, the segment to which the number belongs can be directly obtained according to the association relationship, and only one query is required, and the performance is greatly improved compared with the original solution.
[0221] The embodiment of the present disclosure also provides an electronic device 100, such asFigure 6 As shown, the electronic device 100 includes:
[0222] One or more processors 101;
[0223] A memory 102, on which one or more programs are stored. When the one or more programs are executed by the one or more processors 101, the one or more processors 101 implement the method for querying the home number segment;
[0224] One or more input / output I / O interfaces 103, connected between the processor 101 and the memory 102, configured to implement information interaction between the processor 101 and the memory 102.
[0225] Among them, the processor 101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU), etc.; the memory 102 is a device with data storage capabilities, including but not limited to a random access memory (RAM, more specifically such as SDRAM, DDR, etc.), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory (FLASH); the I / O interface (read / write interface) 103 is connected between the processor 101 and the memory 102 and can implement information interaction between the processor 101 and the memory 102, including but not limited to a data bus (Bus), etc.
[0226] In some embodiments, the processor 101, the memory 102, and the I / O interface 103 are interconnected through a bus 104 and further connected to other components of the computing device.
[0227] The embodiments of the present disclosure also provide a computer-readable storage medium 200, such as Figure 7 As shown, a computer program is stored on the computer-readable storage medium 200. When the computer program is executed by a processor, the method for querying the home number segment is implemented.
[0228] Those of ordinary skill in the art can understand that all or some of the functional modules / units disclosed above can be implemented as software, firmware, hardware, and their appropriate combinations.
[0229] In a hardware implementation, the division between the functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, one physical component can have multiple functions, or one function or step can be executed by several physical components in cooperation.
[0230] Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit (CPU), a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-temporary medium) and a communication medium (or temporary medium). As known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH) or other disk storage; read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical disk storage; magnetic cassettes, magnetic tapes, disk storage or other magnetic storage; any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0231] The present disclosure has disclosed example embodiments, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly stated, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.
Claims
1. A method for querying attribution number segments, characterized in that, The method includes: Obtain the number to be queried; Determine the atomic number segment to which the number to be queried belongs according to the index of the preset atomic number segments; the atomic number segments are obtained based on the original number segments, and the atomic number segments are independent of each other; Obtain the original number segment corresponding to the determined atomic number segment as the original number segment to which the number to be queried belongs.
2. The method for querying attribution number segments according to claim 1, wherein Before positioning the number to be queried to the corresponding atomic number segment according to the index of the preset atomic number segments, the method further includes: Split the original number segment into the atomic number segments; Create an index for each of the atomic number segments and establish a corresponding relationship between each of the atomic number segments and the original number segment.
3. The attribution number segment query method according to claim 2, characterized in that, The splitting of the original number segment into the atomic number segments includes: Obtain a new original number segment; Perform atomic number segment splitting on the new original number segment according to the relationship between the new original number segment and the existing atomic number segments.
4. The attribution number segment query method according to claim 3, characterized in that The performing of atomic number segment splitting on the new original number segment according to the relationship between the new original number segment and the existing atomic number segments includes: In the case where there is no existing atomic number segment, or in the case where there is an existing atomic number segment and there is no association relationship between the new original number segment and the existing atomic number segment, regard the new original number segment as a new atomic number segment.
5. The method for querying attribution number segments according to claim 3, characterized in that, The performing of atomic number segment splitting on the new original number segment according to the relationship between the new original number segment and the existing atomic number segments includes: In the case where there is an existing atomic number segment and there is an association relationship between the new original number segment and the existing atomic number segment, perform atomic number segment splitting on the new original number segment according to the association relationship.
6. The attribution number segment query method according to claim 4 or 5, characterized in that In the case where there is an existing atomic number segment, the method further includes: determining whether there is the association relationship between the new original number segment and the existing atomic number segment; The determining whether there is the association relationship between the new original number segment and the existing atomic number segment includes: Obtain the start number and end number of the new original number segment; Determine the positional relationship between the start number and end number of the new original number segment and the numbers included in the existing atomic number segment; Determine whether there is the association relationship between the new original number segment and the existing atomic number segment according to the positional relationship.
7. The method for querying attribution number segments according to claim 5, wherein The association relationship includes any one or more of the following: intersection relationship, inclusion relationship, and equality relationship.
8. The method for querying attribution number segments according to claim 7, wherein, In the case where the association relationship between the new original number segment and any first atomic number segment is the inclusion relationship, the performing of atomic number segment splitting on the new original number segment according to the association relationship includes: If the first atomic number segment is included in the new original number segment, divide the new original number segment according to the positions of the start number and end number of the first atomic number segment within the new original number segment to obtain multiple sub-original number segments, and create an atomic number segment for each of the sub-original number segments respectively to establish the corresponding relationship between the new original number segment and the created atomic number segments.
9. The method for querying attribution number segments according to claim 7, wherein When the association relationship between the new original number segment and any first atomic number segment is the inclusion relationship, the atomic number segment splitting of the new original number segment according to the association relationship includes: If the new original number segment is included in the first atomic number segment, split the first atomic number segment according to the positions of the start number and end number of the new original number segment within the first atomic number segment, so as to establish the corresponding relationship between the atomic number segments obtained after splitting and the new original number segment.
10. The method for querying attribution number segments according to claim 7, wherein When the association relationship between the new original number segment and any second atomic number segment is the intersection relationship, the atomic number segment splitting of the new original number segment according to the association relationship includes: Determine the intersection area between the new original number segment and the second atomic number segment; Split the second atomic number segment according to the start position or end position of the intersection area within the second atomic number segment, so as to establish the corresponding relationship between the atomic number segments obtained after splitting and the new original number segment.
11. The attribution number segment query method according to claim 7, wherein When the association relationship between the new original number segment and any third atomic number segment is the equality relationship, the atomic number segment splitting of the new original number segment according to the association relationship includes: Take the third atomic number segment as the atomic number segment included in the new original number segment, so as to establish the corresponding relationship between the new original number segment and the atomic number segment.
12. The method for querying attribution number segments according to claim 2, wherein, The creation of the index for each of the atomic number segments includes: When the obtained original number segment is the first original number segment, determine the start number and end number of the atomic number segment, and take the corresponding start number and / or end number of the atomic number segment as the index of the atomic number segment.
13. The method for querying attribution number segments according to claim 2, characterized in that, The creation of the index for each of the atomic number segments includes: When the obtained original number segment is not the first original number segment, update the index of the split atomic number segment and create a new index for the newly split atomic number segment.
14. The method for querying attribution number segments according to claim 2, wherein, The establishment of the corresponding relationship between each of the atomic number segments and the original number segment includes: When the obtained original number segment is the first original number segment, determine the atomic number segments included in the original number segment; and / or, determine the original number segment to which the atomic number segment belongs.
15. The method for querying attribution number segments according to claim 2, wherein, The establishment of the corresponding relationship between each of the atomic number segments and the original number segment includes: When the obtained original number segment is not the first original number segment, perform any one or more of the following: Obtain all the atomic number segments included in the new original number segment; Update the atomic number segments included in the existing original number segment; Update all the original number segments to which the split atomic number segment belongs; and, Obtain all the original number segments to which the newly split atomic number segments belong.
16. The method for querying attribution number segments according to claim 2, characterized in that, After splitting the obtained original number segment into atomic number segments, the method further includes: When deleting any one or more existing original number segments, update the corresponding relationship of the atomic number segments corresponding to the deleted existing original number segments.
17. The method for querying attribution number segments according to claim 16, wherein, The update of the corresponding relationship of the atomic number segments corresponding to the deleted existing original number segments includes: Obtain all the atomic number segments corresponding to any of the deleted original number segments; Delete the original segment recorded in the first linked list of all the obtained atomic segments.
18. The method for querying attribution number segments according to claim 17, wherein After updating the correspondence of the atomic segments corresponding to the deleted existing original segments, the method further includes: After deleting any one or more original segments recorded in the first linked list of any atomic segment, when the any atomic segment no longer corresponds to any original segment, delete the any atomic segment.
19. An electronic device, characterized in that, The electronic device includes: One or more processors; A memory storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the attribution segment query method according to any one of claims 1-18; One or more input / output I / O interfaces connected between the processor and the memory and configured to implement information interaction between the processor and the memory.
20. A computer-readable storage medium storing a computer program, which when executed by a processor, implements the attribution segment query method according to any one of claims 1-18.