CN113590856B - 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
CN113590856B
CN113590856B CN202110909213.6A CN202110909213A CN113590856B CN 113590856 B CN113590856 B CN 113590856B CN 202110909213 A CN202110909213 A CN 202110909213A CN 113590856 B CN113590856 B CN 113590856B
Authority
CN
China
Prior art keywords
query
tag
data
row
label
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.)
Active
Application number
CN202110909213.6A
Other languages
Chinese (zh)
Other versions
CN113590856A (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

Landscapes

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

Abstract

The invention relates to the field of data processing, and discloses a label inquiry method which comprises the following steps: converting the rows and columns of the tag data table to obtain data of each row in the conversion data table, and constructing a bitmap to obtain corresponding bitmap data; replacing data of a corresponding row in the conversion data table by using each bitmap data to obtain a compressed data table; identifying the logic relationship of all the obtained query tags, and constructing a query formula according to the logic relationship; inquiring bitmap data of a corresponding row in the compressed data table by using all inquiry tags to obtain inquiry tag 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 inquiry.

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, a device, an electronic apparatus, and a readable storage medium.
Background
With the development of economy and 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, the user group is divided by different user labels, so that in order to distinguish users with different labels, label inquiry needs to be performed in a database to inquire the users corresponding to the labels.
However, in the current tag query method, user data is directly queried in a database through a plurality of tag values, and the query speed is slow due to the fact that the number of the user data is large and the data table is large.
Disclosure of Invention
The invention provides a tag query method, a tag query device, electronic equipment and a computer readable storage medium, and mainly aims to improve the practicability of tag 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 row in the conversion data table to obtain corresponding row label bitmap data;
Replacing data of a corresponding row in the conversion data table by using each row label bitmap data to obtain a compressed data table;
acquiring a tag query request, extracting all query tags in the tag query request, identifying the logic relationship of all query tags, and constructing a query logic formula according to the logic relationship;
querying row label bitmap data of a 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 performing binary information restoration 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 row in the conversion data table to obtain corresponding row label bitmap data includes:
counting the number of indexes corresponding to columns in the conversion data table to obtain the number of columns;
constructing a blank bitmap according to the column number;
and replacing the bit value of the corresponding position in the blank bitmap with 1 according to the index of the column of the preset label value of each row in the conversion data table to obtain the corresponding row label bitmap data.
Optionally, the 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 includes:
replacing the data of the corresponding row in the conversion data table with the row label bitmap data 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 the row tag bitmap data of the corresponding row in the compressed data table by using all the query tags to obtain query tag data includes:
constructing a row key corresponding to the query tag by utilizing the preset rule to obtain a query row key;
and inquiring 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 constructs a query logic formula according to the logical relationship, including:
obtaining a label class corresponding to each query label, and connecting query labels of the same label class by using a preset first logic operator to obtain a query label module;
And connecting all the query tag modules by using a preset second logic operator to obtain the query logic formula.
Optionally, the calculating the replaced query logic formula to obtain an initial query result includes:
converting a logic operator contained in the replaced query logic formula into a corresponding bit operator to obtain a bit operation formula;
and executing bit operation on the bit operation formula to obtain the initial query result.
Optionally, the performing binary 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;
determining the target sign bit as a query index;
and inquiring user information corresponding to the same index in the index mapping table by using the inquiry index to obtain the target inquiry result.
In order to solve the above problems, 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 row in the conversion data table to obtain corresponding row label bitmap data;
The bitmap calculation module is used for acquiring a tag query request, extracting all query tags in the tag query request, identifying the logic relationship of all the query tags, and constructing a query logic formula according to the logic relationship; querying row label bitmap data of a 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-mentioned problems, the present invention also provides an electronic apparatus including:
a memory storing at least one computer program; a kind of electronic device with high-pressure air-conditioning system
And the processor executes the computer program stored in the memory to realize the label inquiry method.
In order to solve the above-mentioned problems, the present invention also provides a computer-readable storage medium having stored therein at least one computer program that is executed by a processor in an electronic device to implement the tag query method described above.
According to the embodiment of the invention, the label data table is subjected to row-column conversion to obtain a conversion data table; constructing a bitmap according to the data of each row in the conversion data table to obtain corresponding row label bitmap data; the data of the corresponding row in the conversion data table is replaced by the data of each row label bitmap to obtain a compressed data table, so that the size of the data table is reduced, the consumption of storage resources of the data table is reduced, and the query speed of the data table is improved; extracting all query tags in the tag query request, identifying the logic relationship of all query tags, and constructing a query logic formula according to the logic relationship; querying row label bitmap data of corresponding rows in the compressed data table by using all the query labels to obtain query label data, and converting users corresponding to the query labels into row label bitmap data corresponding to the query labels, thereby reducing the scale of the query data and improving the query speed; 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 (3) carrying out binary information restoration on the initial query result by using a preset index mapping table to obtain a target query result, converting the process of querying a user in the data table according to the tag into binary calculation, accelerating the calculation process during the query of the data table, and improving the query speed of the tag. Therefore, the label inquiry method, the label inquiry device, the electronic equipment and the readable storage medium provided by the embodiment of the invention improve the label inquiry speed.
Drawings
Fig. 1 is a flow chart of a tag query method according to an embodiment of the present invention;
FIG. 2 is an exemplary table of a tag data table in a tag query method according to an embodiment of the present invention;
FIG. 3 is an exemplary table of tag data tables after adding an index in the tag query method according to an embodiment of the present invention;
FIG. 4 is a flowchart of obtaining line label bitmap data in a label query method according to an embodiment of the present invention;
fig. 5 is a schematic block diagram of a tag query device according to an embodiment of the present invention;
fig. 6 is a schematic diagram of an internal structure of an electronic device for implementing a tag query method according to an embodiment of the present invention;
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the invention provides a label inquiry method. The execution subject of the tag query method includes, but is not limited to, at least one of a server, a terminal, and the like, which 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 a terminal device or a server device, and the software may be a blockchain platform. The service end 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, a flowchart of a tag query method according to an embodiment of the present invention is shown, where in the embodiment of the present invention, the tag query method includes:
s1, acquiring a tag data table, and performing row-column conversion on the tag 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 tag. The tag may be a gender tag, such as a male or female, an age tag, such as a post 90 or post 80, or a work type tag, such as a "programmer", as shown in fig. 2, and the tag data table includes: a username column, a male tag column, a 90 post tag column, and a programmer tag column.
Further, in order to facilitate the addition of indexes with the same numerical value to the data in the tag data table according to the position ordering of each row in the tag data table. For example, the index corresponding to the first row is 1, the index corresponding to the second row is 2, and referring to fig. 3, the tag data table corresponding to fig. 2 is added with an index.
Further, in order to facilitate subsequent data query calculation, excessive types of labels are prevented, and storage calculation cannot be performed uniformly by using binary, so that the embodiment of the invention performs row-column conversion on the label data table added with the index, converts the rows in the label data table into columns, and obtains a conversion data table.
S2, constructing a bitmap according to the data of each row in the conversion data table to obtain corresponding row label bitmap data;
in detail, in order to increase the operand of data and reduce the capacity of data, the embodiment of the invention constructs a bitmap (bitmap) according to the data of each line in the conversion data table to obtain the corresponding line label bitmap data.
Specifically, referring to fig. 4, in the embodiment of the present invention, a bitmap is constructed according to data of each line in the conversion data table, so as to obtain corresponding line label bitmap data, which includes:
s21, counting the number of indexes corresponding to columns in the conversion data table to obtain the number of columns;
s22, constructing a blank bitmap according to the column number;
s23, replacing bit values of corresponding positions in the blank bitmap with 1 according to indexes of columns where the preset label values of each row in the conversion data table are located, and obtaining 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 are located in the conversion data table, so the number of columns represents the number of users in the conversion data table, for example, there are three user name columns in the conversion data table, namely, user a, user B, and user C, and since the user name columns are obtained by converting user name rows in the 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 indexes is 3, then the number of columns in the conversion data table is 3.
Further, the embodiment of the invention constructs the blank bitmap with the same dimension according to the number of columns. For example, the number of columns is 3, then the blank bitmap is 000.
Further, according to the embodiment of the invention, the bit value of the corresponding position in the blank bitmap is replaced by 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, in the embodiment of the present invention, the tag value in the conversion data table includes: yes, not, the preset tag value is yes.
For example, in one embodiment of the present invention, three rows and three columns are in the conversion data table, the preset label value is "yes", the indexes corresponding to the first column, the second column and the third column are sequentially 1, 2 and 3, the label value of the first column and the third column in the first row is "no", the label value of the second column is "yes", and then the corresponding row label bitmap data is 010; the label values of the first column and the third column in the second row are yes, the label value of the second column is not yes, and then the label bitmap data of the corresponding row 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 not, and then the label bitmap data of the corresponding row is 100.
S3, replacing data of corresponding rows in the conversion data table by using the row label bitmap data to obtain a compressed data table;
in detail, in order to reduce the consumption of storage resources of a data table, the embodiment of the invention replaces the data of the corresponding row in the conversion data table with each row label bitmap data to obtain an initial compression data table;
further, in order to facilitate the query of the line label bitmap data of each line in the initial compressed data table, a preset rule is used to construct a corresponding line key for each line of the initial compressed data table to obtain the compressed data table, and optionally, in the embodiment of the present invention, the preset rule is to convert the label of each line into a binary character to obtain the line key corresponding to the line. Such as: the label of the first row in the compressed data table is "man", then the text "man" is converted into binary characters, and the row key corresponding to the row is obtained 111010100110111.
In another embodiment of the present invention, the label category corresponding to each row of labels may be identified, the current year, the label category, and the labels of each row are combined by using preset characters to obtain the row key corresponding to the line change, for example, if the label category corresponding to the male label is Gender and the current year is 2021, then the corresponding row key is 2021-Gender-man.
S4, acquiring a tag query request, extracting all query tags in the tag query request, identifying logic relations of all query tags, and constructing a query logic formula according to the logic relations;
in detail, in the embodiment of the invention, in order to query the tags more quickly, the logic relationship of all query tags in the tag query request needs to be known. 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: obtaining the label category corresponding to each query label, and connecting query labels of the same label category by using a preset first logic operator to obtain a query label module, wherein no query label of the same category directly determines the query label as the query label module, and connecting all the query label modules by using a preset second logic operator to obtain the query logic formula. Optionally, in the embodiment of the present invention, a preset tag class mapping table is used to identify a class corresponding to the query tag, where the tag class mapping table includes data tables of tag classes corresponding to different tags, such as: the label categories corresponding to the "90-th" label and the "80-th" label are all ages. Optionally, in the embodiment of the present invention, the first logical operator is "sum", and the second logical operator is "or".
For example: the three query tags of 90 post, 80 post and programmer are age tags, so the query tag module is obtained by connecting the 90 post tag with the 80 post tag by or, the corresponding tag category of the programmer is a working category, and the same tag category does not exist, so the query tag module is singly used as a query tag module "programmer", and a query logic formula obtained by connecting the query tag module of 90 post or 80 post with the query tag module of programmer and operator is "90 post or 80 post" and the programmer ".
Optionally, the query tag in the embodiment of the invention can be stored in a blockchain node, and the taking efficiency of the query tag is improved by utilizing the characteristic of high throughput of the blockchain.
S5, querying row label bitmap data of corresponding rows in the compressed data table by using all the query labels to obtain query label data;
in detail, in order to query the line label bitmap data of the corresponding line in the compressed data table more quickly, a line key corresponding to the query label is constructed by utilizing the preset rule to obtain a query line key, and the line label bitmap data corresponding to the same line key line in the compressed data table is queried according to the query line key to obtain the query label data.
Further, in the embodiment of the invention, the user corresponding to the query tag is converted into the row tag bitmap data corresponding to the query tag, so that the scale of the query data is reduced, and the query speed is improved.
S6, replacing the query label data with the corresponding query label in the query logic formula, and calculating the replaced query logic formula to obtain an initial query result;
for example: the query logic formula is ("after 90 or" after 80 ") and the programmer, the query label data corresponding to the query label after 90 is 101, the query label data corresponding to the query label after 80 is 010, the query label data corresponding to the query label after 80 is 110, and then the query logic formula after replacement is (101 or 010) and110.
Further, because the expression forms of the logical operators and the bit operators are different, in order to perform bit operation on the replaced query logical formula, the embodiment of the invention converts the logical operators contained in the replaced query logical formula into the corresponding bit operators to obtain a bit operation formula, for example: the query logic formula after replacement is (101 or 010) and110, and 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 embodiment of the invention executes bit operation on the bit operation formula to obtain the initial query result. For example: the bit operation formula is (101|010) &110, and an initial query result obtained by executing bit operation on the bit operation formula is 110.
Further, in order to perform calculation faster in the embodiment of the present invention, the replaced query logic formula is calculated in real time in the memory by using an averter calculation rule engine.
S7, performing 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 containing information of different users and indexes corresponding to the information, where a correspondence between the users and the indexes is the same as that in the tag data table. Such as: and the index corresponding to the user A in the tag data table is 1, and 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 information reduction is performed on the initial query result by using a preset index mapping table to obtain a target query result, including: 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 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 an 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 inquiring the user information with the corresponding indexes of 1, 6 and 8 in the index mapping table to obtain a target inquiry result.
Further, after the target query result is obtained, the embodiment of the present invention may further send the target query result to a terminal device of the label query request initiator, where the preset terminal device includes: intelligent terminals such as mobile phones, computers, tablets and the like.
According to the embodiment of the invention, the label data table is subjected to row-column conversion to obtain a conversion data table; constructing a bitmap according to the data of each row in the conversion data table to obtain corresponding row label bitmap data; the data of the corresponding row in the conversion data table is replaced by the data of each row label bitmap to obtain a compressed data table, so that the size of the data table is reduced, the consumption of storage resources of the data table is reduced, and the query speed of the data table is improved; extracting all query tags in the tag query request, identifying the logic relationship of all query tags, and constructing a query logic formula according to the logic relationship; querying row label bitmap data of corresponding rows in the compressed data table by using all the query labels to obtain query label data, and converting users corresponding to the query labels into row label bitmap data corresponding to the query labels, thereby reducing the scale of the query data and improving the query speed; 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 (3) carrying out binary information restoration on the initial query result by using a preset index mapping table to obtain a target query result, converting the process of querying a user in the data table according to the tag into binary calculation, accelerating the calculation process during the query of the data table, and improving the query speed of the tag.
As shown in fig. 2, a functional block diagram of the tag inquiry apparatus of the present invention is shown.
The tag inquiry apparatus 100 of the present invention can be installed in an electronic device. Depending on 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 refers to a series of computer program segments capable of being executed by a processor of an electronic device and performing a fixed function, which are stored in a memory of the electronic device.
In the present embodiment, the functions concerning 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 converted data table; constructing a bitmap according to the data of each row in the conversion data table to obtain corresponding row 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 tag. The tag may be a gender tag, such as a male or female, an age tag, such as a post 90 or post 80, or a work type tag, such as a "programmer", as shown in fig. 2, and the tag data table includes: a username column, a male tag column, a 90 post tag column, and a programmer tag column.
Further, in order to facilitate the addition of the same numerical index to the data in the tag data table, the bitmap construction module 101 orders the data according to the position of each row in the tag data table. For example, the index corresponding to the first row is 1, the index corresponding to the second row is 2, and referring to fig. 3, the tag data table corresponding to fig. 2 is added with an index.
Further, in order to facilitate subsequent data query calculation, to prevent excessive types of labels and unable to uniformly utilize binary system to perform storage calculation, the bitmap construction module 101 in the embodiment of the present invention performs row-column conversion on the label data table to which the index is added, and converts rows in the label data table into columns to obtain a conversion data table.
In detail, in order to increase the operand of data and reduce the capacity of data, the bitmap construction module 101 according to the embodiment of the present invention constructs a bitmap (bitmap) according to the data of each line in the conversion data table, so as to obtain the corresponding line label bitmap data.
Specifically, in the embodiment of the present invention, the bitmap construction module 101 constructs a bitmap according to the data of each line in the conversion data table, to obtain corresponding line label bitmap data, including:
Counting the number of indexes corresponding to columns in the conversion data table to obtain the number of columns;
constructing a blank bitmap according to the column number;
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 are located in the conversion data table, so the number of columns represents the number of users in the conversion data table, for example, there are three user name columns in the conversion data table, namely, user a, user B, and user C, and since the user name columns are obtained by converting user name rows in the 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 indexes is 3, then the number of columns in the conversion data table is 3.
Further, the bitmap construction module 101 according to the embodiment of the present invention constructs a blank bitmap with the same dimension according to the number of columns. For example, the number of columns is 3, then the blank bitmap is 000.
Further, according to the embodiment of the present invention, the bitmap construction 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, not, the preset tag value is yes.
For example, in one embodiment of the present invention, three rows and three columns are in the conversion data table, the preset label value is "yes", the indexes corresponding to the first column, the second column and the third column are sequentially 1, 2 and 3, the label value of the first column and the third column in the first row is "no", the label value of the second column is "yes", and then the corresponding row label bitmap data is 010; the label values of the first column and the third column in the second row are yes, the label value of the second column is not yes, and then the label bitmap data of the corresponding row 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 not, and then the label bitmap data of the corresponding row 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 logic formula according to the logical relationships; querying row label bitmap data of a 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 consumption of storage resources of the data table, the bitmap calculation module 102 replaces the data of the corresponding row in the conversion data table with each row of the row label bitmap data to obtain an initial compressed data table;
further, in order to facilitate the query of the line label bitmap data of each line in the initial compressed data table, the bitmap calculation module 102 constructs a corresponding line key for each line of the initial compressed data table by using a preset rule to obtain the compressed data table, and optionally, in the embodiment of the present invention, the preset rule is to convert the label of each line into a binary character to obtain the line key corresponding to the line. Such as: the label of the first row in the compressed data table is "man", then the text "man" is converted into binary characters, and the row key corresponding to the row is obtained 111010100110111.
In another embodiment of the present invention, the bitmap calculation module 102 may further identify a tag class corresponding to each row of tags, and combine the current year, the tag class, and the tags of each row with preset characters to obtain a row key corresponding to the line change, for example, if the tag class corresponding to the male tag is Gender and the current year is 2021, then the corresponding row key is 2021-Gender-man.
In detail, in the embodiment of the invention, in order to query the tags more quickly, the logic relationship of all query tags in the tag query request needs to be known. Optionally, the logical relationship in the embodiment of the present invention includes: and, or.
Optionally, in an embodiment of the present invention, the bitmap computation module 102 identifies logical relationships of all the query tags, including: obtaining the label category corresponding to each query label, and connecting query labels of the same label category by using a preset first logic operator to obtain a query label module, wherein no query label of the same category directly determines the query label as the query label module, and connecting all the query label modules by using a preset second logic operator to obtain the query logic formula. Optionally, in the embodiment of the present invention, a preset tag class mapping table is used to identify a class corresponding to the query tag, where the tag class mapping table includes data tables of tag classes corresponding to different tags, such as: the label categories corresponding to the "90-th" label and the "80-th" label are all ages. Optionally, in the embodiment of the present invention, the first logical operator is "sum", and the second logical operator is "or".
For example: the three query tags of 90 post, 80 post and programmer are age tags, so the query tag module is obtained by connecting the 90 post tag with the 80 post tag by or, the corresponding tag category of the programmer is a working category, and the same tag category does not exist, so the query tag module is singly used as a query tag module "programmer", and a query logic formula obtained by connecting the query tag module of 90 post or 80 post with the query tag module of programmer and operator is "90 post or 80 post" and the programmer ".
Optionally, the query tag in the embodiment of the invention can be stored in a blockchain node, and the taking efficiency of the query tag is improved by utilizing the characteristic of high throughput of the blockchain.
In detail, in order to query the line tag bitmap data of the corresponding line in the compressed data table more quickly, the bitmap calculation module 102 constructs the line key corresponding to the query tag by using the preset rule to obtain a query line key, and queries the line tag bitmap data corresponding to the same line key line in the compressed data table according to the query line key to obtain the query tag data.
Further, in the embodiment of the invention, the user corresponding to the query tag is converted into the row tag bitmap data corresponding to the query tag, so that the scale of the query data is reduced, and the query speed is improved.
For example: the query logic formula is ("after 90 or" after 80 ") and the programmer, the query label data corresponding to the query label after 90 is 101, the query label data corresponding to the query label after 80 is 010, the query label data corresponding to the query label after 80 is 110, and then the query logic formula after replacement is (101 or 010) and110.
Further, because the expression forms of the logical operators and the bit operators are different, in order to perform the bit operation on the replaced query logical formula, the bitmap computation module 102 in the embodiment of the present invention converts the logical operators included in the replaced query logical formula into the corresponding bit operators, so as to obtain a bit operation formula, for example: the query logic formula after replacement is (101 or 010) and110, and 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, the bitmap calculation module 102 performs a bit operation on the bit operation formula to obtain the initial query result. For example: the bit operation formula is (101|010) &110, and an initial query result obtained by executing bit operation on the bit operation formula is 110.
Further, in the embodiment of the present invention, for faster calculation, the bitmap calculation module 102 calculates the replaced query logic formula in real time in the memory by using an averter calculation rule engine.
The data restoring module 103 is configured to restore binary information of the initial query result by using a preset index mapping table, so as to obtain a target query result.
Optionally, in the embodiment of the present invention, the index mapping table is a data table containing information of different users and indexes corresponding to the information, where a correspondence between the users and the indexes is the same as that in the tag data table. Such as: and the index corresponding to the user A in the tag data table is 1, and 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 data restoring module 103 performs information restoration on the initial query result by using a preset index mapping table to obtain a target query result, including: 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 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 an 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 inquiring the user information with the corresponding indexes of 1, 6 and 8 in the index mapping table to obtain a target inquiry result.
Further, after the target query result is obtained, the embodiment of the present invention may further send the target query result to a terminal device of the label query request initiator, where the preset terminal device includes: intelligent terminals such as mobile phones, computers, tablets and the like.
Fig. 5 is a schematic structural diagram of an electronic device for 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 lookup program, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. The memory 11 may in other embodiments also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or 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 for storing application software installed in an electronic device and various data such as codes of a tag inquiry program, etc., but also for temporarily storing data that has been output or is to be output.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device and processes data by running or executing programs or modules (e.g., tag inquiry programs, etc.) stored in the memory 11, and calling data stored in the memory 11.
The communication bus 12 may be a peripheral component interconnect standard (perIPheral component interconnect, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The communication bus 12 is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
Fig. 5 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 5 is not limiting of the electronic device and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power source (such as a battery) for supplying power to the respective components, and preferably, the power source 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 implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device may further include various sensors, bluetooth modules, wi-Fi modules, etc., which are not described herein.
Optionally, the communication interface 13 may comprise a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the electronic device and other electronic devices.
Optionally, the communication interface 13 may further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, 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, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The tag query program stored in the memory 11 of the electronic device is a combination of a plurality of computer programs, which when run 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 row in the conversion data table to obtain corresponding row label bitmap data;
Replacing data of a corresponding row in the conversion data table by using each row label bitmap data to obtain a compressed data table;
acquiring a tag query request, extracting all query tags in the tag query request, identifying the logic relationship of all query tags, and constructing a query logic formula according to the logic relationship;
querying row label bitmap data of a 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 performing binary information restoration on the initial query result by using a preset index mapping table to obtain a target query result.
In particular, the specific implementation method of the processor 10 on the computer program may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
Further, the electronic device integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, 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 the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
Embodiments of the present invention may also provide a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, 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 row in the conversion data table to obtain corresponding row label bitmap data;
replacing data of a corresponding row in the conversion data table by using each row label bitmap data to obtain a compressed data table;
acquiring a tag query request, extracting all query tags in the tag query request, identifying the logic relationship of all query tags, and constructing a query logic formula according to the logic relationship;
querying row label bitmap data of a 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 performing binary information restoration 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 from the use of blockchain nodes, and the like.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
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 characteristics 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 blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (9)

1. A method of tag interrogation, 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 row in the conversion data table to obtain corresponding row label bitmap data;
replacing data of a corresponding row in the conversion data table by using each row label bitmap data to obtain a compressed data table;
acquiring a tag query request, extracting all query tags in the tag query request, identifying the logic relationship of all query tags, and constructing a query logic formula according to the logic relationship;
Querying row label bitmap data of a 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;
binary information reduction is carried out on the initial query result by using a preset index mapping table, and a target query result is obtained;
the identifying the logic relationship of all the query tags, and constructing a query logic formula according to the logic relationship includes: obtaining a label class corresponding to each query label, and connecting query labels of the same label class by using a preset first logic operator to obtain a query label module; and connecting all the query tag modules by using a preset second logic operator to obtain the query logic formula.
2. The tag query method as claimed in claim 1, wherein said constructing a bitmap from the data of each row in said conversion data table to obtain corresponding row tag bitmap data comprises:
counting the number of indexes corresponding to columns in the conversion data table to obtain the number of columns;
Constructing a blank bitmap according to the column number;
and replacing the bit value of the corresponding position in the blank bitmap with 1 according to the index of the column of the preset label value of each row in the conversion data table to obtain the corresponding row label bitmap data.
3. The tag query 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 row label bitmap data 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 tag query method as claimed in claim 3, wherein said querying the row tag bitmap data of the corresponding row in the compressed data table with all the query tags to obtain query tag data comprises:
constructing a row key corresponding to the query tag by utilizing the preset rule to obtain a query row key;
and inquiring row label bitmap data corresponding to the same row key in the compressed data table according to the inquiring row key to obtain the inquiring label data.
5. The tag query method of claim 1, wherein said calculating the replaced query logic formula to obtain an initial query result comprises:
converting a logic operator contained in the replaced query logic formula into a corresponding bit operator to obtain a bit operation formula;
and executing bit operation on the bit operation formula to obtain the initial query result.
6. The tag query method as claimed in any one of claims 1 to 5, wherein the performing binary information reduction on the initial query result 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 inquiring user information corresponding to the same index in the index mapping table by using the inquiry index to obtain the target inquiry result.
7. A tag inquiry 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 row in the conversion data table to obtain corresponding row label bitmap data;
The bitmap calculation module is used for replacing data of a corresponding row in the conversion data table by using the label bitmap data of each row to obtain a compressed data table, acquiring a label inquiry request, extracting all inquiry labels in the label inquiry request, identifying the logic relationship of all inquiry labels, and constructing an inquiry logic formula according to the logic relationship; querying row label bitmap data of a 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;
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;
the identifying the logic relationship of all the query tags, and constructing a query logic formula according to the logic relationship includes: obtaining a label class corresponding to each query label, and connecting query labels of the same label class by using a preset first logic operator to obtain a query label module; and connecting all the query tag modules by using a preset second logic operator to obtain the query logic formula.
8. An electronic device, the electronic device comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor;
wherein the memory stores a computer program 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 6.
9. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the tag query method of any one of claims 1 to 6.
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 CN113590856A (en) 2021-11-02
CN113590856B true 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 (3)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10621370B2 (en) * 2016-05-27 2020-04-14 Intel Corporation Methods and apparatus to provide group-based row-level security for big data platforms

Patent Citations (3)

* 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
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
CN113590856A (en) 2021-11-02

Similar Documents

Publication Publication Date Title
CN112052370A (en) Message generation method and device, electronic equipment and computer readable storage medium
CN112528616B (en) Service form generation method and device, electronic equipment and computer storage medium
CN111897831A (en) Service message generation method and device, electronic equipment and storage medium
CN112418798A (en) Information auditing method and device, electronic equipment and storage medium
CN114979120B (en) Data uploading method, device, equipment and storage medium
CN114491047A (en) Multi-label text classification method and device, electronic equipment and storage medium
CN113868528A (en) Information recommendation method and device, electronic equipment and readable storage medium
CN114781832A (en) Course recommendation method and device, electronic equipment and 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
CN113722533B (en) Information pushing method and device, electronic equipment and readable storage medium
CN113505273B (en) Data sorting method, device, equipment and medium based on repeated data screening
CN113656690B (en) Product recommendation method and device, electronic equipment and readable storage medium
CN112464619B (en) Big data processing method, device and equipment and computer readable storage medium
CN111930897B (en) Patent retrieval method, device, electronic equipment and computer-readable storage medium
CN111985194A (en) Data storage method and device, electronic equipment and storage medium
CN113590856B (en) Label query method and device, electronic equipment and readable storage medium
CN113626605B (en) Information classification method, device, electronic equipment and readable storage medium
CN114840388A (en) Data monitoring method and device, electronic equipment and storage medium
CN114547011A (en) Data extraction method and device, electronic equipment and storage medium
CN114610854A (en) Intelligent question and answer method, device, equipment and storage medium
CN113449002A (en) Vehicle recommendation method and device, electronic equipment and storage medium
CN112328960B (en) Optimization method and device for data operation, electronic equipment and storage medium
CN113360505B (en) Time sequence data-based data processing method and device, electronic equipment and readable storage medium
CN113704616B (en) Information pushing method and device, electronic equipment and readable 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