Query result determination method and apparatus, storage medium, and electronic device
Patent Information
- Application Number
- CN202611006504.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-07
- Publication Date
- 2026-10-23
AI Technical Summary
[0005]本申请实施例提供了一种查询结果的确定方法、装置、存储介质及电子设备,以至少解决相关技术确定查询结果不准确的技术问题
[0020]通过本申请,在接收到根据目标用户输入的对查询对象进行查询的查询语句所生成的查询请求的情况下,可以根据查询请求构建问题语义树,之后可以确定问题语义树与多个参考语义树之间的语义距离,其中,一个参考语义树为基于一个目标对象的描述信息所构建的语义树,目标对象为不同业务领域中的数据对象,不同的参考语义树所对应的目标对象不同。最后可以根据确定出来的问题语义树和参考语义树之间的语义距离确定查询请求的查询结果。由于通过构建语义距离的量化指标,可以在生成查询结果的之前插入路由决策过程,可以精准识别用户的查询意图是否能够被已有指标语义树(即参考语义树)覆盖,避免了现有技术中无论是否存在标准答案,均强制利用大模型生成查询结果,忽略了现有已沉淀的指标进而导致的大模型输出查询结果时口径不一致等问题,即可以实现从盲目生成到精准复用的转变,可以从根本上解决现有技术中存在的确定查询结果不准确的问题,达到提高确定查询结果准确率的效果。
Smart Images

Figure CN122964094A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a method, apparatus, storage medium, and electronic device for determining query results. Background Technology
[0002] In related technologies, whether the solution for converting natural language to structured query language is generated directly based on a large-scale pre-trained model or based on retrieval enhancement, the core logic is to generate the target SQL statement in one step by directly or through context enhancement of the user's natural language question. This one-size-fits-all approach completely ignores the business metrics assets that already exist within the enterprise and have been rigorously verified.
[0003] This indicates that there is a technical problem in the relevant technologies that determines the inaccuracy of query results.
[0004] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0005] This application provides a method, apparatus, storage medium, and electronic device for determining query results, so as to at least solve the technical problem of inaccurate determination of query results in related technologies.
[0006] According to one aspect of the embodiments of this application, a method for determining query results is provided, comprising: constructing a question semantic tree based on a query request, wherein the query request is a query statement input by a target user, and the query statement includes a query object; determining the semantic distance between the question semantic tree and multiple reference semantic trees, wherein one of the reference semantic trees is a semantic tree constructed based on the description information of a target object, and the target objects corresponding to different reference semantic trees are different, and the target objects are data objects in different business domains; and determining the query result of the query request based on the semantic distance.
[0007] In one exemplary embodiment, before constructing the question semantic tree based on the query request, the method further includes: determining the description information of each target object; and constructing a reference semantic tree based on the description information of each target object.
[0008] In an exemplary embodiment, constructing a reference semantic tree based on the description information of each target object includes: performing the following operations for each target object to determine the reference semantic tree corresponding to the target object: determining the business domain to which the target object belongs, the entity objects included in the target object, the statistical granularity for statistical analysis of the entity objects, the filtering conditions for filtering the entity objects, and the analysis dimensions for analyzing the entity objects based on the tag information and the identification information of the target objects included in the description information; and determining the reference semantic tree based on the description information, the business domain, the entity objects, the statistical granularity, the filtering conditions, and the analysis dimensions.
[0009] In an exemplary embodiment, determining the reference semantic tree based on the description information, the business domain, the entity object, the statistical granularity, the filtering conditions, and the analysis dimension includes: determining the business domain as the root node of the reference semantic tree; determining the entity object and the statistical granularity as intermediate nodes of the reference semantic tree; determining the filtering conditions and the analysis dimension as leaf nodes of the reference semantic tree; determining the description information as the first child node of the reference semantic tree; and determining the semantic tree constructed by the root node, the intermediate nodes, the leaf nodes, and the first child node as the reference semantic tree.
[0010] In an exemplary embodiment, determining the semantic distance between the question semantic tree and a plurality of reference semantic trees includes: for each first reference semantic tree in the reference semantic trees, performing the following operations to determine the semantic distance between the first reference semantic tree and the question semantic tree, wherein the first reference semantic tree is any one of the plurality of reference semantic trees: determining a target operation to be performed to convert the question semantic tree into the first reference semantic tree, the target operation being used to adjust the nodes included in the question semantic tree; and determining the semantic distance based on the target operation.
[0011] In an exemplary embodiment, determining the semantic distance based on the target operation includes: determining the sub-operations included in the target operation; determining the sub-semantic distance corresponding to each sub-operation; and determining the sum of all the sub-semantic distances as the semantic distance.
[0012] In an exemplary embodiment, determining the sub-semantic distance corresponding to each sub-operation includes: when the sub-operation is a replacement operation, determining the replacement object and the replaced object of the replacement operation; when the semantics of the replacement object and the replaced object satisfy a first preset condition, and the first node position of the replacement object in the second reference semantic tree is the same as the second node position of the replaced object in the question semantic tree, determining the sub-semantic distance as a first value, wherein the second reference semantic tree is a semantic tree included in a plurality of reference semantic trees; when the semantics of the replacement object and the replaced object satisfy the first preset condition, and the first node position of the replacement object in the second reference semantic tree is not the same as the second node position of the replaced object in the question semantic tree, determining the sub-semantic distance as a second value; when the semantics of the replacement object and the replaced object do not satisfy the first preset condition, determining the sub-semantic distance as a third value, wherein the first value is less than the second value, and the second value is less than the third value.
[0013] In an exemplary embodiment, determining the sub-semantic distance corresponding to each sub-operation includes: when the sub-operation is an insertion operation, determining a first node type of the inserted object of the insertion operation; when the first node type is a root node or a child node, determining the sub-semantic distance as a fourth value; when the first node type is an intermediate node or a leaf node, determining the sub-semantic distance as a fifth value, wherein the fifth value is less than the fourth value.
[0014] In an exemplary embodiment, determining the sub-semantic distance corresponding to each sub-operation includes: when the sub-operation is a deletion operation, determining the second node type of the deleted object of the deletion operation; when the second node type is a root node or a child node, determining the sub-semantic distance as a sixth value; when the second node type is an intermediate node or a leaf node, determining the sub-semantic distance as a seventh value, wherein the sixth value is less than the seventh value.
[0015] In an exemplary embodiment, determining the query result of the query request based on the semantic distance includes: if a target semantic distance is less than a preset threshold among multiple semantic distances, determining the third reference semantic tree corresponding to the smallest semantic distance included in the target semantic distance; determining the query instruction template included in the description information corresponding to the second child node included in the third reference semantic tree; filling the query instruction template with the query request to generate a target query instruction; and determining the query result based on the target query instruction.
[0016] According to another aspect of the embodiments of this application, a device for determining query results is also provided, comprising: a construction module, configured to construct a question semantic tree based on a query request, wherein the query request is a query statement input by a target user, and the query statement includes a query object; a first determination module, configured to determine the semantic distance between the question semantic tree and multiple reference semantic trees, wherein one of the reference semantic trees is a semantic tree constructed based on the description information of a target object, and the target objects corresponding to different reference semantic trees are different, and the target objects are data objects in different business domains; and a second determination module, configured to determine the query result of the query request based on the semantic distance.
[0017] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed by a processor.
[0018] According to another aspect of the embodiments of this application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the steps in any of the method embodiments described above.
[0019] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to perform the steps of any of the above method embodiments through the computer program.
[0020] This application, upon receiving a query request generated from a query statement input by a target user, allows for the construction of a question semantic tree based on the query request. The semantic distance between this question semantic tree and multiple reference semantic trees can then be determined. Each reference semantic tree is constructed based on the description information of a target object, which can be a data object from different business domains; different reference semantic trees correspond to different target objects. Finally, the query result is determined based on the semantic distance between the determined question semantic tree and the reference semantic trees. By constructing a quantitative indicator of semantic distance, a routing decision process can be inserted before generating the query result. This allows for precise identification of whether the user's query intent can be covered by existing indicator semantic trees (i.e., reference semantic trees). This avoids the problems in existing technologies where large models are forcibly used to generate query results regardless of the existence of a standard answer, ignoring existing, established indicators and leading to inconsistencies in the output of query results. This achieves a shift from blind generation to precise reuse, fundamentally solving the problem of inaccurate query result determination in existing technologies and improving the accuracy of query result determination. Attached Figure Description
[0021] Figure 1 This is a schematic diagram illustrating an application scenario of a method for determining query results according to an embodiment of this application;
[0022] Figure 2 This is a flowchart illustrating an optional method for determining query results according to an embodiment of this application;
[0023] Figure 3 This is a flowchart illustrating the method for determining the query results in this optional example;
[0024] Figure 4 This is a structural block diagram of an optional query result determination device according to an embodiment of this application;
[0025] Figure 5 This is a computer system architecture block diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] According to one aspect of the embodiments of this application, a method for determining query results is provided. Optionally, in this embodiment, the above-described method for determining query results may be applied, but is not limited to, to applications such as... Figure 1 The hardware environment shown includes terminal device 102 and server 104. Server 104 can be connected to terminal device 102 via a network and can be used to provide services (e.g., application services, etc.) to terminal device 102 or clients installed on terminal device 102. A database can be set up on server 104 or independently of server 104 to provide data storage services for server 104.
[0029] The aforementioned network may include, but is not limited to, at least one of the following: wired network and wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network (WAN), metropolitan area network (MAN), and local area network (LAN). The aforementioned wireless network may include, but is not limited to, at least one of the following: Wireless Fidelity (WIFI) and Bluetooth. Terminal device 102 may be, but is not limited to, a personal computer (PC), mobile phone, tablet computer, etc. Server 104 may be, but is not limited to, a cloud server, server cluster, or other server types.
[0030] The query result determination method of this application embodiment can be executed by server 104, terminal device 102, or jointly by server 104 and terminal device 102. Alternatively, the query result determination method of this application embodiment executed by terminal device 102 can also be executed by a client installed on it.
[0031] Figure 2 This is a flowchart illustrating an optional method for determining query results according to an embodiment of this application, such as... Figure 2 As shown, the process of this method may include the following steps:
[0032] Step S202: Construct a semantic tree for the question based on the query request, wherein the query request is a query statement input by the target user and the query statement includes a query object;
[0033] The query result determination method in this embodiment can be applied to various technical fields such as finance, e-commerce, and the internet, and can be specifically applied to specific scenarios of Natural Language to Structured Query Language (NL2SQL). In the process of enterprise digital transformation, NL2SQL technology has become a key bridge connecting business personnel and data warehouses. However, existing technologies often suffer from problems such as a single SQL generation path, insufficient knowledge utilization, lack of asset accumulation and feedback loops, and potential inconsistencies. The single SQL generation path can be understood as directly generating the target SQL statement from the user's natural language question, either directly or through context enhancement. Whether it's a direct generation scheme based on a large-scale pre-trained model or a retrieval-augmented generation (RAG) scheme... The Generation approach, with its single SQL generation path, completely ignores the enterprise's existing, rigorously validated business metrics assets. Insufficient knowledge utilization can be understood as using existing SQL statement generation systems and multi-source knowledge bases (schema vector libraries, business knowledge vector libraries, etc.) for collaborative retrieval to enhance SQL generation. While these methods aim to improve SQL generation, they fail to address the fundamental routing decision: when should validated metrics be used directly, and when is SQL generation necessary? The lack of an asset accumulation feedback loop can be understood as insufficient feedback based on successful SQL execution. Using failure modes to update the knowledge base (such as "answer book" and "error book") as feedback learning fails to systematically accumulate, verify, and transform a successful, dynamically generated SQL query into a reusable, standardized indicator asset for the enterprise. It can only make minor adjustments to the parameters of the retriever and generator, which will limit the system's intelligence to temporary queries and prevent the value leap from data querying to knowledge condensation. The potential risk of inconsistent interpretation can be understood as prioritizing the generation of SQL by large models. Large models are prone to context bias or model illusion, which can lead to different people obtaining results based on different SQL interpretations for the same business problem at different times, thus triggering a data trust crisis.
[0034] To at least partially address the aforementioned technical issues, in this embodiment, when a user initiates a natural language query (i.e., the query statement mentioned above), natural language processing technology can be used to perform named entity recognition and intent parsing on the received query request. This identifies the business domain, query object, analysis dimension, time and location constraints, and analysis intent within the query request, thereby constructing a semantic tree reflecting the query intent. During the construction of the semantic tree, the business domain can be determined as the root node, the query object and time and location constraints as intermediate nodes, and the analysis dimension and analysis intent (filtering conditions) as leaf nodes. For example, if a user's query request is "Please help me check the total amount of personal loans disbursed through mobile banking channels in East China last month," the identified business domain is the financial domain, the query object is the total amount of loans disbursed, the time and location constraints are East China last month, the analysis intent (filtering condition) is mobile banking channels, and the analysis dimension is personal loans. The constructed semantic tree would then have the financial domain as the root node, the total amount of loans disbursed in East China last month as the intermediate node, and the personal loans disbursed through mobile banking channels as the leaf node.
[0035] Step S204: Determine the semantic distance between the problem semantic tree and multiple reference semantic trees, wherein a reference semantic tree is a semantic tree constructed based on the description information of a target object, and the target objects corresponding to different reference semantic trees are different, and the target objects are data objects in different business domains;
[0036] In at least one embodiment, semantic distance can be understood as the degree of overlap between the question semantic tree and the reference semantic tree in terms of topological structure. Specifically, it can be understood as an indicator that measures the similarity between the "query object that the user wants to query" and the "standard answer that is already in the system" (i.e., the reference semantic tree) in terms of logical structure and core business.
[0037] In at least one embodiment, semantic distance can be determined using a hybrid scoring method based on vector phase velocity and tree structure constraints: Each node of the question semantic tree and the indicator semantic tree can be converted into a vector representation using a pre-trained language model (such as BERT, RoBERTa, etc.), the similarity between nodes and the topological similarity of the trees can be calculated, and then the similarity between nodes and the topological similarity of the trees can be weighted and summed. The weighted total score is then used to evaluate the semantic distance. Alternatively, a dependency syntax path matching method can be used. This involves extracting dependency paths between keywords and their core arguments from the question semantic tree and the indicator semantic tree, and then comparing the edit distance or overlap of the two paths. For example, if "time" and "metric object" are a modifying relationship in the question semantic tree, but a parallel relationship in the indicator tree, then a structural mismatch can be determined.
[0038] Step S206: Determine the query result of the query request based on the semantic distance.
[0039] In at least one embodiment, a routing decision threshold can be preset. If the semantic distance of a subtree is less than the threshold, it can be determined as a high-confidence hit, and the query result can be determined based on the subtree. If the semantic edit distance of all subtrees is greater than or equal to the threshold, it can be determined as a low-confidence miss.
[0040] In at least one embodiment, when the semantic distance determines that the question semantic tree and the reference semantic tree are low-confidence misses, a closed-loop process including knowledge enhancement generation, manual verification, and candidate indicator accumulation can be initiated. This involves sorting the determined semantic distances from smallest to largest, recalling several predefined indicators from the indicator semantic tree that are most similar to but not fully matched with the current query request, and extracting the full metadata and underlying SQL calculation logic of each predefined indicator as strong contextual reference information. This strong contextual reference information can be combined with the database technology metadata and enterprise data standards and specifications of the data sources involved in the current query request to construct hierarchical structured enhancement prompts. These structured enhancement prompts may include instructions such as: "Please strictly refer to the definitions and SQL implementation logic of the above similar predefined indicators to generate a complete SQL statement to answer the user's query request." The structured enhancement prompts can then be input into a large language model to generate the first SQL statement.
[0041] In at least one embodiment, a first SQL statement can be executed to obtain query results, which can then be visualized and rendered. Simultaneously, a caliber review and confirmation panel can be created in the user interface. This panel can be understood as a key interactive interface connecting generation and data retention. The panel can simultaneously display the generated first SQL statement text, a natural language explanation of the SQL statement logic, a comparison view of the differences between the SQL statement and the most similar predefined indicator in terms of data source table and filtering conditions, and functional controls for user operation. Specifically, the caliber review and confirmation panel can include three areas: a generated SQL and natural language explanation area, a difference comparison area with the most similar indicator, and an operation function area. The SQL generation and natural language interpretation areas display the complete text of the first SQL statement generated by the large language model, along with the system's natural language description of the SQL logic. For example: "This query aggregates and calculates the percentage of refunded order amounts from the order fact table and refund fact table by payment method, and then left-joins it with the daily development volume of the e-channel." The comparison area with the most similar metric allows for a point-by-point comparison of the current SQL's FROM clause, WHERE condition, and GROUP BY field with the standard SQL of the most similar predefined metric (e.g., daily product development volume of the e-channel). Newly added data tables and adjusted filter conditions are highlighted or marked with different colors. The operation function area provides two button controls: button one, "Accept this caliber and add it as a new metric," triggers the candidate metric generation process; button two, "Logic error, needs correction," pops up a text box allowing users to input corrections, and the system regenerates the SQL based on the feedback.
[0042] In at least one embodiment, the user can click to approve this caliber in the operation function area. After receiving the instruction from the user through the function control provided in the operation function area to confirm that the data retrieval logic of the first SQL statement is correct, the original question text Q of the user's original query, the first SQL statement S_final confirmed by the user, and the retrieved list of similar indicators can be packaged directly. The large language model is then called to reverse parse the information and generate a candidate indicator definition. That is, prompt words can be input into the large language model. For example, based on the following information "Please output indicator name, business caliber definition, calculation logic description, related dimensions, original question: {Q}, confirmed SQL: {S_final}, reference indicators: {similar indicator information}", a candidate business indicator definition is generated. The candidate indicator definition includes: candidate indicator name, candidate indicator caliber definition, candidate indicator calculation logic, and related dimension information. Then, other attributes of the candidate indicator definition can be automatically filled in and its status marked as "pending review".
[0043] In at least one embodiment, candidate indicator definitions marked as "pending review" can also be pushed to a pre-defined business review node for review by data governance personnel or business domain leaders with approval authority. Specifically, data administrators can view the complete information, source SQL, confirmer, and confirmation time of candidate indicators in the background. After receiving the approval instruction, the registration API of the indicator service can be called to register the candidate indicator definition and its associated complete data retrieval logic information as a new predefined indicator and write it into the indicator library of the indicator system. This completes the entire process from temporary query to standard asset. In addition, the newly registered indicator can be retrieved and updated into the indicator semantic tree by a scheduled synchronization task in subsequent tasks, so that it can be directly hit and reused in subsequent queries.
[0044] This application, upon receiving a query request generated from a query statement input by a target user, allows for the construction of a question semantic tree based on the query request. The semantic distance between this question semantic tree and multiple reference semantic trees can then be determined. Each reference semantic tree is constructed based on the description information of a target object, which can be a data object from different business domains; different reference semantic trees correspond to different target objects. Finally, the query result is determined based on the semantic distance between the determined question semantic tree and the reference semantic trees. By constructing a quantitative indicator of semantic distance, a routing decision process can be inserted before generating the query result. This allows for precise identification of whether the user's query intent can be covered by existing indicator semantic trees (i.e., reference semantic trees). This avoids the problems in existing technologies where large models are forcibly used to generate query results regardless of the existence of a standard answer, ignoring existing, established indicators and leading to inconsistencies in the output of query results. This achieves a shift from blind generation to precise reuse, fundamentally solving the problem of inaccurate query result determination in existing technologies and improving the accuracy of query result determination.
[0045] Optionally, the entity performing the above steps may be a client, server, terminal, or other device with similar processing capabilities, but is not limited to these.
[0046] In one exemplary embodiment, before constructing the question semantic tree based on the query request, the method further includes: determining the description information of each target object; and constructing a reference semantic tree based on the description information of each target object.
[0047] In at least one embodiment, the full description information of all registered predefined metrics (i.e., the aforementioned target objects) can be obtained in advance by calling the API provided by the metrics service. This full description information may include, but is not limited to, the unique identifier of the metric, the metric name, the metric definition, the metric data retrieval logic, the associated dimensions, and the acceptable query parameters. The description information can then be identified and analyzed to construct a reference semantic tree for each target object based on its full description information. An example of the data structure returned for each metric is shown below: {
[0048] "metric_id":"M001",
[0049] "metric_name":"Daily Product Development Volume of Electric Channel",
[0050] "definition":"Statistical analysis of the number of products developed by each organization through electronic channels within a specified period",
[0051] "execution_logic_type":"sql",
[0052] "execution_logic":"SELECT a.org_name,SUM(a.index_value)AS cnt FROMapp_ld_index_day a JOIN org b ON a.org_id=b.id WHERE a.index_id='D033' ANDa.month='{stat_month}' AND b.org_name='{org_name}'GROUP BY a.org_name",
[0053] "related_dimensions":["organization","time"],"query_params":["stat_month","org_name"]
[0054] In this table, "metric_id":"M001" is the unique identifier of the above indicator, "metric_name":"Daily Product Development Volume of Electronic Channels" is the name of the above indicator, "definition":"The number of products developed by each organization through electronic channels within the specified period", and "execution_logic_type":"sql" is the definition of the above indicator, "execution_logic": "SELECT a.org_name, SUM(a.index_value) AS cnt FROM app_ld_index_day aJOIN org b ON a.org_id=b.id WHERE a.index_id='D033' AND a.month='{stat_month}'AND b.org_name='{org_name}'GROUP BY a.org_name" is the data retrieval logic information of the above indicator, "related_dimensions":["organization","time"] is the related dimension of the above, and "query_params":["stat_month", "org_name"] is the acceptable query parameter of the above.
[0055] This embodiment transforms unstructured natural language descriptions into structured semantic knowledge graphs by pre-parsed the descriptive information of target objects and constructing a reference semantic tree. This not only ensures that query intent parsing and indicator matching are performed within a unified semantic space, significantly improving the accuracy and efficiency of semantic distance calculation, but also enables the system to complete deep indexing and association of massive indicator assets before the query occurs. This supports millisecond-level real-time routing decisions and effectively solves the technical problems of low matching accuracy, high response latency, and inconsistent standards caused by the lack of structured references in traditional technologies.
[0056] In an exemplary embodiment, constructing a reference semantic tree based on the description information of each target object includes: performing the following operations for each target object to determine the reference semantic tree corresponding to the target object: determining the business domain to which the target object belongs, the entity objects included in the target object, the statistical granularity for statistical analysis of the entity objects, the filtering conditions for filtering the entity objects, and the analysis dimensions for analyzing the entity objects based on the tag information and the identification information of the target objects included in the description information; and determining the reference semantic tree based on the description information, the business domain, the entity objects, the statistical granularity, the filtering conditions, and the analysis dimensions.
[0057] In at least one embodiment, dependency parsing and semantic entity recognition can be performed on the unique identifier and indicator name (i.e., the aforementioned identifier information) and indicator definition (i.e., the aforementioned label information) included in the description information of each target object, to extract the business domain, core metric object (i.e., the aforementioned entity object), statistical granularity (which may include time dimension and spatial dimension), filtering conditions and analysis dimensions, and then the atomic semantic nodes in the reference semantic tree are determined based on the business domain, core metric object, statistical granularity, filtering conditions and analysis dimensions. Here, "business domain" can be understood as the business segment or functional scope to which the indicator belongs, which may include transaction domain, user domain, financial domain, logistics domain, etc.; "core measurement object" can be understood as the core business entity of the indicator, such as: order, product, amount, sales volume, user, etc.; "statistical granularity" can be understood as the time or spatial dimension of data aggregation, where the time dimension may include but is not limited to day, week, month, year, etc., and the spatial dimension may include but is not limited to a certain region, a certain city, a certain company, etc.; "filtering conditions" can be understood as the scope of limitation imposed on the core measurement object, such as: online channel, payment status, product category is electronic product, etc.; "analysis dimension" can be understood as the aspect or grouping method of data display, such as: by province, by brand, by time period, etc. Taking "daily product development volume of e-channels" as an example, the semantic parsing of the indicator's identification information "daily product development volume of e-channels" and tag information "the number of products developed by each organization through electronic channels within the specified statistical period" can be abstracted into the following semantic nodes: [Business domain: channel], [Measurement object: development volume], [Statistical granularity: day], [Channel type (filtering condition): electronic channel], [Measurement content (analysis dimension): product].
[0058] This embodiment achieves the automatic transformation of unstructured indicator definitions into standardized, hierarchical semantic models by accurately extracting five core semantic elements—business domain, entity object, statistical granularity, filtering conditions, and analysis dimensions—from the tag and identification information of the target object, and mapping them into a structured reference semantic tree. This fine-grained structured decomposition not only ensures the complete preservation and unambiguous expression of indicator logic, but also provides a high-fidelity comparison benchmark for subsequent routing decisions. The system can accurately identify the degree of matching between user intent and existing indicators by calculating the structured edit distance between the question semantic tree and the reference semantic tree, thereby significantly improving the accuracy of indicator reuse and the efficiency of routing decisions while ensuring the consistency of data query criteria.
[0059] In an exemplary embodiment, determining the reference semantic tree based on the description information, the business domain, the entity object, the statistical granularity, the filtering conditions, and the analysis dimension includes: determining the business domain as the root node of the reference semantic tree; determining the entity object and the statistical granularity as intermediate nodes of the reference semantic tree; determining the filtering conditions and the analysis dimension as leaf nodes of the reference semantic tree; determining the description information as the first child node of the reference semantic tree; and determining the semantic tree constructed by the root node, the intermediate nodes, the leaf nodes, and the first child node as the reference semantic tree.
[0060] In at least one embodiment, after determining the business domain, entity object, statistical granularity, filtering conditions, and analysis dimensions based on the description information, the semantic nodes of all indicators can be aggregated by business to form a multi-branch semantic tree. The business domain is the root node of the reference semantic tree, the metric object and statistical granularity are the intermediate nodes of the reference semantic tree, and the filtering conditions and analysis dimensions are the leaf nodes of the reference semantic tree. Each leaf node has a first child node attached, which is the full metadata corresponding to the indicator.
[0061] This embodiment constructs a hierarchical reference semantic tree structure with the business domain as the root, entity objects and statistical granularity as intermediate branches, and filtering conditions and analysis dimensions as leaf nodes, with complete descriptive information mounted as the first child node. This achieves a layer-by-layer refinement and spatial mapping of indicator logic from the macro business domain to the micro execution details. It not only intuitively reflects the logical dependencies between the semantic elements within the indicator, making the topology of the tree structure highly consistent with the business logic, but also provides a clear path guide for the subsequent calculation of the structured editing distance between the semantic tree and the indicator subtree. This enables more accurate quantification of the matching differences between user query intent and existing indicators in terms of business level, statistical granularity, and filtering dimensions, significantly improving the semantic understanding depth and matching accuracy of routing decisions.
[0062] In an exemplary embodiment, determining the semantic distance between the question semantic tree and a plurality of reference semantic trees includes: for each first reference semantic tree in the reference semantic trees, performing the following operations to determine the semantic distance between the first reference semantic tree and the question semantic tree, wherein the first reference semantic tree is any one of the plurality of reference semantic trees: determining a target operation to be performed to convert the question semantic tree into the first reference semantic tree, the target operation being used to adjust the nodes included in the question semantic tree; and determining the semantic distance based on the target operation.
[0063] In at least one embodiment, semantic distance can be understood as defining a structured semantic tree edit distance D(T_q, T_m), which can be expressed as the minimum operation cost of the target operation required to transform the problem semantic tree T_q into a subtree T_m of the reference index semantic tree (i.e., the aforementioned first reference semantic tree). Finally, the semantic distance can be determined based on the number of target operations or the degree of adjustment of the target operations. The target operation is to adjust the nodes of the problem semantic tree T_q to transform it into a subtree of the reference index semantic tree.
[0064] In this embodiment, by employing a quantization algorithm based on tree structure edit distance, the semantic matching process between natural language query intent and standardized indicator structure is transformed into calculating the minimum operational cost required to convert the question semantic tree into the target reference semantic tree, thereby enabling precise measurement of the degree of difference between the two in terms of node addition, deletion, modification and replacement.
[0065] In an exemplary embodiment, determining the semantic distance based on the target operation includes: determining the sub-operations included in the target operation; determining the sub-semantic distance corresponding to each sub-operation; and determining the sum of all the sub-semantic distances as the semantic distance.
[0066] In at least one embodiment, the structured semantic edit distance between any subtree in the problem semantic tree and the indicator semantic tree is defined by a target operation, i.e., by the weighted sum of the costs of target operations on the path that transforms the problem semantic tree into a subtree. A target operation may include one or more sub-operations, each corresponding to a sub-semantic distance. The semantic distance is determined by the sum of the sub-semantic distances of all sub-operations. Sub-operations can be node insertion, node deletion, or node replacement. A node insertion operation can be understood as inserting a missing semantic node into the problem semantic tree; a node deletion operation can be understood as deleting a redundant semantic node from the problem semantic tree; and a node replacement operation can be understood as replacing a node in the problem semantic tree with its corresponding node in the indicator semantic tree. The sub-semantic distances corresponding to each sub-operation can be the same or different, depending on the type of node being operated on. For example, the operation cost for core metric object nodes and business entity nodes can be assigned a higher weight than that for general time nodes and location nodes.
[0067] This embodiment achieves fine-grained quantitative control over semantic matching accuracy by subdividing the target operation into specific sub-operations and assigning corresponding sub-semantic distances to each, and finally accumulating them to obtain the total semantic distance. This accumulation mechanism allows the system to set different weight costs for different operations based on business importance, enabling the semantic distance calculation to accurately reflect the degree of deviation between the user's query intent and the indicator definition on key business elements. This provides a more discriminative confidence index for routing decisions, effectively avoiding misjudgments caused by matching a single indicator, and improving the accuracy of indicator reuse and the scientific nature of system decision-making.
[0068] In an exemplary embodiment, determining the sub-semantic distance corresponding to each sub-operation includes: when the sub-operation is a replacement operation, determining the replacement object and the replaced object of the replacement operation; when the semantics of the replacement object and the replaced object satisfy a first preset condition, and the first node position of the replacement object in the second reference semantic tree is the same as the second node position of the replaced object in the question semantic tree, determining the sub-semantic distance as a first value, wherein the second reference semantic tree is a semantic tree included in a plurality of reference semantic trees; when the semantics of the replacement object and the replaced object satisfy the first preset condition, and the first node position of the replacement object in the second reference semantic tree is not the same as the second node position of the replaced object in the question semantic tree, determining the sub-semantic distance as a second value; when the semantics of the replacement object and the replaced object do not satisfy the first preset condition, determining the sub-semantic distance as a third value, wherein the first value is less than the second value, and the second value is less than the third value.
[0069] In at least one embodiment, when the sub-operation is a substitution operation, the object to be replaced in the problem semantic tree and the substitution object in the second reference semantic tree can be determined respectively. Then, the semantic relationship between the object to be replaced and the substitution object, as well as the relationship between the second node position of the object to be replaced in the problem semantic tree and the first node position of the substitution object in the second reference semantic tree, can be determined. If the substitution object and the object to be replaced have the same semantics or are synonyms, it can be determined that they satisfy a first preset condition. Furthermore, it can be determined whether the first node position and the second node position are the same, i.e., whether the operated nodes belong to the same level.
[0070] In at least one embodiment, if the replacement object and the replaced object have the same semantics or are synonyms (i.e., satisfy the first preset condition), and the first node position and the second node position are the same (i.e., the nodes belong to the same level), then the replacement cost (i.e., sub-semantic distance) can be determined to be a first value of 0; if the replacement object and the replaced object satisfy the first preset condition, but the first node position and the second node position are not the same (i.e., the nodes do not belong to the same level), then the replacement cost (i.e., sub-semantic distance) can be determined to be a second value of 2; if the replacement object and the replaced object have completely different semantics, then the replacement cost (i.e., sub-semantic distance) can be determined to be a third value of 5. The first, second, and third values are merely illustrative examples and can be adjusted according to specific circumstances. Example 1: A certain indicator subtree (i.e., the second reference semantic tree) has the structure: [Root node: Transaction domain], [Intermediate node: Daily GVM (Gross Merchandise Volume)], [Leaf node: Online channel]; the question semantic tree has the structure: [Root node: Transaction domain], [Intermediate node: Daily transaction volume], [Leaf node: Online channel]. The replacement operation is to replace [Intermediate node: Daily transaction volume] with [Intermediate node: Daily GVM (Gross Merchandise Volume)]. The nodes have the same semantics and are in the same position; they are both intermediate nodes, so the operation cost is 0. Example 2: A certain indicator subtree (i.e., the second reference semantic tree) has the structure: [Root node: Transaction domain], [Intermediate node: Daily order quantity], [Leaf node: Status = Completed]; the question semantic tree has the structure: [Root node: Transaction domain], [Intermediate node: Daily refund amount], [Leaf node: Status = Refunded]. The intermediate node and leaf node to be replaced have completely different semantics, so the replacement cost is 5.
[0071] In this embodiment, by constructing a dual evaluation mechanism based on semantic similarity and node position consistency, the cost of replacement operation is subdivided into three levels, realizing a fine quantification of semantic matching accuracy. This provides a highly discriminative confidence index for routing decisions, ensuring that only truly semantically and structurally consistent indicators are reused first, greatly improving the accuracy of query results and the consistency of data.
[0072] In an exemplary embodiment, determining the sub-semantic distance corresponding to each sub-operation includes: when the sub-operation is an insertion operation, determining a first node type of the inserted object of the insertion operation; when the first node type is a root node or a child node, determining the sub-semantic distance as a fourth value; when the first node type is an intermediate node or a leaf node, determining the sub-semantic distance as a fifth value, wherein the fifth value is less than the fourth value.
[0073] In at least one embodiment, when the sub-operation is an insertion operation, the type of the first node of the insertion object can be determined. Different nodes correspond to different operation costs. That is, if the type of the first node of the insertion object is a root node or a child node (e.g., a specific business entity node), the corresponding operation cost (i.e., sub-semantic distance) can be the fourth value 3. If the type of the first node of the insertion object is an intermediate node or a leaf node (e.g., a general time node), the corresponding operation cost (i.e., sub-semantic distance) can be the fifth value 1. For example, if the subtree structure of a certain indicator is: [root node: user domain], [intermediate node: monthly user retention rate], [leaf node: newly registered users]; and the structure of the problem semantic tree is: [root node: user domain], [intermediate node: user retention rate], [leaf node: newly registered users], then the insertion object is [intermediate node: monthly], and the insertion cost can be the fifth value 1.
[0074] This embodiment, by distinguishing the hierarchical position of the inserted node in the tree structure and assigning differentiated cost weights, can achieve an accurate quantitative assessment of the degree of incompleteness of the user's query intent. Thus, while ensuring high confidence hit rate, it can reasonably tolerate the absence of non-core elements, effectively balancing the coverage and accuracy of indicator reuse.
[0075] In an exemplary embodiment, determining the sub-semantic distance corresponding to each sub-operation includes: when the sub-operation is a deletion operation, determining the second node type of the deleted object of the deletion operation; when the second node type is a root node or a child node, determining the sub-semantic distance as a sixth value; when the second node type is an intermediate node or a leaf node, determining the sub-semantic distance as a seventh value, wherein the sixth value is less than the seventh value.
[0076] In at least one embodiment, when the sub-operation is a deletion operation, the second node type of the deleted object can be determined. Different nodes correspond to different operation costs. That is, if the second node type of the deleted object is a root node or a child node (e.g., a specific business entity node), the corresponding operation cost (i.e., sub-semantic distance) can be the sixth value 4. If the second node type of the deleted object is an intermediate node or a leaf node (e.g., a general time node), the corresponding operation cost (i.e., sub-semantic distance) can be the seventh value 2.
[0077] This embodiment enables the system to keenly capture key business filtering conditions in user queries, ensuring that data caliber deviations are not caused by ignoring specific user requirements when reusing indicators, thus significantly improving the usability and business relevance of query results.
[0078] In an exemplary embodiment, determining the query result of the query request based on the semantic distance includes: if a target semantic distance is less than a preset threshold among multiple semantic distances, determining the third reference semantic tree corresponding to the smallest semantic distance included in the target semantic distance; determining the query instruction template included in the description information corresponding to the second child node included in the third reference semantic tree; filling the query instruction template with the query request to generate a target query instruction; and determining the query result based on the target query instruction.
[0079] In at least one embodiment, a routing decision threshold can be set. If the semantic edit distance (i.e., the target semantic distance mentioned above) of some subtrees is less than the threshold, the third reference semantic tree corresponding to the minimum semantic distance D_min can be determined. Then, the indicator retrieval logic information (i.e., the query instruction template mentioned above) included in the description information attached to the second child node in the third reference semantic tree can be extracted. The indicator retrieval logic information can be understood as a target query instruction template that can be directly consumed by the executor. It can be a pre-compiled Structured Query Language (SQL) template, or a request template for calling the indicator service data query API, which can include the API endpoint, request method, request body structure, and parameter mapping relationship.
[0080] In at least one embodiment, specific user constraint parameters can be extracted from the intent information parsed from the query request and populated into the target query instruction template defined by the metric retrieval logic information to generate the final target query instruction for this query. Specifically, when the metric retrieval logic information is an SQL template, the final target query instruction can be a complete executable SQL statement populated with parameters, which can be submitted to the corresponding data warehouse engine for execution via the data source adapter; when the metric retrieval logic information is an API query request template, the final target query instruction can be a fully encapsulated HTTP request, which can be initiated and the query results returned by the metric service platform can be received. Finally, the query results can be directly visualized and rendered, a process that bypasses the large language model, ensuring query accuracy and response speed.
[0081] In this embodiment, the most matching reference semantic tree is selected based on a semantic distance threshold, and the final query is generated by directly calling the rigorously validated query instruction template attached to it. This achieves an efficient closed loop from intent recognition to result execution, completely bypassing the illusion risks and inconsistencies that may be brought about by the dynamic generation of SQL by a large language model, and ensuring the absolute accuracy of the query logic and the efficiency of execution.
[0082] The method for determining the query results in this application will be explained below with reference to specific embodiments.
[0083] Figure 3 This is a flowchart illustrating the method for determining the query results in this optional example, such as... Figure 3 As shown, the process for determining the query result may include the following steps:
[0084] Step S302: Construct a mapping system between enterprise-level indicator semantic trees and executable data retrieval logic;
[0085] Step S304: Parsing the user's natural language query intent and making a semantic tree routing decision;
[0086] Step S306, execution of query with priority given to indicators;
[0087] Step S308: Dynamic SQL generation for enhanced metrics, user confirmation, and metric accumulation;
[0088] Step S310: Review and formal registration of candidate indicators.
[0089] In at least one embodiment, by creating an indicator semantic tree structure, the measurement objects, filtering conditions, analysis dimensions, and underlying executable data retrieval logic (SQL templates or API call templates) of all predefined indicators within an enterprise can be structurally represented. When a user initiates a natural language query, the query intent can first be parsed into a question semantic tree, and then a routing decision can be made by calculating the structured edit distance with the indicator semantic tree: if the indicator is accurately matched, its verified data retrieval logic is directly reused to execute the query; if it is not matched, the metadata and data retrieval logic of the most similar indicator are recalled as the strongest context-enhanced SQL generation, and after the user confirms that the data retrieval logic is correct, candidate indicators are automatically generated, pushed for review, and finally registered as new standard indicators through the indicator service API, forming a complete knowledge self-accumulation closed loop.
[0090] This optional example constructs a complete closed-loop data accumulation mechanism: "temporary query - knowledge-enhanced SQL generation - manual confirmation of data retrieval logic - automatic generation of candidate indicators - business review - formal registration and network access." This enables the system to learn and refine new indicators from each successful temporary data analysis. Business knowledge is no longer a temporary product that disappears after the query ends, but is systematically captured, verified, and transformed into reusable core enterprise data assets, truly enabling the system to become richer and smarter with use. Moreover, by elevating the indicator data retrieval logic to an executable template, it supports both direct consumption of SQL templates for database cohesive execution and encapsulation as API requests to call external indicator service platforms. This allows for flexible adaptation to the technical architecture of enterprises at different stages of digital development. Whether it is a mature enterprise with a well-established indicator service platform or a new project that wants the system to have built-in closed-loop execution capabilities, it can be seamlessly integrated, thereby protecting the enterprise's existing technology investments. Secondly, through the semantic tree routing decision mechanism, high-frequency business queries that hit predefined metrics can be directly routed to validated data retrieval logic for execution, completely bypassing the complex and potentially error-prone SQL generation process of large language models. For these regular queries, accuracy can be directly improved to nearly 100%, and the average query response time is compressed from seconds to milliseconds, significantly improving user experience and business decision-making efficiency. Furthermore, prioritizing the reuse of standardized business metrics accumulated during enterprise data governance can eliminate potential issues such as inconsistencies in terminology, calculation logic deviations, or table field mapping errors that may arise when dynamically generating SQL from large language models. This ensures the authority and consistency of enterprise data analysis results and eliminates internal trust crises caused by differing data definitions. In addition, for new business issues not yet covered by the metric system, the metadata and data retrieval logic of the most similar metrics can be recalled as enhanced context, significantly improving the accuracy of the business logic generated by dynamic SQL. Simultaneously, the design of the verbal verification confirmation panel allows business and technical personnel to intuitively understand the logic of the generated SQL and quickly confirm it, greatly shortening the time cycle from submitting analysis requests to obtaining reliable results, accelerating the business trial-and-error and decision-making cycle.
[0091] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0092] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / random access memory (RAM), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0093] According to another aspect of the embodiments of this application, a query result determination apparatus is also provided. This query result determination apparatus can be used to implement the query result determination method provided in the above embodiments, and will not be repeated as already described. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0094] Figure 4 This is a structural block diagram of an optional query result determination device according to an embodiment of this application, such as... Figure 4 As shown, the device for determining the query result includes:
[0095] Module 42 is used to construct a semantic tree of questions based on a query request, wherein the query request is a query statement input by the target user and the query statement includes a query object;
[0096] The first determining module 44 is used to determine the semantic distance between the problem semantic tree and multiple reference semantic trees, wherein one of the reference semantic trees is a semantic tree constructed based on the description information of a target object, and the target objects corresponding to different reference semantic trees are different, and the target objects are data objects in different business domains;
[0097] The second determining module 46 is used to determine the query result of the query request based on the semantic distance.
[0098] In one exemplary embodiment, the apparatus is further configured to: determine the description information of each of the target objects and construct a reference semantic tree based on the description information of each of the target objects before constructing the question semantic tree based on the query request.
[0099] In an exemplary embodiment, the apparatus can construct a reference semantic tree based on the description information of each target object in the following manner: for each target object, the following operations are performed to determine the reference semantic tree corresponding to the target object: determining the business domain to which the target object belongs, the entity objects included in the target object, the statistical granularity for statistical analysis of the entity objects, the filtering conditions for filtering the entity objects, and the analysis dimensions for analyzing the entity objects based on the tag information and the identification information of the target objects included in the description information; determining the reference semantic tree based on the description information, the business domain, the entity objects, the statistical granularity, the filtering conditions, and the analysis dimensions.
[0100] In an exemplary embodiment, the apparatus can determine the reference semantic tree based on the description information, the business domain, the entity object, the statistical granularity, the filtering conditions, and the analysis dimension in the following manner: determining the business domain as the root node of the reference semantic tree; determining the entity object and the statistical granularity as intermediate nodes of the reference semantic tree; determining the filtering conditions and the analysis dimension as leaf nodes of the reference semantic tree; determining the description information as the first child node of the reference semantic tree; and determining the semantic tree constructed by the root node, the intermediate nodes, the leaf nodes, and the first child node as the reference semantic tree.
[0101] In an exemplary embodiment, the first determining module 44 may determine the semantic distance between the question semantic tree and the plurality of reference semantic trees in the following manner: for each first reference semantic tree in the reference semantic trees, perform the following operations to determine the semantic distance between the first reference semantic tree and the question semantic tree, wherein the first reference semantic tree is any one of the plurality of reference semantic trees: determine the target operation to be performed to convert the question semantic tree into the first reference semantic tree, the target operation being used to adjust the nodes included in the question semantic tree; and determine the semantic distance based on the target operation.
[0102] In an exemplary embodiment, the first determining module 44 may determine the semantic distance based on the target operation by: determining the sub-operations included in the target operation; determining the sub-semantic distance corresponding to each sub-operation; and determining the sum of all the sub-semantic distances as the semantic distance.
[0103] In an exemplary embodiment, the first determining module 54 can determine the sub-semantic distance corresponding to each sub-operation in the following manner: when the sub-operation is a replacement operation, determining the replacement object and the replaced object of the replacement operation; when the semantics of the replacement object and the replaced object satisfy a first preset condition, and the first node position of the replacement object in the second reference semantic tree is the same as the second node position of the replaced object in the question semantic tree, determining the sub-semantic distance as a first value, wherein the second reference semantic tree is a semantic tree included in a plurality of reference semantic trees; when the semantics of the replacement object and the replaced object satisfy the first preset condition, and the first node position of the replacement object in the second reference semantic tree is not the same as the second node position of the replaced object in the question semantic tree, determining the sub-semantic distance as a second value; when the semantics of the replacement object and the replaced object do not satisfy the first preset condition, determining the sub-semantic distance as a third value, wherein the first value is less than the second value, and the second value is less than the third value.
[0104] In an exemplary embodiment, the first determining module 44 may determine the sub-semantic distance corresponding to each sub-operation in the following manner: when the sub-operation is an insertion operation, determining the first node type of the insertion object of the insertion operation; when the first node type is a root node or a child node, determining the sub-semantic distance as a fourth value; when the first node type is an intermediate node or a leaf node, determining the sub-semantic distance as a fifth value, wherein the fifth value is less than the fourth value.
[0105] In an exemplary embodiment, the first determining module 44 may determine the sub-semantic distance corresponding to each sub-operation in the following manner: when the sub-operation is a deletion operation, determining the second node type of the deleted object of the deletion operation; when the second node type is a root node or a child node, determining the sub-semantic distance as a sixth value; when the second node type is an intermediate node or a leaf node, determining the sub-semantic distance as a seventh value, wherein the sixth value is less than the seventh value.
[0106] In an exemplary embodiment, the second determining module 46 can determine the query result of the query request based on the semantic distance in the following manner: when there is a target semantic distance less than a preset threshold among the multiple semantic distances, determine the third reference semantic tree corresponding to the smallest semantic distance included in the target semantic distance; determine the query instruction template included in the description information corresponding to the second child node included in the third reference semantic tree; fill the query instruction template with the query request to generate a target query instruction; and determine the query result based on the target query instruction.
[0107] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0108] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein the program executes the steps in any of the above method embodiments when it is run.
[0109] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, ROMs, RAMs, portable hard drives, magnetic disks, or optical disks.
[0110] According to another aspect of the embodiments of this application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor is configured to perform the steps of any of the method embodiments described above via the computer program. In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0111] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0112] According to another aspect of the embodiments of this application, a computer program product is also provided, comprising a computer program / instructions containing program code for performing the methods shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit 501, it performs various functions provided in the embodiments of this application. The sequence numbers of the embodiments of this application above are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0113] Figure 5 A schematic block diagram of a computer system architecture for implementing embodiments of the present application is shown. Figure 5 As shown, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in ROM 502 or programs loaded into RAM 503 from storage section 508. Random Access Memory 503 also stores various programs and data required for system operation. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An Input / Output (I / O) interface 505 is also connected to the bus 504.
[0114] The following components are connected to I / O interface 505: input section 506 including keyboard, mouse, etc.; output section 507 including cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; storage section 508 including hard disk, etc.; and communication section 509 including network interface card, modem, etc. Communication section 509 performs communication processing via a network such as the Internet. Drive 510 is also connected to I / O interface 505 as needed. Removable media 511, such as disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 510 as needed so that computer programs read from them can be installed into storage section 508 as needed.
[0115] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit 501, it performs various functions defined in the system of this application.
[0116] It should be noted that, Figure 5 The computer system 500 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0117] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0118] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for determining query results, characterized in that: A semantic tree of questions is constructed based on a query request, wherein the query request is a query statement input by the target user and the query statement includes a query object; Determine the semantic distance between the problem semantic tree and multiple reference semantic trees, wherein a reference semantic tree is a semantic tree constructed based on the description information of a target object, and the target objects corresponding to different reference semantic trees are different, and the target objects are data objects in different business domains; The query result of the query request is determined based on the semantic distance.
2. The method according to claim 1, characterized in that, Before constructing the question semantic tree based on the query request, the method further includes: Determine the description information for each of the target objects; A reference semantic tree is constructed based on the description information of each target object.
3. The method according to claim 2, characterized in that, Constructing a reference semantic tree based on the description information of each target object includes: For each target object, the following operations are performed to determine the reference semantic tree corresponding to the target object: Based on the tag information and the identification information of the target object included in the description information, the business domain to which the target object belongs, the entity objects included in the target object, the statistical granularity for statistical analysis of the entity objects, the filtering conditions for filtering the entity objects, and the analysis dimensions for analyzing the entity objects are determined. The reference semantic tree is determined based on the description information, the business domain, the entity object, the statistical granularity, the filtering conditions, and the analysis dimensions.
4. The method according to claim 3, characterized in that, The reference semantic tree is determined based on the description information, the business domain, the entity object, the statistical granularity, the filtering conditions, and the analysis dimensions, including: The business domain is determined as the root node of the reference semantic tree; The entity object and the statistical granularity are determined as the intermediate nodes of the reference semantic tree; The filtering conditions and the analysis dimensions are determined as leaf nodes of the reference semantic tree; The description information is used to determine the first child node of the reference semantic tree; The semantic tree constructed from the root node, the intermediate nodes, the leaf nodes, and the first child node is determined as the reference semantic tree.
5. The method according to claim 1, characterized in that, Determining the semantic distance between the problem semantic tree and multiple reference semantic trees includes: For each first reference semantic tree in the reference semantic tree, the following operations are performed to determine the semantic distance between the first reference semantic tree and the question semantic tree, wherein the first reference semantic tree is any one of the plurality of reference semantic trees: Determine the target operation to be performed to convert the problem semantic tree into the first reference semantic tree, wherein the target operation is used to adjust the nodes included in the problem semantic tree; The semantic distance is determined based on the target operation.
6. The method according to claim 5, characterized in that, Determining the semantic distance based on the target operation includes: Determine the sub-operations included in the target operation; Determine the sub-semantic distance corresponding to each of the sub-operations; The sum of all the sub-semantic distances is determined as the semantic distance.
7. The method according to claim 6, characterized in that, Determining the sub-semantic distance corresponding to each of the sub-operations includes: When the sub-operation is a replacement operation, the replacement object and the object being replaced are determined. If the semantics of the replacement object and the replaced object satisfy the first preset condition, and the first node position of the replacement object in the second reference semantic tree is the same as the second node position of the replaced object in the question semantic tree, the sub-semantic distance is determined to be a first value, wherein the second reference semantic tree is a semantic tree included in a plurality of reference semantic trees; If the semantics of the replacement object and the replaced object satisfy the first preset condition, and the first node position of the replacement object in the second reference semantic tree is different from the second node position of the replaced object in the question semantic tree, the sub-semantic distance is determined to be the second value. If the semantics of the replacement object and the replaced object do not meet the first preset condition, the sub-semantic distance is determined to be a third value, wherein the first value is less than the second value, and the second value is less than the third value.
8. The method according to claim 6, characterized in that, Determining the sub-semantic distance corresponding to each of the sub-operations includes: In the case that the sub-operation is an insertion operation, determine the first node type of the object to be inserted in the insertion operation; When the first node type is a root node or a child node, the sub-semantic distance is determined to be the fourth value; When the first node type is an intermediate node or a leaf node, the sub-semantic distance is determined to be a fifth value, wherein the fifth value is less than the fourth value.
9. The method according to claim 6, characterized in that, Determining the sub-semantic distance corresponding to each of the sub-operations includes: In the case that the sub-operation is a deletion operation, determine the second node type of the object to be deleted in the deletion operation; When the second node type is a root node or a child node, the sub-semantic distance is determined to be the sixth value; When the second node type is an intermediate node or a leaf node, the sub-semantic distance is determined to be the seventh value, wherein the sixth value is less than the seventh value.
10. The method according to claim 1, characterized in that, Determining the query result of the query request based on the semantic distance includes: If, among the multiple semantic distances, there exists a target semantic distance that is less than a preset threshold, the third reference semantic tree corresponding to the smallest semantic distance included in the target semantic distances is determined. Determine the query instruction template included in the description information corresponding to the second child node included in the third reference semantic tree; The query request is used to populate the query instruction template to generate the target query instruction; The query result is determined based on the target query instruction.
11. A device for determining query results, characterized in that, include: A construction module is used to construct a semantic tree of questions based on a query request, wherein the query request is a query statement input by the target user and the query statement includes a query object; The first determining module is used to determine the semantic distance between the problem semantic tree and multiple reference semantic trees, wherein one of the reference semantic trees is a semantic tree constructed based on the description information of a target object, and the target objects corresponding to different reference semantic trees are different, and the target objects are data objects in different business domains; The second determining module is used to determine the query result of the query request based on the semantic distance.
12. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 10.
14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 10.