Construction of multi-source legal knowledge graph of consumer rights protection and intelligent retrieval method

By constructing a multi-source legal knowledge graph and combining it with a hybrid strategy of semantic vector and keyword retrieval, the problem of fragmented legal knowledge and semantic gap in the field of consumer rights protection has been solved, and intelligent legal consultation services with high coverage, timeliness and regional adaptability have been achieved.

CN120743931BActive Publication Date: 2025-12-16HANGZHOU NAT E-COMMERCE PROD QUALITY MONITORING & DISPOSAL CENT +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511265100.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-05
Publication Date
2025-12-16
Estimated Expiration
2045-09-05

AI Technical Summary

Technical Problem

Existing intelligent legal consultation systems in the field of consumer rights protection face technical challenges in integrating and accurately retrieving multi-source heterogeneous legal knowledge, including issues such as knowledge fragmentation, semantic gaps, difficulties in cross-clause reasoning, and insufficient regional and industry adaptability, resulting in insufficient knowledge base completeness and timely answers.

Method used

By constructing a multi-source legal knowledge graph, adopting entity alignment and semantic mapping mechanisms to uniformly represent legal concepts, and combining semantic vector retrieval and keyword retrieval in parallel strategies, a high-coverage candidate set is generated. Furthermore, a legal basis chain is formed through multi-hop path reasoning, embedding legal clauses and case source tags to achieve real-time updates and regional adaptation of the knowledge base.

Benefits of technology

It significantly improves the completeness and relevance of the legal knowledge base, enhances the professional depth and credibility of the answers, ensures the timeliness and regional applicability of search results, and improves the robustness of the system and the response stability under high concurrency scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743931B_ABST
    Figure CN120743931B_ABST
Patent Text Reader

Abstract

The application discloses a multi-source legal knowledge graph construction and intelligent retrieval method for consumer rights protection, and relates to the field of legal knowledge graph and retrieval. The method comprises the following steps: constructing a multi-source legal knowledge graph, unifying semantically equivalent legal concept nodes through an entity alignment mechanism, and adding regional and industry source labels to the nodes; analyzing user natural language questions, extracting legal entities, dispute elements, and regional and industry context constraints involved therein; adopting a hybrid retrieval strategy of parallel semantic vector retrieval and keyword retrieval, combining the context constraints to pre-filter and limit the retrieval range, and generating a candidate legal clause set; based on the knowledge graph, performing multi-hop path reasoning on the candidate legal clauses to generate an associated path with node contribution weights; and outputting traceable answers with legal clause references and case sources. The application can significantly improve the coverage, accuracy and credibility of legal consulting services, and has high application value.
Need to check novelty before this filing date? Find Prior Art

Description

BACKGROUND

[0001] The present application relates to the field of legal knowledge graph and retrieval, and particularly relates to a multi-source legal knowledge graph construction and intelligent retrieval method for consumer rights protection.

[0002] The current intelligent legal consultation system in the field of consumer rights protection faces technical challenges in integrating and accurately retrieving multi-source heterogeneous legal knowledge. Related legal knowledge is scattered in heterogeneous data sources such as regulations, industry standards and judicial cases, which have low structured degree and significant differences in semantic expression, resulting in serious fragmentation and islandization of the knowledge base. Traditional systems mainly rely on keyword matching-based retrieval mechanism, which cannot effectively bridge the semantic gap between user natural language description and legal professional terminology, and lack dynamic adaptation ability to regional differences and industry characteristics. At the same time, due to the lack of unified structured representation of legal knowledge, the system is difficult to realize cross-clause and case association reasoning, resulting in lack of legal basis chain support for complex multi-factor problem solving. The existing solutions have systematic defects in knowledge coverage, retrieval accuracy and result explainability, and it is urgent to realize the deep integration of multi-source knowledge and semantic-driven intelligent retrieval through technological innovation.

[0003] The core defects of the existing method mainly include: 1. Regulations and case data are stored in isolated form, lacking entity alignment and semantic fusion mechanism across data sources, which cannot construct a knowledge network covering multi-level legal system, resulting in limited knowledge base integrity; 2. Over-reliance on keyword literal matching or single semantic vector retrieval, the former is easy to miss semantic related clauses due to terminology differences, and the latter is difficult to ensure the full recall of key elements mentioned by the user, both of which cannot balance high precision and high recall rate; 3. No explicit association path between legal clauses and cases is established, the system cannot perform multi-hop reasoning to generate conclusions by integrating multiple legal basis, resulting in lack of professional depth and logical explainability of the answer to complex consultation; 4. Lack of active perception mechanism for regional and industry context, and knowledge base update relies on manual batch operation, which cannot respond to regulations revision and new cases in real time, resulting in insufficient timeliness and regional adaptability of the answer. Therefore, based on the above problems, the present application proposes a multi-source legal knowledge graph construction and intelligent retrieval method for consumer rights protection. SUMMARY

[0004] OBJECTIVE

[0005] In order to solve the above problems, the purpose of the present application is to provide a multi-source legal knowledge graph construction and intelligent retrieval method for consumer rights protection, by constructing a unified knowledge representation and intelligent retrieval framework, realizing the deep integration of multi-level legal knowledge, the accurate analysis of user intent, the adaptive retrieval of cross-regional scenarios, and strengthening the authority and reasoning transparency of the answer, ultimately improving the coverage, accuracy and credibility of legal consultation services.

[0006] Technical solution

[0007] In order to achieve the above-mentioned purpose, the present application provides a multi-source legal knowledge graph construction and intelligent retrieval method for consumer rights protection, which uniformly represents heterogeneous data such as industry norms and judicial cases as a knowledge graph with regional and industry source labels through entity alignment and semantic mapping mechanism, solves the problem of fragmentation of legal knowledge; combined with legal dictionary and synonym library to analyze user natural language problems, extract legal entities, dispute elements and regional and industry context constraints, and generate structured queries; adopt parallel strategy of semantic vector retrieval and keyword retrieval, based on context pre-filtering dynamic limitation of retrieval range, and through adjustable weight fusion score generation of high coverage candidate set; form reasoning chain by connecting rule clauses and case nodes on knowledge graph, calculate path score according to node matching degree and topological distance attenuation weighting, and generate legal basis chain with contribution weight; embed machine-readable reference tags of legal clauses and cases in the answer, and realize real-time synchronization of knowledge base through incremental extraction and model cooperative optimization. This scheme systematically solves the problems of dispersion of legal knowledge, low efficiency of retrieval and weak reasoning, and realizes the coordinated improvement of coverage, authority and timeliness.

[0008] In the first aspect, the present application provides a multi-source legal knowledge graph construction and intelligent retrieval method for consumer rights protection, comprising:

[0009] A multi-source legal knowledge graph is constructed by integrating legal regulations, industry norms and case texts, the semantic equivalent legal concept nodes are unified through entity alignment mechanism, and regional and industry source labels are added to the nodes to realize the fusion representation and source traceability of cross-source knowledge;

[0010] The user natural language problem is analyzed, the legal entities, dispute elements and regional and industry context constraints involved are extracted, and the structured query adaptable to regional differences is generated to eliminate the semantic gap;

[0011] A hybrid retrieval strategy of semantic vector retrieval and keyword retrieval in parallel is adopted, the context constraints are combined to pre-filter and limit the retrieval range, and a candidate legal clause set with high recall rate and high precision is generated;

[0012] Based on the knowledge graph, multi-hop path reasoning is performed on the candidate legal clauses to generate an associated path with node contribution weight, forming a traceable legal basis chain to improve the professional depth of the answer; the multi-hop path reasoning connects the rule clause nodes and the associated case nodes in the knowledge graph to form a reasoning chain, and calculates the comprehensive score of the path according to the node matching degree and the topological distance, wherein the weight of the starting node is higher than that of the jump node, realizing the completeness guarantee of the answer for multi-element complex problems;

[0013] Output traceable answers with legal clause references and case sources to ensure the authority and verifiability of the conclusions.

[0014] Further, in the process of constructing the legal knowledge graph, joint entity recognition and relationship extraction are performed on structured regulation texts and unstructured case texts to generate triple knowledge units across data sources. Through a synonymous concept mapping mechanism, legal terms with different expressions but equivalent semantics are mapped to the same node in the knowledge graph, eliminating term fragmentation and achieving knowledge correlation.

[0015] Further, based on the pre-constructed legal field adaptive dictionary, user colloquial expressions are mapped to legal terms, and the extracted regional and industry context is used as a mandatory constraint condition in the retrieval stage to dynamically limit the sub-space range of regulation retrieval.

[0016] Further, in the mixed retrieval strategy, there are two parallel sub-modules: semantic vector retrieval engine and keyword retrieval engine. The semantic vector retrieval engine calculates the implicit semantic similarity between the problem and the legal clause using a deep language model, and the keyword retrieval engine matches legal terms and clause identifiers through an inverted index, and weights and fuses the results according to adjustable weight coefficients to achieve dynamic balance between semantic relevance and term coverage to optimize comprehensive retrieval performance.

[0017] Further, the pre-filtering limited retrieval range is executed before the start of mixed retrieval, and the retrieval authority of the corresponding regional legal regulation library or industry standard library is activated based on the parsed context constraints to improve regional adaptation accuracy and avoid invalid regulation interference.

[0018] Further, the path comprehensive score is obtained by accumulating the weighted matching scores of each node on the path, and the weight of the node decreases monotonically with the increase of the jump distance between the node and the user's question.

[0019] Further, in the process of generating traceable answers, the regulation name, clause number, and case source are embedded in the natural language answer text in the form of machine-readable tags; in the pure retrieval mode, the results containing the original text of the legal clause corresponding to the question are returned, and the hit keywords are visually highlighted.

[0020] Further, in constructing the legal knowledge graph, each node is assigned a pre-calculated confidence score, which is determined based on the type of data source corresponding to the node, the level of data source publication, and the decision-making agency.

[0021] In the mixed retrieval strategy, the confidence score is used as an adjustment factor for retrieval priority, and legal clauses corresponding to data sources with high confidence scores are preferentially returned.

[0022] In the multi-hop path reasoning, the confidence score is combined with the matching degree and topological distance of nodes in the path to calculate a comprehensive score of the path, and a node with a high confidence score is given a higher weight contribution.

[0023] Further, the method continuously monitors changes in legal data sources, updates the graph nodes and associated relationships through incremental extraction, and optimizes the semantic vector model and keyword dictionary according to the characteristics of the new data, continuously maintains the timeliness of the knowledge base, and synchronously optimizes the retrieval model.

[0024] In a second aspect, the present application also provides a multi-source legal knowledge graph construction and intelligent retrieval system for consumer rights protection, which comprises the method according to the first aspect.

[0025] A knowledge graph construction module is configured to perform entity recognition, relationship extraction and semantic alignment processing on multi-source heterogeneous data to construct the legal knowledge graph.

[0026] A user question analysis module is configured to integrate a legal field dictionary and a synonym library to analyze a user natural language question into a structured query carrying regional and industry constraints.

[0027] A hybrid retrieval module comprises a semantic vector retrieval submodule and a keyword retrieval submodule running in parallel, and is configured to perform semantic retrieval and keyword retrieval on the structured query and fuse the results.

[0028] A path reasoning fusion module is configured to perform multi-hop associated path search and score calculation on the retrieval candidate results based on a graph database, to generate the legal basis link and determine the best reasoning path.

[0029] A legal result output module is configured to generate a natural language answer containing legal clause references and case source identifiers according to the best path reasoning result.

[0030] A resource dynamic scheduling module is configured to automatically switch the semantic model calculation mode according to the hardware resource status, dynamically manage the graph database connection pool, and perform a retrieval retry mechanism in abnormal situations.

[0031] A service fault tolerance control module is configured to interrupt the reasoning process and fall back to output the keyword retrieval result when the path reasoning function is abnormal, and switch to a pure keyword retrieval mode when the semantic retrieval model is invalid.

[0032] In a third aspect, the present application also provides a computer readable storage medium, which stores a computer program, and the computer program is run by a processor to execute the multi-source legal knowledge graph construction and intelligent retrieval method for consumer rights protection.

[0033] The application fuses heterogeneous data sources such as laws and regulations, industry standards and judicial cases, generates cross-source triples through entity recognition and relation extraction, realizes semantic unified representation of knowledge nodes based on entity alignment and synonymous concept mapping mechanism, and adds regional and industry source labels to the nodes to support knowledge tracing; combines legal field dictionary and synonym library to analyze user natural language questions, extracts legal entities, controversial elements and regional industry context constraints, and pre-filters the context-based dynamic search sub-space; adopts a hybrid retrieval strategy of parallel execution of semantic vector retrieval and keyword retrieval, adjusts the weight coefficient to fuse semantic relevance and term coverage score, and generates a candidate result set with high recall rate and high precision; forms a reasoning chain by connecting the legal provisions and case nodes on the knowledge graph, calculates the path comprehensive score based on the node matching degree and topological distance attenuation weighting, and generates a legal basis chain with contribution weight annotation; embeds machine-readable labels such as regulation name, clause number and case citation in the output, and constructs a closed-loop update mechanism for collaborative optimization to maintain the timeliness of the knowledge base. The scheme is realized through a modular system architecture, supports dynamic adaptation of heterogeneous computing resources and service degradation strategy, and ensures robustness in high-concurrency scenarios.

[0034] The application eliminates the fragmentation and islandization of legal knowledge through multi-source heterogeneous knowledge fusion and entity alignment mechanism, constructs a unified semantic network covering a multi-level legal system, and significantly improves the completeness and relevance of the knowledge base; the dual-engine hybrid retrieval strategy considers semantic generalization ability and term accurate recall, and combines the context pre-filtering mechanism to significantly expand the search coverage while ensuring high relevance, effectively bridging the semantic gap between user natural language and legal professional terminology; the path reasoning mechanism generates a legal basis chain with contribution weight, and combines the clause reference and case tracing label embedded in the answer to make the conclusion have strong legal basis support and logical traceability, greatly improving the professional depth of the answer and the user credibility; the closed-loop update system based on incremental extraction synchronizes legal dynamics in real time, ensures that the knowledge base and the search model continuously adapt to the latest regulations, and the regional context perception mechanism ensures the effectiveness of the answer in cross-regional scenarios; the dynamic scheduling of heterogeneous computing resources and the service degradation strategy support the core function preservation in fault scenarios, and maintain the response stability of high-concurrency access. The scheme realizes a systematic breakthrough over the prior art in terms of knowledge integration breadth, comprehensive retrieval performance, answer professional depth and system adaptability.

[0035] Advantages

[0036] By implementing the above-mentioned consumer rights protection multi-source legal knowledge graph construction and intelligent retrieval method, the following technical effects are achieved:

[0037] (1) Through the entity alignment mechanism and cross-source semantic mapping, heterogeneous data such as regulations, industry standards and judicial cases are uniformly represented as a homogeneous graph structure, with regional and industry source labels. This architecture realizes the deep correlation of multi-level legal knowledge and the traceability of the source, significantly improving the integrity and relevance of the knowledge base. This framework solves the incomplete coverage problem caused by knowledge silos in traditional systems, providing global knowledge support for precise retrieval.

[0038] (2) Provide intelligent question analysis and context pre-filtering strategies for legal consultation questions. Combine semantic vector retrieval and keyword retrieval with a "double-engine" hybrid retrieval scheme, and dynamically pre-filter the search range based on user region and industry context. This mechanism ensures high relevance while considering term coverage completeness and semantic generalization ability, breaking through the inherent limitations of single retrieval mode in recall rate and precision, effectively bridging the semantic gap between user natural language expression and legal professional terminology.

[0039] (3) Multi-hop path reasoning fusion mechanism based on knowledge graph, which can connect multiple related regulation clause nodes and case nodes to form a reasoning chain, and calculate the path score based on node matching degree and topological distance weighting. Select the optimal link to generate conclusions. Compared with existing question and answer systems that rely on a single law directly, this chain reasoning mechanism gives the system the ability to analyze complex problems across multiple legal bases, ensuring that the generated legal conclusions and case sources have a logical chain, greatly improving the professional depth and explainability of the answers, solving the problem of fragmented knowledge that cannot support chain reasoning in existing technology.

[0040] (4) Proposed a self-adaptive updating mechanism for legal knowledge base, through the closed-loop mechanism of regulation monitoring, incremental extraction and model co-optimization, to realize the automatic discovery, extraction and index updating of newly enacted legal clauses and cases. This mechanism ensures that the knowledge base content is synchronized with the legal dynamics in real time, continuously maintains the timeliness and authority of the search results, overcomes the problem of outdated knowledge caused by manual update lag in traditional systems, and significantly reduces the long-term operation and maintenance cost.

[0041] (5) Fusion of regional context information for retrieval pre-filtering, with cross-regional regulation adaptation capability. The system can automatically limit the search range according to the user's region and preferentially return the regulations of the corresponding region, ensuring that the answers meet the requirements of local laws and policies. Thanks to the integration of regional labels and context constraint strategies, the use of invalid regulations from other regions is effectively avoided, improving the practical applicability of the answers.

[0042] (6) A perfect exception handling and fault-tolerant mechanism is constructed, which combines dynamic scheduling of heterogeneous computing resources and service degradation strategy to ensure the reliable operation and basic service of the system when faults occur in each module or the concurrent request is too high. For example, when the semantic model fails to load or the knowledge graph database connection is abnormal, the system can automatically switch to a simplified model or pure keyword retrieval mode to continue service. When the performance of some modules is reduced, high time-consuming steps can also be temporarily skipped to ensure timely response. The above fault-tolerant scheme significantly improves the robustness of the system in fault scenarios, avoids system crash due to single point failure, and ensures the stability and service continuity of long-term operation. BRIEF DESCRIPTION OF DRAWINGS

[0043] In order to make the above-mentioned multi-source legal knowledge graph construction and intelligent retrieval method for consumer rights protection of the present application more obvious and easy to understand, the drawings needed in the specific embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and other drawings can be obtained from these drawings without creative labor for those skilled in the art.

[0044] Figure 1 The method flowchart of the present application is shown;

[0045] Figure 2 The system composition and technical implementation principle diagram of the present application is shown;

[0046] Figure 3 The intelligent retrieval flowchart is shown. DETAILED DESCRIPTION

[0047] Example 1:

[0048] A multi-source legal knowledge graph construction and intelligent retrieval method for consumer rights protection is provided, and the method flow is as shown in Figure 1 , and is specifically described as follows.

[0049] A legal knowledge graph construction method fusing multi-source heterogeneous data is provided. The data sources include structured legal regulations and provisions, industry agreement terms, and unstructured consumer complaint cases and mediation results, etc. Through preprocessing and information extraction of the above multi-source data, the key information is converted into a unified knowledge graph representation. For example, the legal knowledge is parsed into the form of "triplet", and the typical cases are associated with the corresponding legal provision nodes to construct a semantic network across regulations and cases. In specific implementation, natural language processing technology is used to automatically identify entities and relationships in legal text: the key entities in legal provisions are extracted using word segmentation and named entity recognition models, and the legal relationships between entities are identified using relationship extraction algorithms. The extracted entities and relationships are inserted into the graph database in the form of triplets, forming a legal knowledge graph. For data from different sources, an entity alignment and fusion mechanism is added to merge nodes with semantic equivalence or association. At the same time, a source label is attached to each node in the graph to indicate its origin, whether it is a regulation, industry standard or case, so that the knowledge graph can accommodate heterogeneous legal knowledge and maintain traceability of the source. Through the above method, a unified knowledge graph covering consumer rights protection related laws and regulations and typical cases is constructed, bridging the association between knowledge sources and eliminating the fragmentation and isolation of legal knowledge in existing systems.

[0050] The system composition and technical implementation principle diagram of the present application is shown in Figure 2

[0051] For natural language consultation questions input by users, a special semantic analysis module is set up to identify the intent and extract the elements of user questions. First, the key elements are identified and extracted from the user's question using word segmentation, part-of-speech tagging and named entity recognition technology, such as the names of goods or services involved, the focus of the dispute, the amount, the time, and other key information, as well as possible legal entities or regions, industry attributes. By introducing a professional dictionary and a synonym library in the legal field, the problem of inconsistency between user language and legal terminology is solved. For example, it can identify the colloquial expression "return" in the user's wording as the formal legal term "terminate the contract", and identify "refund" as a synonymous concept of "fee". Secondly, the analysis module extracts context information, and when it detects that the user's question contains regional or industry indications, it records this information as a context constraint condition for subsequent retrieval stage to filter irrelevant regulations. After the above semantic understanding processing, the user's unstructured question is converted into a structured query intent representation, which contains the main legal semantics, the entities involved, and the scene context, providing accurate and rich input for subsequent retrieval.

[0052] ​For the parsed structured query, a "double-engine" hybrid retrieval strategy combining semantic vector retrieval and keyword retrieval is adopted. On the one hand, semantic retrieval is performed by the semantic vector engine, which encodes the user question into a semantic vector using a deep language model trained or fine-tuned on legal corpus, and performs approximate nearest neighbor search on the pre-constructed vector index of legal provisions to find the Top-N most semantically similar legal provisions or knowledge nodes. Semantic vector retrieval can bridge the surface gap between user language and legal wording, and capture the deep semantic match between user question and legal provision content. On the other hand, exact match retrieval is performed by the keyword engine, which extracts the significant legal keywords from the query and performs search in the knowledge base using inverted index or Boolean retrieval to ensure that the legal provisions directly related to the user question are not missed. In actual implementation, the context filtering strategy is preferred, which limits the search scope to the corresponding regional legal database or industry specification sub-database according to the context information obtained from the previous question parsing, to improve the relevance of the retrieval results and avoid irrelevant regional laws. Then semantic vector retrieval and keyword retrieval are performed in parallel, and the two engines can run asynchronously to improve efficiency. After merging the candidate results obtained by the two approaches, they are fused and sorted according to the relevance to output. In the fusion matching process, a comprehensive matching score is calculated for each candidate result, for example, using a linear weighting method ; wherein, is the comprehensive matching score; is the semantic matching score of the candidate entry with the user question; represents the keyword exact match score; and are weight coefficients, with a value range of 0 to 1, used to balance the contribution of semantic matching and keyword matching to the final score. The weights and are tuned according to the validation set results, and the initial values are both set to 0.5 to give equal importance to semantic and keyword retrieval. Through the above double-engine fusion retrieval method, the limitations of single retrieval method are overcome, which not only expands the recall range by vector semantic retrieval, but also ensures the relevance and accuracy of the results by keyword exact match, so as to realize legal knowledge retrieval with high recall rate and high precision.

[0053] For the retrieved candidate results of legal knowledge, a path fusion and reasoning mechanism is provided to support multi-hop reasoning on the knowledge graph and the explainability of the results. First, when the user question involves multiple legal points or needs to cross knowledge association, the system will perform multi-hop path search on the knowledge graph, find related nodes and connect them to form an answer link. For example, for a complex consumer dispute question, the system may first locate the relevant legal clause node, then find the typical case node connected to the legal clause through the graph, and finally synthesize the decision points of the case to reason out the answer. The path fusion module considers the above-mentioned associated paths formed by jumping through multiple nodes on the graph as different reasoning schemes, and calculates a path score for each candidate reasoning path to evaluate the relevance and credibility of the path to answer the current question. The path score formula is set according to factors such as the matching degree of each node on the path and the path length, for example, in the form of step-by-step cumulative weighting: ; In the formula, the path score of the path is calculated as follows: ; In the formula, the path score of the path is calculated as follows: ; In the formula, the path score of the path is calculated as follows: ; In the formula, the path score of the path is calculated as follows: ; In the formula, the path score of the path is calculated as follows: ; In the formula, the path score of the path is calculated as follows: ; In the formula, the path score of the path is calculated as follows: ; In the formula, the path score of the path is calculated as follows:

[0054] In generating the reply to the user, the system outputs the relevant legal provision content and source, and clearly marks the name of the regulation and the clause number in the answer, and if necessary, adds the citation of the corresponding case. Specifically, when integrated into the question and answer dialogue system, the retrieval results are fused by the dialogue generation model or the preset template to generate natural language answers, and the law clause citation tags or annotations are embedded in the answer sentences, so that the user can clearly see the legal provisions on which the conclusion is based. This legal provision citation mechanism ensures that the answer content is traceable, greatly enhancing the authority and credibility of the results. In the pure retrieval scene of the non-dialogue interface, the system can also directly return the matched legal provision original text paragraph, and highlight the key words in the matching, to facilitate the user to quickly locate the key information. By introducing clear legal basis and case sources in the results, the lack of basis support in traditional intelligent question and answer answers is effectively overcome, so that the user can clearly see the source of the answer, further improving the user's trust in the system's reply.

[0055] In order to ensure the timeliness and completeness of the knowledge graph, a set of knowledge base adaptive updating mechanism is also provided. This mechanism runs in the background and includes three sub-processes of regulation monitoring, case collection and incremental updating. First, regulation monitoring: regularly monitor legal regulations database, government announcements and information sources publicly disclosed by consumer associations in various places, automatically obtain newly enacted or revised laws and regulations, policy documents, and newly added typical cases of consumer rights protection. Second, change detection: compare the new regulation text obtained with the old version of the regulation in the knowledge base to detect newly added, modified or abolished clause content. For newly appearing clauses or changes in items, mark them as to be updated. Third, incremental knowledge extraction: perform the same information extraction process as the graph construction on the changed or newly added regulation and case text to obtain new entity and relationship triples and insert them into the knowledge graph. At the same time, update the source label and associated relationship of the node. If the change involves an existing node, update the node attributes or adjust the association to maintain the consistency of the graph. To improve the accuracy of automatic extraction, combine semi-supervised learning to gradually optimize the extraction model, or manually review and confirm the update of important legal provisions before entering the database. Finally, when the knowledge base content is significantly expanded, trigger the retrieval model update, and continue training or fine-tuning the semantic vector model using the updated data to adapt to the newly added language and knowledge. If necessary, the keyword matching dictionary can also be retrained to ensure that new regulation terms are also included in the retrieval. Through the above continuous updating mechanism, the legal knowledge base of the system can keep up with the changes in legal policies, ensure that the retrieval results are synchronized with the latest regulations, and overcome the problem of outdated knowledge and incomplete coverage in traditional systems. Even when new local regulations are frequently introduced or new cases appear in the consumer field, the knowledge graph can be expanded in time to maintain high-quality support for user questions.

[0056] The system is deployed in an engineering modular architecture, taking into account computing resources and cross-platform compatibility. In terms of model loading order, the system loads various models and indexes in order of frequency of use and dependency when starting, for example, first loading NLP models and dictionary resources required for user question analysis, then loading semantic vector retrieval models and their vector indexes, then initializing the inverted index structure required for keyword retrieval, and finally starting the connection of the knowledge graph database. Through reasonable loading order, the system can enter service state as soon as possible, avoiding delayed loading of models when the user first asks questions. In terms of GPU and CPU resource judgment, the system automatically detects available GPU acceleration resources in the running environment when starting. If a GPU is detected, the system loads the GPU version of the deep model and uses the GPU for semantic encoding and ANN search operations to speed up vector retrieval and reasoning calculation. If the GPU resource is insufficient or unavailable, the system automatically switches to CPU mode to load a simplified model or reduce the batch size to ensure service stability. In terms of index loading strategy, for semantic vector indexes generated from large-scale regulation corpus, the system uses memory mapping or lazy loading mechanism to pre-load necessary vector index segments into memory at startup to reduce real-time query reading overhead. At the same time, the system adopts an on-demand loading strategy for large index files to avoid excessive memory usage at one time. Inverted indexes and other structures can be serialized and stored and rebuilt or loaded into memory cache at startup to improve retrieval speed. In terms of graph database connection pool management, since the retrieval and reasoning modules frequently access the graph database, the connection pool technology is used to maintain a certain number of database connections for module reuse. The system dynamically adjusts the size of the connection pool according to the number of concurrent requests, with an upper limit limited by database performance and hardware resources. When a connection is idle for a long time or an error occurs, the connection pool manager will automatically recycle and rebuild it to ensure the health and availability of the connection. At the same time, for cross-module data exchange, asynchronous message queues or shared caches are used to reduce module coupling and improve system concurrency processing capability. In terms of cross-platform deployment compatibility, the system supports containerization and distributed deployment, and all components can be integrated in a Docker container for easy deployment on different operating systems and server environments. Through container orchestration, the system's service modules can be scaled up or down to adapt to different business loads, such as automatically expanding retrieval and reasoning module replicas to handle high concurrency requests during peak consultation periods, and shrinking resources to save costs during idle times. The overall architecture design follows the principles of loose coupling and microservices, and each functional module can be deployed centrally on the same server or distributed across multiple servers or even geographically distributed cloud environments to meet performance requirements in large knowledge bases and high concurrency scenarios.

[0057] Each module works cooperatively through explicit data interfaces and calling sequences to form a complete intelligent retrieval process. For example, Figure 3As shown, after the user raises a question, the system sequentially calls relevant modules for processing in a predetermined order, in which some steps can be accelerated in parallel. First, the user question analysis module synchronously receives user input and analyzes the intention of the question, and outputs a structured query to the retrieval module. Then, the hybrid retrieval module starts two engines to perform concurrent retrieval on the query: one engine calls the semantic vector model to calculate the query vector and retrieve similar clauses in the regulation vector index, and the other engine simultaneously performs keyword exact match retrieval. The retrieval processes of the two engines are relatively independent and can be completed asynchronously in parallel. After the retrieval engines complete, the hybrid retrieval module aggregates the semantic and keyword candidate results, and ranks them according to the aforementioned scoring mechanism, and passes the top-N candidates to the reasoning module. Next, the path reasoning fusion module queries relevant nodes from the knowledge graph database according to the candidate result set, performs multi-hop association search to expand the candidate answer path, and calculates the score for each path to select the optimal path scheme. This process needs to access the knowledge graph database to obtain the relationship between nodes, and is considered a synchronous process in series with the retrieval stage. If there are many candidate results, parallel evaluation of multiple paths can also be considered to reduce time consumption. When the optimal path is determined, the result output module assembles the answer, generates a reply text according to the legal clause content and reasoning conclusion in the path, and attaches the reference basis and returns it to the user. In this process, each module transmits information through a predefined data structure interface. The modules are mainly called synchronously in the above order, but use an asynchronous concurrent mechanism inside the retrieval to improve efficiency. The knowledge base update module runs independently in the background and does not affect the front-end query process, and performs asynchronous updates according to the set time interval or trigger condition, and writes the update results into the knowledge graph database and index for use by the front-end module for the next retrieval. Through the process as shown in Figure 3 , the whole-link processing from user questioning to legal basis exact match to reasoning and explanation output is realized.

[0058] The system also has a perfect abnormality processing mechanism, which ensures the reliable operation of the system and provides degraded services when faults occur in each module. If a core model fails to load during system startup, the system will capture the loading exception and immediately start the backup plan, such as trying to load a simplified backup model or switching to a keyword-only retrieval mode to ensure basic retrieval functionality. At the same time, error logs are recorded and maintenance personnel are notified to troubleshoot problems. When the knowledge graph database connection times out or query fails, the connection pool management module will enable the retry mechanism, and after a short wait, it will try to connect or query again. If multiple retries are ineffective, the circuit breaking strategy will be triggered to temporarily interrupt the request to this database. During the circuit breaking period, the system enables emergency contingency plans, such as using pre-cached knowledge data or limiting the function to return only the retrieved statute results without path reasoning, to ensure that the system has some response capability to user requests. For time-consuming modules such as retrieval and reasoning, the system has an automatic degradation mechanism. When the response delay is caused by too high a concurrent request volume, the system can temporarily simplify the processing flow, such as narrowing the Top-N range of vector retrieval or skipping the complex multi-hop reasoning process, to prioritize timely response of core question and answer functions. When a sub-module continuously experiences exceptions, the system marks it as unavailable through the service governance module and implements isolation, while enabling backup strategies to maintain uninterrupted external services. The system records detailed logs for all types of exceptions and sets up monitoring alarms to notify maintenance personnel to intervene and handle when module exceptions, response timeouts, and other situations occur. Through the above mechanisms, the intelligent retrieval system has high robustness and fault tolerance. Even in the case of partial model unavailability or limited external knowledge base connection, the system can still provide basic services through automatic degradation, avoiding system crashes and improving long-term operation stability.

Claims

1. A method for constructing and intelligently retrieving a multi-source legal knowledge graph for consumer rights protection, characterized in that: include: Construct a multi-source legal knowledge graph that integrates regulations, industry standards, and case texts. Unify semantically equivalent legal concept nodes through an entity alignment mechanism and attach regional and industry source tags to the nodes to achieve cross-source knowledge fusion representation and source traceability. The system analyzes users' natural language questions and extracts the legal entities, disputed elements, geographical context constraints, and industry context constraints involved. A hybrid retrieval strategy combining semantic vector retrieval and keyword retrieval is adopted, and the retrieval scope is pre-filtered and limited by the aforementioned contextual constraints to generate a set of candidate legal clauses; Based on the knowledge graph, multi-hop path reasoning is performed on candidate legal clauses to generate associated paths with node contribution weights. The multi-hop path reasoning connects legal clause nodes and associated case nodes in the knowledge graph to form a reasoning chain. The comprehensive score of the associated path is calculated based on the matching score between each node in the path and the user's question, as well as the weight determined by the jump distance of the node in the reasoning chain. The starting node has a higher weight than the jump node. Output a traceable answer with accompanying legal clause citations and case sources.

2. The method according to claim 1, characterized in that: In the process of constructing the legal knowledge graph, joint entity recognition and relation extraction are performed on structured legal texts and unstructured case texts to generate triple knowledge units across data sources. Through a synonym concept mapping mechanism, legal terms that are different in expression but semantically equivalent are mapped to the same node in the knowledge graph.

3. The method according to claim 1, characterized in that: Based on a pre-built adaptive legal domain dictionary, user colloquial expressions are mapped to legal terms, and the extracted regional and industry contexts are used as mandatory constraints in the retrieval stage to dynamically limit the subspace scope of the legal retrieval.

4. The method according to claim 1, characterized in that: The hybrid retrieval strategy consists of two parallel sub-modules: a semantic vector retrieval engine and a keyword retrieval engine. The semantic vector retrieval engine uses a deep language model to calculate the implicit semantic similarity between the question and the legal clause, while the keyword retrieval engine matches legal terms and clause identifiers through an inverted index and performs a weighted fusion sort of the two types of results according to an adjustable weight coefficient.

5. The method according to claim 4, characterized in that: The pre-filtering and retrieval scope limitation is performed before the mixed retrieval begins, and the retrieval permissions for the corresponding regional legal and regulatory database or industry standard database are activated based on the parsed context constraints.

6. The method according to claim 1, characterized in that: The comprehensive path score is obtained by accumulating the weighted matching scores of each node on the path, and the weight assigned to a node decreases monotonically as the jump distance between it and the user's question increases.

7. The method according to claim 1, characterized in that: In the process of generating traceable answers, the name of the regulation, the clause number, and the source of the case are embedded in the natural language answer text in the form of machine-readable tags; in pure search mode, the results containing the original text of the legal provisions corresponding to the question are returned, and the keywords that are matched are visually highlighted.

8. The method according to claim 1, characterized in that: When constructing the legal knowledge graph, each node is assigned a pre-calculated confidence score, which is determined based on the data source type, data source publication, and the level of the judgment body corresponding to that node. In the hybrid retrieval strategy, the confidence score is used as an adjustment factor for retrieval priority, and legal clauses corresponding to data sources with high confidence scores are returned first. In the multi-hop path inference, the confidence score, the matching score between each node in the path and the user's question, and the weight determined by the jump distance of the node in the inference chain are jointly calculated to calculate the comprehensive path score, and nodes with high confidence scores are given higher weight contributions.

9. The method according to claim 1, characterized in that: The method continuously monitors changes in legal data sources, updates graph nodes and relationships through incremental extraction, and optimizes the semantic vector model and keyword dictionary based on the characteristics of the new data.

10. A multi-source legal knowledge graph construction and intelligent retrieval system for consumer rights protection, characterized by: The system is implemented based on the method of any one of claims 1-9, including: The knowledge graph construction module is used to perform entity recognition, relation extraction, and semantic alignment processing of multi-source heterogeneous data in order to construct the legal knowledge graph. The user question parsing module integrates a legal dictionary and a thesaurus to parse user natural language questions into structured queries with regional and industry constraints. The hybrid retrieval module includes a semantic vector retrieval submodule and a keyword retrieval submodule that run in parallel, used to perform semantic retrieval and keyword retrieval on the structured query and fuse the results; The path reasoning fusion module performs multi-hop association path search and scoring calculation on the retrieval candidate results based on the graph database, which is used to generate the legal basis link and determine the best reasoning path; The legal result output module is used to generate a natural language answer containing legal clause citations and case source identifiers based on the reasoning results of the optimal reasoning path; The resource dynamic scheduling module is used to automatically switch the semantic model calculation mode according to the hardware resource status, dynamically manage the graph database connection pool, and execute the retrieval retry mechanism in case of abnormality. The service fault tolerance control module is used to interrupt the reasoning process and roll back the keyword search results when the path reasoning function malfunctions. When the semantic retrieval model fails, it switches to pure keyword retrieval mode.

Citation Information

Patent Citations

  • Method and system for enhancing RAG questions and answers through mixed retrieval method

    CN118627625A

  • Information retrieval query method for legal data service platform

    CN118981512A