Authority query method and device of multi-dimensional data
A multi-dimensional data and query method technology, applied in the computer field, can solve the problems of cumbersome query process, low query efficiency, and long time spent in the query process, and achieve the effect of improving the efficiency of authority query
Active Publication Date: 2015-04-15
TENCENT TECH (BEIJING) CO LTD
5 Cites 5 Cited by
AI-Extracted Technical Summary
Problems solved by technology
[0005] Because a large number of hash operations are required to query the permissions of multi-dimensional data through the hash table, the process of querying permissions is cumbersome, especially when the multi-dimensional data to be queried ha...
Method used
The computer-readable storage medium that the embodiment of the present invention provides realizes the permission inquiry of multi-dimensional data by introducing type bitmap and authority index information mechanism, makes whole inquiry process need not complicated function operation, thus adopts hash table compared The method of querying permissions improves the efficiency of querying permissions for multidimensional data.
The graphical user interface provided by the embodiment of the present invention realizes the permission query of multi-dimensional data by introducing the type bitmap and the permission index information mechanism, so that the whole query process does not need complex function calculations, so compared with using the hash table query permission The method improves the efficiency of permission query of multidimensional data.
The method provided by the present embodiment realizes the permission query of multidimensional data by introducing the type bitmap and the permission index information mechanism, so that the whole query process does not need complex function calculations, so compared with the way of using the hash table query permission, The efficiency of permission query for multidimens...
Abstract
The invention discloses an authority query method and device of multi-dimensional data, and belongs to the technical field of computers. The method comprises the following steps: acquiring the multi-dimensional data of which the authority is to be queried; acquiring a type bitmap of the multi-dimensional data according to the data type information of each dimension of data; determining a combined subtype bitmap of the multi-dimensional data according to the type bitmap of the multi-dimensional data and the type bitmap in previously acquired authority index data, and querying authority index information corresponding to the combined subtype bitmap in the authority index information; querying corresponding authority information from the previously acquired authority data according to the authority index information corresponding to the combined subtype bitmap, and determining the authority of the multi-dimensional data according to the queried authority information. By introducing the type bitmap and the authority index information mechanism, the authority query of the multi-dimensional data is realized, so complex functional operation is not required in the entire query process; compared with a mode of querying authority by using a hash table, the authority query efficiency is improved.
Application Domain
Multi-dimensional databasesSpecial data processing applications
Technology Topic
Multiple dimensionData type +3
Image
Examples
- Experimental program(6)
Example Embodiment
[0027] Example one
[0028] The embodiment of the present invention provides a permission query method for multi-dimensional data, see figure 1 , The method flow provided in this embodiment includes:
[0029] 101: Obtain the multidimensional data of the permission to be queried, and each dimension data includes at least corresponding data type information, data length information, and data content information;
[0030] 102: Obtain the type bitmap of the multidimensional data according to the data type information of each dimension data;
[0031] 103: Determine the sub-combination type bitmap of the multi-dimensional data according to the type bitmap of the multidimensional data and the type bitmap in the permission index data obtained in advance, and query the permission corresponding to the sub-combination type bitmap in the permission index data Index information;
[0032] 104: Query corresponding permission information from the pre-acquired permission data according to the permission index information corresponding to the bitmap of the sub-combination type, and determine the permission of the multidimensional data according to the queried permission information.
[0033] The method provided in this embodiment implements multi-dimensional data permissions query by introducing the type bitmap and permission index information mechanism, so that the entire query process does not require complex function calculations. Therefore, compared with the way of querying permissions using a hash table, the multi-dimensional data is improved. Query efficiency of data permissions.
Example Embodiment
[0034] Example two
[0035] In order to improve the efficiency of multi-dimensional data authorization query, combined with the content of the first embodiment, the embodiment of the present invention provides a multi-dimensional data authorization query method, see figure 2 , The method flow provided in this embodiment includes:
[0036] 201: Collect data of each dimension with restricted permissions and corresponding permission information, and store the data of each dimension with restricted permissions and corresponding permission information in order to obtain permission data;
[0037] For this step, the purpose of collecting each dimension data with restricted permissions and the corresponding permission information is to obtain permission data before querying the permissions of the multi-dimensional data, so as to query the permissions corresponding to the multi-dimensional data through the permission data. Among them, the data of each dimension with restricted permissions can be data of any dimension such as one-dimensional data, two-dimensional data, and three-dimensional data with restricted permissions, and the data of each dimension with restricted permissions can be any data with restricted permissions, including But it is not limited to data such as IP addresses, instant messaging numbers, and regional location information with restricted permissions. Each dimension of data with restricted permissions can also correspond to any permission information, including but not limited to permission information with restricted transmission and reception, permission information with restricted answering, and so on. This embodiment does not deal with the specific dimensions and specific dimensions of data with restricted permissions. The content and corresponding permission information are limited.
[0038] When collecting data of various dimensions with restricted permissions, it includes, but is not limited to, collecting data of any dimension with corresponding restricted permissions based on historical records of data of any dimension. In addition, it can also provide data setting options with restricted permissions, and collect data with restricted permissions set by users through this option. Of course, there may be other collection methods, and this embodiment does not limit the specific collection methods.
[0039] For ease of understanding, the process of collecting data of each dimension with restricted permissions and corresponding permission information will be illustrated in detail with specific examples.
[0040] For example, based on the analysis of user data on an instant messaging application, it is found that a user with an instant messaging number of 36089***** has published multiple messages spreading rumors on the instant messaging application platform. In order to maintain the network environment, Determine the instant messaging number 36089***** as the data with restricted authority, and set the authority information corresponding to the instant messaging number 36089***** to prohibit sending messages, and then the instant messaging number 36089**** *The corresponding authority information is recorded in the history record corresponding to the instant messaging number. When collecting various dimensions of data with restricted permissions, you can obtain the historical records corresponding to each instant messaging number, and determine whether each instant messaging number is restricted according to the historical records, then the instant messaging number 36089***** is collected as a historical record Data with restricted permissions.
[0041] Regardless of which method is used to collect data with restricted permissions, in order to facilitate subsequent search, the method provided in this embodiment adopts a sequential storage method to store each dimension data with restricted permissions and corresponding permission information to obtain permission data. Among them, the ordered array is obtained after storing in order. Each array element in the ordered array is arranged in a certain order, which can be arranged in ascending order, or in ascending order. This embodiment does not limit the specific arrangement order. Further, when the method provided in this embodiment stores the collected dimension data with restricted permissions and the corresponding permission information in order, in order to facilitate searching, the method provided in this embodiment also adds a corresponding corresponding to each array stored. The length information. In order to facilitate understanding, each dimension data with restricted permissions and corresponding permission information are stored in order, and the obtained permission data can be as shown in Table 1 below.
[0042] Table 1
[0043] Buffer_Length
[0044] Among them, Buffer_Length, TLV_Buffer and Limits are used as an array element in an ordered array. Buffer_Length is used to identify the length of the data stored in the array element, TLV_Buffer is used to store data with limited permissions, and Limits is used to store data with limited permissions. The permission information of TLV_Buffer uses TLV (Type Length Value) format to store data with restricted permissions. The T field is a type definition, which specifies which type of data the permission is restricted corresponds to. In order to facilitate subsequent queries, the T field is represented by a binary bitmap. The L field defines the length of data with restricted permissions, and can also be represented by a binary bitmap. The V field defines the specific value of the restricted data, and can still be represented by a binary bitmap.
[0045] For example, still taking the specific value of the restricted data as the instant messaging number 36089*****, the corresponding type is 6, and the bitmap corresponding to this type is 0110 as an example, then the restricted data corresponds to The T field is 0110. And because the length of the instant messaging number is uniform, L can be a fixed length, and because the length of the instant messaging number 36089***** is 10 digits, L can be represented by a 4-bit binary bitmap, and is 1010. Regarding the specific value of V, since each digit of the instant messaging number can be represented by a 4-bit binary bitmap, V can be represented by 40 bits, that is, the value of V can be represented as 0011011000010001001**** ****************. Therefore, the restricted data is expressed in TLV format as follows:
[0046] 011010100011011000010001001********************
[0047] Further, in practical applications, the bitmap corresponding to the T field of each data with restricted permissions may be preset. During specific implementation, several data types can be pre-defined, and a bitmap corresponding to each pre-defined data type can be set. Before determining the bitmap corresponding to the T field of each restricted data, first determine which data type each restricted data corresponds to, and use the bitmap corresponding to the predefined data type as the right The binary bitmap corresponding to the T field of the restricted data. The ways to set the bitmap corresponding to each predefined data type include but are not limited to the following four:
[0048] The first setting method: Determine the number of types of pre-defined data types, and express the number of types in binary values, then determine the number of bits occupied by the binary value, and use the number of bits occupied by the binary value as each type The first number of bits occupied by the bitmap corresponding to the predefined data type, each predefined data type is represented by the binary value of the first number of bits, and the bitmap corresponding to each data type is obtained.
[0049] For example, four data types are predefined, the number of data types is 4, the binary value corresponding to the value 4 is 100, and the number of bits occupied by the binary value is 3. Therefore, the number of bits occupied by the binary value is regarded as each The first number of bits occupied by the bitmap corresponding to a predefined data type, that is, the first number of bits is 3, that is, each predefined data type can be performed with a 3-bit binary value Indicates to get the corresponding bitmap. The bitmaps corresponding to the four predefined data types are shown in Table 2 below:
[0050] Table 2
[0051] type of data
[0052] The second setting method: use the number of predefined data types as the second number of bits occupied by the bitmap corresponding to each predefined data type, and each predefined data type corresponds to one bit. The pre-defined data type represents the bitmap corresponding to each pre-defined data type by distinguishing the value on its corresponding bit from the value on other bits.
[0053] Still taking four pre-defined data types as an example, the bitmap corresponding to each pre-defined data type occupies 4 of the second bits, and each of the four pre-defined data types corresponds to 4 bits. For example, the value of the bit corresponding to each predefined data type is 1, and the value of other bits is 0 to indicate the bitmap corresponding to each predefined data type. Then 4 The bitmap corresponding to a predefined data type can be shown in Table 3 below:
[0054] table 3
[0055] type of data
[0056] Taking the value of the bit corresponding to each pre-defined data type as 0, and the value of other bits at 1 to indicate the bitmap corresponding to each pre-defined data type, there are 4 types of pre-defined data The bitmap corresponding to the type can be shown in Table 4 below:
[0057] Table 4
[0058] type of data
[0059] The third setting method: the number of predefined data types minus one is used as the third number of bits occupied by the bitmap corresponding to each predefined data type, and the first predefined data type corresponds to The value of all the bits of the bitmap is the same, each of the other predefined data types corresponds to one bit, and each of the other predefined data types is different from other bits by the value of the corresponding bit The value of represents the bitmap corresponding to each other predefined data type.
[0060] Still taking four pre-defined data types as an example, the bitmap corresponding to each pre-defined data type occupies 3 bits, and the type bitmap corresponding to the first pre-defined data type The values on all the bits of the are the same, and the remaining 2nd to 4th pre-defined data types correspond to one of the 3 bits, and the type bitmap corresponding to the first pre-defined data type For example, the value of all bits is 0. The bitmap corresponding to the four predefined data types can be shown in Table 5 below:
[0061] table 5
[0062] type of data
[0063] Or, taking the first type of pre-defined data type corresponding to all bits of the type bitmap whose value is 1 as an example, the bitmap corresponding to the four pre-defined data types can be as shown in Table 6 below :
[0064] Table 6
[0065] type of data
[0066] It should be noted that the bitmap corresponding to the second to fourth pre-defined data types in Table 5 and Table 6 above, except that the value of the bit corresponding to each pre-defined data type is 1, as an example, The value of the bit corresponding to each pre-defined data type may also be 0, which is not specifically limited in this embodiment, and it is sufficient to ensure that each pre-defined data type corresponds to a different bitmap.
[0067] The fourth setting method: take the number of predefined data types minus one as the third number of bits occupied by the bitmap corresponding to each predefined data type, and the last predefined data type corresponds to The value of all the bits of the bitmap is the same, each of the other predefined data types corresponds to one bit, and each of the other predefined data types is different from other bits by the value of the corresponding bit The value of represents the bitmap corresponding to each other predefined data type.
[0068] Still taking the pre-set 4 data types as an example, the bitmap corresponding to each pre-defined data type occupies 3 bits, and the type bitmap corresponding to the fourth pre-defined data type The value on all bits of the is the same. The first to third predefined data types correspond to one bit, and the value on all the bits of the type bitmap corresponding to the fourth predefined data type is the same. For example, if it is 0, the bitmap corresponding to the four predefined data types can be as shown in Table 7 below:
[0069] Table 7
[0070] type of data
[0071] Or, taking the value of all bits in the type bitmap corresponding to the fourth predefined data type as 1. The bitmap corresponding to the four predefined data types can be as shown in Table 8 below :
[0072] Table 8
[0073] type of data
[0074] It should be noted that the bitmap corresponding to the first to third predefined data types in Table 7 and Table 8 above, except that the value of the bit corresponding to each predefined data type is 1, as an example, The value of the bit corresponding to each pre-defined data type may also be 0, which is not specifically limited in this embodiment, and it is sufficient to ensure that each pre-defined data type corresponds to a different bitmap.
[0075] Regardless of the above method of setting the bitmap corresponding to the pre-defined data type, when determining the T field of each restricted data, you can first determine the type corresponding to the restricted data, and then determine the type It can be single-dimensional or multi-dimensional. If it is determined that the type corresponding to the data with restricted permissions is single-dimensional, you can directly query from the bitmap corresponding to the predefined data type set above. If it is determined that the type corresponding to the data with restricted permissions is multi-dimensional, the bitmap corresponding to each dimension type in the multi-dimensional type can be queried from the bitmap corresponding to the predefined data type set above, and then the queried bitmap The bitmap is connected to obtain the T field of the data with restricted permissions. Among them, when merging, for any of the above setting methods, the bitmaps corresponding to multiple types can be directly connected. For example, if the bitmaps corresponding to the two types of data with restricted permissions are 010 and 100, respectively, the T field of the data with restricted permissions is 010100.
[0076] Optionally, for the above-mentioned second setting method, in addition to the method of directly connecting the bitmaps corresponding to multiple types, if the bitmap corresponding to each predefined data type is used in the above-mentioned second setting method, The value of the above is 1, and the value of other bits is 0 to indicate the bitmap corresponding to each pre-defined data type. After querying the bitmap corresponding to each type of data with restricted permissions, you can Combine the queried bitmaps, and the result of the operation is used as the T field of the data with restricted permissions. Among them, each 1 in the operation result corresponds to a type of data with restricted permissions. For example, data with restricted permissions includes the first data type and the third data type. The bitmap corresponding to the first data type found is 0001, and the bitmap corresponding to the third data type is 0100. After 0001 and 0100 are combined, the result of the operation is 0101. Since 1 in the operation result corresponds to the first and third bits, it means that the type of data with restricted permissions includes the first type of data. And the third data type is the same as the type actually contained in the restricted data.
[0077] Optionally, if the value of the bit corresponding to each pre-defined data type is 0 in the above second setting method, the value of other bits is 1 to indicate the bit corresponding to each pre-defined data type Bitmap, after querying the bitmap corresponding to each type of data with restricted permissions, the queried bitmap can be ANDed, and the result of the operation can be used as the T field of the data with restricted permissions. Among them, each 0 in the operation result corresponds to a type of data with restricted permissions. For example, data with restricted permissions includes the first data type and the third data type. The bitmap corresponding to the first data type found is 1110, and the bitmap corresponding to the third data type is 1011. After performing the AND operation of 1110 and 1011, the result of the operation is 1010. Since the 0 in the operation result corresponds to the first and third bits, it means that the type of data with restricted permissions includes the first data type. And the third data type is the same as the type actually contained in the restricted data.
[0078] In addition to the way to determine the T field of data with restricted permissions, in order to facilitate searching, the data of Buffer_Length and TLV_Buffer in the ordered array can also be expressed in binary. For example, Buffer_Length can use 200 bits, and the length of TLV_Buffer is also 200 bits. Since the Limits item represents the permission information corresponding to each data with limited permissions, and the permission information can have multiple types, including but not limited to the permission to send messages, the permission to receive messages, the permission to add friends, and so on. And because one data with limited permission can also correspond to multiple permission information, in order to facilitate subsequent management of permission information, the data in Limits can also be represented by a binary bitmap. The specific representation methods include but are not limited to two Kind. For example, Limits corresponds to 6 bits, and each bit corresponds to a permission. The specific value can be replaced by 0 and 1. If the value of which bit is 1, it means that the permission corresponding to the bit is limited. For example, the data in TLV_Buffer(1) does not have the authority to send messages, and the authority to send messages corresponds to the third bit in Limits, and the value of the data in Limits on the third bit is 1.
[0079] It should be noted that the length of the restricted data stored in TLV_Buffer can be set as needed, the length of TLV_Buffer in each array element can be the same or different, and the length of the data stored in TLV_Buffer can also be the same or different different. Because the data with restricted permissions is in the TLV format, but the data dimensions and types of each scene are different, the TLV_Buffer in each array element becomes longer, and the processing of variable-length data is more troublesome. If you directly store the variable-length data, Therefore, the current length of each array element needs to be calculated in the subsequent search, which leads to an increase in the complexity of the query. To this end, in order to simplify the subsequent query process and improve the query speed, the method provided in this embodiment uses a fixed-length TLV_Buffer. In other words, the length of the TLV_Buffer in each array element is a fixed length, but the length of the data with restricted permissions stored in the TLV_Buffer in each array element can be the same or different. For example, the length of TLV_Buffer in each array element is 100 bits, TLV_Buffer (1) stores the instant messaging number, and its storage space is occupied by 86 bits; TLV_Buffer (2) stores the IP address and its storage space 96 bits are occupied. It can be seen that although the length of the TLV_Buffer in each array element is 100 bits, the length of the data stored in the TLV_Buffer in each array element may be of unequal length.
[0080] 202: Obtain the type bitmap corresponding to each dimension data with restricted permissions, and determine the authority index information corresponding to each dimension data with restricted permissions, and the authority index information corresponding to each dimension data with restricted permissions and each with restricted permissions The dimension data corresponds to the storage area in the permission data;
[0081] Among them, it can be seen from the above steps that each data with restricted permissions can be stored in TLV format, and the T, L, and V fields can all be represented by binary bits, that is, the type bits corresponding to each dimension data with restricted permissions The bitmap is a string of 0 and 1 codes. Then the permission data constructed in the above step has stored the type bitmap corresponding to the data with limited permissions, then when obtaining the type bitmap corresponding to the data with limited permissions in this step, you can directly start from the above step 201 Query in the permission data obtained in.
[0082] Further, when determining the authority index information corresponding to each dimension data with restricted authority, the authority index information is used to identify the storage location of each dimension data with restricted authority in the authority data, including the start index information and the end of the storage location. Index information, the authority index information corresponding to each dimension data with restricted authority may be the address corresponding to the storage area of each dimension data with restricted authority in the authority data, therefore, the authority index corresponding to each dimension data with restricted authority The information corresponds to the storage area of each dimension data with restricted permissions in the permission data. For example, if the permission data is obtained and stored in the memory, the starting index information in the permission index information corresponding to each dimension data with restricted permission may be the starting storage address of each dimension data with restricted permission in the memory. The end index information in the authority index information corresponding to each dimension data with restricted authority may be the end storage address of each dimension data with restricted authority in the memory.
[0083] 203: Store the type bitmap and the authority index information corresponding to each dimension data with restricted authority in order to obtain authority index data;
[0084] For this step, after sequentially storing the type bitmap and authority index information corresponding to each dimension data with limited authority, the obtained authority index data can be stored in a structure. In order to facilitate subsequent search, in addition to storing type bitmaps and rights index information corresponding to each dimension data with restricted rights, the rights index data can also store index number information to speed up the subsequent search speed. Among them, when storing permission index data in a structure, the first field of the structure can be used to record the current number of indexes, and the following fields are used to store data of various dimensions with restricted permissions in an array. Corresponding type bitmap and authority index information.
[0085] In order to facilitate the understanding of the structure of the authority index data, combined with the above content, take the structure of the authority index data as shown in the following Table 9 as an example:
[0086] Table 9
[0087]
[0088] In Table 9, wUsedNum is the currently existing index number information in the authority index data, which records the number of authority index information stored in the authority index data. dwTypeBitMap(m) represents the type bitmap corresponding to the m-th permission restricted data. dwStartIndex(m) is the start index information in the authority index information of the m-th authority restricted data. dwEndIndex(m) is the end index information in the authority index information of the m-th authority restricted data. Among them, m is a positive integer.
[0089] The location of wUsedNum is the first field of permission index data, and the location of dwTypeBitMap(0), dwStartIndex(0) and dwEndIndex(0) is the second field of permission index data, dwTypeBitMap(1), dwStartIndex(1), and dwEndIndex(1) The position of) is the third field of the authority index data, and the positions of dwTypeBitMap(2), dwStartIndex(2) and dwEndIndex(2) are the fourth field of the authority index data, and so on. The other fields except the first field use an array to store the authority index information and the type bitmap. Each array stores a type bitmap and corresponding authority index information. Taking the type bitmap in the first array as 00001, the corresponding authority index information is the start address 0 and the end address 9 as an example, it means that the storage location of the multidimensional data with the type bitmap of 00001 in the authority data is an array Elements a[0]~a[9]. Of course, the authority index information can also adopt other formats, that is, it can also express the storage location of the multi-dimensional data in the authority data in other ways, such as using the memory addressing method to directly express the location of the multi-dimensional data in the memory. For example, the start address is 0x00000F41 and the end address is 0x00001FFF. In actual operation, the content of the authority index information can be determined according to the storage mode of the multidimensional data in the authority data, which is not specifically limited in this embodiment.
[0090] Further, when using an array to store permission index information and type bitmaps, space can be dynamically allocated according to actual needs, and stored in an array without holes, so that there are no empty elements in the array, and some space can be saved during storage. .
[0091] It should be noted that the permission index data can also be stored in other ways. For example, a class can be constructed, and the specific object of the class is a permission index data. This embodiment does not specifically limit the storage method of the permission index data.
[0092] It should be noted that, in addition, the above process of obtaining permission index data and permission data is not performed every time the method provided in this embodiment is executed, that is, when the above steps 201 to 203 are used to obtain permission index data After obtaining the permission data, if the method provided in this embodiment is executed again, it is only necessary to directly apply the obtained permission index data and permission data.
[0093] 204: Obtain the multidimensional data of the permission to be queried, and each dimension data includes at least corresponding data type information, data length information, and data content information;
[0094] Specifically, this embodiment does not limit the manner of obtaining the multidimensional data of the permission to be queried, and also does not limit the dimensions of the obtained multidimensional data of the permission to be queried. In specific applications, after a user performs an operation through the terminal, the multidimensional data of the permission to be queried can be obtained by collecting information related to the operation.
[0095] For example, if a user sends a message through an instant messaging application, the instant messaging number registered by the user under the instant messaging application and the IP address of the terminal used by the user can be used as the acquired multi-dimensional data of the authority to be queried. Each dimension of data in the multidimensional data for which the permission is to be queried has its own corresponding data type information, data length information, and data content information. The instant messaging number registered by the user is 36980*****, the data type corresponding to the instant messaging number is the first data type, the IP address is 111.123.123.123, and the data type corresponding to the IP address is the second data type. The type bitmap corresponding to the first data type is 001, and the type bitmap corresponding to the second data type is 010, then the multi-dimensional data of the permission to be queried is two-dimensional data, 36980***** is to be queried For the first-dimensional data in the multi-dimensional data of the authority, 111.123.123.123 is used as the second-dimensional data as an example, and the first-dimensional data and the second-dimensional data are respectively converted into binary, then the binary value after the conversion of the first-dimensional data is 00110110100110000000 ********************, the binary value after the second dimension data conversion is 000100010001.000100100011.000100100011.000100100011, then the data type information corresponding to the first dimension data is 001, and the data length The information is 40 bits, expressed in binary as 101000, and the data content information is 00110110100110000000********************. The data type information corresponding to the second two-dimensional data is 010, the data length information is 110011, and the data content information is 000100010001.000100100011.000100100011.000100100011.
[0096] 205: Obtain the type bitmap of the multi-dimensional data according to the data type information of each dimension data;
[0097] Specifically, in this step, when acquiring the type bitmap of the multidimensional data according to the data type information of each dimension data, since the data type information of each dimension data can be represented by the type bitmap corresponding to each dimension data, the The type bitmap can be obtained by connecting the type bitmap corresponding to each dimension data.
[0098] Wherein, if the data type information of each dimension data in this step corresponds to the first setting method in step 201, then the data type information of each dimension data can be directly connected. For example, the multi-dimensional data to be queried is two-dimensional data, corresponding to the instant messaging number and IP address, the data type information corresponding to the instant messaging number is 010, and the data type information corresponding to the IP address is 100, then according to the data of each dimension data The type bitmap of the two-dimensional data obtained by the type information is 010100.
[0099] Optionally, if the data type information of each dimension data in this step corresponds to the second setting method in step 201, in addition to directly connecting the data type information of each dimension data to obtain the type bitmap of the multidimensional data In addition to the method, if in the second setting method in step 201 above, the value of the bit corresponding to each predefined data type is 1, and the value of other bits is 0 to indicate the data type information of each dimension data , In this step, the data type information of each dimension of the multidimensional data can be combined to obtain the type bitmap of the multidimensional data. Among them, each 1 in the operation result corresponds to a data type. Optionally, if in the second setting method in step 201, the value of the bit corresponding to each predefined data type is 0, the value of other bits is 1 to indicate the data type of each dimension data Information, the data type information of each dimension of the multidimensional data can be ANDed to obtain the type bitmap of the multidimensional data. Among them, each 0 in the operation result corresponds to a data type.
[0100] For ease of understanding, the setting mode of the bit corresponding to each pre-defined data type is 1 and the value of other bits is 0 is used for illustration. For example, the multi-dimensional data to be queried for permissions is two-dimensional data, corresponding to the instant messaging number and IP address, the data type information corresponding to the instant messaging number is 001, and the data type information corresponding to the IP address is 010, then according to the data of each dimension data When the type information obtains the type bitmap of the two-dimensional data, 001 and 010 are combined, and the operation result is 011. 011 is the type bitmap of the two-dimensional data. Since 1 in the bitmap of the two-dimensional data type corresponds to the first bit and the second bit, it means that the data type of the multi-dimensional data includes the first data type and the second data type. The data actually contains the same data type.
[0101] 206: Determine the sub-combination type bitmap of the multi-dimensional data according to the type bitmap of the multi-dimensional data and the type bitmap in the permission index data obtained in advance, and query the permission corresponding to the sub-combination type bitmap in the permission index data Index information;
[0102] Specifically, the sub-combination type bitmap of the multi-dimensional data can be determined according to the type bitmap of the multi-dimensional data and the type bitmap in the authority index data obtained in advance. After the sub-combination type bitmap of the multi-dimensional data is determined, Further query the authority index information corresponding to the bitmap of the sub-combination type.
[0103] Among them, the determination of the sub-combination type bitmap of the multidimensional data according to the type bitmap of the multidimensional data and the type bitmap in the pre-acquired authority index data can be performed in the following two ways:
[0104] The first method of determination: Taking a bit with a value of 1 corresponding to a data type as an example, the type bitmap of the multidimensional data and the type bitmap stored in the permission index data are sequentially ANDed. If the result of the calculation is related to the permission If any type of bitmap stored in the index data is the same, then this type of bitmap is used as a sub-combination type bitmap of the multidimensional data.
[0105] For example, take the type bitmap of multidimensional data as 00011 as an example, and the first type bitmap stored in the authority index data is 00010, the second type bitmap is 01001, and so on. Do the AND operation of the type bitmap of the multidimensional data with the type bitmap stored in the authority index data in turn. The result of the AND operation of 00011 and 00010 is 00010. The result of the operation is the same as the first type bitmap 00010. The first type bitmap 00010 stored in the authority index data is a sub-combination type bitmap of the multi-dimensional data.
[0106] The second way of determining: Taking the bit with a value of 0 as an example of a data type, the type bitmap of the multidimensional data and the type bitmap stored in the permission index data are sequentially combined. If the result of the calculation is related to the permission If any type of bitmap stored in the index data is the same, then this type of bitmap is used as a sub-combination type bitmap of the multidimensional data.
[0107] For example, take the type bitmap of multidimensional data as 11100, and the first type bitmap stored in the authority index data is 11101, the second type bitmap is 10110, and so on. Combine the type bitmap of the multidimensional data with the type bitmap stored in the authority index data in turn, and the result of the AND operation of 11100 and 11101 is 11101, which is the same as the first type bitmap 11101, then the description The first type bitmap 11101 stored in the authority index data is a sub-combination type bitmap of the multi-dimensional data.
[0108] Of course, the method of determining the sub-combination type bitmap of the multi-dimensional data according to the type bitmap of the multi-dimensional data and the type bitmap in the pre-acquired authority index data, in addition to the above two determination methods, may also adopt other determination methods. This embodiment does not specifically limit this.
[0109] It should be noted that in the specific implementation process, after determining that a type bitmap in the authority index data is a sub-combination type bitmap of the multi-dimensional data type bitmap, the sub-combination type can be queried in the authority index data The authority index information corresponding to the bitmap is further searched in the authority data according to the authority index information, without determining all the sub-combination type bitmaps of the multi-dimensional data.
[0110] 207: Query corresponding permission information from the permission data obtained in advance according to the permission index information corresponding to the bitmap of the sub-combination type, and determine the permission of the multidimensional data according to the queried permission information;
[0111] Specifically, after the sub-combination type bitmap of the multi-dimensional data is determined in the above steps, the multi-dimensional data is split into sub-combination type data according to the determined data type in the sub-combination type bitmap. According to the permission index information corresponding to the bitmap of the sub-combination type, locate the data storage location with restricted permission in the permission data, and find the data storage location of the restricted data in the permission data that is the same as the data of the split sub-combination type Data with restricted permissions. If the same permission-restricted data as the data of the split sub-combination type is found in the permission data, the permission information corresponding to the found permission-restricted data is queried, and the multi-dimensional data is determined according to the queried permission information Data permissions. If the same permission-restricted data as the data of the split sub-combination type is not found in the permission data, step 206 and step 207 are executed again, according to the type bitmap of the multidimensional data and the permission index obtained in advance The type bitmap in the data determines another sub-combination type bitmap of the multidimensional data, and continues to query the corresponding authority information until all the type bitmaps stored in the authority index data are retrieved.
[0112] Among them, when searching for data with the same permissions as the data of the split sub-combination type in the data storage location with limited permissions in the permission data, since the data in the permission data is stored in an orderly manner, Therefore, the search process can be implemented with a binary search algorithm, thereby improving the search efficiency. Of course, other search algorithms can also be used, which is not specifically limited in this embodiment.
[0113] It should be noted that since the authority index data also stores the current index number information in the authority index data, the type bitmap of the multidimensional data and the type bitmap stored in the authority index data are sequentially combined with During operation or union operation, the number of type bitmaps for AND operation or union operation can be determined according to the currently existing index number information in the authority index data. For example, if the index number information is 6, it can be determined that 6 type bitmaps are stored in the permission index data, and the data of the type bitmap in the second field value and the seventh field in the permission index data can be read sequentially Then, without reading other fields in the permission index data, the query efficiency can be improved.
[0114] Further, after the authority index data and authority data are established through the above steps 201 to 203, the method provided in this embodiment further includes a process of updating the authority index data and the data in the authority data. The specific update process can be in the above steps. The query process from step 204 to step 207 is executed before or after. The time for updating the authority index data and the data in the authority data is not specifically limited in this embodiment. For ease of description, this embodiment only takes the permission index data and the data update process in the permission data after the query process from step 204 to step 207 is performed as an example, and details the permission index data and the data update process in the permission data. Explanation, see step 208 below for details:
[0115] 208: Obtain the data to be updated and update operation information. The data to be updated includes at least corresponding data type information, data length information, and data content information;
[0116] Specifically, this embodiment does not limit the manner of acquiring the data to be updated and the update operation information, and also does not limit the content of the acquired data to be updated and the update operation information. In specific applications, when the user performs an operation through the terminal, the relevant data and operation information of the operation can be collected, the collected relevant data is used as the acquired data to be updated, and the collected operation information is regarded as the acquired Update operation information.
[0117] 209: Determine the type bitmap of the data to be updated according to the data type information of the data to be updated, and query whether the type bitmap of the data to be updated exists in the authority index data;
[0118] Specifically, the data to be updated includes corresponding data type information, and the type bitmap of the data to be updated can be determined according to the data type information. The specific process is explained in detail in step 205 and will not be repeated here. After determining the type bitmap of the data to be updated, you can query all types of bitmaps stored in the authority index data according to the type bitmap of the data to be updated to determine whether there are any type bits of the data to be updated in the authority index data bitmap.
[0119] 210: Update the authority index data and the content in the authority data according to the query result and the update operation information.
[0120] For this step, the authority index data and the content in the authority data are updated according to the query result and update operation information, including but not limited to the following three situations:
[0121] The first case: If the query result is that the type bitmap of the data to be updated does not exist in the authority index data, and the update operation information carries the authority information corresponding to the data to be updated, the data to be updated and the corresponding position are stored in the corresponding position of the authority data The authority information; according to the storage location of the data to be updated and the corresponding authority information, the type bitmap of the data to be updated and the corresponding authority index information are stored in the authority index data.
[0122] In the first case, if the type bitmap of the data to be updated does not exist in the authority index data, it indicates that the update operation at this time is a data update operation, and the update operation information carries the authority information corresponding to the data to be updated. Therefore, it is necessary to create a new space in the permission data to store the data to be updated and the corresponding permission information. Since the data in the permission data is stored in order, the newly opened space can be determined according to the size order of the updated data and other data already stored in the permission data.
[0123] After the authority data is updated and the authority information is updated, the authority index information in the authority index data also needs to be updated. First, you need to add an index item to the authority index data. The type bitmap of the index item is the type bitmap of the data to be updated, and the corresponding authority index information is the data to be updated and the corresponding authority information in the authority data. According to the size relationship between the authority index information and other authority index information in the authority index data, the authority index information is inserted into the corresponding position in the authority index data.
[0124] The second case: if the query result is that there is a bitmap of the type of data to be updated in the authority index data, and the update operation information carries the authority information corresponding to the data to be updated, then query the type bit of the data to be updated in the authority index data The permission index information corresponding to the bitmap; determine the storage area of the permission data corresponding to the queried permission index information, and search the storage area for data with restricted permissions that are consistent with the data to be updated, if the permission consistent with the data to be updated is found For restricted data, according to the authority information corresponding to the data to be updated carried in the update operation information, the authority information corresponding to the data with restricted authority that is found consistent with the data to be updated is updated. If the data with restricted permissions consistent with the data to be updated is not found, insert the data to be updated and the corresponding permission information in the corresponding position of the storage area, and adjust the storage location of other content in the permission data; according to the data to be updated and the corresponding Update the permission index information corresponding to the bitmap of the type of data to be updated in the permission index data, and update the corresponding permission index information in the permission index data according to the storage location of other content in the adjusted permission data .
[0125] In the second case, there is a bitmap of the type of data to be updated in the authority index data, which means that the authority data may contain the same data as the data to be updated. If the permission data contains the same data as the data to be updated, then the permission of the multidimensional data that is the same as the data to be updated in the permission data is updated. If there is no data in the permission data that is the same as the data to be updated, then the data in the permission data is updated at this time. Therefore, there are two situations in the second case, specifically:
[0126] The first scenario: update the permissions of the multidimensional data in the permission data that is the same as the data to be updated; specifically, after finding the multidimensional data in the permission data that is the same as the data to be updated, according to the data to be updated carried in the update operation information The corresponding authority information updates the found authority information corresponding to the data with limited authority that is consistent with the data to be updated.
[0127] Wherein, updating the authority information may be adding at least one restricted authority or reducing at least one restricted authority. This embodiment does not specifically limit the content of the authority information corresponding to the data to be updated carried in the update operation information. The specific update method of the permission information can be determined according to the expression method of the permission information. This embodiment does not specifically limit the update method of the permission information. The expression method of the permission information has been explained in detail in step 202 above, and will not be repeated here. .
[0128] The second scenario: update the data in the permission data. Specifically, insert the data to be updated and the corresponding permission information in the corresponding position of the storage area, and adjust the storage location of other content in the permission data; update the data to be updated in the permission index data according to the storage location of the data to be updated and the corresponding permission information The type bitmap corresponds to the authority index information, and the corresponding authority index information in the authority index data is updated according to the storage location of other content in the adjusted authority data.
[0129] During specific implementation, first insert the data to be updated and the corresponding authority information in the corresponding position of the storage area. Among them, the following methods can be used to determine the position where the data to be updated and the corresponding permission information are inserted:
[0130] The data with restricted permissions in the storage area and the corresponding permission information are stored in binary when they are stored, and the two are connected together to form a string of binary 0 and 1 codes, which represent a specific value. By analogy, each pair of permission-restricted data and corresponding permission information corresponding to a type of bitmap in the permission data corresponds to a specific value, which is sorted according to the size of each value to form an ordered sequence . The data to be updated and the corresponding authority information also correspond to a binary value, and a binary search is used in the sorted sequence according to the value to determine the position where the data to be updated and the corresponding authority information are inserted. Of course, other methods may also be used to determine the position where the data to be updated and the corresponding authority information are inserted, which is not specifically limited in this embodiment.
[0131] Since new data with restricted permissions and corresponding permission information are inserted, the data to be updated and the corresponding permission information insertion location behind the permission-restricted data and the storage location of the corresponding permission information will all change. Actually adjust the storage location of other content in the permission data. At the same time, because the storage location of other content in the permission data has changed, it is necessary to update the corresponding permission index information in the permission index data according to the storage location of the other content in the adjusted permission data.
[0132] In view of the second situation above, after updating the found permission information corresponding to the data with limited permissions that is consistent with the data to be updated according to the permission information corresponding to the data to be updated carried in the update operation information, it further includes:
[0133] If the updated authority information indicates that the authority data that is consistent with the data to be updated is not restricted, the authority data that is consistent with the data to be updated and the corresponding authority information are deleted from the authority data and adjusted The storage location of other content in the permission data;
[0134] Delete the permission index information corresponding to the permission restricted data that is consistent with the data to be updated in the permission data from the permission index data, and index the corresponding permission in the permission index data according to the storage location of other content in the adjusted permission data Information is updated.
[0135] Specifically, when performing an operation to update the authority information, if the update operation is to reduce at least one restricted authority, when all the restricted authority of the data with restricted authority is eliminated, the data with restricted authority is Without any restricted authority, the data with restricted authority has no meaning to be stored in the authority data at this time, so the data with restricted authority needs to be deleted from the authority data. After deleting the data with restricted permissions and the corresponding permission information that are consistent with the data to be updated from the permission data, the storage locations of the data with restricted permissions and other content following the corresponding permission information need to be moved forward. Among them, other content refers to other data with restricted permissions and corresponding permission information, and the storage location of other content in the permission data needs to be adjusted.
[0136] Since the storage location of the permission data and other permission-restricted data and the corresponding permission information has changed, it is necessary to update the corresponding permission index information in the permission index data according to the storage location of other content in the adjusted permission data.
[0137] The third case: if the query result is that the type bitmap of the data to be updated exists in the authority index data, and the update operation information carries a delete instruction, then query the authority index data for the authority corresponding to the type bitmap of the data to be updated Index information; determine the storage area of the permission data corresponding to the queried permission index information, and search the storage area for data with restricted permissions that are consistent with the data to be updated. If you find data with restricted permissions that are consistent with the data to be updated, According to the delete instruction carried in the update operation information, delete the permission-limited data consistent with the data to be updated and the corresponding permission information from the permission data, and adjust the storage location of other content in the permission data; update the permission index data to be updated The authority index information corresponding to the bitmap of the data type bitmap, and the corresponding authority index information in the authority index data is updated according to the storage location of other content in the adjusted authority data.
[0138] Among them, when adjusting the storage location of other content in the permission data, the other content refers to other restricted data and corresponding permission information, which can be adjusted according to the specific storage method of the restricted data in the permission data. For example, when the data with restricted permissions and the corresponding permission information in the permission data are stored in an array, after deleting a data with restricted permissions and the corresponding permission information, it is necessary to move other subsequent content forward by one storage location. In this way, the storage location of the subsequent permission-restricted data and the corresponding permission information will be changed. Therefore, the corresponding permission index information in the permission index data needs to be updated according to the storage location of other content in the adjusted permission data.
[0139] If in the process of deleting data, all data with restricted permissions corresponding to a type of bitmap in the permission data is deleted, in addition to adjusting the storage location of other content in the permission data caused by deleting the data, Delete the permission index item corresponding to the bitmap of this type in the permission index data. After deleting a permission index item, the subsequent permission index items need to be moved forward, so that the storage location of the updated permission index information needs to be readjusted.
[0140] The method provided in this embodiment implements multi-dimensional data permissions query by introducing the type bitmap and permission index information mechanism, so that the entire query process does not require complex function calculations. Therefore, compared with the way of querying permissions using a hash table, the multi-dimensional data is improved. Query efficiency of data permissions.
Example Embodiment
[0141] Example three
[0142] The embodiment of the present invention provides a permission query device for multi-dimensional data, see image 3 , The device includes:
[0143] The first obtaining module 301 is used to obtain multidimensional data of the permission to be queried, and each dimensional data includes at least corresponding data type information, data length information, and data content information;
[0144] The second acquiring module 302 is configured to acquire the type bitmap of the multidimensional data according to the data type information of each dimension data;
[0145] The first determining module 303 is configured to determine the sub-combination type bitmap of the multidimensional data according to the type bitmap of the multidimensional data and the type bitmap in the permission index data obtained in advance;
[0146] The first query module 304 is configured to query the permission index information corresponding to the sub-combination type bitmap in the permission index data;
[0147] The second query module 305 is configured to query the corresponding permission information from the permission data obtained in advance according to the permission index information corresponding to the bitmap of the sub-combination type;
[0148] The second determining module 306 is configured to determine the authority of the multidimensional data according to the inquired authority information.
[0149] As a preferred embodiment, the first determining module 303 includes:
[0150] The arithmetic unit is used to sequentially AND or combine the type bitmap of the multi-dimensional data and the type bitmap in the authority index data obtained in advance;
[0151] The determining unit is configured to use any type of bitmap as a sub-combination type bitmap of the multi-dimensional data when the operation result is the same as any type of bitmap in the authority index data.
[0152] As a preferred embodiment, the permission query device for multi-dimensional data further includes:
[0153] The third acquisition module is used to acquire the type bitmap corresponding to each dimension data with restricted permissions;
[0154] The third determining module is used to determine the authority index information corresponding to each dimension data with restricted authority, and the authority index information corresponding to each dimension data with restricted authority corresponds to the storage area of each dimension data with restricted authority in the authority data ;
[0155] The first storage module is used to sequentially store the type bitmap and authority index information corresponding to each dimension data with limited authority to obtain authority index data.
[0156] As a preferred embodiment, the permission query device for multi-dimensional data further includes:
[0157] The collection module is used to collect data of each dimension with restricted permissions and the corresponding permission information;
[0158] The second storage module is used to sequentially store each dimension data with restricted permissions and the corresponding permission information to obtain permission data; among them, each dimension data with restricted permissions is in the storage area in the permission data and in the permission index data. The authority index information corresponding to the limited data of each dimension corresponds.
[0159] As a preferred embodiment, the second query module 305 includes:
[0160] The first determining unit is configured to determine the corresponding storage area in the pre-acquired permission data according to the permission index information corresponding to the bitmap of the sub-combination type;
[0161] The query unit is used to query the data with restricted authority that is consistent with the data corresponding to the bitmap of the sub-combination type in the determined storage area;
[0162] The second determining unit is configured to, when the data with limited permissions that is consistent with the data corresponding to the bitmap of the sub-combination type is queried, use the permission information corresponding to the queried data with limited permissions as the queried permission information .
[0163] As a preferred embodiment, the permission query device for multi-dimensional data further includes:
[0164] The fourth acquiring module is used to acquire the data to be updated and the update operation information, and the data to be updated includes at least corresponding data type information, data length information and data content information;
[0165] The third query module is used to determine the type bitmap of the data to be updated according to the data type information of the data to be updated, and to query whether the type bitmap of the data to be updated exists in the authority index data;
[0166] The update module is used to update the authority index data and the content in the authority data according to the query result and update operation information.
[0167] As a preferred embodiment, the update module includes:
[0168] The first storage unit is used to store the data to be updated in the corresponding position of the permission data when the query result is that the type bitmap of the data to be updated does not exist in the permission index data, and the update operation information carries permission information corresponding to the data to be updated And the corresponding authority information;
[0169] The second storage unit is configured to store the type bitmap of the data to be updated and the corresponding authority index information in the authority index data according to the storage location of the data to be updated and the corresponding authority information.
[0170] As a preferred embodiment, the update module includes:
[0171] The first query unit is used to query the permission index data for the data to be updated when the query result is that the type bitmap of the data to be updated exists in the permission index data, and the update operation information carries permission information corresponding to the data to be updated. Authority index information corresponding to the type bitmap;
[0172] The second query unit is used to determine the storage area of the permission data corresponding to the queried permission index information, and search the storage area for data with restricted permissions consistent with the data to be updated;
[0173] The first update unit is used to update the found data that is consistent with the data to be updated and the data to be updated is consistent with the data to be updated according to the permission information corresponding to the data to be updated when the data with restricted permissions is found. Permission information corresponding to the data.
[0174] As a preferred embodiment, the update module further includes:
[0175] The inserting unit is used to insert the data to be updated and the corresponding permission information in the corresponding position of the storage area when the data with restricted permissions that is consistent with the data to be updated is not found;
[0176] The first adjustment unit is used to adjust the storage location of other content in the permission data;
[0177] The second update unit is used to update the permission index information corresponding to the bitmap of the type of the data to be updated in the permission index data according to the storage location of the data to be updated and the corresponding permission information, and to store other content according to the adjusted permission data The location updates the corresponding authority index information in the authority index data.
[0178] As a preferred embodiment, the update module further includes:
[0179] The first deleting unit is used for deleting the data with restricted permissions consistent with the data to be updated and the data with restricted permissions consistent with the data to be updated from the permission data when the updated permission information indicates that the data with restricted permissions consistent with the data to be updated is not restricted. Corresponding authority information;
[0180] The second adjustment unit is used to adjust the storage location of other content in the permission data;
[0181] The second deletion unit is used to delete the authority index information corresponding to the authority restricted data consistent with the data to be updated in the authority data from the authority index data;
[0182] The third adjustment unit is configured to update the corresponding authority index information in the authority index data according to the storage location of other content in the adjusted authority data.
[0183] As a preferred embodiment, the update module includes:
[0184] The third query unit is used to query the permission index data for the type bitmap corresponding to the data to be updated when the query result is that the type bitmap of the data to be updated exists in the permission index data, and the update operation information carries a delete instruction Permission index information;
[0185] The fourth query unit is used to determine the storage area of the permission data corresponding to the queried permission index information, and search the storage area for data with restricted permissions that are consistent with the data to be updated;
[0186] The third deleting unit is used to delete the data with restricted permissions that are consistent with the data to be updated and the corresponding data according to the delete instruction carried in the update operation information when the data with restricted permissions that is consistent with the data to be updated is found Permission information;
[0187] The fourth adjustment unit is used to adjust the storage location of other content in the permission data;
[0188] The third update unit is used to update the authority index information corresponding to the type bitmap of the data to be updated in the authority index data, and perform the corresponding authority index information in the authority index data according to the storage location of other content in the adjusted authority data Update.
[0189] The device provided in this embodiment implements multi-dimensional data permissions query by introducing the type bitmap and permission index information mechanism, so that the entire query process does not require complex function calculations. Therefore, compared with the method of querying permissions using a hash table, the multi-dimensional data is improved. Query efficiency of data permissions.
PUM


Description & Claims & Application Information
We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.