CN113590856A - Label query method and device, electronic equipment and readable storage medium - Google Patents

Label query method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN113590856A
CN113590856A CN202110909213.6A CN202110909213A CN113590856A CN 113590856 A CN113590856 A CN 113590856A CN 202110909213 A CN202110909213 A CN 202110909213A CN 113590856 A CN113590856 A CN 113590856A
Authority
CN
China
Prior art keywords
query
tag
label
data
row
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110909213.6A
Other languages
Chinese (zh)
Other versions
CN113590856B (en
Inventor
杨丹丹
倪涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202110909213.6A priority Critical patent/CN113590856B/en
Publication of CN113590856A publication Critical patent/CN113590856A/en
Application granted granted Critical
Publication of CN113590856B publication Critical patent/CN113590856B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/53Querying
    • G06F16/535Filtering based on additional data, e.g. user or group profiles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to the field of data processing, and discloses a label query method, which comprises the following steps: converting the rows and columns of the label data table to obtain data of each row in the conversion data table to construct a bitmap, and obtaining corresponding bitmap data; replacing the data of the corresponding row in the conversion data table by using each bitmap data to obtain a compressed data table; identifying the obtained logic relations of all the query tags, and constructing a query formula according to the logic relations; inquiring bitmap data of corresponding rows in the compressed data table by using all the inquiry labels to obtain inquiry label data; replacing the query tag in the query formula with the query tag data, and calculating the replaced query formula to obtain an initial query result; and carrying out binary information reduction on the initial query result to obtain a target query result. The invention also relates to a blockchain technique, and the query tag can be stored in a blockchain node. The invention also provides a label inquiry device, equipment and a medium. The invention can improve the speed of label query.

Description

Label query method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of data processing, and in particular, to a tag query method, an apparatus, an electronic device, and a readable storage medium.
Background
With the development of the economic society, targeted product recommendation is performed for different user groups, so that the purchase cost of the user can be effectively reduced, and the shopping experience of the user is improved;
at present, a user group is divided by different user tags, so in order to distinguish users with different tags, tag query needs to be performed in a database to query users corresponding to the tags.
However, in the current label query method, user data is directly queried in a database through a plurality of label values, and the query speed is slow due to more user data and larger data table.
Disclosure of Invention
The invention provides a label query method, a label query device, electronic equipment and a computer readable storage medium, and mainly aims to improve the practicability of label query.
In order to achieve the above object, the present invention provides a tag query method, including:
acquiring a tag data table, and performing row-column conversion on the tag data table to obtain a conversion data table;
constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data;
replacing the data of the corresponding row in the conversion data table by using the bitmap data of each row label to obtain a compressed data table;
acquiring a tag query request, extracting all query tags in the tag query request, identifying the logic relations of all the query tags, and constructing a query logic formula according to the logic relations;
querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data;
replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result;
and carrying out binary information reduction on the initial query result by using a preset index mapping table to obtain a target query result.
Optionally, the constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line tag bitmap data includes:
counting the number of indexes corresponding to the columns in the conversion data table to obtain the number of the columns;
constructing a blank bitmap according to the number of the columns;
and replacing the bit value of the corresponding position in the blank bitmap with 1 according to the index of the column where the preset label value of each row in the conversion data table is located, so as to obtain the corresponding row label bitmap data.
Optionally, the replacing, by the bitmap data of each line tag, the data of the corresponding line in the conversion data table to obtain a compressed data table, includes:
replacing the data of the corresponding row in the conversion data table with the bitmap data of each row label to obtain an initial compression data table;
and constructing a corresponding row key for each row of the initial compressed data table by using a preset rule to obtain the compressed data table.
Optionally, the querying, by using all the query tags, row tag bitmap data of a corresponding row in the compressed data table to obtain query tag data includes:
constructing a row key corresponding to the query label by using the preset rule to obtain a query row key;
and inquiring the row label bitmap data corresponding to the same row key in the compressed data table according to the inquiry row key to obtain the inquiry label data.
Optionally, the identifying the logical relationship of all the query tags, and constructing a query logical formula according to the logical relationship includes:
acquiring a label category corresponding to each query label, and connecting the query labels of the same label category by using a preset first logical operator to obtain a query label module;
and connecting all the query label modules by using a preset second logical operator to obtain the query logical formula.
Optionally, the calculating the replaced query logic formula to obtain an initial query result includes:
converting the logic operator contained in the replaced query logic formula into a corresponding bit operator to obtain a bit operation formula;
and performing bit operation on the bit operation formula to obtain the initial query result.
Optionally, the performing binary information reduction on the initial query result by using a preset index mapping table to obtain a target query result includes:
inquiring a sign bit corresponding to a preset bit value in the initial inquiry result to obtain a target sign bit;
determining the target sign bit as a query index;
and querying the user information corresponding to the same index in the index mapping table by using the query index to obtain the target query result.
In order to solve the above problem, the present invention further provides a tag query apparatus, including:
the bitmap construction module is used for acquiring a tag data table and performing row-column conversion on the tag data table to obtain a conversion data table; constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data;
the bitmap calculation module is used for acquiring a label query request, extracting all query labels in the label query request, identifying the logic relations of all the query labels, and constructing a query logic formula according to the logic relations; querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data; replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result;
and the data reduction module is used for carrying out binary information reduction on the initial query result by utilizing a preset index mapping table to obtain a target query result.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one computer program; and
and the processor executes the computer program stored in the memory to realize the label inquiry method.
In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the tag query method described above.
Performing row-column conversion on the tag data table to obtain a conversion data table; constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data; replacing the data of the corresponding row in the conversion data table by using the bitmap data of each row label to obtain a compressed data table, and reducing the size of the data table, thereby reducing the storage resource consumption of the data table and improving the query speed of the data table; extracting all query tags in the tag query request, identifying the logical relations of all the query tags, and constructing a query logical formula according to the logical relations; querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data, and converting the users corresponding to the query labels into the row label bitmap data corresponding to the query labels, so that the scale of the query data is reduced, and the query speed is increased; replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result; and carrying out binary information reduction on the initial query result by using a preset index mapping table to obtain a target query result, and converting the process of querying a user in the data table according to the label into binary calculation, so that the calculation process during the query of the data table is accelerated, and the label query speed is improved. Therefore, the label query method, the label query device, the electronic equipment and the readable storage medium provided by the embodiment of the invention improve the label query speed.
Drawings
Fig. 1 is a schematic flowchart of a tag query method according to an embodiment of the present invention;
fig. 2 is an example table of a tag data table in the tag query method according to an embodiment of the present invention;
fig. 3 is an example table of a tag data table after adding indexes in the tag query method according to an embodiment of the present invention;
fig. 4 is a schematic flow chart illustrating a process of obtaining row tag bitmap data in the tag query method according to an embodiment of the present invention;
fig. 5 is a schematic block diagram of a tag query apparatus according to an embodiment of the present invention;
fig. 6 is a schematic internal structural diagram of an electronic device implementing a tag query method according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the invention provides a label query method. The execution subject of the tag query method includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiments of the present application. In other words, the tag query method may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Referring to fig. 1, which is a schematic flow diagram of a tag query method according to an embodiment of the present invention, in an embodiment of the present invention, the tag query method includes:
s1, acquiring a label data table, and performing row-column conversion on the label data table to obtain a conversion data table;
in detail, in the embodiment of the present invention, the tag data table is a data table containing tag values of all tags corresponding to different users or user groups, and includes: a user name and a corresponding label. The tag may be a gender tag, such as a male or a female, or an age tag, such as 90 th or 80 th, or a work type tag, such as "programmer", as shown in fig. 2, and the tag data table includes: user name column, male tab column, 90-post tab column, and programmer tab column.
Further, in order to facilitate adding the index with the same value to the data in the tag data table according to the position sorting of each row in the tag data table in the embodiment of the present invention. For example, the index corresponding to the first row is 1, and the index corresponding to the second row is 2, and referring to fig. 3, the index is added to the tag data table corresponding to fig. 2.
Further, in order to facilitate subsequent data query calculation, it is prevented that the types of the tags are too many and the storage calculation cannot be uniformly performed by using a binary system, and therefore, in the embodiment of the present invention, the tag data table to which the index is added is subjected to row-column conversion, and rows in the tag data table are converted into columns, so as to obtain a conversion data table.
S2, constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data;
in detail, in order to increase the computation amount of data and reduce the data capacity, in the embodiment of the present invention, a bitmap (bitmap) is constructed according to the data of each row in the conversion data table, so as to obtain corresponding row label bitmap data.
Specifically, referring to fig. 4, in the embodiment of the present invention, constructing a bitmap according to data of each line in the conversion data table to obtain corresponding line tag bitmap data includes:
s21, counting the number of indexes corresponding to the columns in the conversion data table to obtain the number of the columns;
s22, constructing a blank bitmap according to the number of the columns;
and S23, replacing the bit value of the corresponding position in the blank bitmap with 1 according to the index of the column where the preset label value of each row in the conversion data table is located, and obtaining the corresponding row label bitmap data.
In detail, in the embodiment of the present invention, the number of columns is the number of columns where the user names in the conversion data table are located, and therefore, the number of columns represents the number of users in the conversion data table, and for example, three user name columns including a user a, a user B, and a user C are common in the conversion data table, since the user name columns are obtained by converting user name rows in a tag data table into columns, each user name row has a corresponding index, and therefore, each user name column has a corresponding index, for example: the number of indices is 3, then the number of columns in the translation data table is 3.
Further, the embodiment of the present invention constructs blank bitmaps with the same dimension according to the number of columns. For example, if the number of columns is 3, then the blank bitmap is 000.
Further, in the embodiment of the present invention, the bit value of the corresponding position in the blank bitmap is replaced with 1 according to the index of the column where the preset tag value of each row in the conversion data table is located, so as to obtain the corresponding row tag bitmap data. Optionally, in the embodiment of the present invention, the tag value in the conversion data table includes: "yes" and "no", and the preset tag value is "yes".
For example, in one embodiment of the present invention, three rows and three columns are shared in the conversion data table, the preset tag value is "yes", the indexes corresponding to the first column, the second column, and the third column are sequentially 1, 2, and 3, the tag values of the first column and the third column in the first row are "no", the tag value of the second column is "yes", and then the corresponding row tag bitmap data is 010; if the label values of the first column and the third column in the second row are yes and the label value of the second column is not yes, the corresponding row label bitmap data is 101; in the first row, the label value of the first column is "yes", the label values of the second column and the third column are "no", and the corresponding row label bitmap data is 100.
S3, replacing the data of the corresponding row in the conversion data table with the bitmap data of each row label to obtain a compressed data table;
in detail, in order to reduce the storage resource consumption of the data table, the embodiment of the present invention replaces the data of the corresponding row in the conversion data table with each row tag bitmap data to obtain an initial compressed data table;
further, in order to facilitate query of the row label bitmap data of each row in the initial compressed data table, a corresponding row key is constructed for each row of the initial compressed data table by using a preset rule to obtain the compressed data table. Such as: the label of the first row in the compressed data table is "male", then the text "male" is converted into a binary character, resulting in a row key 111010100110111 corresponding to the row.
In another embodiment of the present invention, the label category corresponding to each line of labels may also be identified, and the current year, the label category, and the label in each line are combined by using preset characters to obtain the line key corresponding to the line change, where if the label category corresponding to the male label is Gender, and if the current year is 2021, the corresponding line key is 2021-gentr-man.
S4, acquiring a label query request, extracting all query labels in the label query request, identifying the logic relations of all query labels, and constructing a query logic formula according to the logic relations;
in detail, in order to query the tag more quickly in the embodiment of the present invention, it is necessary to know the logical relationship of all query tags in the tag query request. Optionally, the logical relationship in the embodiment of the present invention includes: and/or.
Optionally, in the embodiment of the present invention, identifying the logical relationship of all the query tags includes: and obtaining the label category corresponding to each query label, connecting the query labels of the same label category by using a preset first logical operator to obtain a query label module, wherein the query labels without the same category are directly determined as the query label module, and connecting all the query label modules by using a preset second logical operator to obtain the query logical formula. Optionally, in the embodiment of the present invention, a preset tag category mapping table is used to identify a category corresponding to the query tag, where the tag category mapping table includes data tables of tag categories corresponding to different tags, for example: the label categories corresponding to the "after 90" label and the "after 80" label are all ages. Optionally, in this embodiment of the present invention, the first logical operator is "and", and the second logical operator is "or".
For example: the method comprises the steps that three query labels of ' 90 rear ', ' 80 rear ' and ' programmer ' are shared, the label of ' 90 rear ' and the label of ' 80 rear ' are all age labels, so that a query label module is obtained by connecting the label of ' 90 rear ' and the label of ' 80 rear ', the label category corresponding to the programmer ' is a work category, and the label category is not the same, so that the query label module is independently used as a query label module ' programmer ', and a query logic formula obtained by connecting the query label module ' 90 rear ' or ' 80 rear ' and the query label module ' programmer ' with a sum operator is ' 90 rear ' or ' 80 rear ') and ' programmer '.
Optionally, the query tag in the embodiment of the present invention may be stored in a block link point, and the efficiency of taking the query tag is improved by using the high throughput characteristic of the block link.
S5, querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data;
in detail, in order to query the row label bitmap data of the corresponding row in the compressed data table more quickly, the row key corresponding to the query label is constructed by using the preset rule to obtain a query row key, and the row label bitmap data corresponding to the same row key row in the compressed data table is queried according to the query row key to obtain the query label data.
Furthermore, in the embodiment of the invention, the user corresponding to the query tag is converted into the line tag bitmap data corresponding to the query tag, so that the scale of query data is reduced, and the query speed is increased.
S6, replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result;
for example: the query logic formula is (after "or" 80 "after" 90) and "programmer", the query tag data corresponding to the query tag after "90" is 101, the query tag data corresponding to the query tag after "80" is 010, the query tag data corresponding to the query tag by "programmer" is 110, and then the replaced query logic formula is (101or010) and 110.
Further, because the expression forms of the logical operator and the bit operator are different, in order to perform bit operation on the replaced query logical formula, the embodiment of the present invention converts the logical operator included in the replaced query logical formula into a corresponding bit operator, so as to obtain a bit operation formula, for example: the substituted query logic formula is (101or010) and110, the bit operator corresponding to the and is &, and the bit operator corresponding to the or is |, so the bit operation formula is (101|010) & 110.
Further, in the embodiment of the present invention, bit operation is performed on the bit operation formula to obtain the initial query result. For example: the bit operation formula is (101|010) &110, and the initial query result obtained by performing the bit operation on the bit operation formula is 110.
Further, in the embodiment of the present invention, in order to perform calculation more quickly, the aviator calculation rule engine is used to calculate the substituted query logic formula in the memory in real time.
S7, carrying out binary information reduction on the initial query result by using a preset index mapping table to obtain a target query result;
optionally, in the embodiment of the present invention, the index mapping table is a data table including information of different users and indexes corresponding to the information, where a corresponding relationship between a user and an index is the same as that in the tag data table. Such as: if the index corresponding to the user a in the tag data table is 1, the index corresponding to the information of the user a in the index mapping table is also 1.
In detail, in the embodiment of the present invention, performing information reduction on the initial query result by using a preset index mapping table to obtain a target query result, includes: inquiring a sign bit corresponding to a preset bit value in the initial inquiry result to obtain a target sign bit; and determining the target sign bit as a query index, and querying the user information corresponding to the same index in the index mapping table by using the query index to obtain the target query result. Optionally, in this embodiment of the present invention, the preset bit value is 1. For example: the initial query result is 10000101, and the preset bit value is 1, so that the target sign bits are 1, 6, and 8, and further, 1, 6, and 8 are used as query indexes. And querying the corresponding user information with indexes 1, 6 and 8 in the index mapping table to obtain a target query result.
Further, after obtaining the target query result, the embodiment of the present invention may further send the target query result to a terminal device of a person who initiates the tag query request, where the preset terminal device includes: intelligent terminals such as mobile phones, computers and tablets.
Performing row-column conversion on the tag data table to obtain a conversion data table; constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data; replacing the data of the corresponding row in the conversion data table by using the bitmap data of each row label to obtain a compressed data table, and reducing the size of the data table, thereby reducing the storage resource consumption of the data table and improving the query speed of the data table; extracting all query tags in the tag query request, identifying the logical relations of all the query tags, and constructing a query logical formula according to the logical relations; querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data, and converting the users corresponding to the query labels into the row label bitmap data corresponding to the query labels, so that the scale of the query data is reduced, and the query speed is increased; replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result; and carrying out binary information reduction on the initial query result by using a preset index mapping table to obtain a target query result, and converting the process of querying a user in the data table according to the label into binary calculation, so that the calculation process during the query of the data table is accelerated, and the label query speed is improved.
Fig. 2 is a functional block diagram of the tag inquiry apparatus according to the present invention.
The tag query device 100 of the present invention can be installed in an electronic device. According to the implemented functions, the tag query device may include a bitmap construction module 101, a bitmap calculation module 102, and a data restoration module 103, which may also be referred to as a unit, and refer to a series of computer program segments that can be executed by a processor of an electronic device and can perform fixed functions, and are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the bitmap construction module 101 is configured to obtain a tag data table, and perform row-column conversion on the tag data table to obtain a conversion data table; constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data;
in detail, in the embodiment of the present invention, the tag data table is a data table containing tag values of all tags corresponding to different users or user groups, and includes: a user name and a corresponding label. The tag may be a gender tag, such as a male or a female, or an age tag, such as 90 th or 80 th, or a work type tag, such as "programmer", as shown in fig. 2, and the tag data table includes: user name column, male tab column, 90-post tab column, and programmer tab column.
Further, in order to facilitate adding the data in the tag data table, in the embodiment of the present invention, the bitmap constructing module 101 adds the index with the same value according to the position sorting of each row in the tag data table. For example, the index corresponding to the first row is 1, and the index corresponding to the second row is 2, and referring to fig. 3, the index is added to the tag data table corresponding to fig. 2.
Further, in order to facilitate subsequent data query calculation, it is prevented that the types of the tags are too many and the storage calculation cannot be uniformly performed by using a binary system, and therefore, the bitmap constructing module 101 according to the embodiment of the present invention performs row-column conversion on the tag data table to which the index is added, and converts rows in the tag data table into columns to obtain a conversion data table.
In detail, in order to increase the computation amount of data and reduce the data capacity, the bitmap constructing module 101 according to the embodiment of the present invention constructs a bitmap (bitmap) according to the data of each row in the conversion data table, so as to obtain corresponding row label bitmap data.
Specifically, in the embodiment of the present invention, the constructing a bitmap by the bitmap constructing module 101 according to the data of each line in the conversion data table, to obtain the corresponding line label bitmap data, includes:
counting the number of indexes corresponding to the columns in the conversion data table to obtain the number of the columns;
constructing a blank bitmap according to the number of the columns;
and replacing the bit value of the corresponding position in the blank bitmap with 1 according to the index of the column where the preset label value of each row in the conversion data table is located, so as to obtain the corresponding row label bitmap data.
In detail, in the embodiment of the present invention, the number of columns is the number of columns where the user names in the conversion data table are located, and therefore, the number of columns represents the number of users in the conversion data table, and for example, three user name columns including a user a, a user B, and a user C are common in the conversion data table, since the user name columns are obtained by converting user name rows in a tag data table into columns, each user name row has a corresponding index, and therefore, each user name column has a corresponding index, for example: the number of indices is 3, then the number of columns in the translation data table is 3.
Further, the bitmap constructing module 101 according to the embodiment of the present invention constructs blank bitmaps with the same dimension according to the number of columns. For example, if the number of columns is 3, then the blank bitmap is 000.
Further, in the embodiment of the present invention, the bitmap constructing module 101 replaces the bit value of the corresponding position in the blank bitmap with 1 according to the index of the column where the preset tag value of each row in the conversion data table is located, so as to obtain the corresponding row tag bitmap data. Optionally, in the embodiment of the present invention, the tag value in the conversion data table includes: "yes" and "no", and the preset tag value is "yes".
For example, in one embodiment of the present invention, three rows and three columns are shared in the conversion data table, the preset tag value is "yes", the indexes corresponding to the first column, the second column, and the third column are sequentially 1, 2, and 3, the tag values of the first column and the third column in the first row are "no", the tag value of the second column is "yes", and then the corresponding row tag bitmap data is 010; if the label values of the first column and the third column in the second row are yes and the label value of the second column is not yes, the corresponding row label bitmap data is 101; in the first row, the label value of the first column is "yes", the label values of the second column and the third column are "no", and the corresponding row label bitmap data is 100.
The bitmap calculation module 102 is configured to obtain a tag query request, extract all query tags in the tag query request, identify logical relationships of all query tags, and construct a query logical formula according to the logical relationships; querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data; replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result;
in detail, in order to reduce the storage resource consumption of the data table in the embodiment of the present invention, the bitmap calculation module 102 replaces the data of the corresponding row in the converted data table with each row tag bitmap data to obtain an initial compressed data table;
further, in order to facilitate query of the row label bitmap data of each row in the initial compressed data table, the bitmap calculation module 102 constructs a corresponding row key for each row of the initial compressed data table by using a preset rule to obtain the compressed data table, and optionally, the preset rule in the embodiment of the present invention is to convert a label of each row into a binary character to obtain a row key corresponding to the row. Such as: the label of the first row in the compressed data table is "male", then the text "male" is converted into a binary character, resulting in a row key 111010100110111 corresponding to the row.
In another embodiment of the present invention, the bitmap calculation module 102 may further identify a label category corresponding to each line of labels, and combine the current year, the label category, and the labels in each line by using preset characters to obtain a line key corresponding to the line change, where if the label category corresponding to the male label is Gender, and the current year is 2021, the corresponding line key is 2021-Gender-man.
In detail, in order to query the tag more quickly in the embodiment of the present invention, it is necessary to know the logical relationship of all query tags in the tag query request. Optionally, the logical relationship in the embodiment of the present invention includes: and/or.
Optionally, in this embodiment of the present invention, the bitmap calculation module 102 identifies a logical relationship of all the query tags, including: and obtaining the label category corresponding to each query label, connecting the query labels of the same label category by using a preset first logical operator to obtain a query label module, wherein the query labels without the same category are directly determined as the query label module, and connecting all the query label modules by using a preset second logical operator to obtain the query logical formula. Optionally, in the embodiment of the present invention, a preset tag category mapping table is used to identify a category corresponding to the query tag, where the tag category mapping table includes data tables of tag categories corresponding to different tags, for example: the label categories corresponding to the "after 90" label and the "after 80" label are all ages. Optionally, in this embodiment of the present invention, the first logical operator is "and", and the second logical operator is "or".
For example: the method comprises the steps that three query labels of ' 90 rear ', ' 80 rear ' and ' programmer ' are shared, the label of ' 90 rear ' and the label of ' 80 rear ' are all age labels, so that a query label module is obtained by connecting the label of ' 90 rear ' and the label of ' 80 rear ', the label category corresponding to the programmer ' is a work category, and the label category is not the same, so that the query label module is independently used as a query label module ' programmer ', and a query logic formula obtained by connecting the query label module ' 90 rear ' or ' 80 rear ' and the query label module ' programmer ' with a sum operator is ' 90 rear ' or ' 80 rear ') and ' programmer '.
Optionally, the query tag in the embodiment of the present invention may be stored in a block link point, and the efficiency of taking the query tag is improved by using the high throughput characteristic of the block link.
In detail, in order to query the row label bitmap data of the corresponding row in the compressed data table more quickly, the bitmap calculation module 102 constructs a row key corresponding to the query label by using the preset rule to obtain a query row key, and queries the row label bitmap data corresponding to the same row key row in the compressed data table according to the query row key to obtain the query label data.
Furthermore, in the embodiment of the invention, the user corresponding to the query tag is converted into the line tag bitmap data corresponding to the query tag, so that the scale of query data is reduced, and the query speed is increased.
For example: the query logic formula is (after "or" 80 "after" 90) and "programmer", the query tag data corresponding to the query tag after "90" is 101, the query tag data corresponding to the query tag after "80" is 010, the query tag data corresponding to the query tag by "programmer" is 110, and then the replaced query logic formula is (101or010) and 110.
Further, because the expression forms of the logical operator and the bit operator are different, in order to perform bit operation on the substituted query logical formula, the bitmap calculation module 102 in the embodiment of the present invention converts the logical operator included in the substituted query logical formula into a corresponding bit operator, so as to obtain a bit operation formula, for example: the substituted query logic formula is (101or010) and110, the bit operator corresponding to the and is &, and the bit operator corresponding to the or is |, so the bit operation formula is (101|010) & 110.
Further, the bitmap calculation module 102 in the embodiment of the present invention performs bit operation on the bit operation formula to obtain the initial query result. For example: the bit operation formula is (101|010) &110, and the initial query result obtained by performing the bit operation on the bit operation formula is 110.
Further, in the embodiment of the present invention, in order to perform calculation faster, the bitmap calculation module 102 calculates the substituted query logic formula in the memory in real time by using an ariator calculation rule engine.
The data restoring module 103 is configured to perform binary information restoration on the initial query result by using a preset index mapping table to obtain a target query result.
Optionally, in the embodiment of the present invention, the index mapping table is a data table including information of different users and indexes corresponding to the information, where a corresponding relationship between a user and an index is the same as that in the tag data table. Such as: if the index corresponding to the user a in the tag data table is 1, the index corresponding to the information of the user a in the index mapping table is also 1.
In detail, in the embodiment of the present invention, the performing, by the data restoring module 103, information restoration on the initial query result by using a preset index mapping table to obtain a target query result includes: inquiring a sign bit corresponding to a preset bit value in the initial inquiry result to obtain a target sign bit; and determining the target sign bit as a query index, and querying the user information corresponding to the same index in the index mapping table by using the query index to obtain the target query result. Optionally, in this embodiment of the present invention, the preset bit value is 1. For example: the initial query result is 10000101, and the preset bit value is 1, so that the target sign bits are 1, 6, and 8, and further, 1, 6, and 8 are used as query indexes. And querying the corresponding user information with indexes 1, 6 and 8 in the index mapping table to obtain a target query result.
Further, after obtaining the target query result, the embodiment of the present invention may further send the target query result to a terminal device of a person who initiates the tag query request, where the preset terminal device includes: intelligent terminals such as mobile phones, computers and tablets.
Fig. 5 is a schematic structural diagram of an electronic device implementing the tag query method according to the present invention.
The electronic device may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a tag query program, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as a code of a tag inquiry program, etc., but also to temporarily store data that has been output or will be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (e.g., a tag query program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The communication bus 12 may be a PerIPheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
Fig. 5 shows only an electronic device having components, and those skilled in the art will appreciate that the structure shown in fig. 5 does not constitute a limitation of the electronic device, and may include fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Optionally, the communication interface 13 may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
Optionally, the communication interface 13 may further include a user interface, which may be a Display (Display), an input unit (such as a Keyboard (Keyboard)), and optionally, a standard wired interface, or a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The tag query program stored in the memory 11 of the electronic device is a combination of computer programs, which when executed in the processor 10, can implement:
acquiring a tag data table, and performing row-column conversion on the tag data table to obtain a conversion data table;
constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data;
replacing the data of the corresponding row in the conversion data table by using the bitmap data of each row label to obtain a compressed data table;
acquiring a tag query request, extracting all query tags in the tag query request, identifying the logic relations of all the query tags, and constructing a query logic formula according to the logic relations;
querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data;
replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result;
and carrying out binary information reduction on the initial query result by using a preset index mapping table to obtain a target query result.
Specifically, the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer program, which is not described herein again.
Further, the electronic device integrated module/unit, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. The computer readable medium may be non-volatile or volatile. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
Embodiments of the present invention may also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program may implement:
acquiring a tag data table, and performing row-column conversion on the tag data table to obtain a conversion data table;
constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data;
replacing the data of the corresponding row in the conversion data table by using the bitmap data of each row label to obtain a compressed data table;
acquiring a tag query request, extracting all query tags in the tag query request, identifying the logic relations of all the query tags, and constructing a query logic formula according to the logic relations;
querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data;
replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result;
and carrying out binary information reduction on the initial query result by using a preset index mapping table to obtain a target query result.
Further, the computer usable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method for querying a tag, the method comprising:
acquiring a tag data table, and performing row-column conversion on the tag data table to obtain a conversion data table;
constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data;
replacing the data of the corresponding row in the conversion data table by using the bitmap data of each row label to obtain a compressed data table;
acquiring a tag query request, extracting all query tags in the tag query request, identifying the logic relations of all the query tags, and constructing a query logic formula according to the logic relations;
querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data;
replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result;
and carrying out binary information reduction on the initial query result by using a preset index mapping table to obtain a target query result.
2. The method for querying tags according to claim 1, wherein said constructing a bitmap according to the data of each row in said conversion data table to obtain the corresponding row tag bitmap data comprises:
counting the number of indexes corresponding to the columns in the conversion data table to obtain the number of the columns;
constructing a blank bitmap according to the number of the columns;
and replacing the bit value of the corresponding position in the blank bitmap with 1 according to the index of the column where the preset label value of each row in the conversion data table is located, so as to obtain the corresponding row label bitmap data.
3. The tag lookup method as claimed in claim 1, wherein said replacing data of a corresponding row in said conversion data table with each of said row tag bitmap data to obtain a compressed data table comprises:
replacing the data of the corresponding row in the conversion data table with the bitmap data of each row label to obtain an initial compression data table;
and constructing a corresponding row key for each row of the initial compressed data table by using a preset rule to obtain the compressed data table.
4. The method of claim 3, wherein the querying the row tag bitmap data of the corresponding row in the compressed data table by using all the query tags to obtain the query tag data comprises:
constructing a row key corresponding to the query label by using the preset rule to obtain a query row key;
and inquiring the row label bitmap data corresponding to the same row key in the compressed data table according to the inquiry row key to obtain the inquiry label data.
5. The tag query method of claim 1, wherein said identifying the logical relationship of all the query tags, and constructing a query logical formula according to the logical relationship comprises:
acquiring a label category corresponding to each query label, and connecting the query labels of the same label category by using a preset first logical operator to obtain a query label module;
and connecting all the query label modules by using a preset second logical operator to obtain the query logical formula.
6. The tag query method of claim 1, wherein said computing the substituted query logic formula to obtain an initial query result comprises:
converting the logic operator contained in the replaced query logic formula into a corresponding bit operator to obtain a bit operation formula;
and performing bit operation on the bit operation formula to obtain the initial query result.
7. The tag query method according to any one of claims 1 to 6, wherein the performing binary information reduction on the initial query result by using a preset index mapping table to obtain a target query result includes:
inquiring a sign bit corresponding to a preset bit value in the initial inquiry result to obtain a target sign bit;
determining the target sign bit as a query index;
and querying the user information corresponding to the same index in the index mapping table by using the query index to obtain the target query result.
8. A tag interrogation apparatus, comprising:
the bitmap construction module is used for acquiring a tag data table and performing row-column conversion on the tag data table to obtain a conversion data table; constructing a bitmap according to the data of each line in the conversion data table to obtain corresponding line label bitmap data;
the bitmap calculation module is used for acquiring a label query request, extracting all query labels in the label query request, identifying the logic relations of all the query labels, and constructing a query logic formula according to the logic relations; querying the row label bitmap data of the corresponding row in the compressed data table by using all the query labels to obtain query label data; replacing the corresponding query tag in the query logic formula with the query tag data, and calculating the replaced query logic formula to obtain an initial query result;
and the data reduction module is used for carrying out binary information reduction on the initial query result by utilizing a preset index mapping table to obtain a target query result.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor;
wherein the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the tag query method of any one of claims 1 to 7.
10. A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, implements the tag query method according to any one of claims 1 to 7.
CN202110909213.6A 2021-08-09 2021-08-09 Label query method and device, electronic equipment and readable storage medium Active CN113590856B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110909213.6A CN113590856B (en) 2021-08-09 2021-08-09 Label query method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110909213.6A CN113590856B (en) 2021-08-09 2021-08-09 Label query method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN113590856A true CN113590856A (en) 2021-11-02
CN113590856B CN113590856B (en) 2023-05-23

Family

ID=78256474

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110909213.6A Active CN113590856B (en) 2021-08-09 2021-08-09 Label query method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113590856B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102254012A (en) * 2011-07-19 2011-11-23 北京大学 Graph data storing method and subgraph enquiring method based on external memory
US20170344749A1 (en) * 2016-05-27 2017-11-30 Intel Corporation Methods and apparatus to provide group-based row-level security for big data platforms
CN107704527A (en) * 2017-09-18 2018-02-16 华为技术有限公司 Date storage method, device and storage medium
CN109902100A (en) * 2019-01-31 2019-06-18 平安科技(深圳)有限公司 Report form inquiring method, device and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102254012A (en) * 2011-07-19 2011-11-23 北京大学 Graph data storing method and subgraph enquiring method based on external memory
US20170344749A1 (en) * 2016-05-27 2017-11-30 Intel Corporation Methods and apparatus to provide group-based row-level security for big data platforms
CN107704527A (en) * 2017-09-18 2018-02-16 华为技术有限公司 Date storage method, device and storage medium
CN109902100A (en) * 2019-01-31 2019-06-18 平安科技(深圳)有限公司 Report form inquiring method, device and storage medium

Also Published As

Publication number Publication date
CN113590856B (en) 2023-05-23

Similar Documents

Publication Publication Date Title
CN112052370A (en) Message generation method and device, electronic equipment and computer readable storage medium
CN112418798A (en) Information auditing method and device, electronic equipment and storage medium
CN112528616B (en) Service form generation method and device, electronic equipment and computer storage medium
CN114979120B (en) Data uploading method, device, equipment and storage medium
CN111897831A (en) Service message generation method and device, electronic equipment and storage medium
CN114781832A (en) Course recommendation method and device, electronic equipment and storage medium
CN113868529A (en) Knowledge recommendation method and device, electronic equipment and readable storage medium
CN114185895A (en) Data import and export method and device, electronic equipment and storage medium
CN112949278A (en) Data checking method and device, electronic equipment and readable storage medium
CN112579621A (en) Data display method and device, electronic equipment and computer storage medium
CN113722533B (en) Information pushing method and device, electronic equipment and readable storage medium
CN114491047A (en) Multi-label text classification method and device, electronic equipment and storage medium
CN113505273B (en) Data sorting method, device, equipment and medium based on repeated data screening
CN113868528A (en) Information recommendation method and device, electronic equipment and readable storage medium
CN114708461A (en) Multi-modal learning model-based classification method, device, equipment and storage medium
CN113837631A (en) Employee evaluation method and device, electronic device and readable storage medium
CN112256472A (en) Distributed data calling method and device, electronic equipment and storage medium
CN111985194A (en) Data storage method and device, electronic equipment and storage medium
CN115496166A (en) Multitasking method and device, electronic equipment and storage medium
CN114840388A (en) Data monitoring method and device, electronic equipment and storage medium
CN113590856B (en) Label query method and device, electronic equipment and readable storage medium
CN111930897B (en) Patent retrieval method, device, electronic equipment and computer-readable storage medium
CN114547011A (en) Data extraction method and device, electronic equipment and storage medium
CN113449002A (en) Vehicle recommendation method and device, electronic equipment and storage medium
CN114610854A (en) Intelligent question and answer method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant