Data query method, device and equipment based on BI system and medium
By extracting and transforming the query text of the BI system, and combining it with similarity retrieval and calculation from a vector database, the problems of the BI system's inability to understand intent and synchronization delays were solved, enabling fast and secure data queries and improving query efficiency and data real-time performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NEW TREND INT LOGIS TECH
- Filing Date
- 2026-05-07
- Publication Date
- 2026-06-02
Smart Images

Figure CN122132557A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a data query method, apparatus, device, and medium based on a BI system. Background Technology
[0002] Enterprise BI (Business Intelligence) systems typically accumulate a large number of reports and datasets, which are defined through structured metadata. Traditionally, users need to know the exact identifier or name of the target resource beforehand and manually construct requests according to fixed query condition formats to obtain the data, which has a high barrier to entry.
[0003] While existing improvement solutions incorporate keyword search, the retrieval methods only support exact string matching and cannot understand the user's natural language intent, leading to lexical mismatches and information silos. Furthermore, the introduction of a vector database results in significant delays in metadata change synchronization, severely impacting high availability.
[0004] Therefore, existing BI (Business Intelligence) systems suffer from problems such as incomprehensible intent, delayed vector library synchronization, and high security risks, resulting in low query efficiency. Summary of the Invention
[0005] This invention provides a data query method, apparatus, device, and medium based on a BI system, aiming to solve the problems of low query efficiency caused by the inability to understand intent, vector library synchronization delay, and high security risks in existing BI (Business Intelligence) system data query methods.
[0006] To address the aforementioned problems, in a first aspect, embodiments of the present invention provide a data query method based on a BI system, the method comprising: In response to the query text, query extraction processing is performed on the query text to obtain query entity data; The query entity data is transformed to obtain a query vector; In a pre-built vector database, a candidate resource set is obtained by performing similarity retrieval processing on the query vector based on a retrieval strategy. The relevance score is obtained by calculating and processing the query vector and the candidate resource set according to the matching score strategy; The candidate resource set is sorted using the relevance scores to obtain an ordered candidate resource set; The query results are obtained by selecting from the ordered candidate resource set according to the selection strategy.
[0007] Secondly, embodiments of this application provide a data query device based on a BI system, the device comprising: The query extraction unit is used to extract query entity data from the query text in response to the query text. The transformation unit is used to transform the query entity data to obtain a query vector; The retrieval unit is used to perform similarity retrieval processing on the query vector in a pre-built vector database based on a retrieval strategy to obtain a candidate resource set; The calculation unit is used to calculate and process the query vector and the candidate resource set according to the matching scoring strategy to obtain a relevance score; A sorting unit is used to sort the candidate resource set using the relevance score to obtain an ordered candidate resource set; The selection unit is used to select from the ordered candidate resource set according to the selection strategy to obtain the query result.
[0008] Thirdly, embodiments of this application provide a computer device, the computer device including a memory and a processor connected to the memory; the memory is used to store a computer program, and the processor is used to run the computer program stored in the memory to perform the method described in the first aspect above.
[0009] Fourthly, embodiments of this application provide a storage medium storing a computer program, the computer program including program instructions, which, when executed by a processor, implement the method described in the first aspect above.
[0010] This invention provides a data query method, apparatus, device, and medium based on a BI system. The method includes: responding to query text, performing query extraction processing on the query text to obtain query entity data; transforming the query entity data to obtain a query vector; performing similarity retrieval processing on the query vector in a pre-built vector database based on a retrieval strategy to obtain a candidate resource set; calculating a relevance score on the query vector and the candidate resource set according to a matching score strategy; sorting the candidate resource set using the relevance score to obtain an ordered candidate resource set; and selecting from the ordered candidate resource set according to a selection strategy to obtain a query result. Therefore, this invention obtains query results through query extraction, transformation, retrieval, calculation, sorting, and selection processing. Users do not need to understand the specific content and query condition format of the system resources; they can accurately locate target resources and obtain query results through natural language descriptions, achieving fast querying while ensuring data security, thereby improving query efficiency. Simultaneously, it also achieves efficient incremental synchronization, ensuring the real-time nature, validity, and accuracy of data, thereby improving query efficiency. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 A flowchart illustrating the data query method based on a BI system provided in an embodiment of the present invention; Figure 2 A schematic block diagram of a data query device based on a BI system provided in an embodiment of the present invention; Figure 3 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation
[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0015] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0016] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0017] It should be noted that if any AI models, software tools, or components not belonging to the applicant appear in the embodiments of this application, they are merely illustrative examples and do not represent actual use. The user personal information involved in the embodiments of this application is obtained by an entity authorized (knowing and consenting) by the relevant parties or fully authorized by all parties through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.
[0018] Please see Figure 1 , Figure 1 This is a flowchart illustrating a data query method based on a BI system provided in an embodiment of the present invention. Figure 1 As shown, this embodiment of the invention provides a data query method based on a BI system. The BI system refers to a business intelligence system, and the system resources corresponding to the system can be stored in a vector database. The system resources refer to the reports or datasets corresponding to the business intelligence system.
[0019] The method includes the following steps S110-S160.
[0020] S110. In response to the query text, perform query extraction processing on the query text to obtain query entity data.
[0021] In this embodiment, the query text is sent by the user terminal. For example, the query text could be "View sales figures for East China this month", etc.
[0022] The query extraction process for obtaining query entity data involves calling a preset extraction model to extract entities from the query text, thereby obtaining spatiotemporal entities and indicator business domain entities contained in the query text. These spatiotemporal entities and indicator business domain entities are then used as the query entity data. The preset extraction model can be a large language model or similar model capable of entity extraction. The spatiotemporal entities include time range, time granularity, region, organization, and channel, etc.; the indicator business domain entities include metrics, analysis dimensions, business domains, data sources, and report names, etc.
[0023] In one embodiment, the response prior to the query text further includes: Acquire initial system resources, and perform resource extraction processing on the initial system resources to obtain resource entity data and semantic digest; The semantic summary is transformed to obtain the summary vector; The resource entity data and the corresponding summary vector are used as target system resources, and the vector database is constructed using the target system resources.
[0024] In this embodiment, the initial system resources refer to the reports or datasets corresponding to the business intelligence system, including several system resources; each system resource corresponds to one report or dataset, forming a one-to-one relationship; the system resources can be understood as system metadata, which may include resource ID (resourceId), resource description (resourceDesc), query condition definition (queryConditions), and return value definition (returnValue); the resource ID is a unique identifier of the system resource; the resource description is a textual description of the system resource; the query condition definition is the filtering query condition fields and their operators supported by the system resource; the return value definition is the data field structure returned after the resource query (including field name, field type, field description, etc.).
[0025] A company's business intelligence system typically accumulates a large number of such system resources (i.e., multiple reports and datasets). The core objective of this invention is to help users accurately locate target resources from these vast amounts of system resources through semantic retrieval.
[0026] The initial system resources are processed to extract resource entity data and semantic summaries. Specifically, a preset extraction model is used to extract the initial system resources, concatenating their metadata to obtain a structured input text. This input text, along with a preset system prompt, is sent to the large language model. Finally, the large language model's Chat Completion API is called, setting temperature=0 (to ensure output determinism), and the output format is set to JSON Object (via the response_format parameter) to automatically generate the resource entity data and semantic summary that meet the constraints based on its semantic understanding of the input text. The input text includes resource ID, resource description, query condition field names (including field descriptions), and return value field names. The resource entity data includes spatiotemporal / organizational entities and indicator / business domain entities. The spatiotemporal / organizational entities include time range, time granularity, region, organization, and channel, etc. These entities strictly define the data analysis boundaries in both physical and business dimensions. The indicator / business domain entities include metrics, analysis dimensions, business domains, data sources, and report names; these entities constitute the core logical semantic support for resource analysis. The semantic summary uses a preset number of tokens to summarize the main content of the system resources. For example, the system prompts can explicitly constrain output requirements: summarizing the main content of the resource using no more than 300 tokens, and prohibiting explanations of reasons, industry background, or speculative conclusions. The preset extraction model can be a large language model or other model capable of entity extraction.
[0027] The semantic summary is transformed to obtain the summary vector. Specifically, the semantic summary is transformed using a preset transformation model to obtain the summary vector. The preset transformation model can be an embedding model or other model that converts text (or other data) into vectors.
[0028] The step involves using the resource entity data and the corresponding digest vector as target system resources, and constructing the vector database using the target system resources. Specifically, the resource entity data and the corresponding digest vector are written into the vector database as payloads in the form of flat key-value pairs, i.e., the target system resources, to complete the construction of the vector database.
[0029] S120. The query entity data is transformed to obtain a query vector.
[0030] In this embodiment, after obtaining the query entity data, the query entity data can be transformed to obtain a query vector.
[0031] The process of transforming the query entity data to obtain the query vector involves, specifically, using a preset transformation model to transform the query entity data to obtain the query vector. The preset transformation model can be an embedding model or similar model that converts text (or other data) into vectors.
[0032] S130. In a pre-constructed vector database, a similarity retrieval process is performed on the query vector based on a retrieval strategy to obtain a candidate resource set.
[0033] In this embodiment, after obtaining the query vector, a candidate resource set can be obtained by performing similarity retrieval processing on the query vector based on a retrieval strategy in a pre-built vector database.
[0034] In one embodiment, the step of performing similarity retrieval processing on the query vector based on a retrieval strategy in a pre-constructed vector database to obtain a candidate resource set includes: The initial similarity set is obtained by calculating the similarity between the query vector and each summary vector in the vector database; The initial similarity set is filtered according to a dynamic threshold strategy to obtain the target similarity set; The target system resources corresponding to the target similarity set are obtained from the vector database as the candidate resource set.
[0035] In this embodiment, the initial similarity set is obtained by calculating the similarity between the query vector and each summary vector in the vector database. Specifically, the initial similarity set is obtained by performing pure vector cosine similarity retrieval between the query vector and the summary vector in the vector database.
[0036] The initial similarity set is filtered according to a dynamic threshold strategy to obtain a target similarity set. Specifically, the initial similarity set is sorted in descending order of similarity to obtain an ordered similarity set. The target similarity set is then selected from this ordered similarity set according to a preset number of candidates. The number of candidates is set to 10% of the total system resources, and its physical range is strictly constrained to a lower limit of 10 and an upper limit of 100. This pure vector retrieval does not impose any filtering conditions, ensuring semantic recall and preventing the omission of relevant resources due to overly strict entity matching filtering conditions.
[0037] Finally, the target system resources corresponding to the target similarity set are obtained from the vector database as the candidate resource set.
[0038] Furthermore, after obtaining the target system resources corresponding to the target similarity set from the vector database as the candidate resource set, the method further includes: Obtain the list of permission resource identifiers corresponding to the user terminal, and obtain the candidate resource identifier for each candidate resource in the candidate resource set; If the candidate resource identifier is in the permission resource identifier list, then the candidate resource corresponding to the candidate resource identifier is taken as a sub-candidate resource, and a number of the sub-candidate resources are taken as the latest candidate resource set; If the candidate resource identifier is not in the list of permission resource identifiers, then the candidate resource corresponding to the candidate resource identifier will be deleted.
[0039] In this embodiment, if none of the candidate resource identifiers for all candidate resources in the candidate resource set are in the permission resource identifier list, a notification message indicating that the user does not have the corresponding permission is directly sent to the user terminal. Here, the user terminal refers to the user who sent the query text.
[0040] The resource_id list, i.e. the list of permission resource identifiers, can be sent through the permission check interface of the BI system backend to determine the list of resource identifiers allowed by the permissions corresponding to the user terminal, thereby ensuring data security.
[0041] S140. Calculate and process the query vector and the candidate resource set according to the matching score strategy to obtain the relevance score.
[0042] In this embodiment, after obtaining the query vector and the candidate resource set, a relevance score can be calculated and processed on the query vector and the candidate resource set according to the matching score strategy.
[0043] In one embodiment, the step of calculating and processing the query vector and the candidate resource set according to the matching scoring strategy to obtain a relevance score includes: Obtain a preset relevance scoring function and preset weights, and obtain the similarity score between the query vector and each candidate resource in the candidate resource set; The query vector and the candidate resource set are confirmed using an indicator function to obtain an indicator value; The preset weight, the similarity score, and the indicator value are input into the relevance scoring function to calculate the relevance score.
[0044] In this embodiment, the correlation scoring function is: Where q (query) represents the query vector; d (document) represents the candidate variable of each candidate resource in the candidate resource set, that is, the candidate variable can be obtained by transforming each candidate resource in the candidate resource set using the preset transformation model; S_dense(q,d) is the cosine similarity score between the obtained query vector and each candidate variable, that is, the similarity score; : The set of entity categories extracted from the query vector q (or query entity data) by the large language model. The set of entity categories includes time range, time granularity, region, organization and channel, as well as metrics, analysis dimensions, business domain, data source and report name, etc. It is an indicator function that indicates the category of an entity matched in the query vector q. The value is 1 when a resource appears in the candidate resource set d, and when a certain entity category is matched in the query vector q. The value is 0 when the resource does not appear exactly in the candidate resource set d. The reward is a constant weight with a preset weight, and the specific value is [not specified]. =0.05; that is, for each entity category field matched, an additional 0.05 points are added to the base cosine similarity score (i.e., the similarity score). Therefore, the physical meaning of this relevance scoring function formula is: Final relevance score = base vector semantic similarity score + entity category match bonus score.
[0045] Regarding the preset weight values, in standard pre-trained embedding models, the cosine similarity of similar but unrelated documents typically fluctuates between 0.70 and 0.85. In this case, an entity weight of 0.05 (or as high as 0.15 if three entity categories are hit) is sufficient to break the deadlock of vector clustering in the candidate resource set, forcing documents containing precise business definitions to the top of the rankings, thus ensuring data accuracy.
[0046] S150. The candidate resource set is sorted using the correlation score to obtain an ordered candidate resource set.
[0047] In this embodiment, after obtaining the relevance score and the candidate resource set, the candidate resource set can be sorted using the relevance score to obtain an ordered candidate resource set.
[0048] In one embodiment, the step of sorting the candidate resource set using the relevance score to obtain an ordered candidate resource set includes: The candidate resource set is sorted in descending order according to the relevance score to obtain the ordered candidate resource set.
[0049] In this embodiment, the candidate resource set is sorted in descending order according to the relevance score to obtain the ordered candidate resource set, which provides accurate data for subsequent targeted processing, ensuring data accuracy and thus improving query efficiency.
[0050] S160. Select the ordered candidate resource set according to the selection strategy to obtain the query result.
[0051] In this embodiment, after obtaining the ordered candidate resource set, the ordered candidate resource set can be selected according to the selection strategy to obtain the query results.
[0052] In one embodiment, the step of selecting the ordered candidate resource set according to the selection strategy to obtain the query result includes: Get the preset number of selections; The preset number of candidate resources are selected from the ordered candidate resource set as the query result.
[0053] In this embodiment, the preset selection number can be 3, that is, the first 3 candidate resources are selected from the ordered candidate resource set as the query result, and the query result can be returned to the user terminal.
[0054] Furthermore, regarding the method for caching and synchronizing the initial system resources: the system maintains a resource cache and a relational cache in memory, with each cache record containing resource details and its corresponding version number string. The system periodically requests the global version number from the BI system's backend at configurable time intervals (default 60 seconds) via a background asynchronous polling task. The synchronization process consists of two logical levels: the system backend first detects and compares the global version number with the BI system's backend. The global version number is an atomic variable that monotonically increases with any minor changes within the system. If the locally stored global version number matches the remote version number, it indicates that the entire system's data dashboard has been in a silent state during the previous polling cycle, and the synchronization task terminates directly, skipping all subsequent processes. Only when the global version number drifts (changes) does the system initiate a request to the BI backend to retrieve a detailed list of version numbers, accurately identifying three types of changes: newly added resources that exist remotely but not locally; resources with content changes where the remote version number differs from the local version number; and deleted resources that exist locally but not remotely. The remote end can be another server within a local area network, or a cloud service on the Internet or a remote data center.
[0055] Differential execution: For newly added and modified resources, the system only retrieves the detailed data of these resources for cache updates; for deleted resources, they are removed from the local cache; after synchronization, the local global version number is updated, and downstream components are notified to perform corresponding incremental update operations through registered callback functions. After the execution of the resource cache in memory is completed, the newly added and modified system resources are synchronized to the vector database.
[0056] Furthermore, this solution achieves complete lock-free read and write operations. Readers (i.e., online natural language retrieval requests, the user end) perform consistent memory reads based on the current version number, enjoying a lightning-fast experience with zero waiting time; simultaneously, writers (i.e., incremental synchronization background processes) silently calculate the incremental vector embedding for the new report in the background. Once the writer completes all calculations and persistence, it advances the global version number forward via atomic instructions. This mechanism ensures that the retrieval system will never block the availability of online services when performing complex incremental modifications.
[0057] Furthermore, the system uses a local file-based vector database to store index data, with both vector and payload data persisted to disk as files. The index builder maintains four strictly mutually exclusive lifecycle states: NOT_STARTED (index construction has not yet started); BUILDING (index is being built); READY (index construction is complete and retrieval services are available); and FAILED (index construction failed). This state machine isolation ensures that any dirty indexes that have not been fully initialized are never exposed to the front end. During a full build, the system calls the large language model to perform entity extraction, generate embedding vectors, and write them to the vector database for each system resource. The build process runs in a background asynchronous task, without blocking the startup and response of the main service. The build process supports asynchronous cancellation; if it is canceled midway through the build, the successfully written portion of the index is still marked as READY, avoiding progress loss.
[0058] Furthermore, this solution abandons the fragile pure memory operation mode and adopts a strategy of persistently storing the index as a file on the host disk. The cold start recovery mechanism is as follows: When the service restarts, the system checks whether there is a valid collection with a number of points greater than zero in the persistent storage of the vector database; if so, the system uses the operating system's underlying memory mapping technology (mmap) to achieve zero-copy direct loading from disk to physical memory, so that the high-dimensional graph structure instantly resides in the memory address space without recalculating node distances. The system state immediately jumps from NOT_STARTED to READY, and the semantic retrieval service is immediately available; the index builder sets a recovery flag (is_restored) to indicate that the current scenario is a cold start recovery scenario.
[0059] Furthermore, persistent snapshots on disk reflect a historical slice at a point in time before a system crash, potentially losing metadata changes that occurred in the system backend between the crash and restart. This solution asynchronously triggers a cache synchronization callback immediately upon the system being marked as READY and ready to provide services. During the callback, the index builder identifies a cold start recovery scenario and executes the following differentiated logic: if no resources have been deleted in the system backend and the recovery flag is true, the index version number is directly aligned to the current cache version number, skipping incremental updates and achieving zero-overhead recovery; if resources have been deleted, incremental extraction and writing are only performed on new resources not present in the vector database, skipping processing for existing resources. This mechanism perfectly illustrates the principle of eventual consistency in distributed systems: frontend users can smoothly retrieve historical main data, while the backend silently weaves missing incremental data into the index.
[0060] Furthermore, as an MCP Server, the system supports three communication transmission protocols to adapt to complex enterprise intranet topologies: stdio (Standard Input / Output): suitable for extremely low-latency communication when LLM (Large Language Model) proxy and retrieval services are deployed on the same physical machine or container environment; SSE (Server-Sent Events): suitable for scenarios where the server needs to actively push streaming long-connection messages to the AI model; Streamable HTTP: ensures large-scale load balancing capabilities in firewall and complex reverse proxy environments. The system exposes a set of standardized tool interfaces to any LLM (Large Language Model) client conforming to the MCP specification through the aforementioned standard transmission channel. These tool interfaces may include a time acquisition tool, a semantic search tool, a resource listing tool, a detail retrieval tool, a BI-based data query tool, and a relationship query tool. The time acquisition tool provides the current system time and commonly used relative time ranges, resolving the real-time time illusion problem in LLM. The semantic search tool performs vector retrieval and entity reordering, returning Top-N matching results and matching reasons. The resource listing tool is based on keyword-based resource discovery and list display. The detail retrieval tool provides a structured display of resource metadata (query conditions, sorting rules, return value structure). The BI-based data query tool supports conditional queries using 11 filtering operators. The relationship query tool displays nested relationships between resources.
[0061] Furthermore, in traditional API authentication, developers often need to hardcode long-term valid database passwords or API keys to the LLM, posing a significant risk of key leakage. This solution can fully utilize Passkey and One-time Token mechanisms.
[0062] Before executing a query, the system first sends a permission verification request to the BI backend. The BI backend returns one of two authorization modes based on the current user's identity: Passkey mode, which directly returns a one-time query token, used by the system to query data without needing to pass query conditions. Passkey relies on asymmetric public-key cryptography, possessing strong anti-phishing capabilities and cannot be silently stolen by programs; and Conditional Constraint mode, which returns a set of permission conditions, which the system combines with user-defined filter conditions before initiating the query. Only after the permission verification is successful will the system allow the actual data query operation based on the BI system to be executed.
[0063] Furthermore, upon receiving the query conditions generated by the LLM, this solution does not directly send them to the BI database engine. The system's backend engine forcibly intercepts the process at the execution path, merging the permission constraints (such as row-level security RLS policies) returned by the underlying BI system for the current requesting user with the conditions parsed by the LLM, constructing a new Abstract Syntax Tree (AST) intersection in memory. This means that even if the LLM suffers a complex adversarial jailbreak attack attempting to generate a global query statement, the condition merging mechanism will forcibly inject non-preemptible additional predicates at the physical execution layer. This method of hard-coding the underlying authentication logic to the dynamic execution context provides the system with an absolute security safeguard independent of the model's security itself, fundamentally preventing the possibility of data breaches and leaks.
[0064] Furthermore, context window truncation protection: To prevent excessive data from overwhelming the LLM's context window and causing a decline in inference capabilities, the system implements truncation protection for list-formatted returned data, limiting the maximum number of returned rows to 100. This limitation not only prevents massive data leakage but also significantly reduces API token fees.
[0065] In summary, this invention discloses a process that, in response to query text, involves: extracting query entity data from the query text; transforming the query entity data to obtain a query vector; performing similarity retrieval on the query vector in a pre-built vector database based on a retrieval strategy to obtain a candidate resource set; calculating a relevance score between the query vector and the candidate resource set according to a matching score strategy; sorting the candidate resource set using the relevance score to obtain an ordered candidate resource set; and selecting from the ordered candidate resource set according to a selection strategy to obtain the query result. As can be seen, this invention obtains query results through query extraction, transformation, retrieval, calculation, sorting, and selection processes. Users do not need to know the specific IDs of system resources or the format of query conditions; they can accurately locate target resources and obtain query results through natural language descriptions, achieving fast querying while ensuring data security, thereby improving query efficiency. Simultaneously, it also achieves efficient incremental synchronization and second-level cold start recovery, ensuring the real-time nature, validity, and accuracy of data, thereby improving query efficiency.
[0066] Figure 2 This is a schematic block diagram of a data query device based on a BI system provided in an embodiment of the present invention. Figure 2 As shown, this embodiment of the invention provides a data query device 700 based on a BI system to implement the method described above. The BI system refers to a business intelligence system, and the system resources corresponding to the system can be stored in a vector database. The system resources refer to the reports or datasets corresponding to the business intelligence system.
[0067] Please see Figure 2 The data query device 700 based on the BI system includes: The query extraction unit 701 is used to perform query extraction processing on the query text in response to the query text to obtain query entity data. The conversion unit 702 is used to convert the query entity data to obtain a query vector; The retrieval unit 703 is used to perform similarity retrieval processing on the query vector based on a retrieval strategy in a pre-constructed vector database to obtain a candidate resource set; The calculation unit 704 is used to calculate and process the query vector and the candidate resource set according to the matching scoring strategy to obtain a relevance score; The sorting unit 705 is used to sort the candidate resource set using the relevance score to obtain an ordered candidate resource set. The selection unit 706 is used to select the ordered candidate resource set according to the selection strategy to obtain the query result.
[0068] In some embodiments, the retrieval unit 703 performs similarity retrieval processing on the query vector based on a retrieval strategy in a pre-built vector database to obtain a candidate resource set, including: The initial similarity set is obtained by calculating the similarity between the query vector and each summary vector in the vector database; The initial similarity set is filtered according to a dynamic threshold strategy to obtain the target similarity set; The target system resources corresponding to the target similarity set are obtained from the vector database as the candidate resource set.
[0069] In some embodiments, the calculation unit 704 calculates a relevance score by performing a matching scoring strategy on the query vector and the candidate resource set, including: Obtain a preset relevance scoring function and preset weights, and obtain the similarity score between the query vector and each candidate resource in the candidate resource set; The query vector and the candidate resource set are confirmed using an indicator function to obtain an indicator value; The preset weight, the similarity score, and the indicator value are input into the relevance scoring function to calculate the relevance score.
[0070] In some embodiments, the query extraction unit 701 further includes, before responding to the query text: Acquire initial system resources, and perform resource extraction processing on the initial system resources to obtain resource entity data and semantic digest; The semantic summary is transformed to obtain the summary vector; The resource entity data and the corresponding summary vector are used as target system resources, and the vector database is constructed using the target system resources.
[0071] In some embodiments, the sorting unit 705 performs sorting processing on the candidate resource set using the relevance score to obtain an ordered candidate resource set, including: The candidate resource set is sorted in descending order according to the relevance score to obtain the ordered candidate resource set.
[0072] In some embodiments, the selection unit 706 performs selection processing on the ordered candidate resource set according to the selection strategy to obtain the query result, including: Get the preset number of selections; The preset number of candidate resources are selected from the ordered candidate resource set as the query result.
[0073] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned device can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.
[0074] The above-described device can be implemented as a computer program, and the computer program can be implemented in, for example... Figure 3 It runs on the computer device shown.
[0075] Please see Figure 3 , Figure 3 This is a schematic block diagram of an electronic device provided in an embodiment of the present invention. The electronic device 800 can be a terminal or a server. The terminal can be an electronic device with communication functions. The server can be a standalone server or a server cluster composed of multiple servers.
[0076] See Figure 3 The electronic device 800 includes a processor 802, a memory, and a network interface 805 connected via a system bus 801. The memory may include a non-volatile storage medium 803 and internal memory 804.
[0077] The non-volatile storage medium 803 may store an operating system 8031 and a computer program 8032. The computer program 8032 includes program instructions that, when executed, cause the processor 802 to perform a data query method based on a BI system.
[0078] The processor 802 provides computing and control capabilities to support the operation of the entire electronic device 800.
[0079] The internal memory 804 provides an environment for the execution of the computer program 8032 in the non-volatile storage medium 803. When the computer program 8032 is executed by the processor 802, the processor 802 can execute a data query method based on a BI system.
[0080] This network interface 805 is used for network communication with other devices. Those skilled in the art will understand that... Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the electronic device 800 to which the present invention is applied. The specific electronic device 800 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0081] The processor 802 is used to run a computer program 8032 stored in the memory to perform the following steps: In response to the query text, query extraction processing is performed on the query text to obtain query entity data; The query entity data is transformed to obtain a query vector; In a pre-built vector database, a candidate resource set is obtained by performing similarity retrieval processing on the query vector based on a retrieval strategy. The relevance score is obtained by calculating and processing the query vector and the candidate resource set according to the matching score strategy; The candidate resource set is sorted using the relevance scores to obtain an ordered candidate resource set; The query results are obtained by selecting from the ordered candidate resource set according to the selection strategy.
[0082] It should be understood that, in this embodiment of the invention, the processor 802 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0083] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program includes program instructions and can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0084] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When executed by a processor, the program instructions cause the processor to perform the following steps: In response to the query text, query extraction processing is performed on the query text to obtain query entity data; The query entity data is transformed to obtain a query vector; In a pre-built vector database, a candidate resource set is obtained by performing similarity retrieval processing on the query vector based on a retrieval strategy. The relevance score is obtained by calculating and processing the query vector and the candidate resource set according to the matching score strategy; The candidate resource set is sorted using the relevance scores to obtain an ordered candidate resource set; The query results are obtained by selecting from the ordered candidate resource set according to the selection strategy.
[0085] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.
[0086] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0087] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0088] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0089] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0090] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A data query method based on a BI system, characterized in that, The method includes: In response to the query text, query extraction processing is performed on the query text to obtain query entity data; the query entity data includes spatiotemporal entities and indicator business domain entities; The query entity data is transformed to obtain a query vector; In a pre-built vector database, a candidate resource set is obtained by performing similarity retrieval processing on the query vector based on a retrieval strategy. The relevance score is obtained by calculating and processing the query vector and the candidate resource set according to the matching score strategy; The candidate resource set is sorted using the relevance scores to obtain an ordered candidate resource set; The query results are obtained by selecting from the ordered candidate resource set according to the selection strategy.
2. The method according to claim 1, characterized in that, The step of performing similarity retrieval on the query vector in a pre-built vector database based on a retrieval strategy to obtain a candidate resource set includes: The initial similarity set is obtained by calculating the similarity between the query vector and each summary vector in the vector database; The initial similarity set is filtered according to a dynamic threshold strategy to obtain the target similarity set; The target system resources corresponding to the target similarity set are obtained from the vector database as the candidate resource set.
3. The method according to claim 1, characterized in that, The step of calculating and processing the query vector and the candidate resource set according to the matching scoring strategy to obtain a relevance score includes: Obtain a preset relevance scoring function and preset weights, and obtain the similarity score between the query vector and each candidate resource in the candidate resource set; The query vector and the candidate resource set are confirmed using an indicator function to obtain an indicator value; The preset weight, the similarity score, and the indicator value are input into the relevance scoring function to calculate the relevance score.
4. The method according to claim 2, characterized in that, The response preceding the query text also includes: Acquire initial system resources, and perform resource extraction processing on the initial system resources to obtain resource entity data and semantic digest; The semantic summary is transformed to obtain the summary vector; The resource entity data and the corresponding summary vector are used as target system resources, and the vector database is constructed using the target system resources.
5. The method according to claim 1, characterized in that, The step of sorting the candidate resource set using the relevance score to obtain an ordered candidate resource set includes: The candidate resource set is sorted in descending order according to the relevance score to obtain the ordered candidate resource set.
6. The method according to claim 1, characterized in that, The step of selecting the ordered candidate resource set according to the selection strategy to obtain the query result includes: Get the preset number of selections; The preset number of candidate resources are selected from the ordered candidate resource set as the query result.
7. A data query device based on a BI system, characterized in that, The device includes: The query extraction unit is used to extract query entity data from the query text in response to the query text; the query entity data includes spatiotemporal entities and indicator business domain entities. The transformation unit is used to transform the query entity data to obtain a query vector; The retrieval unit is used to perform similarity retrieval processing on the query vector in a pre-built vector database based on a retrieval strategy to obtain a candidate resource set; The calculation unit is used to calculate and process the query vector and the candidate resource set according to the matching scoring strategy to obtain a relevance score; A sorting unit is used to sort the candidate resource set using the relevance score to obtain an ordered candidate resource set; The selection unit is used to select from the ordered candidate resource set according to the selection strategy to obtain the query result.
8. The apparatus according to claim 7, characterized in that, The step of calculating and processing the query vector and the candidate resource set according to the matching scoring strategy to obtain a relevance score includes: Obtain a preset relevance scoring function and preset weights, and obtain the similarity score between the query vector and each candidate resource in the candidate resource set; The query vector and the candidate resource set are confirmed using an indicator function to obtain an indicator value; The preset weight, the similarity score, and the indicator value are input into the relevance scoring function to calculate the relevance score.
9. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-6.
10. A storage medium, characterized in that, The storage medium stores a computer program, which includes program instructions that, when executed by a processor, can implement the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Game strategy retrieval method and device based on event-driven knowledge graph embedding
CN120104814A
Resource recommendation method and system based on hybrid retrieval RAG
CN120780916A
Enterprise knowledge base retrieval and intelligent answering method and system based on large language model
CN121681719A
Retrieval optimization method adaptive to multi-dimensional storage of power documents
CN121858715A