Intent resolution based enterprise natural language query permission verification method

By employing intent decomposition and resource binding methods, the problem of resource unavailability caused by permission restrictions in enterprise natural language queries is solved. This achieves semantic and database relationship consistency in multi-resource queries, ensuring query executability and permission adaptation.

CN123049655APending Publication Date: 2026-11-06合肥理微大数据有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611553588.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-09
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

When enterprise natural language queries involve multiple interrelated physical database resources, some resources may become unavailable due to user permission restrictions, causing the query to fail. How can we maintain the executable consistency between query semantics and database resource relationships, and avoid the impact of local resource unavailability on the overall query processing?

Method used

Natural language queries and user permissions are obtained through intent decomposition. The query is decomposed to determine the target semantic slots and the corresponding physical resource providers, forming an initial resource binding. When the bound resource fails, the binding of the affected semantic slots is released, and the resource binding is re-established until a closed binding query plan is formed, and it is verified whether the semantic and permission constraints are met.

Benefits of technology

Under permission restrictions, the executability of query semantics and database resource relationships is maintained by rebinding dependencies and semantic slots, avoiding the impact of local resource failures on the overall query, and forming a closed-loop bound query plan that is adapted to user permissions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123049655A_ABST
    Figure CN123049655A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of database query permission control, and discloses an enterprise natural language query permission verification method based on intention decomposition. The method obtains a natural language query and user permission for intention decomposition, determines target semantic slots and a plurality of physical resource providers, and forms an initial resource binding; determines the effective state of the physical resource providers according to the actual query purpose and the user permission; when the bound physical resource provider is invalid, determines the affected semantic slots along the necessary resource dependency relationship, removes the affected binding, and retains the unaffected binding; determines a replacement physical resource provider from the remaining candidate physical resource providers and rebinds, verifies the permission coverage of the semantic constraints, database resource relationships and actual query purposes, forms a closed binding query plan or determines that it cannot be formed, and obtains a permission verification result. The present application can reform a resource combination that meets the query semantics, database resource relationships and user permissions when local resources are limited.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of database query permission control technology, and in particular to an enterprise natural language query permission verification method based on intent decomposition. Background Technology

[0002] As the scale and types of enterprise data resources continue to increase, natural language queries are increasingly being applied to data processing scenarios such as database retrieval and intelligent data analysis. Business data in enterprise databases is typically distributed across different tables, database views, metrics, and derived data. A single business query may involve multiple physical data resources and their relationships. In the process of converting natural language queries into executable database queries, the corresponding data resources and data operations need to be determined based on the query semantics, while also being constrained by user access permissions to different data resources.

[0003] Existing natural language database query technologies typically perform semantic parsing of user input and combine it with database schema information, semantic layer, or business indicator information to determine the data tables, fields, and relationships involved in the query, thereby generating a structured query statement. Regarding data access permissions, permissions are usually verified for the data fields, data range, or query operations involved in the query based on user roles, attributes, database authorization information, or access control policies. Based on the permission verification results, the query content is filtered, adjusted, rewritten, or terminated. When a query involves multiple interrelated data resources, the permission status of local data resources may also affect the already established data computational relationships, associations, or derivation relationships.

[0004] Therefore, when natural language queries involve multiple interrelated data resources, how to maintain the executable consistency between query semantics and database resource relationships when some physical data resources are unavailable for the current query due to user permission restrictions, and how to reduce the impact of local resource unavailability on the overall query processing, is a technical problem that needs to be further solved in existing enterprise natural language query permission control. Summary of the Invention

[0005] The technical problem to be solved by this invention is: when an enterprise natural language query involves multiple interrelated database physical resources, and some physical resources are unavailable for the current query because the current user does not have the permission for the corresponding query purpose, how to avoid the unavailability of local physical resources directly causing the entire query to fail, and how to re-form a data resource combination that conforms to the user's permissions while maintaining the executable nature of the query semantics and database resource relationships.

[0006] The technical solution of this invention to solve the above-mentioned technical problems is as follows: A method for verifying enterprise natural language query permissions based on intent decomposition, comprising: obtaining natural language queries and user permissions; decomposing the natural language queries; determining target semantic slots and physical resource providers corresponding to each target semantic slot, wherein at least one target semantic slot corresponds to multiple semantically matching physical resource providers, and determining an initial physical resource provider from among them to form an initial resource binding; determining the effective status of each physical resource provider based on the actual query purpose of the physical resources in each physical resource provider and the user permissions; when a bound physical resource provider becomes invalid, determining the bound physical resource provider as an invalid physical resource provider, and binding the semantic slots corresponding to the invalid physical resource provider and the invalid physical resource provider according to resource dependencies. If a user or its necessary physical resources have semantic slots corresponding to downstream physical resource providers that they directly or indirectly depend on, these are identified as affected semantic slots. The binding of the affected semantic slots is then released, while the unaffected bindings are retained. An alternative physical resource provider is selected from the remaining candidate physical resource providers for the affected semantic slots, and resource bindings are re-established. The re-established resource bindings are verified to meet semantic constraints and database resource relationships, and to verify whether their actual query purpose is covered by the user's permissions. If the verification fails, the affected semantic slots are re-identified, and the unbinding and re-establishment of resource bindings are repeated until a closed-loop query plan is formed or it is determined that a closed-loop query plan cannot be formed. Permission verification is confirmed to have passed when the closed-loop query plan is formed; permission verification fails when the closed-loop query plan cannot be formed.

[0007] The beneficial effects of this invention are as follows: During the resource binding stage of physical resource providers, the effective status of the physical resources is determined based on the actual query purpose and user permissions, so that permission restrictions can be applied to the specific physical resource implementation used in the current query; when a bound physical resource provider fails due to permission restrictions, the affected semantic slots are determined through necessary dependencies, and only the resource binding of the affected semantic slots is unbound, thereby limiting the impact of local physical resource failure to the binding scope with actual resource dependencies; by re-establishing resource binding from the remaining candidate physical resource providers and continuously verifying the semantic constraints, database resource relationships, and permission coverage of the actual query purpose, it is possible to restore the executable data resource combination corresponding to the original query semantics when alternative physical resources exist, while avoiding retaining non-executable bindings that depend on failed physical resources, ultimately forming a closed-loop binding query plan adapted to the current user permissions.

[0008] Based on the above technical solution, the present invention can be further improved as follows.

[0009] Furthermore, the step of decomposing the natural language query and determining the target semantic slot includes: parsing the natural language query to obtain semantic operators and the input-output dependencies between each semantic operator; establishing semantic slots based on the database data input positions in each semantic operator, and determining the business semantic identifier, data granularity, time caliber, and actual query purpose of each semantic slot; and determining the semantic slots required to complete the natural language query and that need to be bound to database physical resources as the target semantic slots.

[0010] The beneficial effects of adopting the above-mentioned further solution are: by decomposing natural language queries into semantic operators with input-output dependencies, and determining the target semantic slots that require support from physical database resources, subsequent permission judgments and resource rebinding have clear data requirement objects, avoiding directly and fixedly corresponding natural language expressions with specific physical database resources, and providing a unified semantic bearing location for the same query semantics to be implemented using different physical resources.

[0011] Furthermore, determining the physical resource provider corresponding to each target semantic slot includes: obtaining physical resources and corresponding implementation expressions from the database system directory, view definition and indicator directory; performing semantic matching on the physical resources based on business semantic identifiers, data granularity, time caliber, measurement unit and aggregation rules; and determining the physical resources that satisfy the semantic constraints of the target semantic slot as the corresponding physical resource providers.

[0012] The beneficial effects of adopting the above-mentioned further solution are: by simultaneously using database physical resource information and business semantic constraints to filter physical resource providers, physical resources entering the same target semantic slot candidate range maintain a corresponding relationship in terms of business semantics, statistical granularity, and calculation caliber. This provides physical resource candidates with the same query semantic basis for alternative binding after permission expires, reducing the situation where query semantics are changed due to replacing resources only based on name or field similarity.

[0013] Furthermore, determining the effective status of each physical resource provider based on the actual query purpose of the physical resources and user permissions includes: determining the output, filtering, calculation, aggregation, sorting, comparison, or association purpose of each physical resource according to the semantic operator corresponding to the target semantic slot and the implementation expression of the physical resource provider; matching the actual query purpose and data scope of each physical resource with user permissions; and determining the corresponding physical resource provider as an invalid physical resource provider when the actual query purpose of any necessary physical resource is not covered by user permissions.

[0014] The beneficial effect of adopting the above-mentioned further solution is that by combining the actual usage of physical resources in the current query to determine permissions, the same physical resource can be validally determined according to the corresponding permissions in different data processing processes such as output, calculation, aggregation, and association. This allows the failure status of the physical resource provider to reflect its actual availability in the current specific query implementation, providing a triggering state corresponding to the current database processing relationship for subsequent failure propagation.

[0015] Furthermore, the resource dependencies are determined based on the implementation expression of the physical resource provider, the database connection relationship, and the data lineage. A resource dependency index is established based on the dependency type and the necessary dependency status. The dependency types include computational dependencies, association dependencies, indicator dependencies, and dimension dependencies.

[0016] The beneficial effects of adopting the above-mentioned further scheme are: by organizing the computational, association, indicator and dimensional relationships between physical resources into resource dependency relationships with dependent directions and necessary dependent states, it is possible to determine the affected objects according to the actual database data processing relationship after the physical resource provider fails, and to provide a queryable relationship basis for distinguishing between bindings that have necessary dependencies on the failed resource and bindings of unaffected resources.

[0017] Furthermore, determining the affected semantic slots includes: identifying the semantic slots corresponding to the failed physical resource providers as affected semantic slots, and using the failed physical resource providers and their necessary physical resources as the propagation starting point; determining the downstream physical resource providers that have the propagation starting point as necessary dependencies based on the resource dependency index, identifying the corresponding physical resource providers as failed physical resource providers, and determining the corresponding affected semantic slots; and continuing the necessary dependency propagation along the newly determined failed physical resource providers until there are no new failed physical resource providers.

[0018] The beneficial effect of adopting the above-mentioned further scheme is that by determining the downstream affected bindings step by step from the initial failed physical resource provider along the necessary resource dependencies, the indirect computation failure, association failure or indicator dependency failure caused by local permission failure can be identified along with the actual resource dependencies, avoiding only processing the initial unauthorized resources and continuing to retain the physical resource implementation whose dependencies have been broken in subsequent bindings.

[0019] Furthermore, the step of unbinding the affected semantic slots and retaining the unaffected bindings includes: determining a local unbinding set based on the affected semantic slots and the set to be rebound; unbinding the resource bindings between each semantic slot in the local unbinding set and the current physical resource provider; and retaining the resource bindings that are not included in the local unbinding set and do not have a direct or indirect necessary dependency on the failed physical resource provider.

[0020] The beneficial effect of adopting the above-mentioned further solution is that by limiting the scope of resource bindings that need to be unbound based on the failure propagation results, the physical resource bindings that have passed the permission verification and have no necessary dependence on the failed resource are retained, thereby avoiding the need to resolve resource bindings unrelated to the failure due to the failure of local physical resource permissions, while maintaining the confirmed valid database resource relationships.

[0021] Furthermore, the re-establishment of resource binding includes: excluding failed physical resource providers and physical resource providers that have failed verification during the current binding process from the physical resource providers corresponding to the affected semantic slots; determining alternative physical resource providers based on semantic constraints, actual query purposes, and user permissions; and establishing new resource bindings based on the database connection relationship between the alternative physical resource providers and the unaffected bindings; when changes in the database connection relationship cause the unaffected bindings to lose their necessary dependencies, the corresponding semantic slots are reinstated into the local unbinding scope.

[0022] The beneficial effects of adopting the above-mentioned further solution are: by excluding physical resource providers that have failed or have been verified as unexecutable during the rebinding process, and simultaneously verifying the database connection relationship between the alternative physical resource provider and the retained binding, the alternative resource not only meets the current query semantics and permission requirements, but can also form an executable data relationship with the existing resource; when the alternative resource causes a change in the database connection relationship, the impact is fed back to the local unbinding scope, thereby avoiding the creation of new resource relationship breaks due to the replacement of a single resource.

[0023] Furthermore, the verification of whether the re-established resource binding satisfies semantic constraints and database resource relationships, and whether the actual query purpose is covered by user permissions, includes: determining whether each target semantic slot is bound to a valid physical resource provider, determining whether the bound physical resources form an executable database processing structure, and determining whether the actual query purpose of each bound physical resource is covered by user permissions; when the above conditions are met, a closed binding query plan is formed; when a new invalid physical resource provider is generated or the database resource relationship verification fails, the determination and rebinding of the affected semantic slots continues; when there are no remaining valid physical resource providers for the target semantic slots or an executable database processing structure cannot be formed, it is determined that a closed binding query plan cannot be formed.

[0024] The beneficial effects of adopting the above-mentioned further solution are: by simultaneously verifying the data provision integrity of the target semantic slot, the database executable relationship between the bound physical resources, and whether the actual query purpose is covered by user permissions, the rebinding process has clear success and failure termination states, thereby avoiding the formation of query plans that actually lack necessary connection relationships or computational dependencies simply because each slot has authorized resources.

[0025] Furthermore, a database query statement is generated based on the closed-loop binding query plan, and before execution, the physical resources and query operations actually used by the database query statement are matched with the closed-loop binding query plan.

[0026] The beneficial effects of adopting the above-mentioned further solution are: by limiting the physical data source, connection relationship and query operation of the database query statement with a closed binding query plan, and verifying the actual resource usage of the database query statement before execution, the database query statement is kept consistent with the binding result that has completed semantic, resource relationship and permission verification, and the query statement is prevented from introducing physical resources or data operations outside the closed binding query plan during the compilation or transformation process. Attached Figure Description

[0027] Figure 1 This is a flowchart of the enterprise natural language query permission verification method based on intent decomposition according to the present invention. Figure 2 This is a schematic diagram of semantic slots and multiple candidate physical resource providers provided in an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the failure propagation and partial unbinding of physical resource providers provided in an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the formation of a rebinding and closed-loop binding query plan for an alternative physical resource provider, as provided in an embodiment of the present invention. Detailed Implementation

[0028] The embodiments of the present invention will now be described with reference to the accompanying drawings. This embodiment is applied to scenarios involving intelligent enterprise data retrieval, natural language database queries, and database access control. The executing entity can be a query processing program deployed on a server or computing device. The server or computing device executes program instructions stored in memory via a processor, and obtains the data required for processing and completes the database query through query interfaces, permission interfaces, database metadata interfaces, and database access interfaces.

[0029] In this implementation, a semantic slot is a semantic input location where a natural language query, after intent decomposition, requires data to be provided by the database's physical resources. A physical resource provider is a database physical implementation capable of satisfying the semantic constraints of the corresponding semantic slot. A physical resource provider can be a single field, a view field, a materialized view field, a pre-computed metric, or a derived implementation consisting of multiple base fields and existing deterministic implementation expressions.

[0030] The actual query purpose refers to the data processing role undertaken by the physical resources within the physical resource providers in the current query, including one or more of the following: output, filtering, calculation, aggregation, sorting or comparison, and association. Resource dependencies are computational dependencies, association dependencies, metric dependencies, or dimensional dependencies formed between physical resource providers and their underlying physical resources. Database resource relationships refer to the connection or implementation relationships between selected physical resources used to form an executable database processing structure. A closed-loop bound query plan is an intermediate representation of the physical query formed before the database query statement is generated. In this plan, the target semantic slots required to complete the current natural language query are bound to valid physical resource providers. The bound physical resources can form an executable database processing structure, and the actual query purpose of each physical resource is overridden by the current user's permissions.

[0031] like Figure 1 As shown, this implementation completes the permission verification process in the following order: natural language query input, semantic slot determination, physical resource provider binding, usage permission verification, failure propagation, partial unbinding, rebinding with alternative physical resource providers, and closure verification. Figure 1 The above processing relationships and the data flow between each processing stage are shown.

[0032] S1. Determine the target semantic slot and the corresponding physical resource provider, and form an initial resource binding.

[0033] Specifically, the inputs to S1 include natural language queries, user permissions, and database system directories, view definitions, and indicator directories that describe the enterprise's database resources. Natural language queries are input through the enterprise intelligent query interface or the natural language database query interface. User permissions are provided by the enterprise permission system or the database authorization system. The database system directory, view definitions, and indicator directories are read from the database metadata interface.

[0034] First, the natural language query is decomposed into intent, forming a semantic processing structure separate from specific database physical tables and fields. This semantic processing structure includes multiple semantic operators and the input-output dependencies between them. Semantic operators can include data acquisition, filtering, association, calculation, aggregation, sorting, quantity limiting, and output. Semantic slots are created for locations within semantic operators that require database data input, recording the business semantic identifier, data granularity, time caliber, and actual query purpose. The semantic slots required to complete the current natural language query and bound to physical database resources are identified as target semantic slots.

[0035] Intent decomposition for natural language queries can be accomplished by a semantic parser, a rule engine, or a language model. The intent decomposition stage only outputs the semantic operators, input-output dependencies, and target semantic slots required for subsequent resource binding; it does not determine the final database physical resources to be used at this stage.

[0036] like Figure 2 As shown, a corresponding candidate physical resource provider is determined for each target semantic slot. Figure 2 Taking the gross profit margin semantic slot as an example, this illustrates the relationship between multiple candidate physical resource providers corresponding to the same semantic slot and different physical resource providers corresponding to different physical resource implementations.

[0037] Candidate physical resource providers can be obtained from the database system directory, view definitions, and metric directory. The database system directory provides information on tables, views, fields, and data types. View definitions provide the dependencies between view fields and underlying physical resources. The metric directory provides the physical resources, statistical granularity, time caliber, and existing implementation expressions corresponding to business metrics. For derived physical resource providers, the underlying physical resources and implementation expressions required to constitute that physical resource provider are also recorded.

[0038] After obtaining candidate physical resources, it is determined whether the candidate physical resources meet the semantic constraints of the target semantic slot based on business semantic identifiers, data granularity, time caliber, measurement units, and aggregation rules. If a registered unit conversion relationship exists, the unit conversion can be completed before semantic matching. Physical resources that meet the semantic constraints of the corresponding semantic slot are identified as the physical resource providers for that semantic slot.

[0039] For example, a natural language query to find the five customers with the highest gross profit margin in East China last year and display their account managers can generate target semantic slots for date, region, customer, gross profit margin, and account manager. The gross profit margin semantic slot can have physical resource providers A, B, and C. Physical resource provider A provides the gross profit margin using existing expressions corresponding to the sales revenue and cost of sales fields; physical resource provider B provides the gross profit margin using existing expressions corresponding to the gross profit and sales revenue fields; and physical resource provider C provides the gross profit margin using the customer gross profit margin field in the security metrics view. Only physical resource providers that meet the same business semantics, data granularity, time caliber, measurement unit, and aggregation rules are retained as candidates for the gross profit margin semantic slot.

[0040] The initial physical resource provider is determined from the candidate physical resource providers corresponding to each target semantic slot, and an initial resource binding is established between the semantic slot and the initial physical resource provider. The initial resource binding is used to subsequently determine the effective state of the physical resource provider and the scope of resource dependency impact. S1 outputs the target semantic slot, the candidate set of physical resource providers, and the initial resource binding.

[0041] A target semantic slot can correspond to one or more physical resource providers. This implementation does not require each target semantic slot to have multiple physical resource providers; when a target semantic slot has only one physical resource provider and that physical resource provider is valid, the corresponding resource binding is maintained; when the physical resource provider fails and there are no other physical resource providers, it is determined that there are no available physical resource providers for that target semantic slot.

[0042] S2. Determine the valid status of the physical resource provider based on the actual query purpose and user permissions.

[0043] Specifically, the input to S2 is the physical resource provider candidate set obtained from S1, the initial resource binding, and the current user permissions. Based on the physical resource composition of each physical resource provider, the semantic operator to which the target semantic slot belongs, and the implementation expression of the physical resource provider recorded in the physical resource provider candidate set, the actual query purpose of each physical resource in the current query is determined.

[0044] When a physical resource is returned as a query result, it is determined to be used for output. When a physical resource is used as a query condition, it is determined to be used for filtering. When a physical resource is used as input for derived fields or business metrics, it is determined to be used for calculation. When a physical resource is used as input for aggregation processing, it is determined to be used for aggregation. When a physical resource is used as a sort key or comparison criterion, it is determined to be used for sorting or comparison. When a physical resource is used to establish a connection between database objects, it is determined to be used for joins. The same physical resource can serve multiple actual query purposes simultaneously.

[0045] User permissions are organized into permission information that can determine whether physical resources, actual query purposes, and data scope are permitted. User permissions can originate from role-based access control, attribute-based access control, native database authorization, access control lists, or a unified enterprise permission platform. When there are restrictions on organizational scope, business scope, data row scope, or time range, these scopes are compared with the data scope required for the current query.

[0046] Necessary physical resources refer to the physical resources that a physical resource provider cannot do without when forming corresponding semantic data according to its implementation expression; if the necessary physical resources are missing, the corresponding physical resource provider cannot form the data required for the current semantic slot.

[0047] The system sequentially checks whether each necessary physical resource in the physical resource provider can be used by the current user according to the current actual query purpose. If all necessary physical resources in the physical resource provider and their actual query purpose are covered by the user's permissions, the physical resource provider is determined to be a valid physical resource provider. If the actual query purpose of any necessary physical resource is not covered by the user's permissions, the physical resource provider is determined to be an invalid physical resource provider. The valid status of a physical resource provider only applies to the current query processing status and does not change the existing definition of physical resource providers in the database.

[0048] Taking physical resource provider A as an example, the sales revenue and sales cost fields are used for calculation, while the gross profit margin output by physical resource provider A is used for sorting and output. If the current user allows sales revenue to participate in the calculation but not sales cost in this derived calculation, physical resource provider A is identified as a failed physical resource provider. S2 outputs the validity status of each physical resource provider. When a bound physical resource provider fails, the failed physical resource provider is used as input for subsequent failure propagation.

[0049] S3. Establish resource dependencies and resource dependency indexes.

[0050] Specifically, the inputs to S3 are the implementation expression of the physical resource provider, the database connection relationship, and the data lineage. Based on the above information, the resource dependencies between upstream physical resources and downstream physical resource providers or semantic slots are determined, and the corresponding dependency types and necessary dependency states are recorded.

[0051] Computational dependencies indicate that a derived physical resource provider requires upstream fields or metrics as implementation input. Association dependencies indicate that a physical resource needs to participate in queries with other physical resources through specific join fields or database relationships. Metric dependencies indicate that upper-layer business metrics require data from lower-layer metrics or physical resources. Dimension dependencies indicate that aggregation, grouping, or filtering processes require specific dimension resources. Necessary dependency states indicate whether a downstream physical resource provider can maintain its current physical implementation when upstream resources are unavailable.

[0052] In one implementation, resource dependencies are recorded in a resource dependency index. Each resource dependency record includes at least the upstream resource identifier, the downstream physical resource provider or semantic slot identifier, the dependency type, and the necessary dependency state. For dependencies with alternative resources, other physical resource providers available for rebinding in the corresponding semantic slot can also be recorded. The resource dependency index can be implemented using a graph database, adjacency list, or relational table.

[0053] For example, if physical resource provider A uses sales revenue and sales cost to provide its gross profit margin, then physical resource provider A forms computational dependencies with sales revenue and sales cost, respectively. When sales cost is a necessary input for physical resource provider A to complete the current physical implementation, the corresponding computational dependency is recorded as a necessary dependency. S3 outputs resource dependency relationships and resource dependency indexes, which are used by S4 to retrieve affected resource bindings based on the failed physical resource provider.

[0054] S4. Propagate the failure state along resource dependencies and determine the affected semantic slots.

[0055] Specifically, such as Figure 3 As shown, Figure 3 This illustrates the process of determining affected bindings along resource dependencies after a physical resource provider fails, and distinguishing between affected and unaffected bindings. The input to S4 is the failed physical resource provider and the resource dependency index obtained in S3.

[0056] First, the semantic slots corresponding to the failed physical resource providers are identified as the affected semantic slots, and the failed physical resource providers and their necessary physical resources are used as the propagation starting point. Downstream physical resource providers or existing resource bindings that directly depend on the propagation starting point are retrieved based on the resource dependency index.

[0057] For each retrieved downstream physical resource provider, determine whether the failed physical resource provider or the failed physical resource is a necessary dependency of that downstream physical resource provider. If it is a necessary dependency, the downstream physical resource provider is identified as a failed physical resource provider, and the corresponding semantic slot is identified as an affected semantic slot. If there are other valid physical resource providers for the semantic slot that do not depend on the failed resource, the semantic slot is added to the set to be rebound; if there are no other valid physical resource providers, the newly identified failed physical resource provider is used as the starting point for propagation, and propagation continues along its downstream necessary dependencies.

[0058] For non-essential dependencies, the corresponding downstream physical resource provider is not identified as invalid, nor is the corresponding semantic slot included in the local unbinding scope; the current resource binding is maintained. After the alternative physical resource provider is determined, if the resource binding has a database connection relationship with the alternative physical resource provider, the database connection relationship is re-verified when the resource binding is re-established.

[0059] Failure propagation can be handled using a queue. Initially failed physical resource providers are added to the queue of pending failures. Failed physical resource providers are retrieved from the head of the queue, and affected objects are obtained based on the resource dependency index. Newly identified failed physical resource providers that have not yet been processed are added to the tail of the queue. Physical resource providers that have completed propagation processing are recorded in the visited set to avoid duplicate processing caused by bidirectional metadata relationships or circular dependencies. The current propagation process ends when the queue of pending failures is empty. S4 outputs the set of affected semantic slots and the set of slots to be rebound. These results are directly used in S5 to limit the scope of resource bindings that need to be unbound.

[0060] S5. Create a partial unbinding set and retain unaffected bindings.

[0061] Specifically, the input to S5 is the set of affected semantic slots and the set to be rebound obtained from S4. The local unbinding set is determined based on the propagation results. Semantic slots belonging to the initially failed physical resource provider, as well as semantic slots affected by the break in necessary dependencies, are all included in the local unbinding set.

[0062] Remove the existing resource bindings between each semantic slot in the partial unbinding set and the current physical resource provider. Unbinding only deletes the binding state between the current semantic slot and the current physical resource provider; the semantic slot itself and other candidate physical resource providers that have not yet expired or failed verification are retained.

[0063] For semantic slots not included in the local unbinding set, determine whether the current physical resource provider is still a valid physical resource provider, and whether the current physical resource provider has a direct or indirect necessary dependency on the invalid physical resource provider. If the current physical resource provider is still valid and there is no necessary dependency, maintain the corresponding existing resource binding.

[0064] For example, if the gross profit margin physical resource provider A becomes invalid, the gross profit margin semantic slot enters the partial unbinding set. If the account manager physical resource provider has no necessary dependency on either the cost of sales or physical resource provider A, the account manager semantic slot retains its original resource binding. S5 outputs the partial unbinding set and the unaffected bindings, and provides the results to S6.

[0065] S6. Identify alternative physical resource providers from the remaining physical resource providers and re-establish resource bindings.

[0066] Specifically, such as Figure 4 As shown, Figure 4 The diagram illustrates the processing relationship where affected semantic slots are rebound from the remaining candidate physical resource providers, and a closed-loop binding query plan is formed after revalidating semantics, database resource relationships, and permissions. The inputs to S6 are the partial unbinding set, the candidate physical resource providers for each semantic slot, and the unaffected bindings.

[0067] For semantic slots in the partial unbinding set, physical resource providers that have been determined to be invalid are excluded from the corresponding candidate physical resource providers. Physical resource providers that are determined to have failed verification due to unmet semantic constraints or failed database resource relationship verification are also no longer considered as candidates for rebinding in this round.

[0068] Candidate alternative physical resource providers are sequentially obtained from the remaining physical resource providers. First, it is verified whether the candidate alternative physical resource provider meets the semantic constraints of the corresponding semantic slot. If the semantic constraints are not met, the physical resource provider is identified as a failed verification provider, and the verification of the remaining physical resource providers continues. If the semantic constraints are met, the actual query purpose of each physical resource in the physical resource provider is re-determined according to the process described in S2, and it is verified whether the actual query purpose is covered by the current user's permissions. If the actual query purpose is not covered by the user's permissions, the physical resource provider is identified as a failed physical resource provider, and this physical resource provider is used as a new failure propagation starting point in S4. After the permission verification is passed, the database resource relationship between the physical resource provider and the unaffected bindings is then verified.

[0069] Database resource relationship validation is performed based on database foreign keys, registered join relationships, view dependencies, implementation expressions of physical resource providers, or data lineage. For derived physical resource providers, it verifies whether all necessary inputs required to implement the physical resource provider are valid. For physical resource providers that cross database objects, it verifies whether the required join fields and join relationships are valid within the current physical resource combination. For physical resource providers that require dimension resources, it verifies whether the corresponding dimension can be provided by the physical resource bound to the current resource. If database resource relationship validation fails, the physical resource provider is identified as a failed validation physical resource provider, and the validation of the remaining physical resource providers continues.

[0070] When semantic constraints, permission coverage for actual query purposes, and database resource relationships are all verified, a new resource binding is established between the affected semantic slot and the alternative physical resource provider. If the alternative physical resource provider is located in a different table or view than the original physical resource provider, the connection relationship between the alternative physical resource provider and the currently unaffected binding is re-verified. If the original unaffected binding loses its necessary dependency due to a change in the physical resource source, the corresponding semantic slot is added to the local unbinding set, and unbinding and rebinding are performed on the newly added affected semantic slots. S6 outputs the newly established resource binding and provides the rebinding result and the unaffected binding to S7.

[0071] S7. Verify resource binding and form a closed binding query plan.

[0072] Specifically, the input to S7 is the rebinding result obtained from S6 and the unaffected bindings. Semantic closure, relation closure, and permission closure verifications are performed on all current target semantic slots.

[0073] Semantic closure determines whether all target semantic slots required to complete the current natural language query are bound to valid physical resource providers. Relational closure determines whether the tables, views, fields, and derived implementations corresponding to the bound physical resource providers can form an executable database processing structure through registered database connection relationships or resource dependencies. Permission closure determines whether the actual query purpose of the physical resources in all bound physical resource providers is covered by the current user's permissions.

[0074] Relationship closure verification checks at least whether the necessary join relationships exist, whether the necessary inputs required for the derived physical resource provider are valid, and whether there are still necessary dependencies pointing to the failed physical resource provider in the current resource combination. Permission closure verification follows the actual query purpose and user permission coverage relationship of S2.

[0075] When semantic closure, relational closure, and permission closure are all satisfied, a closed binding query plan is formed. A closed binding query plan records at least the tables, views or fields bound to each target semantic slot, necessary join relationships, filter conditions, derived expressions, aggregation relationships, sorting relationships, and projection relationships, and determines that the permission verification result of the current query is passed.

[0076] If a new physical resource provider fails after rebinding, S4 to S6 continue execution from the failed physical resource provider as the propagation starting point. If changes in database resource relationships cause existing bindings to lose necessary dependencies, the corresponding semantic slot is identified as the affected semantic slot, and S5 and S6 continue execution. If there are no remaining valid physical resource providers for a target semantic slot, or if the current remaining physical resource providers cannot form an executable database processing structure, it is determined that a closed binding query plan cannot be formed, and the permission verification result of the current query is determined to be failed.

[0077] To avoid repeatedly processing the same resource binding states, accessed resource binding states can be recorded. When the same resource binding state that has already been processed is obtained again, the same rebinding process will not be performed on that state. S7 outputs a closed binding query plan or the processing result if a closed binding query plan cannot be formed.

[0078] S8. Generate and execute database query statements based on the closed binding query plan.

[0079] Specifically, S8 executes after permission verification. The input is the closed-loop binding query plan generated by S7. Database query statements are generated based on the physical resources and database processing relationships recorded in the closed-loop binding query plan.

[0080] The physical tables or views in the closed-loop binding query plan are identified as the data source for the database query. The connection relationships between physical resource providers are converted into database connections and corresponding connection conditions. The filtering relationships are converted into filtering conditions. The existing implementation expressions corresponding to derived physical resource providers are converted into calculated expressions in the database query. The aggregation relationships are converted into aggregation processing. The sorting relationships are converted into sorting processing. The projection relationships are converted into output fields.

[0081] After a database query statement is generated, the actual physical resources and query operations used in the query statement are parsed before execution and matched against the physical resources and query operations recorded in the closed-loop query plan. If a match is found, the database query statement is submitted to the target database for execution. If the database query statement contains physical resources or query operations not included in the closed-loop query plan, the current database query statement is not executed. After the target database completes the query, it returns the query results or the database execution status.

[0082] The following example uses a gross profit margin query to illustrate a complete processing cycle from data retrieval to database execution feedback. The physical resource provider names, permission statuses, and resource connection relationships described below are exemplary configurations used to illustrate the processing flow and do not constitute actual test results, simulation results, or model output.

[0083] Enterprise users input a query for the five customers with the highest gross profit margin in East China last year via a natural language query interface, which then displays the query text from the account manager. The query interface passes the query text to the query processing program. The query processing program obtains the current user's permissions through the permission interface and retrieves table, field, view, indicator directory, and resource dependency information through the database metadata interface. All of the above data is obtained through software interfaces, without requiring physical quantity collection by sensors.

[0084] The query processing program establishes target semantic slots corresponding to date, region, customer, gross profit margin, and account manager. The gross profit margin semantic slot has physical resource provider A, physical resource provider B, and physical resource provider C. Initial resource binding uses physical resource provider A. Sales revenue and cost of sales in physical resource provider A are used for calculation purposes, while the gross profit margin is used for sorting and output.

[0085] When a user currently allows sales revenue to be included in calculations but not sales cost in corresponding derived calculations, physical resource provider A is identified as a failed physical resource provider. The determination of the gross profit margin semantic slot based on the resource dependency index is affected, and the sorting process for determining dependent gross profit margin results needs to be re-validated. The account manager's physical resource provider does not have a necessary dependency on physical resource provider A; therefore, the account manager's semantic slot remains bound to its original position.

[0086] Remove the binding between the gross profit margin semantic slot and physical resource provider A. If the calculation purpose corresponding to the gross profit amount in physical resource provider B is also not covered by the current user permissions, then physical resource provider B is determined to be an invalid physical resource provider. Continue to verify physical resource provider C. When the sorting and output purpose corresponding to the gross profit margin field in physical resource provider C are both covered by user permissions, verify the database connection relationship between the security indicator view where physical resource provider C is located and the customer resources. If the security indicator view can be connected to the customer resources through the registered customer identifier, and the date and region dimensions can be applied to the current resource combination, then rebind the gross profit margin semantic slot to physical resource provider C.

[0087] After rebinding, each target semantic slot has a valid physical resource provider. The current physical resources can form an executable database processing structure, and the actual query purpose of each physical resource is overridden by the current user's permissions, thus forming a closed-loop query plan. A database query statement is generated based on the closed-loop query plan, and when the database query statement matches the closed-loop query plan, it is sent to the server where the target database resides for execution via the database access interface. After the target database server completes the query, it returns the query results. The query processing program then returns the query results through a natural language query interface, thus completing one full query processing cycle.

[0088] When the database system catalog, view definition, or indicator catalog lacks the necessary resource information required to constitute a physical resource provider, the incomplete physical resource will not be considered a valid physical resource provider for that semantic slot. If a necessary target semantic slot therefore has no available physical resource provider, it will be treated as having no feasible binding.

[0089] When natural language parsing cannot generate the target semantic slots required to complete the current query, subsequent physical resource binding processing is not initiated, and the status that the current query cannot form a valid semantic processing structure is output. When performing intent decomposition using a language model, if the model output cannot establish a correspondence with the current business semantic directory, the same processing is performed, and inferential completion of missing semantic slots is not performed.

[0090] When all physical resource providers for a target semantic slot are unusable because the actual query purpose is not covered by user permissions or the database resource relationship verification fails, or when each target semantic slot has a physical resource provider but the selected physical resource provider cannot form an executable database processing structure, it is determined that a closed binding query plan cannot be formed.

[0091] If a communication failure occurs in the query interface, permission interface, database metadata interface, or database access interface, resulting in the inability to obtain the data required for current processing or the inability to submit the database query statement, the current query processing will be terminated, and the corresponding interface execution failure status will be output. Communication failures are not used as a basis for determining whether user permissions are denied.

[0092] Once a closed-binding query plan is formed, if the physical resources or query operations actually used by the generated database query statement are inconsistent with the closed-binding query plan, it is determined that a query execution deviation has occurred, and the current database query statement is not submitted to the target database.

[0093] The above method can be implemented in software on a server or computing device. The software implementation carries the aforementioned processing steps S1 to S8 and maintains the processing relationships between semantic slots, the effective state of physical resource providers, failure propagation, partial unbinding, rebinding, and closure verification.

[0094] A server or computing device includes a processor, memory, and a communication interface. The memory stores the natural language query processing program, candidate physical resource provider information, resource dependency indexes, the status of the currently queried physical resource provider, and resource binding status. The communication interface receives natural language queries and accesses enterprise access control services, database system directories, and target databases. The processor executes program instructions from memory to process the data obtained through the communication interface.

[0095] In software implementation, programs can be divided into semantic processing units, physical resource provider management units, permission verification units, dependency propagation units, resource rebinding units, and query compilation units according to their processing functions. These units are all logical processing units formed by the processor executing program instructions. They can be executed sequentially by the same processor, or by multiple processors or multiple service processes working together.

[0096] The semantic processing unit takes a natural language query as input. It performs intent decomposition on the natural language query, outputs semantic operators, the input-output dependencies between semantic operators, and the target semantic slot, and provides the target semantic slot to the physical resource provider management unit.

[0097] The physical resource provider management unit receives the target semantic slot and the database system directory, view definitions, indicator directory, database connection relationships, and data lineage obtained through the database metadata interface. The physical resource provider management unit determines candidate physical resource providers according to semantic constraints and forms initial resource bindings; simultaneously, it builds a resource dependency index based on the implementation expressions of the physical resource providers, database connection relationships, and data lineages, and writes the resource dependency index into memory. The physical resource provider management unit outputs candidate physical resource providers, the implementation relationships of physical resource providers, the initial resource bindings, and the resource dependency index.

[0098] The input to the permission verification unit is the candidate physical resource provider and its implementation relationship, the current resource binding, and the user permissions obtained through the permission interface. The permission verification unit determines the actual query purpose of the physical resources in the physical resource provider, judges whether the user permissions cover the actual query purpose of the necessary physical resources, and outputs the valid status of the physical resource provider and the permission closure verification result corresponding to the updated resource binding.

[0099] The input to the dependency propagation unit is the failed physical resource provider and the resource dependency index established and stored in memory by the physical resource provider management unit. The dependency propagation unit determines the set of affected semantic slots and the set to be rebound along the necessary dependencies, and provides the propagation results to the resource rebinding unit.

[0100] The resource rebinding unit takes as input the affected semantic slots, remaining candidate physical resource providers, and unaffected bindings. The resource rebinding unit unbinds existing bindings of affected semantic slots, retains unaffected bindings, selects alternative physical resource providers, and verifies semantic constraints and database resource relationships. The permission verification unit performs permission coverage verification for the alternative physical resource providers and the updated resource bindings, based on the actual query purpose. The resource rebinding unit performs semantic closure and relational closure verification based on the updated resource bindings, and determines whether a closed-loop binding query plan is formed based on the permission closure verification result from the permission verification unit. When all three closures are satisfied, the resource rebinding unit outputs a closed-loop binding query plan; if the closure is not achieved and a new failed physical resource provider appears, the failed physical resource provider is provided to the dependency propagation unit for further processing; if changes in database resource relationships cause existing bindings to lose necessary dependencies, the corresponding affected semantic slots are provided to the resource rebinding unit for further partial unbinding and rebinding; if no available physical resource provider exists or an executable database processing structure cannot be formed, the processing result indicating that a closed-loop binding query plan cannot be formed is output.

[0101] The query compilation unit takes a closed-binding query plan as input. It generates database query statements according to these plans and sends them to the target database via a database access interface. The target database, acting as the execution device for the query statements, returns the query results or execution status after completing the query.

[0102] This implementation process takes natural language queries, user permissions, and database metadata as input, all of which are obtained through software or database interfaces and do not involve sensor data acquisition. The processor handles semantic parsing, permission checks, dependency propagation, resource binding, and query compilation. The memory stores resource dependency indexes and the current query state. The communication interface handles data acquisition and the distribution of database query statements. The target database server executes the query and returns execution feedback.

Claims

1. A method for verifying enterprise natural language query permissions based on intent decomposition, characterized in that, include: Obtain natural language queries and user permissions, decompose the natural language queries, determine target semantic slots and physical resource providers corresponding to each target semantic slot, wherein at least one target semantic slot corresponds to multiple semantically matched physical resource providers, and determine the initial physical resource provider from them to form an initial resource binding; The effective status of each physical resource provider is determined based on the actual query purpose of the physical resources in each physical resource provider and the user permissions. When a bound physical resource provider fails, the bound physical resource provider is identified as the failed physical resource provider. The semantic slots corresponding to the failed physical resource provider, as well as the semantic slots corresponding to downstream physical resource providers that have a direct or indirect necessary dependence on the failed physical resource provider or its necessary physical resources according to resource dependency relationships, are identified as affected semantic slots. The binding of the affected semantic slots is released, and the unaffected bindings are retained. Determine alternative physical resource providers from the remaining candidate physical resource providers for the affected semantic slots and re-establish resource bindings; Verify whether the re-established resource binding satisfies semantic constraints and database resource relationships, and verify whether its actual query purpose is covered by the user permissions. If the verification fails, re-determine the affected semantic slots and repeat the unbinding and re-establishment of resource binding until a closed binding query plan is formed or it is determined that a closed binding query plan cannot be formed. When forming the closed-loop binding query plan, the permission verification is determined to pass; if the closed-loop binding query plan cannot be formed, the permission verification is determined to fail.

2. The method according to claim 1, characterized in that, The process of decomposing the natural language query to determine the target semantic slot includes: Parse the natural language query to obtain semantic operators and the input-output dependencies between them; Semantic slots are established based on the database data input positions in each semantic operator, and the business semantic identifier, data granularity, time caliber, and actual query purpose of each semantic slot are determined. The semantic slots that are required to complete the natural language query and need to be bound to the physical resources of the database are determined as the target semantic slots.

3. The method according to claim 2, characterized in that, The process of determining the physical resource provider corresponding to each target semantic slot includes: Retrieve physical resources and their corresponding implementation expressions from the database system directory, view definitions, and indicator directory; The physical resources are semantically matched based on business semantic identifiers, data granularity, time caliber, measurement unit, and aggregation rules. The physical resource whose semantic matching result satisfies the semantic constraints of the corresponding target semantic slot is determined as the physical resource provider corresponding to the target semantic slot.

4. The method according to claim 1, characterized in that, The determination of the effective status of each physical resource provider based on the actual query purpose of the physical resources in each physical resource provider and the user permissions includes: Based on the semantic operators corresponding to the target semantic slots and the implementation expressions of the physical resource providers, determine the output, filtering, calculation, aggregation, sorting, comparison, or association uses of each physical resource. Match the actual query purpose and data scope corresponding to each physical resource with the user permissions; If the actual purpose of querying any necessary physical resource is not covered by the user's permissions, the corresponding physical resource provider will be identified as an invalid physical resource provider; otherwise, it will be identified as a valid physical resource provider.

5. The method according to claim 1, characterized in that, The determination of the resource dependencies includes: Based on the implementation expression of the physical resource provider, database connection relationship and data lineage, determine the dependency between upstream physical resources and downstream physical resource providers or semantic slots; Determine the dependency type and necessary dependency status for each dependency. The dependency types include computational dependencies, association dependencies, metric dependencies, and dimension dependencies. Write the dependencies, dependency types, and necessary dependency states into the resource dependency index to obtain the resource dependency relationship.

6. The method according to claim 5, characterized in that, The determination of the affected semantic slots includes: The failure of the physical resource provider and its necessary physical resources serve as the starting point for propagation; Based on the resource dependency index, downstream physical resource providers that require the propagation starting point as a necessary dependency are determined level by level. The downstream physical resource providers are identified as failed physical resource providers, and the corresponding semantic slots are identified as affected semantic slots. If there are remaining valid physical resource providers for the affected semantic slot, the affected semantic slot is added to the set to be rebounded. If there are no remaining valid physical resource providers, the newly determined failed physical resource providers continue to propagate along the necessary dependencies until there are no new failed physical resource providers, thus obtaining the affected semantic slot.

7. The method according to claim 6, characterized in that, The process of unbinding the affected semantic slots and retaining the unaffected bindings includes: Determine the local unbinding set based on the affected semantic slots and the set to be rebound; Release the resource binding between each semantic slot in the local unbinding set and the current physical resource provider; Resource bindings corresponding to semantic slots that are not included in the local unbinding set and have no direct or indirect necessary dependency on the failed physical resource provider are identified as the unaffected bindings.

8. The method of claim 7, wherein, The step of determining an alternative physical resource provider from the remaining candidate physical resource providers for the affected semantic slot and re-establishing the resource binding includes: Exclude invalid physical resource providers and physical resource providers that have failed verification during the current binding process from the physical resource providers corresponding to each semantic slot in the local unbinding set; Based on the semantic constraints of the corresponding semantic slot, the actual query purpose of the physical resource, and the user's permissions, a replacement physical resource provider is determined from the remaining physical resource providers; Establish a new resource binding based on the database connection relationship between the alternative physical resource provider and the unaffected binding; When the database connection relationship changes and the unaffected binding loses its necessary dependency, the corresponding semantic slot is added to the local unbinding set and an alternative physical resource provider is re-determined to obtain a rebinding result.

9. The method according to claim 8, characterized in that, The verification of whether the re-established resource binding satisfies semantic constraints and database resource relationships, and the verification of whether the actual query purpose is covered by the user permissions, include: Determine whether each target semantic slot is bound to a valid physical resource provider; Determine whether the bound physical resources form an executable database processing structure through database connection relationships or implementation expressions, and determine whether the actual query purpose of each bound physical resource is covered by the user permissions; When each target semantic slot is bound to a valid physical resource provider, the executable database processing structure is formed, and each actual query purpose is covered by the user's permissions, the closed binding query plan is formed. When a new failed physical resource provider is generated or the database resource relationship verification fails, the affected semantic slots are re-identified and the unbinding and re-establishment of resource binding are repeated. If there is no remaining valid physical resource provider for any target semantic slot or the executable database processing structure cannot be formed, it is determined that the closed binding query plan cannot be formed.

10. The method according to claim 9, characterized in that, The method further includes: The physical tables or views, fields, join relationships, filter conditions, derived expressions, aggregation relationships, sorting relationships, and projection relationships in the closed-loop binding query plan are respectively converted into data sources, join conditions, filter conditions, calculated expressions, aggregation structures, sorting structures, and output fields in the database query statement to obtain the database query statement; Parse the database query statement to obtain the actual physical resources and query operations used by the database query statement; The actual physical resources and query operations used are matched with the physical resources and query operations in the closed-loop binding query plan. If they match, the database query statement is executed; if they do not match, the execution of the database query statement is prevented.