CN116049509A - Data query method, device, equipment and medium based on regular matching - Google Patents

Data query method, device, equipment and medium based on regular matching Download PDF

Info

Publication number
CN116049509A
CN116049509A CN202211563104.4A CN202211563104A CN116049509A CN 116049509 A CN116049509 A CN 116049509A CN 202211563104 A CN202211563104 A CN 202211563104A CN 116049509 A CN116049509 A CN 116049509A
Authority
CN
China
Prior art keywords
hash
data
regular matching
query
hash field
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.)
Pending
Application number
CN202211563104.4A
Other languages
Chinese (zh)
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.)
Shenzhen Proscenic Technology Co Ltd
Original Assignee
Shenzhen Proscenic Technology 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 Shenzhen Proscenic Technology Co Ltd filed Critical Shenzhen Proscenic Technology Co Ltd
Priority to CN202211563104.4A priority Critical patent/CN116049509A/en
Publication of CN116049509A publication Critical patent/CN116049509A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/374Thesaurus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9014Indexing; Data structures therefor; Storage structures hash tables
    • 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 discloses a data query method, device, equipment and medium based on regular matching, wherein the method comprises the following steps: acquiring a query request containing query data; the query data comprises at least one first character string; performing regular matching on all first character strings in the query data according to a preset regular matching rule and a preset association sequence to generate a first hash field with a hash structure; according to the first hash field, inquiring a second hash field matched with the first hash field in a regular matching dictionary of the cache database; and inquiring from the relational database according to the storage code associated with the inquired second hash field to obtain relational data corresponding to the inquired data. The invention improves the speed and efficiency of data query.

Description

Data query method, device, equipment and medium based on regular matching
Technical Field
The present invention relates to the field of data query based on regular matching, and in particular, to a data query method, apparatus, device, and medium based on regular matching.
Background
At present, in order to quickly inquire data required by service execution from mass data, the data is conveniently searched and replaced, the relation between the data is maintained, the data is generally stored in a relational database, the inquiry among multiple tables is carried out through DQL (Data Query Language, data inquiry language), the required data is finally combined, and the result is returned to a client; or the data is stored in a non-relational database (such as NOSQL type database), relevant business data query is performed by using query language of the non-relational database, and the result is returned to the client. The data stored IN the relational database can store many one-to-many or many-to-many relational data because of the requirement of actual business, if the relational data are stored IN a plurality of tables, a great deal of associative query and IN (IN operators are used for judging whether a list or a tuple contains a certain element or not and judging whether a character string contains a certain character string or not) operations are used during query, and the database index cannot be used, so that the query efficiency is low; if the list is stored, the relationship between the data is stored in the form of Json (JavaScript Object Notation) character strings, and the storage structure cannot quickly query the relevant fields. The data stored in the non-relational database (such as NOSQL database) can laterally expand the relational data to store single document due to the special feature of the storage structure, so as to reduce the association operation during query, but the query is slower in terms of range query and fuzzy matching.
Disclosure of Invention
Based on the data query method, the device, the equipment and the medium based on regular matching are provided by the invention, so that the problems of low processing speed, low efficiency and the like of the existing data query method are solved.
A data query method based on canonical matching, comprising:
acquiring a query request containing query data; the query data comprises at least one first character string;
performing regular matching on all first character strings in the query data according to a preset regular matching rule and a preset association sequence to generate a first hash field with a hash structure;
according to the first hash field, inquiring a second hash field matched with the first hash field in a regular matching dictionary of a cache database; the regular matching dictionary is stored with a plurality of groups of structure body arrays, and each group of structure body arrays comprises a second hash field with the preset association sequence and a storage code associated with the second hash field;
and inquiring from a relational database according to the storage code associated with the inquired second hash field to obtain relational data corresponding to the inquired data.
A canonical matching based data query device, comprising:
the condition acquisition module is used for acquiring a query request containing query data; the query data comprises at least one first character string;
the first matching module is used for carrying out regular matching on all first character strings in the query data according to a preset regular matching rule and a preset association sequence to generate a first hash field with a hash structure;
the first query module is used for querying a second hash field matched with the first hash field in a regular matching dictionary of the cache database according to the first hash field; the regular matching dictionary is stored with a plurality of groups of structure body arrays, and each group of structure body arrays comprises a second hash field with the preset association sequence and a storage code associated with the second hash field;
and the second query module is used for querying from a relational database according to the storage code associated with the queried second hash field to obtain relational data corresponding to the query data.
A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the regular matching based data query method described above when the computer program is executed.
A computer readable storage medium storing a computer program which, when executed by a processor, performs the steps of the regular matching based data query method described above.
In the data query method based on regular matching, query data are converted into the first hash field through a preset regular matching rule, the second hash field matched with the first hash field is queried in a regular matching dictionary of a cache database through the first hash field, and finally, the relational data corresponding to the query data are queried from the relational database through storage codes associated with the second hash field. The invention utilizes the preset regular matching rule (high-speed matching) to match with the cache database (high-speed reading and writing), thereby achieving the rapid matching of complex screening conditions and improving the speed and efficiency of data query.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic view of an application environment of a data query method based on canonical matching in an embodiment of the invention;
FIG. 2 is a flow chart of a data query method based on canonical matching in an embodiment of the invention;
FIG. 3 is a flowchart of step S300 of a regular matching-based data query method in an embodiment of the present invention;
FIG. 4 is a schematic diagram of a data query device based on canonical matching in an embodiment of the invention;
FIG. 5 is a further schematic diagram of a regular matching based data query device in accordance with an embodiment of the present invention;
FIG. 6 is a schematic diagram of a computer device in accordance with an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The data query method based on regular matching provided by the application can be applied to an application environment as shown in fig. 1, wherein a client (computer equipment/terminal equipment) communicates with a server (service end) through a network. Clients (computer devices/terminal devices) include, but are not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices. The server may be implemented as a stand-alone server or as a server cluster composed of a plurality of servers.
In one embodiment, as shown in fig. 2, a data query method based on regular matching is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following steps:
s100, acquiring a query request containing query data; the query data comprises at least one first character string. It will be appreciated that the query data is entered by the user via the client and the query request is sent by the client to the server. For example, in a mall system, when a commodity needs to be queried, information such as a name, a type, a number or a specification corresponding to the commodity can be input as a first character string in query data. In addition, taking a timer program as an example, the timer program is used for triggering a timing task at a specified time (the timing task includes query data), a plurality of timing tasks can be set in the timer program, each timing task can be set to create the timing task in a manner of daily, weekly, custom time range (the time range can be regarded as a first character string for limiting the day, the week and the like), and the timing task can be triggered when the specified time setting is reached after the timing task is created.
And S200, performing regular matching on all first character strings in the query data according to a preset regular matching rule and a preset association sequence to generate a first hash field with a hash structure. It will be appreciated that the pre-determined regular matching rules include describing and matching fields to be queried (generated by all first strings in a pre-determined association sequence) using the first hash fields (generated by all first hash strings in a pre-determined association sequence). The preset association sequence is a splicing ordering sequence used when the relational database in the server stores relational data and splices character strings in the relational data.
In an embodiment, the step S200 of performing regular matching on all the first strings in the query data according to a preset regular matching rule and a preset association sequence to generate a first hash field with a hash structure includes:
and acquiring a preset association sequence in the second hash field in the regular matching dictionary, and sequencing all first character strings in the query data according to the preset association sequence to obtain a field to be queried. In an embodiment, the field to be queried is generated by splicing all the first character strings according to a preset association sequence and using preset symbols, wherein the preset symbols include, but are not limited to "_" or "/", and the preset symbols can be spliced according to uniform preset symbols. For example, in the timer procedure described above, the field to be queried is obtained as follows: the timing task is divided into 3 segments (3 first character strings) by using a "_number (preset symbol) according to a time type sequence (i.e. a preset association sequence), specifically, the preset association sequence of the field to be queried of the timing task may be: the number of days of the current time in one year, the number of days of the current time in one week, the number of seconds of the current time in one day, and all the first character strings after the sorting are fields to be queried.
And carrying out regular matching on all the first character strings in the field to be queried according to a preset regular matching rule, and generating first hash character strings corresponding to the first character strings. It is understood that the first hash string refers to a short string (which may consist of one or several characters) extracted or converted from the first string, and the first hash string is used to describe the first string in a short way.
And splicing all the generated first hash character strings according to the preset association sequence to generate a first hash field with a hash structure. It may be appreciated that the first hash field is generated by concatenating at least one first hash string with a predetermined association sequence using a predetermined symbol. The first hash field further comprises preset query conditions corresponding to each first hash character string, and the preset query conditions comprise one of all, equal, inclusion, range or size. It is understood that the number of first hash strings in the first hash field is equal to the number of second hash strings in the second hash field, so that the first hash field can be matched with the second hash field. It can be appreciated that if a corresponding first string does not exist in a certain first hash string in the first hash field (i.e., the string in the position is an empty string) when the first hash string is ordered according to the preset association sequence, the first hash string is recorded as {. For example, in the timer program described above:
if the timing task (i.e. the query data) is "9:00 to 18:00 per day", the first string "the current time is" daily "(the preset query conditions are all) in the field to be queried, and the first hash string corresponding to the first string may be recorded as { x }; the first string in the field to be queried, "the number of days in a week at the current time" is an empty field, and at this time, the first hash string corresponding to the first string may also be denoted as { x }; the first string in the field to be queried is 32400 to 64800 seconds (the preset query condition is the range) in the number of seconds of the current time in one day, and the first hash string corresponding to the first string can be recorded as [32400,64800]; finally, a first hash field corresponding to the field to be queried is generated, namely: day_ { x } _ [32400,64800] (i.e. the first hash field corresponding to the query data).
Similarly, if the timing task (i.e. the query data) is "9:00 to 18:00 of monday and tuesday", the first string "the current time is on the day of the year" in the field to be queried is the null field, and at this time, the first hash string corresponding to the first string may be recorded as { x }; the first character string in the field to be queried, the number of days in the week at the current time, is Monday and Tuesday (the preset query condition is included), and the first hash character string corresponding to the first character string can be recorded as [1|2]; the first character string in the field to be queried, the number of seconds of the current time in one day, is 32400 seconds to 64800 seconds (the range of preset query conditions), and the first hash character string corresponding to the first character string can be recorded as [32400,64800]; finally, a first hash field corresponding to the field to be queried is generated: day_ { x } _ [1|2] _ [32400,64800] (i.e., a first hash field corresponding to the query data);
if the timing task (i.e. the query data) is "2022-06-01,9:00 to 2022-06-10, 18:00", the first string "the current time is on the day of the year" in the field to be queried is 2022-06-01 to 2022-06-10 (the preset query condition is a range), and at this time, the first hash string corresponding to the first string can be recorded as [152,161]; the first character string in the field to be queried, the number of days in a week at the current time, is an empty field, and the first hash character string corresponding to the first character string can be recorded as {; the first character string in the field to be queried, the number of seconds of the current time in one day, is 32400 seconds to 64800 seconds (the range of preset query conditions), and the first hash character string corresponding to the first character string can be recorded as [32400,64800]; finally, a first hash field corresponding to the field to be queried is generated: day_ [152,161] _ { x } _ [32400,64800] (i.e., the first hash field corresponding to the query data described above). S300, according to the first hash field, inquiring a second hash field matched with the first hash field in a regular matching dictionary of a cache database; and at least one group of structure body arrays are stored in the regular matching dictionary, and each group of structure body arrays comprises a second hash field with the preset association sequence and a storage code associated with the second hash field. It is understood that the first hash field and the second hash field are generated according to the specified order of the preset association sequence by using a first hash character string and a second hash character string, respectively, and the number of the first hash character strings in the first hash field is equal to the number of the second hash character strings in the second hash field. The regular matching dictionary is stored with at least one group of structure body arrays, the structure body arrays include, but are not limited to, key-Value (i.e. Key-Value pair) structure body arrays, the Key is a storage code, the Value is a second hash field, that is, the regular matching dictionary includes a second hash field and a storage code associated with the second hash field, and the storage code (Key) associated with the second hash field can be queried in the regular matching dictionary through the second hash field (Value). In an embodiment, the cache database is a REDIS type Key-Value database, and the REDIS type Key-Value database may cache the Key-Value structure array.
In an embodiment, as shown in fig. 3, in step S300, the querying, in a regular matching dictionary of a cache database, a second hash field matching the first hash field according to the first hash field includes:
s310, according to the first hash field, performing regular matching query in a regular matching dictionary of the cache database by using a GET method, and confirming whether a second hash field matched with the first hash field exists in the regular matching dictionary. It may be appreciated that the regular matching dictionary includes HASH-MAP (HASH MAP), that is, a HASH association container that associates Value and Key of an object (e.g., key-Value structure array), the regular matching dictionary is formed by a plurality of the structure arrays, and the regular matching dictionary interface corresponds to the query instruction, that is, the regular matching dictionary may query in the regular matching dictionary according to the query instruction whether there is a second HASH field matching the first HASH field.
S320, when a second hash field matched with the first hash field exists in the regular matching dictionary, recording the storage code associated with the queried second hash field. It will be appreciated that, after confirming that there is a second hash field matching the first hash field, in the regular matching dictionary, the stored code associated with the second hash field may be queried through the second hash field.
In an embodiment, in step S310, after determining whether the second hash field matching the first hash field exists in the regular matching dictionary, the method includes: and when the second hash field matched with the first hash field does not exist in the regular matching dictionary, prompting that no relational data matched with the query request exists in the relational database. It will be appreciated that if there is no second hash field in the regular matching dictionary that matches the first hash field, then it is indicated that there is no stored encoding in the cache database that matches the first hash field, and therefore there is no relational data in the relational database that corresponds to the first hash field (i.e., query data).
S400, according to the storage codes associated with the queried second hash fields, querying from a relational database to obtain relational data corresponding to the query data. In an embodiment, the relational data refers to data having a one-to-one or one-to-many association relationship, for example, in a mall system, commodity data (i.e. relational data) is recorded by a store through a page of the same type form in a management system of a client, and includes, but is not limited to, information such as names, types, numbers, specifications and the like corresponding to commodities. The query data corresponds to the relational data, so that information such as names, types, numbers or specifications corresponding to the commodities can also be input as a first character string in the query data, and specific relational data corresponding to the query data is obtained through query.
According to the regular matching-based data query method provided by the invention, the matching query is not required to be directly carried out from the relational database according to the whole query data, the query data is firstly converted into the first hash field through the preset regular matching rule, the second hash field matched with the first hash field is queried in the regular matching dictionary of the cache database through the first hash field, and finally the relational data corresponding to the query data is queried from the relational database through the storage code associated with the second hash field. According to the invention, the preset regular matching rule (high-speed matching is performed through the short first hash field) is utilized to match with the cache database (high-speed reading and writing are performed in the cache database, and large data query is not required to be directly performed in the relational database), so that the rapid matching of complex screening conditions is achieved, and the speed and efficiency of data query are improved.
In an embodiment, before the obtaining the query request including the query data in step S100, the method further includes:
and acquiring the relation type data to be stored, wherein the relation type data comprises at least one second character string, and all the second character strings in the relation type data have preset association sequences. In an embodiment, for example, in a mall system, commodity data (i.e. relationship data) is input by a store through a page of the same type form in a management system of a client, information such as a name, a type, a number or a specification corresponding to the commodity can be used as a second string in the relationship data, and the preset association sequence can be arranged according to the order of "name_type_number_specification". The relational data is generated by splicing all the second character strings according to a preset association sequence and using preset symbols, wherein the preset symbols comprise but are not limited to "_" or "/", and the second character strings are spliced according to uniform preset symbols. Taking the timer program as an example, when determining whether the current time matches the timing task designated time, the current time may be arranged according to the number of days (first second character string) in which the current time is in one year, the number of days (second character string) in which the current time is in one week, and the number of seconds (third second character string) in which the current time is in one day, where the arrangement order is a preset association sequence, and the field consisting of 3 second character strings may be regarded as one relational data.
And generating a storage code corresponding to the relational data, and storing the storage code and the relational data in a relational database in an associated way. It will be appreciated that the stored code may be a self-growing code in a relational database or may be generated by an open source code generator, as long as the stored code is guaranteed to be globally unique.
And carrying out regular matching on all the second character strings in the relational data according to the preset regular matching rule and the preset association sequence to generate a second hash field with the preset association sequence. It is understood that the predetermined regular matching rule includes describing using second hash fields generated by all second hash strings in a predetermined association sequence and matching relational data generated by all second strings in the predetermined association sequence.
In an embodiment, the performing regular matching on all the second strings in the relational data according to the preset regular matching rule and the preset association sequence to generate a second hash field with the preset association sequence includes:
and carrying out regular matching on all the second character strings in the relational data according to the preset regular matching rule, and generating second hash character strings corresponding to the second character strings. It will be appreciated that the second hash string is a single string (i.e., a short string) that describes and matches the second string (i.e., a complex string).
And splicing all the generated second hash character strings according to the preset association sequence to generate a second hash field with a hash structure. It is understood that the second hash field is generated by splicing at least one second hash character string according to a preset association sequence by using a preset symbol. For example, in the above embodiment for describing the first hash field, if the relational data to be stored corresponding to the timer program is the current time and the current time is "2022-06-01 (wednesday), 9:00", at this time, the second string "the number of days the current time is in one year" in the relational data is 2022-06-01, and the second hash string corresponding to the second string is recorded as 152; the second character string in the relational data, the number of days in the week at the current time, is Zhou, and the second hash character string corresponding to the second character string is recorded as 3; the second character string in the relational data, the second number of seconds the current time is in a day, is 32400 seconds, and the second hash character string corresponding to the second character string is recorded as 32400; finally, a second hash field corresponding to the relational data is generated: day_152_3_32400 (i.e., the second hash field corresponding to the current time). On the basis, if the first hash field generated by querying the data is
day_ [152,161] _ { x } _ [32400,64800]; at this time, since [152,161] matches 152, { 3, [32400,64800] matches 32400, the first hash field is considered to match the second hash field.
And storing the storage code and the second hash field as a group of structure body arrays in a regular matching dictionary of a cache database in an associated mode. It is understood that at least one group of structure body arrays is stored in the regular matching dictionary, and each group of structure body arrays comprises a second hash field with the preset association sequence and a storage code associated with the second hash field. The structure array includes, but is not limited to, a Key-Value (i.e., key-Value pair) structure array, where the Key is a storage code, and the Value is a second hash field, that is, the regular matching dictionary includes a second hash field and a storage code associated with the second hash field, and the storage code (Value) associated with the second hash field may be queried in the regular matching dictionary through the second hash field (Key). In an embodiment, the cache database is a REDIS type Key-Value database, and the REDIS type Key-Value database may cache the Key-Value structure array.
In an embodiment, a data query device based on regular matching is further provided, where the data query device based on regular matching corresponds to the data query method based on regular matching in the above embodiment one by one. As shown in fig. 4, the data query apparatus based on regular matching includes a condition acquisition module 100, a first matching module 200, a first query module 300, and a second query module 400. The functional modules are described in detail as follows:
the condition acquisition module 100 is configured to acquire a query request including query data; the query data comprises at least one first character string;
the first matching module 200 is configured to perform regular matching on all the first strings in the query data according to a preset regular matching rule and a preset association sequence, so as to generate a first hash field with a hash structure;
the first query module 300 is configured to query, according to the first hash field, a regular matching dictionary of a cache database for a second hash field that matches the first hash field; the regular matching dictionary is stored with a plurality of groups of structure body arrays, and each group of structure body arrays comprises a second hash field with the preset association sequence and a storage code associated with the second hash field;
the second query module 400 is configured to query from a relational database according to the stored code associated with the queried second hash field to obtain relational data corresponding to the query data.
In one embodiment, as shown in fig. 5, the data query device further includes a data acquisition module 500, a code generation module 600, a second matching module 700, and a storage module 800. The functional modules are described in detail as follows:
the data obtaining module 500 is configured to obtain, for storage, relationship data including at least one second string, where all second strings in the relationship data have a preset association sequence;
the code generating module 600 is configured to generate a storage code corresponding to the relational data, and store the storage code and the relational data in a relational database in an associated manner;
the second matching module 700 is configured to perform regular matching on all the second strings in the relational data according to the preset regular matching rule and the preset association sequence, so as to generate a second hash field with the preset association sequence;
the storage module 800 is configured to store the storage code and the second hash field as a set of structure body arrays in association with a regular matching dictionary of a cache database.
In an embodiment, a computer device is also provided, which may be a server, and the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement the steps of the data query method based on canonical matching described above.
In an embodiment, there is also provided a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the regular matching based data query method described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (10)

1. A data query method based on canonical matching, comprising:
acquiring a query request containing query data; the query data comprises at least one first character string;
performing regular matching on all first character strings in the query data according to a preset regular matching rule and a preset association sequence to generate a first hash field with a hash structure;
according to the first hash field, inquiring a second hash field matched with the first hash field in a regular matching dictionary of a cache database; the regular matching dictionary is stored with a plurality of groups of structure body arrays, and each group of structure body arrays comprises a second hash field with the preset association sequence and a storage code associated with the second hash field;
and inquiring from a relational database according to the storage code associated with the inquired second hash field to obtain relational data corresponding to the inquired data.
2. The regular matching-based data query method as claimed in claim 1, wherein the performing regular matching on all the first strings in the query data according to a preset regular matching rule and a preset association sequence to generate a first hash field with a hash structure comprises:
acquiring a preset association sequence in the second hash field in the regular matching dictionary, and sequencing all first character strings in the query data according to the preset association sequence to obtain a field to be queried;
performing regular matching on all the first character strings in the field to be queried according to a preset regular matching rule to generate first hash character strings corresponding to the first character strings;
and splicing all the generated first hash character strings according to the preset association sequence to generate a first hash field with a hash structure.
3. The regular matching-based data query method of claim 1, wherein prior to obtaining the query request containing the query data, further comprising:
acquiring relation data to be stored, wherein the relation data comprises at least one second character string, and all the second character strings in the relation data have preset association sequences;
generating a storage code corresponding to the relational data, and storing the storage code and the relational data in a relational database in an associated manner;
performing regular matching on all the second character strings in the relational data according to the preset regular matching rule and the preset association sequence to generate a second hash field with the preset association sequence;
and storing the storage code and the second hash field as a group of structure body arrays in a regular matching dictionary of a cache database in an associated mode.
4. The regular matching-based data query method as claimed in claim 3, wherein said performing regular matching on all the second strings in the relational data according to the preset regular matching rule and the preset association sequence to generate a second hash field with the preset association sequence includes:
performing regular matching on all the second character strings in the relational data according to the preset regular matching rule to generate second hash character strings corresponding to the second character strings;
and splicing all the generated second hash character strings according to the preset association sequence to generate a second hash field with a hash structure.
5. The regular matching-based data query method as claimed in claim 1, wherein said querying, in a regular matching dictionary of a cache database, a second hash field matching the first hash field according to the first hash field, comprises:
according to the first hash field, performing regular matching query in a regular matching dictionary of the cache database by using a GET method, and confirming whether a second hash field matched with the first hash field exists in the regular matching dictionary;
and when a second hash field matched with the first hash field exists in the regular matching dictionary, recording the storage code associated with the queried second hash field.
6. The regular matching-based data query method of claim 5, wherein the confirming whether the second hash field matching the first hash field exists in the regular matching dictionary comprises:
and when the second hash field matched with the first hash field does not exist in the regular matching dictionary, prompting that no relational data matched with the query request exists in the relational database.
7. A canonical matching-based data query device, comprising:
the condition acquisition module is used for acquiring a query request containing query data; the query data comprises at least one first character string;
the first matching module is used for carrying out regular matching on all first character strings in the query data according to a preset regular matching rule and a preset association sequence to generate a first hash field with a hash structure;
the first query module is used for querying a second hash field matched with the first hash field in a regular matching dictionary of the cache database according to the first hash field; the regular matching dictionary is stored with a plurality of groups of structure body arrays, and each group of structure body arrays comprises a second hash field with the preset association sequence and a storage code associated with the second hash field;
and the second query module is used for querying from a relational database according to the storage code associated with the queried second hash field to obtain relational data corresponding to the query data.
8. The canonical-match-based data query device of claim 7, further comprising:
the data acquisition module is used for acquiring the relation data which is to be stored and comprises at least one second character string, wherein all the second character strings in the relation data have a preset association sequence;
the code generation module is used for generating a storage code corresponding to the relational data and storing the storage code and the relational data in a relational database in an associated way;
the second matching module is used for carrying out regular matching on all the second character strings in the relational data according to the preset regular matching rule and the preset association sequence to generate a second hash field with the preset association sequence;
and the storage module is used for storing the storage codes and the second hash fields as a group of structure body arrays in a regular matching dictionary of a cache database in an associated mode.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the regular matching based data query method according to any of claims 1 to 6 when the computer program is executed.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the regular matching based data query method of any of claims 1 to 6.
CN202211563104.4A 2022-12-07 2022-12-07 Data query method, device, equipment and medium based on regular matching Pending CN116049509A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211563104.4A CN116049509A (en) 2022-12-07 2022-12-07 Data query method, device, equipment and medium based on regular matching

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211563104.4A CN116049509A (en) 2022-12-07 2022-12-07 Data query method, device, equipment and medium based on regular matching

Publications (1)

Publication Number Publication Date
CN116049509A true CN116049509A (en) 2023-05-02

Family

ID=86112314

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211563104.4A Pending CN116049509A (en) 2022-12-07 2022-12-07 Data query method, device, equipment and medium based on regular matching

Country Status (1)

Country Link
CN (1) CN116049509A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116521738A (en) * 2023-05-06 2023-08-01 零束科技有限公司 Data processing method, system, electronic device and storage medium
CN116521738B (en) * 2023-05-06 2024-05-14 零束科技有限公司 Data processing method, system, electronic device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116521738A (en) * 2023-05-06 2023-08-01 零束科技有限公司 Data processing method, system, electronic device and storage medium
CN116521738B (en) * 2023-05-06 2024-05-14 零束科技有限公司 Data processing method, system, electronic device and storage medium

Similar Documents

Publication Publication Date Title
US11907244B2 (en) Modifying field definitions to include post-processing instructions
CN111143462B (en) Method, apparatus, computer device and storage medium for data export
AU2015347304B2 (en) Testing insecure computing environments using random data sets generated from characterizations of real data sets
CN112989412B (en) Data desensitization method and device based on SQL statement analysis
US9384202B1 (en) Gateway module to access different types of databases
CN109284273B (en) Massive small file query method and system adopting suffix array index
US11250166B2 (en) Fingerprint-based configuration typing and classification
CN110377649B (en) Construction and query methods, devices, equipment and storage medium of tagged data
CN105373541A (en) Processing method and system for data operation request of database
CN110046155B (en) Method, device and equipment for updating feature database and determining data features
CN112286934A (en) Database table importing method, device, equipment and medium
CN109325042B (en) Processing template acquisition method, form processing method, device, equipment and medium
KR20200094074A (en) Method, apparatus, device and storage medium for managing index
CN111984659B (en) Data updating method, device, computer equipment and storage medium
CN111858467B (en) File data processing method, device, equipment and medium based on artificial intelligence
CN109816338A (en) Enterprise's rewards and punishments processing method, device, computer equipment and storage medium
CN111274291B (en) Query method, device, equipment and medium for user access data
CN108280355A (en) A kind of data desensitization method and device
CN116049509A (en) Data query method, device, equipment and medium based on regular matching
WO2020024824A1 (en) Method and device for determining user status identifier
CN115858471A (en) Service data change recording method, device, computer equipment and medium
US20200401569A1 (en) System and method for data reconciliation
CN115795187A (en) Resource access method, device and equipment
CN115658680A (en) Data storage method, data query method and related device
CN115048456A (en) User label generation method and device, computer 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