Data query method and device, electronic equipment and computer readable medium

By receiving data query requests and generating query statements using classification hierarchical relationship tables and target annotations, the problems of low data query efficiency and poor modification flexibility in the prior art are solved, and efficient data query and flexible modification operations are achieved.

CN119690988APending Publication Date: 2025-03-25CCB FINTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411862205.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The existing multi-level classification data query is inefficient and has poor modification flexibility. The existing technology mainly uses the relationship between the parent class and the child class to query, resulting in low query efficiency and complex modification.

Method used

By receiving a data query request, obtaining the classification identifier to be found, determining the classification type to be found, determining the target annotation based on the classification type, and using the classification hierarchical relationship table to generate the target query statement, and executing the query statement to obtain the query result data.

Benefits of technology

Improve data query efficiency and modification flexibility, and simplify the data query process and improve performance by introducing classification hierarchical relationship tables and target annotations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690988A_ABST
    Figure CN119690988A_ABST
Patent Text Reader

Abstract

The invention discloses a data query method and device, electronic equipment and a computer readable medium, and relates to the technical field of data query, one specific embodiment comprises the steps of receiving a data query request, and obtaining a corresponding to-be-searched classification identifier; determining a to-be-searched classification type according to the to-be-searched classification identifier; determining a target annotation based on the to-be-searched classification type; determining the target annotation: determining a target classification type corresponding to the target classification according to the to-be-searched classification type, and determining the target annotation based on the target classification type and the to-be-searched classification type; generating a target query statement according to the to-be-searched classification type, the target annotation and the classification hierarchical relation table; and executing the target query statement in the classification hierarchical relation table to obtain query result data. By introducing the classification hierarchical relation table and the target annotation, the data query efficiency and the data query modification flexibility are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data query technology, and in particular to a data query method, device, electronic device and computer-readable medium. Background Art

[0002] The existing multi-level classification is mainly achieved by binding the relationship between the parent class and the child class, and incrementing the relationship between the child class and its child class. Generally, the query statement can be used to perform recursive query on the parent-child relationship, which is inefficient and cumbersome to implement; or a tree-like relationship data model can be established in a node-based manner in a non-recursive manner. Although the query efficiency is improved, the modification is very complicated. The data query efficiency is low and the flexibility of data query modification is poor. Summary of the invention

[0003] In view of this, the embodiments of the present application provide a data query method, device, electronic device and computer-readable medium, which can solve the problems of low efficiency of existing data query and poor flexibility of data query modification.

[0004] To achieve the above object, according to one aspect of an embodiment of the present application, a data query method is provided, comprising:

[0005] Receive a data query request and obtain the corresponding classification identifier to be found;

[0006] According to the identification of the classification to be found, determine the type of the classification to be found;

[0007] Determine the target annotation based on the classification type to be found; determine the target annotation, including: determine the target classification type corresponding to the target classification according to the classification type to be found, and determine the target annotation based on the target classification type and the classification type to be found;

[0008] Generate a target query statement based on the classification type to be searched, target annotation and classification hierarchy relationship table;

[0009] Execute the target query statement in the classification hierarchical relationship table to obtain the query result data.

[0010] Optionally, define target annotations, including:

[0011] The target annotation is determined based on the target classification type, the classification type to be searched, and the preset annotation format.

[0012] Optionally, a target query statement is generated, including:

[0013] Get the query text corresponding to the data query request;

[0014] Split the query text to obtain individual split texts;

[0015] Match each split text with a preset sentence fragment to determine a target sentence fragment;

[0016] The classification type to be searched, the target annotation, the classification hierarchy relationship table and the target statement fragment are replaced with the corresponding placeholders in the query statement generation template to generate the target query statement.

[0017] Optionally, the query text is split to obtain individual split texts, including:

[0018] Identify the words in the query text that are relevant to the classification, and split the query text based on the words to obtain separate split texts.

[0019] Optionally, each split text is matched with a preset sentence fragment to determine a target sentence fragment, including:

[0020] Determine the English words corresponding to each split text, compare the English words with preset sentence fragments for consistency, and determine the preset sentence fragments that are consistent with the comparison as the target sentence fragments corresponding to the English words.

[0021] Optionally, before generating the target query statement, the method further includes:

[0022] Add a new table to store all classification parent-child relationship identifiers, classification grandparent-child relationship identifiers and mark the hierarchy of all parent category identifiers to generate a classification hierarchy relationship table.

[0023] In addition, the present application also provides a data query device, including:

[0024] A receiving unit is configured to receive a data query request and obtain a corresponding classification identifier to be found;

[0025] A to-be-searched classification type determination unit is configured to determine the to-be-searched classification type according to the to-be-searched classification identifier;

[0026] The target annotation determination unit is configured to determine the target annotation based on the classification type to be found; determining the target annotation includes: determining the target classification type corresponding to the target classification according to the classification type to be found, and determining the target annotation based on the target classification type and the classification type to be found;

[0027] A target query statement generating unit is configured to generate a target query statement according to the classification type to be searched, the target annotation and the classification hierarchical relationship table;

[0028] The execution unit is configured to execute the target query statement in the classification hierarchical relationship table to obtain query result data.

[0029] Optionally, the target annotation determination unit is further configured to:

[0030] The target annotation is determined based on the target classification type, the classification type to be searched, and the preset annotation format.

[0031] Optionally, the target query statement generating unit is further configured to:

[0032] Get the query text corresponding to the data query request;

[0033] Split the query text to obtain individual split texts;

[0034] Match each split text with a preset sentence fragment to determine a target sentence fragment;

[0035] The classification type to be searched, the target annotation, the classification hierarchy relationship table and the target statement fragment are replaced with the corresponding placeholders in the query statement generation template to generate the target query statement.

[0036] Optionally, the target query statement generating unit is further configured to:

[0037] Identify the words in the query text that are relevant to the classification, and split the query text based on the words to obtain separate split texts.

[0038] Optionally, the target query statement generating unit is further configured to:

[0039] Determine the English words corresponding to each split text, compare the English words with preset sentence fragments for consistency, and determine the preset sentence fragments that are consistent with the comparison as the target sentence fragments corresponding to the English words.

[0040] Optionally, the device further includes a new table adding unit configured to:

[0041] Add a new table to store all classification parent-child relationship identifiers, classification grandparent-child relationship identifiers and mark the hierarchy of all parent category identifiers to generate a classification hierarchy relationship table.

[0042] In addition, the present application also provides a data query electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the one or more processors implement the data query method as described above.

[0043] In addition, the present application also provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the data query method as described above is implemented.

[0044] To achieve the above objective, according to another aspect of the embodiments of the present application, a computer program product is provided.

[0045] A computer program product according to an embodiment of the present application includes a computer program, and when the program is executed by a processor, the data query method provided by the embodiment of the present application is implemented.

[0046] One embodiment of the above invention has the following advantages or beneficial effects: the present application obtains the corresponding classification identifier to be searched by receiving a data query request; determines the classification type to be searched according to the classification identifier to be searched; determines the target annotation based on the classification type to be searched; determines the target annotation, including: determining the target classification type corresponding to the target classification according to the classification type to be searched, and determining the target annotation based on the target classification type and the classification type to be searched; generates a target query statement according to the classification type to be searched, the target annotation and the classification hierarchy relationship table; executes the target query statement in the classification hierarchy relationship table to obtain the query result data. By introducing the classification hierarchy relationship table and the target annotation, the data query efficiency and the data query modification flexibility are improved.

[0047] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings are used to better understand the present application and do not constitute an improper limitation on the present application.

[0049] Figure 1 is a schematic diagram of the main process of a data query method according to an embodiment of the present application;

[0050] Figure 2 is a schematic diagram of the main process of a data query method according to an embodiment of the present application;

[0051] Figure 3 It is a schematic diagram of the main process of a data query method according to an embodiment of the present application;

[0052] Figure 4 is a schematic diagram of main units of a data query device according to an embodiment of the present application;

[0053] Figure 5 is an exemplary system architecture diagram to which the embodiments of the present application can be applied;

[0054] Figure 6 It is a structural diagram of a computer system of a terminal device or server suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION

[0055] The following is a description of the exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of known functions and structures is omitted in the following description. It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solution of the present application are in compliance with the relevant provisions of national laws and regulations. It should be noted that in the embodiments of the present application, certain software, components, models, and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or must have used the solution. In the technical solution of the present application, the collection, analysis, use, transmission, storage, and other aspects of the user's personal information involved are in compliance with the provisions of relevant laws and regulations, and are used for legal and reasonable purposes, and are not shared, leaked, or sold outside of these legal uses, and are subject to supervision and management by regulatory authorities. Take necessary measures to prevent illegal access to such personal information, ensure that persons with access to personal information comply with relevant laws and regulations, and ensure the security of personal information. Once such personal information is no longer needed, risks should be minimized by limiting or even prohibiting data collection and / or deleting data.

[0056] When used, including in certain related applications, user privacy is protected by de-identifying data, such as by removing specific identifiers when used, controlling the amount or specificity of data stored, controlling how data is stored, and / or other methods of de-identification.

[0057] Figure 1 is a schematic diagram of the main process of a data query method according to an embodiment of the present application, such as Figure 1 As shown, the data query method mainly includes the following steps S101 to S105.

[0058] Step S101, receiving a data query request and obtaining a corresponding classification identifier to be searched.

[0059] In this embodiment, the execution subject of the data query method (for example, a server) can receive the data query request through a wired connection or a wireless connection. After receiving the data query request, the execution subject can obtain the category identifier to be searched carried in the request.

[0060] Step S102, determining the type of the category to be searched according to the category identifier to be searched.

[0061] The identification of the category to be searched can be used to characterize the type of the category to be searched, for example, Catid, which means the category to be searched is a subcategory; Superiorid, which means the category to be searched is a supercategory; and superiorlevel, which means the category to be searched is the level of the supercategory.

[0062] Step S103, determining the target annotation based on the classification type to be found; determining the target annotation includes: determining the target classification type corresponding to the target classification according to the classification type to be found, and determining the target annotation based on the target classification type and the classification type to be found.

[0063] Specifically, when determining the target annotation, the execution subject can determine the target classification type corresponding to the target classification (for example, "a certain classification" in "find the first-level category of a certain classification") according to the classification type to be found, such as the level of the superior classification. For example, because the search is for the first-level category of a certain classification, the "certain classification" is a subclassification. Because only subclassifications have superior classifications and corresponding superior classification levels, the "certain classification" is the target classification, and the target classification type corresponding to the target classification can specifically be a subclassification. Based on the target classification type and the classification type to be found, the target annotation is determined. Specifically, the target annotation (for example, @CATID And superiorlevel=1) can be determined based on the identifier corresponding to the target classification type (for example, Catid or CATID) and the identifier corresponding to the classification type to be found (for example, superiorlevel=1).

[0064] Specifically, determining the target annotation includes: determining the target annotation based on the target classification type, the classification type to be found, and a preset annotation format, thereby improving the accuracy of determining the target annotation.

[0065] Step S104, generating a target query statement according to the classification type to be searched, the target annotation and the classification hierarchy relationship table.

[0066] For example, when searching for all parent categories of a category (i.e., the upper-level category, corresponding to Superiorid), the category type to be searched for one of the categories is a subcategory, corresponding to Catid; the corresponding target annotation is @Catid (which can also be @CATID); the category hierarchy table is prod_cat_level; then the generated target query statement is: selectSuperiorid from prod_cat_level where Catid=@CATID.

[0067] Specifically, before generating the target query statement, the method further includes: adding a new table, storing all classification parent-child relationship identifiers, classification grandparent-child relationship identifiers in the new table and marking the hierarchy of all parent category identifiers to generate a classification hierarchy relationship table.

[0068] For example, a new table (i.e., classification hierarchy relationship table) prod_cat_level is added to store all parent-child relationship IDs and all grandparent-child relationship IDs, extending to the top-level classification and the bottom-level child relationship IDs, and marking the levels of all parent class fids.

[0069] For example, the classification hierarchy table stores the following content:

[0070] Catid, category ID;

[0071] Superiorid, the superior classification ID;

[0072] superiorlevel, the level of the superior classification;

[0073] Catid: 1001, 1011, 1011;

[0074] Superiorid: 1000, 1000, 1001;

[0075] Superiorlevel: 1, 1, 2;

[0076] Note: Level 2->Level 1; Level 3->Level 1; Level 3->Level 2.

[0077] For example, the classification hierarchy table contains the following tables:

[0078] Catid Category ID Superiorid Parent Category ID Superior level Level of parent classification

[0079] Data example:

[0080] Catid Superiorid Superior level illustrate <![CDATA[ 1001 ]]> <![CDATA[ 1 000 ]]> <![CDATA[ 1 ]]> Level 2->Level 1 <![CDATA[ 1011 ]]> <![CDATA[ 1 000 ]]> <![CDATA[ 1 ]]> Level 3->Level 1 <![CDATA[ 1011 ]]> <![CDATA[ 1 001 ]]> <![CDATA[ 2 ]]> <![CDATA[Level Three -> 二 Level]]>

[0081] Step S105, executing the target query statement in the classification hierarchical relationship table to obtain query result data.

[0082] This embodiment receives a data query request to obtain a corresponding classification identifier to be searched; determines the classification type to be searched according to the classification identifier to be searched; determines the target annotation based on the classification type to be searched; determines the target annotation, including: determining the target classification type corresponding to the target classification according to the classification type to be searched, and determining the target annotation based on the target classification type and the classification type to be searched; generates a target query statement according to the classification type to be searched, the target annotation and the classification hierarchical relationship table; executes the target query statement in the classification hierarchical relationship table to obtain query result data. By introducing the classification hierarchical relationship table and the target annotation, the data query efficiency and the data query modification flexibility are improved.

[0083] Figure 2 is a schematic diagram of the main flow of a data query method according to an embodiment of the present application, such as Figure 2 As shown, the data query method mainly includes the following steps S201 to S208.

[0084] Step S201, receiving a data query request and obtaining a corresponding classification identifier to be searched.

[0085] Step S202, determining the type of the category to be searched according to the category identifier to be searched.

[0086] Step S203, determining the target annotation based on the classification type to be found; determining the target annotation includes: determining the target classification type corresponding to the target classification according to the classification type to be found, and determining the target annotation based on the target classification type and the classification type to be found.

[0087] The executing entity can convert the identifier corresponding to the target classification type determined according to the classification type to be searched (for example, an identifier of mixed uppercase and lowercase letters) into the format required for annotation (for example, an identifier of all uppercase letters), and determine the target annotation (for example, @CATID And superiorlevel=1) based on the identifier corresponding to the target classification type after the format conversion (for example, CATID of all uppercase letters), the annotation identifier (for example, @), the identifier corresponding to the classification type to be searched (for example, a first-level category) (for example, superiorlevel=1), and the preset annotation format, thereby ensuring the accuracy and effectiveness of the target annotation.

[0088] Step S204: obtaining the query text corresponding to the data query request.

[0089] For example, the query text corresponding to the data query request may be: find the first-level category of a certain classification.

[0090] Step S205, split the query text to obtain individual split texts.

[0091] For example, each split text can be: search, a certain category, and a first-level category.

[0092] Step S206: Match each split text with a preset sentence segment to determine a target sentence segment.

[0093] The preset sentence fragment may be an English sentence fragment. The target sentence fragments obtained by matching each split text with the preset sentence fragment may be: select, Catid, @CATID, superiorlevel=1.

[0094] Step S207, replacing the corresponding placeholders in the query statement generation template with the classification type to be searched, the target annotation, the classification hierarchy relationship table and the target sentence fragment to generate the target query statement.

[0095] According to the semantics of the query text, determine the sentence fragment to be added to ensure the accuracy of the generated target sentence fragment. For example, according to the semantics of the query text, it is also necessary to add Superiorid representing the superior classification in the target sentence fragment. Therefore, when the query text corresponding to the data query request is: find the first-level category of a certain classification, according to the matching results of each split text and the preset sentence fragment, the accurate target sentence fragment can be: selectSuperiorid from prod_cat_level where Catid=@CATID And superiorlevel=1.

[0096] Step S208, executing the target query statement in the classification hierarchical relationship table to obtain query result data.

[0097] Execute the target query statement in the classification hierarchical relationship table to accurately obtain the query result data. By introducing the classification hierarchical relationship table and target annotations, the data query efficiency and data query modification flexibility are improved.

[0098] Figure 3 is a schematic diagram of the main flow of a data query method according to an embodiment of the present application, such as Figure 3 As shown, the data query method mainly includes the following steps S301 to S308.

[0099] Step S301, receiving a data query request and obtaining a corresponding classification identifier to be searched.

[0100] Step S302, determining the type of the category to be searched according to the category identifier to be searched.

[0101] Step S303, determining the target annotation based on the classification type to be found; determining the target annotation includes: determining the target classification type corresponding to the target classification according to the classification type to be found, and determining the target annotation based on the target classification type and the classification type to be found.

[0102] Step S304: obtaining the query text corresponding to the data query request.

[0103] For example, the query text corresponding to the data query request may be: find all subcategories of a certain category.

[0104] Step S305, identifying the words in the query text that are related to the classification, and splitting the query text based on the words to obtain separate split texts.

[0105] The words related to the category in the query text, for example, a category, a sub-category. The query text is split according to the words related to the category in the identified query text, and each split text obtained can be: search, a category, a sub-category.

[0106] Step S306, determining the English words corresponding to each split text, performing consistency comparison between the English words and the preset sentence fragments, and determining the preset sentence fragments that are consistent with the comparison as the target sentence fragments corresponding to the English words.

[0107] The English words corresponding to each split text, for example, search, a certain category, and subcategory may correspond to select, Superiorid, and Catid. If these English words exist in the preset sentence fragments, the existing preset sentence fragments select, Superiorid, and Catid are determined as the target sentence fragments corresponding to the English words.

[0108] Step S307 , replacing the corresponding placeholders in the query statement generation template with the classification type to be searched, the target annotation, the classification hierarchy relationship table and the target statement fragment to generate the target query statement.

[0109] Replace the corresponding placeholders in the query statement generation template with the category type to be searched (e.g., the superior category, Superiorid), the target annotation (e.g., @SUPERIORID), the category hierarchy relationship table (e.g., prod_cat_level), and the target statement fragments select, Superiorid, and Catid to generate the target query statement, for example: select Catid from prod_cat_level where Superiorid=@SUPERIORID.

[0110] Step S308: executing the target query statement in the classification hierarchical relationship table to obtain query result data.

[0111] The embodiment of the present application improves data query efficiency and data query modification flexibility by introducing a classification hierarchical relationship table and target annotations.

[0112] In the embodiment of the present application, the first recursive solution is: simulate the recursive algorithm, define the field id for each category to represent the current category, define the field fid to represent its parent category, and obtain the previous level content by searching the parent fid of the parent fid, so as to obtain the top-level information by recursion. This method is frequently used and is applied to most open source programs. The second aggregation solution is: concentrate all parent class ids in the same field and separate them with special symbols. For example: a subclass id "10" has three parent classes, then the information stored in fid (parent id is fid) is "1, 3, 7". When you need to query which subclasses are under the parent class 1, you can use fuzzy query: where fid like "1%" to retrieve the subclass 10.

[0113] The embodiment of the present application adopts a combination and upgrade of the above first recursive solution and the second aggregation solution, adds a classification hierarchical relationship table, and uses a non-recursive method to decompose its logical relationship, which can improve query efficiency at the same time and simplify the operations of adding, deleting and modifying, which can greatly reduce resource usage.

[0114] Specifically, define the classification relationship: combine the business model, add a new classification hierarchy relationship table, and maintain the hierarchical data structure in the classification hierarchy relationship table. Quick positioning query: according to the information in the newly added classification hierarchy relationship table, query the virtual classification logical relationship in the table, and quickly bind the corresponding sub-table to display the relevant data information under the category.

[0115] Add a new classification hierarchical relationship table, such as prod_cat_level, to store all parent-child relationship ids, and store all grandparent-child relationship ids, extending to the top-level classification and the bottom-level subclass relationship id, and mark the level of all parent class fids. When querying all parent classes of a classification, you can query with the following statement: select Superiorid from prod_cat_level where Catid=@CATID. When querying the first-level category of a classification, query with the following statement: select Superiorid from prod_cat_level where Catid=@CATID And superiorlevel=1. If you need to find all subclasses of a classification, you can use the following statement: select Catid from prod_cat_level where Superiorid=@SUPERIORID. By analyzing and designing the data meta-classification structure model, defining the virtual relationship between classification data, adding a classification hierarchical relationship table, and using a non-recursive method to decompose the logical relationship of multi-layer data sets, this method can achieve the goal of quickly processing multi-level data set classification in the TiDB database, and does not require too much hardware resources during operation, and is time-consuming.

[0116] According to the specific business model, the embodiment of the present application designs the virtual relationship between data at each level, designs the data element classification structure model, and defines the classification relationship data; by adding a classification hierarchical relationship table, a non-recursive method is used to decompose the logical relationship of multi-layer data and quickly locate the target data set. By analyzing the business model, defining the virtual relationship between classified data, adding a classification hierarchical relationship table, and combining the non-recursive method to decompose the logical relationship of multi-layer data sets, it is possible to quickly retrieve all parent category information of the upper level or all classified information of the lower level, as well as efficient addition, deletion, modification and query.

[0117] Figure 4 Schematic diagram of the main units of the data query device according to an embodiment of the present application. Figure 4 As shown, the data query device 400 includes a receiving unit 401 , a classification type to be searched determining unit 402 , a target annotation determining unit 403 , a target query statement generating unit 404 and an executing unit 405 .

[0118] The receiving unit 401 is configured to receive a data query request and obtain a corresponding classification identifier to be found.

[0119] The to-be-searched category type determining unit 402 is configured to determine the to-be-searched category type according to the to-be-searched category identifier.

[0120] The target annotation determination unit 403 is configured to determine the target annotation based on the classification type to be found; determining the target annotation includes: determining the target classification type corresponding to the target classification according to the classification type to be found, and determining the target annotation based on the target classification type and the classification type to be found.

[0121] The target query statement generating unit 404 is configured to generate a target query statement according to the classification type to be searched, the target annotation and the classification hierarchical relationship table.

[0122] The execution unit 405 is configured to execute the target query statement in the classification hierarchical relationship table to obtain query result data.

[0123] In some embodiments, the target annotation determining unit 403 is further configured to determine the target annotation based on the target classification type, the classification type to be found, and a preset annotation format.

[0124] In some embodiments, the target query statement generation unit 404 is further configured to: obtain the query text corresponding to the data query request; split the query text to obtain each split text; match each split text with a preset sentence fragment to determine the target sentence fragment; replace the corresponding placeholders in the query statement generation template with the classification type to be searched, the target annotation, the classification hierarchy relationship table and the target sentence fragment to generate the target query statement.

[0125] In some embodiments, the target query sentence generating unit 404 is further configured to: identify words in the query text that are related to the classification, and split the query text based on the words to obtain separate split texts.

[0126] In some embodiments, the target query sentence generation unit 404 is further configured to: determine the English vocabulary corresponding to each split text, compare the English vocabulary with preset sentence fragments for consistency, and determine the preset sentence fragments that are consistent as the target sentence fragments corresponding to the English vocabulary.

[0127] In some embodiments, the data query device further includes Figure 4 The new table adding unit not shown in the figure is configured to: add a new table, store all classification parent-child relationship identifiers, classification grandparent-child relationship identifiers in the new table and mark the hierarchy of all parent category identifiers to generate a classification hierarchy relationship table.

[0128] It should be noted that the data query method and the data query device of the present application have a corresponding relationship in terms of specific implementation contents, so the repeated contents will not be described again.

[0129] Figure 5 An exemplary system architecture 500 is shown to which the data query method or data query device according to the embodiment of the present application can be applied.

[0130] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0131] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0132] The terminal devices 501 , 502 , and 503 may be various electronic devices having a data query processing screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0133] Server 505 may be a server that provides various services, such as a background management server that provides support for data query requests submitted by users using terminal devices 501, 502, and 503 (only as an example). The background management server may receive a data query request, obtain a corresponding classification identifier to be found; determine the classification type to be found based on the classification identifier to be found; determine a target annotation based on the classification type to be found; determine the target annotation, including: determining a target classification type corresponding to the target classification based on the classification type to be found, and determining a target annotation based on the target classification type and the classification type to be found; generate a target query statement based on the classification type to be found, the target annotation, and the classification hierarchical relationship table; execute the target query statement in the classification hierarchical relationship table to obtain query result data. By introducing the classification hierarchical relationship table and the target annotation, the data query efficiency and data query modification flexibility are improved.

[0134] It should be noted that the data query method provided in the embodiment of the present application is generally executed by the server 505 , and accordingly, the data query device is generally arranged in the server 505 .

[0135] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0136] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present application. Figure 6The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0137] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0138] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0139] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present application are executed.

[0140] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. Computer-readable storage media may include, for example, but are not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0141] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0142] The units involved in the embodiments described in the present application may be implemented by software or hardware. The units described may also be set in a processor, for example, may be described as: a processor includes a receiving unit, a classification type determination unit to be searched, a target annotation determination unit, a target query statement generation unit, and an execution unit. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0143] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device receives a data query request and obtains a corresponding classification identifier to be found; determines the classification type to be found according to the classification identifier to be found; determines the target annotation based on the classification type to be found; determines the target annotation, including: determining the target classification type corresponding to the target classification according to the classification type to be found, and determining the target annotation based on the target classification type and the classification type to be found; generates a target query statement according to the classification type to be found, the target annotation and the classification hierarchy relationship table; executes the target query statement in the classification hierarchy relationship table to obtain the query result data.

[0144] The computer program product of the present application includes a computer program, and when the computer program is executed by a processor, the data query method in the embodiment of the present application is implemented.

[0145] According to the technical solution of the embodiment of the present application, by introducing a classification hierarchical relationship table and target annotations, data query efficiency and data query modification flexibility can be improved.

[0146] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A data query method, characterized in that: include: Receive a data query request and obtain the corresponding classification identifier to be found; Determine the type of the category to be found according to the category identifier to be found; Determine a target annotation based on the classification type to be found; The determining of the target annotation includes: determining a target classification type corresponding to the target classification according to the classification type to be found, and determining the target annotation based on the target classification type and the classification type to be found; Generate a target query statement according to the classification type to be searched, the target annotation and the classification hierarchy relationship table; The target query statement is executed in the classification hierarchical relationship table to obtain query result data.

2. The method according to claim 1, characterized in that The determining of the target annotation comprises: A target annotation is determined based on the target classification type, the classification type to be found, and a preset annotation format.

3. The method according to claim 1, characterized in that: The generating of the target query statement includes: Obtaining a query text corresponding to the data query request; Splitting the query text to obtain separate split texts; Matching each of the split texts with a preset sentence fragment to determine a target sentence fragment; The classification type to be searched, the target annotation, the classification hierarchy relationship table and the target sentence fragment are used to replace corresponding placeholders in a query statement generation template to generate a target query statement.

4. The method according to claim 3, characterized in that The step of splitting the query text to obtain each split text includes: Identify the words related to the classification in the query text, and split the query text based on the words to obtain separate split texts.

5. The method according to claim 3, characterized in that: The step of matching each of the split texts with a preset sentence segment to determine a target sentence segment includes: The English words corresponding to each split text are determined, the English words are compared with preset sentence fragments for consistency, and the preset sentence fragments that are consistent with the comparison are determined as the target sentence fragments corresponding to the English words.

6. The method according to claim 1, characterized in that Before generating the target query statement, the method further includes: A new table is added, in which all classification parent-child relationship identifiers and classification grandparent-child relationship identifiers are stored and the levels of all parent category identifiers are marked to generate a classification hierarchical relationship table.

7. A data query device, characterized in that: include: A receiving unit is configured to receive a data query request and obtain a corresponding classification identifier to be found; A to-be-searched classification type determination unit is configured to determine the to-be-searched classification type according to the to-be-searched classification identifier; a target annotation determining unit, configured to determine a target annotation based on the classification type to be found; The determining of the target annotation includes: determining a target classification type corresponding to the target classification according to the classification type to be found, and determining the target annotation based on the target classification type and the classification type to be found; A target query statement generating unit is configured to generate a target query statement according to the classification type to be searched, the target annotation and the classification hierarchy relationship table; The execution unit is configured to execute the target query statement in the classification hierarchical relationship table to obtain query result data.

8. The device according to claim 7, characterized in that The target annotation determination unit is further configured to: A target annotation is determined based on the target classification type, the classification type to be found, and a preset annotation format.

9. The device according to claim 7, characterized in that The target query statement generating unit is further configured to: Obtaining a query text corresponding to the data query request; Splitting the query text to obtain separate split texts; Matching each of the split texts with a preset sentence fragment to determine a target sentence fragment; The classification type to be searched, the target annotation, the classification hierarchy relationship table and the target sentence fragment are used to replace corresponding placeholders in a query statement generation template to generate a target query statement.

10. The device according to claim 9, characterized in that The target query statement generating unit is further configured to: Identify the words related to the classification in the query text, and split the query text based on the words to obtain separate split texts.

11. The device according to claim 9, characterized in that The target query statement generating unit is further configured to: The English words corresponding to each split text are determined, the English words are compared with preset sentence fragments for consistency, and the preset sentence fragments that are consistent with the comparison are determined as the target sentence fragments corresponding to the English words.

12. The device according to claim 7, characterized in that The device also includes a new table adding unit, which is configured to: A new table is added, in which all classification parent-child relationship identifiers and classification grandparent-child relationship identifiers are stored and the levels of all parent category identifiers are marked to generate a classification hierarchical relationship table.

13. A data query electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

14. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.