Data processing method and device, electronic equipment, storage medium and program product

By automatically generating and analyzing query statements for candidate query strategies, the poor performance problem caused by the rigid query strategies of knowledge graph databases is solved, and more efficient query performance is achieved.

CN120687638APending Publication Date: 2025-09-23MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510314958.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

In the existing technology, the query strategy of knowledge graph databases is rigid, resulting in low operation processing performance, which reduces query efficiency and efficiency.

Method used

By parsing the query request, query statements of different candidate query strategies are automatically generated, the candidate query strategies are executed to obtain the value of the first indicator, and the target query strategy is determined based on these values, avoiding manual pre-customized design.

Benefits of technology

It improves the efficiency of query statement generation, selects better query strategies, and improves the query performance of the database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120687638A_ABST
    Figure CN120687638A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and device, electronic equipment, a storage medium and a program product. The method comprises the steps of obtaining a query request for a database; analyzing the query request to obtain a query parameter of the query request, and generating a query statement corresponding to a candidate query strategy according to the query parameter and a data structure of the database and a query logic of the preset candidate query strategy; obtaining a first value of a first index corresponding to the candidate query strategy by executing the query statement; and determining a target query strategy from the candidate query strategies according to the first value of the first index corresponding to the candidate query strategies. In this way, the query statements can be generated according to the candidate query strategies and automatically analyzed and compared, a better query strategy is determined, and efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method and device, electronic equipment, storage medium, and program product. Background Art

[0002] Knowledge graph databases usually store data in the form of graphs. Graphs include nodes and edges. Nodes represent entities, and edges represent relationships between entities. Each node and edge can also have attributes and other information. Queries in knowledge graph databases mainly rely on graph query languages. Different query strategies based on graph query languages ​​will affect query efficiency and performance. A better query strategy is very important for database performance. Summary of the Invention

[0003] The present disclosure provides a data processing method and device, electronic equipment, storage medium, and program product.

[0004] In a first aspect, the present disclosure provides a data processing method, the data processing method comprising:

[0005] Get query requests for the database;

[0006] Parsing the query request to obtain query parameters of the query request, and generating a query statement corresponding to the candidate query strategy according to the query parameters and the data structure of the database and the preset query logic of the candidate query strategy;

[0007] Obtaining a first value of a first indicator corresponding to the candidate query strategy by executing the query statement;

[0008] A target query strategy is determined from the candidate query strategies according to a first value of a first indicator corresponding to the candidate query strategies.

[0009] In a second aspect, the present disclosure provides a data processing device, the data processing device comprising:

[0010] An acquisition module, used to obtain query requests for the database;

[0011] a processing module, configured to parse the query request, obtain query parameters of the query request, and generate a query statement corresponding to the candidate query strategy according to the query parameters and the data structure of the database and the query logic of the preset candidate query strategy;

[0012] The processing module is configured to obtain a first value of the first indicator corresponding to the candidate query strategy by executing the query statement;

[0013] The determining module is configured to determine a target query strategy from the candidate query strategies according to a first value of a first indicator corresponding to the candidate query strategy.

[0014] In a third aspect, the present disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and one or more of the computer programs are executed by the at least one processor to enable the at least one processor to perform the above-mentioned data processing method.

[0015] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned data processing method when executed by a processor.

[0016] In a fifth aspect, the present disclosure provides a computer program or a computer program product, which includes a computer program stored in a computer-readable storage medium, and the computer program implements the above-mentioned data processing method when executed by a processor.

[0017] The data processing method provided by the present disclosure can generate query statements for candidate query strategies in response to query requests from a database, and improve efficiency through automated parsing and generation. Furthermore, by executing the query statements for the candidate query strategies, a first value of a first indicator corresponding to the candidate query strategies can be obtained. Based on the first value of the first indicator, a target query strategy can be determined from the candidate query strategies. In this way, a better query strategy can be selected through analysis and comparison, without the need for manual pre-customized design, thus saving development time, and thus improving query performance based on the determined target query strategy.

[0018] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing detailed example embodiments with reference to the accompanying drawings. In the accompanying drawings:

[0020] Figure 1 An application scenario diagram of the data processing method and device provided in the embodiments of the present disclosure;

[0021] Figure 2A flowchart of a data processing method provided in an embodiment of the present disclosure;

[0022] Figure 3 A block diagram of a data processing device provided in an embodiment of the present disclosure;

[0023] Figure 4 A block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] To enable those skilled in the art to better understand the technical solutions of the present disclosure, exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered merely exemplary. Therefore, those skilled 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 disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0025] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.

[0026] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0027] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are also intended to include the plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "comprising" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. Similar words such as "connected" or "connected" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect.

[0028] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless expressly defined as such herein.

[0029] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals. The use of user data in this technical solution complies with relevant national laws and regulations (for example, the "Information Security Technology Personal Information Security Specification", etc.). For example: corresponding prescribed measures are taken to control access to personal information; the display of personal information is subject to prescribed restrictions; the purpose of using personal information does not exceed the scope of direct or reasonable connection; when using personal information, clear identity reference is eliminated to avoid precise positioning of specific individuals.

[0030] To facilitate understanding, several concepts involved in the embodiments of the present disclosure are briefly introduced below:

[0031] Knowledge graphs: Knowledge graphs combine theories and methods from applied mathematics, graphics, information visualization, and information science with methods like citation analysis and co-occurrence analysis. They use visual graphs to vividly display the core structure, development history, cutting-edge fields, and overall knowledge architecture of a discipline. Knowledge graphs are a structured information representation method that organizes and displays information in the form of graphs. Graphs consist of nodes and edges, where nodes represent entities and edges represent relationships between entities. These graphs provide efficient storage, query, and other operations.

[0032] Entity: represents a concrete or abstract thing in the real world, such as a person, place, organization, concept, etc. In a knowledge graph, an entity is usually represented as a node.

[0033] Relationship: Represents a certain connection or role between entities. In the knowledge graph, relationships are represented as edges connecting entities and usually have directionality and attribute information.

[0034] Attribute: represents a feature or descriptive information of an entity or edge. In a knowledge graph, attributes usually exist in the form of key-value pairs and are used to enrich the description of entities or edges.

[0035] Cassandra Query Language (CQL): stands for Cypher query language, which is similar to the SQL query language of Oracle databases. The graph database Neo4j often uses CQL as its query language. Neo4j database is a graph database, such as a knowledge graph database. CQL query statements allow users to query and operate graph databases in a more intuitive and efficient way. The writing of CQL query statements is usually related to the database's graph data structure.

[0036] In related technologies, for knowledge graph databases, operations are mainly performed through code configuration with fixed query logic, and the execution is relatively rigid, which may lead to low performance in database operations and processing, reducing efficiency and performance.

[0037] A data processing method is provided in an embodiment of the present disclosure. By parsing a query request for a database, query statements for different candidate query strategies are automatically generated. Then, by executing the query statement of the candidate query strategy, a first value of a first indicator corresponding to the candidate query strategy is obtained. According to the first value of the first indicator, a target query strategy is determined from the candidate query strategies. In this way, a better query strategy can be selected through analysis and comparison, without the need for manual pre-customized design, saving development time and increasing efficiency, and thus improving the query performance of the database based on the target query strategy.

[0038] Figure 1 The following schematically illustrates an application scenario diagram of the data processing method and device provided by an embodiment of the present disclosure.

[0039] like Figure 1 As shown, an application scenario of an embodiment of the present disclosure may include a terminal device 101, a network 103, and a server 102. The network 103 is used as a medium for providing a communication link between the terminal device 101 and the server 102. The network 103 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0040] The user can use the terminal device 101 to interact with the server 102 via the network 103 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0041] The terminal device 101 may be any electronic device having a display screen and supporting web browsing, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, and the like.

[0042] The server 102 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using the terminal device 101. The background management server may analyze and process received user requests and other data, and feed back the processing results (e.g., web pages, information, or data obtained or generated according to user requests) to the terminal device.

[0043] It should be noted that the data processing method and apparatus provided in the embodiments of the present disclosure can be executed by the server 102. Accordingly, the data processing apparatus provided in the embodiments of the present disclosure can be arranged in the server 102. The data processing method provided in the embodiments of the present disclosure can also be executed by a server or server cluster that is different from the server 102 and can communicate with the terminal device 101 and / or the server 102. Accordingly, the data processing apparatus provided in the embodiments of the present disclosure can also be arranged in a server or server cluster that is different from the server 102 and can communicate with the terminal device 101 and / or the server 102. In addition, the data processing method and apparatus in the embodiments of the present disclosure can also be executed by the terminal device 101, which is not limited in the embodiments of the present disclosure.

[0044] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.

[0045] Figure 2 A flowchart of a data processing method provided by an embodiment of the present disclosure. Figure 2 , the method comprising:

[0046] Step S201: Obtain a query request for a database.

[0047] In the embodiments of the present disclosure, mainly for knowledge graph databases, the database adopts a graph structure, which includes nodes, connecting edges for representing the relationship between nodes, and attribute information of nodes and / or edges. For this type of database, the query configuration information of the database can also be pre-configured according to the graph structure, and then when the corresponding query statement is generated after obtaining the query request, it can be generated based on the query configuration information.

[0048] The query configuration information may include the following: In one possible embodiment, 1) the query statement format is configured according to the nodes included in the database and the relationships between the nodes.

[0049] For example, based on the starting node, relationship, and end node in the database, the query statement format can be: starting node -> relationship -> end node. For example, if the nodes represent users and the relationships between nodes represent mobile phone numbers, the graph structure is represented as user -> mobile phone number -> user. Then the query statement format can be: user -> held mobile phone number (relationship) -> user, indicating that you want to query which users the user shares a mobile phone number with.

[0050] 2) Configure the attribute information of nodes and / or edges.

[0051] In the embodiments of the present disclosure, different attribute information required in the application scenario can be configured for nodes and / or edges, so that further screening and analysis can be performed during the query. For example, the attribute information of the user node includes the number of blacklisted contacts in the user's contacts, the number of non-overdue contacts in the user's contacts, etc. The user can be risk analyzed based on these characteristics, so that users with different risk characteristics can be queried.

[0052] 3) Configure the calculation method for query results.

[0053] In the embodiment of the present disclosure, the operation method of the query results can be understood as further operation of the query results obtained based on the above nodes, relationships and attributes. For example, the operation method can include aggregation operation, quantity statistics, maximum value, minimum value, etc., and there is no restriction on this.

[0054] 4) Configure the time segmentation method for query results.

[0055] Among them, the time segmentation method can be understood as a more detailed level of query result splitting. For example, for scenarios such as risk control, it may be necessary to split the query results more finely. Of course, other segmentation methods besides the time segmentation method can also be used, and this is not limited in the embodiments of the present disclosure.

[0056] For example, the time segmentation methods include within 1 hour, 3 hours, 1 day, 7 days, 1 month, 3 months, etc. Taking these six time segments as an example, the query results obtained can be further divided into query results corresponding to the six time segments.

[0057] In addition, it should be noted that in the embodiment of the present disclosure, for the test scenario of the database query strategy during the test phase, a target query strategy with better performance can be determined by testing and comparing multiple candidate query strategies. The target query strategy can then be applied to online scenarios to improve the query performance of the database.

[0058] Step S202: Parse the query request to obtain query parameters of the query request, and generate a query statement corresponding to the candidate query strategy according to the query parameters and the data structure of the database and the preset query logic of the candidate query strategy.

[0059] In the disclosed embodiment, multiple candidate query strategies can be preset according to needs. Different candidate query strategies have different query logics. By parsing the query request, query statements corresponding to the candidate query strategies are automatically generated, thereby improving efficiency.

[0060] In one possible embodiment, parsing the query request and obtaining query parameters of the query request may include: performing semantic analysis on the query request to determine the query intent; and obtaining query parameters associated with the data structure based on the query intent and the data structure of the database.

[0061] For example, in an embodiment of the present disclosure, a model for intent recognition can be pre-trained, so that a query request can be input into the model, and a semantic analysis of the query request can be performed based on the model to determine the query intent and obtain query parameters. For example, if the data structure of the database is a graph structure, the query parameters that can be obtained include node parameters, relationship parameters, operation methods, and attribute parameters of the node.

[0062] Step S203: Obtain a first value of the first indicator corresponding to the candidate query strategy by executing the query statement.

[0063] Furthermore, in practice, concurrent query requests often occur, and concurrent query requests will increase query pressure and have higher performance requirements. Therefore, in the embodiments of the present disclosure, the concurrent query requests of the candidate query strategy can also be tested. Specifically, the concurrency threshold of the query request is determined; when the query requests obtained reach the concurrency threshold, the query statements corresponding to each query request are executed in parallel, and then the first value of the first indicator corresponding to the candidate query strategy is determined.

[0064] Among them, in the embodiment of the present disclosure, the maximum number of concurrent requests for the online scenario can be determined through statistical analysis, and the concurrency threshold of the test phase can be set based on this. This can be more in line with the requirements of the actual scenario and improve the effectiveness and accuracy of the test. For example, it can be determined that the concurrency threshold is the maximum number of concurrent requests for the online scenario. For example, it can be determined that the concurrency threshold is greater than the maximum number of concurrent requests for the online scenario, or is a multiple of the maximum number of concurrent requests, etc., and there is no restriction on this.

[0065] Step S204: determining a target query strategy from the candidate query strategies according to the first value of the first indicator corresponding to the candidate query strategies.

[0066] For this step S204, the present disclosure provides a possible implementation method, for each candidate query strategy, according to the first value of each first indicator and its corresponding weight, obtain the score corresponding to the candidate query strategy; the candidate query strategy whose score meets the preset score condition is determined as the target query strategy.

[0067] Among them, the preset score condition is, for example, the maximum score, or the score being greater than a set threshold, etc., which is not limited in the embodiments of the present disclosure.

[0068] For example, equivalent scores corresponding to different value ranges of each first indicator are pre-set. The higher the equivalent score, the better the first indicator. Then, based on the first value of the first indicator obtained, the corresponding equivalent score is determined. The equivalent score of each first indicator is multiplied by the corresponding weight, and the products are added to obtain the scores corresponding to the candidate query strategies. Then, through comparison, the candidate query strategy with the highest score can be determined as the target query strategy.

[0069] For another example, the first value of each first indicator and its corresponding weight may be directly multiplied, and the products may be added to obtain scores corresponding to the candidate query strategies, thereby screening out target query strategies that meet preset score conditions.

[0070] In another possible embodiment, for each candidate query strategy, the first value of each first indicator is input into the evaluation model for feature extraction to obtain a feature vector corresponding to the first value of each first indicator; and based on the feature vector corresponding to the first value of each first indicator, an evaluation score corresponding to the candidate query strategy is obtained; and the candidate query strategy whose evaluation score meets the preset evaluation conditions is determined as the target query strategy.

[0071] In the embodiment of the present disclosure, a model can also be pre-trained, and the model is used to predict the evaluation score based on the first indicator. Then, when in use, the first indicator of the candidate query strategy and its corresponding first value can be input into the model, and the corresponding evaluation score can be output. Through comparative analysis, a better target query strategy can be determined, for example, the candidate query strategy with the largest evaluation score can be determined as the target query strategy.

[0072] Among them, the first indicator may include the central processing unit (CPU) utilization rate, processing or response time, etc., which is not limited in the embodiment of the present disclosure. For different first indicators, weights can be pre-configured, and then the optimal target query strategy can be determined through analysis and comparison of the first indicators. In this way, through automated analysis, the automation capability of query strategy determination is improved, and a better target query strategy can be determined specifically for different online usage scenarios, thereby improving the query performance of the database.

[0073] For example, there are 100 million nodes and 200 million relationships in the database. This query request needs to produce 2000 result features from the database. After determining the query statement, configure the weight of the first indicator. Then, by executing the query statements of each candidate query strategy, you can obtain the first value of the first indicator corresponding to each candidate query strategy. For example, the first value of the first indicator corresponding to candidate query strategy 1 includes: the highest CPU usage is 100%, 90% of the query request processing time is 150ms, 95% of the query request processing time is 200ms, 99% of the query request processing time is 500ms, and the average time of all query requests is 100ms; the first value of the first indicator corresponding to candidate query strategy 2 includes: the highest CPU usage is 20 %, 90% of the query requests take 50ms to process, 95% of the query requests take 60ms, 99% of the query requests take 80ms, and the average time consumption of all query requests is 30ms; the first value of the first indicator corresponding to candidate query strategy 3 includes: the highest CPU utilization rate is 100%, the processing time consumption of 90% of the query requests is 100ms, 95% of the query requests take 150ms, 99% of the query requests take 200ms, and the average time consumption of all query requests is 90ms; through comparative analysis, candidate query strategy 2 has the lowest highest CPU utilization rate and the lowest average time consumption. Candidate query strategy 2 has the best performance, and candidate query strategy 2 can be determined as the target query strategy.

[0074] In the disclosed embodiment, the query request can be automatically parsed, and the query statement of the candidate query strategy can be generated according to the query logic of the candidate query strategy, thereby improving the efficiency of query statement generation. Then, by executing the query statement, the first value of the first indicator corresponding to the candidate query strategy is obtained. According to the first value of the first indicator corresponding to the candidate query strategy, the target query strategy is determined from the candidate query strategy. In this way, there is no need to manually set the query strategy in advance. Through the analysis and comparison of the first indicator, the automatic determination of a better target query strategy is achieved, and based on the better target query strategy, the query performance of the database is also improved.

[0075] Furthermore, in the embodiment of the present disclosure, after the target query strategy is determined, the target query strategy can be published and used online. However, there may be differences between the online scenario and the test scenario. In order to further improve the query performance of the online scenario, the target query strategy can be dynamically converted according to the actual situation. For this purpose, the embodiment of the present disclosure also provides possible implementation methods, specifically:

[0076] During the application of the target query strategy, according to the set statistical period, the second value of the second indicator corresponding to the target query strategy and the third value of the second indicator corresponding to the preset first query strategy are obtained; based on the second value and the third value, the query strategy that meets the performance conditions within the statistical period is determined from the target query strategy and the first query strategy; if the query strategy that meets the performance conditions within a preset number of consecutive statistical periods is not the target query strategy, the target query strategy is replaced.

[0077] For example, taking the second indicator as average time consumption, the target query strategy of the current online scenario application is query strategy A, and the preset first query strategy includes query strategy B and query strategy C. Then, when query strategy A is applied in the online scenario, query strategy B and query strategy C can be executed synchronously, and statistics are counted every 20 minutes. Five consecutive statistics are performed to determine whether query strategy A needs to be replaced. If query strategy A has the best performance twice, query strategy B has the best performance three times, and query strategy C has the best performance zero times in the five statistics, then the query strategy of the online scenario application can be replaced from query strategy A to query strategy B.

[0078] Furthermore, in order to reduce resource consumption during query strategy execution, when dynamically changing query strategies, it is also possible to execute the preset first query strategy when it is determined that the second indicator of the target query strategy does not meet the performance conditions, and then determine a query strategy with better performance by comparing the values ​​of the second indicator of the target query strategy with that of the first query strategy to replace the currently applied target query strategy.

[0079] As mentioned above, a query request for the database is obtained. The query parameters of the query request may include node parameters, relationship parameters, operation methods, and attribute parameters of the node. Then, corresponding query statements can be generated for different candidate query strategies in step S202. Several possible embodiments are provided in the embodiments of the present disclosure.

[0080] In a possible embodiment, based on the query parameters and the data structure of the database, and in accordance with the preset query logic of the candidate query strategy, a query statement corresponding to the candidate query strategy is generated, including:

[0081] 1) Generate a first query statement based on node parameters and relationship parameters.

[0082] The query logic of the candidate query strategy in this embodiment is: group all starting nodes, relationships and end nodes, first query according to node parameters and relationship parameters to obtain query results, and then construct a query statement including attribute parameters based on the query results and attribute parameters to filter and judge the query results, and finally calculate the filtered results based on the calculation method to obtain the final query results.

[0083] For example, the nodes of the graph data represent users, and the relationships between the nodes are mobile phone numbers (phoneNum) or addresses (address). The first query statement generated can be:

[0084] match(User:n{id:***})->[phoneNum]->(User:n2)return n2

[0085] match(User:n{id:***})->[address]->(User:n2)return n2

[0086] The first query result returned is:

[0087] List <user>phoneList

[0088] List <user>addressList

[0089] Among them, User is the user, id is the node identifier, and the above two match statements represent querying all users who share the same mobile phone number or address with the user with the id from the database. The query result List returned is <user>phoneList means the list of all users found through phoneNum relationship. <user>addressList represents a list of all users found by address.

[0090] 2) Based on the first query statement, a query is performed in the database to obtain a query result set of the first query statement, and a second query statement is generated for each query result in the query result set according to the attribute parameters and filtering conditions of the node, where the filtering conditions represent the query results that are filtered out and meet the attribute parameters.

[0091] In the embodiment of the present disclosure, a second query statement can be generated for each query result in the query result set based on the attribute parameters. For example, if the attribute parameter is users who have been in contact within 7 days, all users in the query result set queried through the phoneNum relationship can be split, and a logical judgment statement (i.e., the second query statement) can be constructed corresponding to each user and the attribute parameter. Then, by running the second query statement, all the queried users can be further screened to obtain users that meet the attribute parameters.

[0092] 3) By running the second query statement, a screening result is obtained, and the screening result is calculated according to the calculation method to generate a query statement corresponding to the candidate query strategy.

[0093] The operation mode may be aggregation operation, quantity statistics, etc., and is not limited. For example, 100 users are filtered out by the second query statement, and these users can be aggregated and returned to the user to obtain the final query result for the query request.

[0094] In a possible embodiment, based on the query parameters and the data structure of the database, a query statement corresponding to the candidate query strategy is generated according to the query logic of the preset candidate query strategy, including: generating a fourth query statement based on the node parameters, relationship parameters, operation method and attribute parameters in the query request, the fourth query statement including multiple statements that use attribute parameters as filtering conditions and query based on node parameters and relationship parameters, and the multiple statements are combined in an operation manner.

[0095] The query logic of the candidate query strategy in this embodiment is: determine all the starting nodes and ending nodes based on how many query results are returned corresponding to the query request, and splice the attribute parameters and operation methods together through conditional judgment statements so that each query statement can be queried only once and the results of all query statements are returned together.

[0096] For example, if the attribute parameters are multiple time segments and the operation method is an aggregation operation (union), the generated fourth query statement can be:

[0097] match(User:n{id:***})->[phoneNum]->(n2)return{value:{"key":n2.**}}

[0098] Union

[0099] match(User:n{id:***})->[phoneNum]->(n2)with where regist_at>'2024-01-02'return{value:{"key2":n2.**}}

[0100] Union

[0101] match(User:n{id:***})->[phoneNum]->(n2)with where regist_at>'2024-02-02'return{value:{"key3":n2.**}}

[0102] Union

[0103] match(User:n{id:***})->[phoneNum]->(n2)with where regist_at>'2024-03-02'return{value:{"key4":n2.**}}

[0104]

[0105] Each match is a CQL query statement. Each match statement can be executed asynchronously. Each match statement obtains users that meet the attribute parameter conditions and then returns them together after aggregation.

[0106] In a possible embodiment, based on the query parameters and the data structure of the database, a query statement corresponding to the candidate query strategy is generated according to the query logic of the preset candidate query strategy, including: generating a fifth query statement based on the node parameters, relationship parameters, operation method and attribute parameters in the query request, the fifth query statement including a statement for querying based on the node parameters and relationship parameters, and a filtering condition statement based on all attribute parameters spliced ​​together.

[0107] The query logic of the candidate query strategy in this embodiment is: classify according to the starting node, relationship and end node of the query request, query according to the node parameters and relationship parameters in the query request, and splice all attribute parameters in the filter condition statement to return query results that meet the attribute parameters.

[0108] For example, if the attribute parameter is multiple time segments, the generated fifth query statement can be:

[0109] match(User:n{id:***})->[phoneNum]->(n2)

[0110] with where regist_at>'2024-01-02'

[0111] return {

[0112] value:{"key1":n2.**},

[0113] {"key2":n2.**},

[0114] {"key3":n2.**whith regist_at>'2024-01-02'},

[0115] {"key4":n2.**whith regist_at>'2024-02-02'},

[0116] {"key5":n2.**whith regist_at>'2024-03-02'},

[0117] {"key6":n2.**whith regist_at>'2024-04-02'},

[0118] {"key7":n2.**whith regist_at>'2024-05-02'}

[0119] }

[0120] The disclosed embodiment provides several different candidate query strategies, each with different query logic. Based on the query request and the data structure of the database, query statements corresponding to the candidate query strategy can be generated according to the query logic of the candidate query strategy, thereby improving efficiency.

[0121] It is understood that the above-mentioned various method embodiments mentioned in this disclosure can be combined with each other to form combined embodiments without violating the principle logic. Due to space limitations, this disclosure will not go into details. It is understood by those skilled in the art that in the above-mentioned methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0122] In addition, the present disclosure also provides a data processing device, an electronic device, a computer-readable storage medium, and a computer program product, all of which can be used to implement any data processing method provided by the present disclosure. The corresponding technical solutions and descriptions are referred to the corresponding records in the method section and will not be repeated here.

[0123] Figure 3 A block diagram of a data processing device provided in an embodiment of the present disclosure.

[0124] Reference Figure 3 , an embodiment of the present disclosure provides a data processing device, the data processing device comprising:

[0125] An acquisition module 31 is used to acquire a query request for a database;

[0126] The processing module 32 is configured to parse the query request, obtain query parameters of the query request, and generate a query statement corresponding to the candidate query strategy according to the query parameters and the data structure of the database and the query logic of the candidate query strategy;

[0127] The processing module 32 is configured to obtain a first value of the first indicator corresponding to the candidate query strategy by executing the query statement;

[0128] The determination module 33 is configured to determine a target query strategy from the candidate query strategies according to a first value of the first indicator corresponding to the candidate query strategy.

[0129] In a possible embodiment, when determining the target query strategy from the candidate query strategies according to the first value of the first indicator corresponding to the candidate query strategies, the determination module 33 is configured to:

[0130] For each candidate query strategy, obtaining a score corresponding to the candidate query strategy according to the first value of each first indicator and its corresponding weight;

[0131] The candidate query strategies whose scores meet the preset score conditions are determined as target query strategies.

[0132] A possible embodiment further includes an update module for:

[0133] During the application of the target query strategy, according to the set statistical period, a second value of the second indicator corresponding to the target query strategy and a third value of the second indicator corresponding to the preset first query strategy are obtained;

[0134] Determining, based on the second value and the third value, a query strategy that meets the performance condition within the statistical period from the target query strategy and the first query strategy;

[0135] If the query strategy that meets the performance condition within a preset number of consecutive statistical periods is not the target query strategy, the target query strategy is replaced.

[0136] In a possible embodiment, the data structure of the database adopts a graph structure, the graph structure includes nodes, connecting edges for representing relationships between nodes, and attribute information of nodes and / or edges, and the query parameters include node parameters, relationship parameters, operation methods, and attribute parameters of nodes;

[0137] When generating a query statement corresponding to the candidate query strategy according to the query parameters and the data structure of the database and the preset query logic of the candidate query strategy, the processing module 32 is used to:

[0138] Generate a first query statement according to the node parameters and the relationship parameters;

[0139] Performing a query in the database based on the first query statement to obtain a query result set of the first query statement, and generating a second query statement for each query result based on the attribute parameters of the node and a filtering condition; the filtering condition represents filtering out query results that meet the attribute parameters;

[0140] The second query statement is executed to obtain a screening result, and the screening result is operated on according to the operation method to generate a query statement corresponding to the candidate query strategy.

[0141] In a possible embodiment, when determining the target query strategy from the candidate query strategies according to the first value of the first indicator corresponding to the candidate query strategies, the determination module 33 is configured to:

[0142] For each candidate query strategy, input the first value of each first indicator into the evaluation model for feature extraction to obtain a feature vector corresponding to the first value of each first indicator;

[0143] and obtaining an evaluation score corresponding to the candidate query strategy according to the feature vector corresponding to the first value of each first indicator;

[0144] The candidate query strategies whose evaluation scores meet the preset evaluation conditions are determined as target query strategies.

[0145] In a possible embodiment, when parsing the query request to obtain the query parameters of the query request, the processing module 32 is configured to:

[0146] Performing semantic analysis on the query request to determine the query intent;

[0147] According to the query intention and the data structure of the database, query parameters associated with the data structure are obtained.

[0148] Each module in the above-mentioned data processing device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0149] Figure 4 A block diagram of an electronic device provided in an embodiment of the present disclosure.

[0150] Reference Figure 4 An embodiment of the present disclosure provides an electronic device, which includes: at least one processor 401; at least one memory 402, and one or more I / O interfaces 403, connected between the processor 401 and the memory 402; wherein the memory 402 stores one or more computer programs that can be executed by the at least one processor 401, and the one or more computer programs are executed by the at least one processor 401 to enable the at least one processor 401 to perform the above-mentioned data processing method.

[0151] Each module in the above-mentioned electronic device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0152] An embodiment of the present disclosure further provides a computer-readable storage medium, which may be a volatile or non-volatile computer-readable storage medium having a computer program stored thereon, wherein the computer program performs the above-mentioned data processing method when executed by a processor.

[0153] An embodiment of the present disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned data processing method.

[0154] It will be understood by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable storage medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium).

[0155] As is well known to those skilled in the art, the term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information (such as computer-readable program instructions, data structures, program modules or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technology, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, as is well known to those skilled in the art, communication media typically contains computer-readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0156] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.

[0157] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, and conventional procedural programming languages ​​such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLC), may be personalized by utilizing the state information of the computer-readable program instructions. The electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0158] The computer program product described herein may be implemented in hardware, software, or a combination thereof. In one embodiment, the computer program product is implemented as a computer storage medium. In another embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0159] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0160] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0161] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0162] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes 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 and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0163] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly indicated, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, it will be understood by those skilled in the art that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.< / user> < / user> < / user> < / user>

Claims

1. A data processing method, characterized in that: include: Get query requests for the database; Parsing the query request to obtain query parameters of the query request, and generating a query statement corresponding to the candidate query strategy according to the query parameters and the data structure of the database and the preset query logic of the candidate query strategy; Obtaining a first value of a first indicator corresponding to the candidate query strategy by executing the query statement; A target query strategy is determined from the candidate query strategies according to a first value of a first indicator corresponding to the candidate query strategies.

2. The method according to claim 1, characterized in that Determining a target query strategy from the candidate query strategies according to a first value of a first indicator corresponding to the candidate query strategy includes: For each candidate query strategy, obtaining a score corresponding to the candidate query strategy according to the first value of each first indicator and its corresponding weight; The candidate query strategies whose scores meet the preset score conditions are determined as target query strategies.

3. The method according to claim 1, characterized in that The method further comprises: During the application of the target query strategy, according to the set statistical period, a second value of the second indicator corresponding to the target query strategy and a third value of the second indicator corresponding to the preset first query strategy are obtained; Determining, based on the second value and the third value, a query strategy that meets the performance condition within the statistical period from the target query strategy and the first query strategy; If the query strategy that meets the performance condition within a preset number of consecutive statistical periods is not the target query strategy, the target query strategy is replaced.

4. The method according to any one of claims 1 to 3, characterized in that The data structure of the database adopts a graph structure, which includes nodes, connecting edges for representing the relationship between nodes, and attribute information of nodes and / or edges. The query parameters include node parameters, relationship parameters, operation mode, and attribute parameters of nodes; Generating a query statement corresponding to the candidate query strategy according to the query parameters and the data structure of the database and the preset query logic of the candidate query strategy includes: Generate a first query statement according to the node parameters and the relationship parameters; Performing a query in the database based on the first query statement to obtain a query result set of the first query statement, and generating a second query statement for each query result in the query result set according to the attribute parameters of the node and a filtering condition, wherein the filtering condition represents filtering out query results that meet the attribute parameters; The second query statement is executed to obtain a screening result, and the screening result is operated on according to the operation method to generate a query statement corresponding to the candidate query strategy.

5. The method according to claim 1, wherein Determining a target query strategy from the candidate query strategies according to a first value of a first indicator corresponding to the candidate query strategy includes: For each candidate query strategy, input the first value of each first indicator into the evaluation model for feature extraction to obtain a feature vector corresponding to the first value of each first indicator; and obtaining an evaluation score corresponding to the candidate query strategy according to the feature vector corresponding to the first value of each first indicator; The candidate query strategies whose evaluation scores meet the preset evaluation conditions are determined as target query strategies.

6. The method according to claim 1, characterized in that The parsing of the query request to obtain query parameters of the query request includes: Performing semantic analysis on the query request to determine the query intent; According to the query intention and the data structure of the database, query parameters associated with the data structure are obtained.

7. A data processing device, characterized in that: include: An acquisition module, used to obtain query requests for the database; a processing module, configured to parse the query request, obtain query parameters of the query request, and generate a query statement corresponding to the candidate query strategy according to the query parameters and the data structure of the database and the query logic of the preset candidate query strategy; The processing module is configured to obtain a first value of the first indicator corresponding to the candidate query strategy by executing the query statement; The determining module is configured to determine a target query strategy from the candidate query strategies according to a first value of a first indicator corresponding to the candidate query strategy.

8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor. The one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the data processing method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the data processing method according to any one of claims 1 to 6.

10. A computer program product, characterized in that A computer-readable storage medium comprising a computer-readable code or carrying a computer-readable code, wherein when the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the data processing method according to any one of claims 1 to 6.