Intelligent arbitration method and system for multi-branch document merging conflicts based on knowledge graph

By constructing a cross-version knowledge graph based on a knowledge graph and using an arbitration strategy, the problems of semantic conflicts and cross-document dependencies in multi-branch document merging are solved, and automatic alignment and consistency maintenance of documents and code are achieved, improving the effectiveness and consistency of merging.

CN123159307APending Publication Date: 2026-11-24SHANDONG XIEHE UNIV
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing distributed version control tools such as Git cannot identify semantic conflicts and cross-document dependencies in multi-branch document merging, resulting in inconsistencies between the merged document and the code. Existing solutions cannot meet the requirements of semantic-level merging, conflict detection, and consistency maintenance in multi-branch scenarios.

Method used

A cross-version knowledge graph is built based on the knowledge graph. By extracting semantic entities and relationships between entities, the system identifies and aligns entity pairs, determines conflict types, generates a merge draft, and introduces a version decay mechanism and code repository symbol table as arbitration criteria to achieve automatic alignment and consistency maintenance of documents and code.

Benefits of technology

It effectively solves the problem that traditional text comparison tools cannot identify semantic conflicts, improves the effectiveness of semantic conflict typification and merging in multi-branch merging scenarios, enhances the consistency between documents and code, and reduces the need for manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123159307A_ABST
    Figure CN123159307A_ABST
Patent Text Reader

Abstract

This application relates to the field of document management and version control technology, and provides a method and system for intelligent arbitration of conflicts in multi-branch document merging based on knowledge graphs. This invention extracts semantic entities from documents and code separately, forms a branch version association matrix, and constructs a cross-version knowledge graph to establish cross-artifact dependencies between document fragments and code entities, effectively solving the problem that traditional text comparison tools can only detect string differences and cannot identify semantic conflicts. By identifying aligned entity pairs corresponding to the same code entity through entity alignment, and comparing the attribute values ​​of the aligned entity pairs, the conflict type is determined based on the type of attribute difference, effectively typifying the semantic conflicts in multi-branch merging scenarios. By matching arbitration strategies from a predefined arbitration strategy library according to the conflict type, a merge draft is generated, and users review the merge draft. Combined with manual confirmation of the merge draft, the effectiveness of the merge is effectively guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of document management and version control technology, and in particular to a knowledge graph-based intelligent arbitration method and system for merging conflicts in multi-branch documents. Background Technology

[0002] In large-scale software project development, parallel evolution across multiple branches is the industry norm. Core applications such as payment systems often maintain multiple branches simultaneously, including stable, pre-release, and refactored versions. Development documents such as API documentation, SDK guidelines, and configuration instructions must be strictly consistent with the corresponding branch code. Current distributed version control tools, represented by Git, use line-based text matching algorithms to perform branch merging. This approach fails to understand the deep semantics of documents and cross-document and cross-artifact dependencies, easily leading to consistency failures.

[0003] Among existing technologies for merging multiple branches of software development documentation, Git line-level merging cannot identify semantic conflicts. For example, when different branches modify the same API parameter type, no conflict warning is triggered because the modified lines are different, resulting in contradictory descriptions in the merged documentation. It also cannot detect cross-document dependency breaks. After API parameters change, the associated example code and comments cannot be updated synchronously, causing inconsistencies between the documentation and the code.

[0004] The single-branch code-document synchronization solution is only suitable for single-branch scenarios and cannot solve the problem of merging multiple branches; the code interface verification tool only processes code logic and does not cover document fragments; the general knowledge graph conflict detection is geared towards question-and-answer scenarios and cannot generate a document merge draft.

[0005] Semantic code merging tools such as Weave and Mergiraf process code files based on ASTs, focusing only on the semantics within the code and neglecting document-to-code cross-artifact dependency detection. Furthermore, they lack an arbitration mechanism based on the code symbol table. In summary, existing solutions cannot meet the needs of semantic merging, conflict detection, and consistency maintenance for software development documents in multi-branch scenarios. Summary of the Invention

[0006] Therefore, it is necessary to provide a knowledge graph-based intelligent arbitration method and system for merging conflicts in multi-branch documents to address the aforementioned technical problems.

[0007] A knowledge graph-based intelligent arbitration method for merging conflicts in multi-branch documents, the method comprising the following steps: Semantic entities and relationships between entities are extracted from the target software development documents and corresponding code repositories of the multiple parallel development branches that are requested to be merged, and a branch version identifier is added to each semantic entity to form a branch version association matrix; Construct a cross-version knowledge graph for each branch using semantic entities as nodes and relationships between entities as edges; Entity nodes are extracted from the cross-version knowledge graph of each branch. Cross-graph entity alignment is performed based on the semantic similarity of code entity names. Aligned entity pairs corresponding to the same code entity are identified, and the attribute values ​​of the aligned entity pairs are compared. The conflict type is determined based on the type of attribute difference. Arbitration strategies are matched from a predefined arbitration strategy library based on the conflict type to generate a merger draft; The merger draft is presented visually to the user, and the target software development documents are updated based on the merger draft after user confirmation.

[0008] In one embodiment, semantic entities and relationships between entities are extracted from the target software development documents and corresponding code repositories of multiple parallel development branches that are requested to be merged. A branch version identifier is added to each semantic entity to form a branch version association matrix, including: Iterate through the code repositories of multiple branches requesting a merge, obtain the latest CommitHash and semantic version number of each branch, and record the parent-child relationships between branches; Parse API documentation, code comments, and design documents to obtain a list of document entities; The code repository for each branch is traversed using an AST parser to obtain a list of code entities; Based on the latest CommitHash and semantic version number of each branch, a branch version identifier is added to each semantic entity to form a branch version association matrix.

[0009] In one embodiment, the method further includes: When code changes propagate from the source branch to the target branch via cherry-pick, merge, or rebase, the source branch, target branch, and a list of changed code entities are extracted through the version control system. Based on the branch version association matrix, the system retrieves document fragments that depend on the current code entity and their associated semantic version numbers. It then performs a compatibility determination based on the difference in semantic version numbers between the source branch and the target branch, and outputs the compatibility level and a list of affected documents.

[0010] In one embodiment, entity nodes are extracted from the cross-version knowledge graph of each branch, cross-graph entity alignment is performed based on the semantic similarity of code entity names, aligned entity pairs corresponding to the same code entity are identified, and the attribute values ​​of the aligned entity pairs are compared. The conflict type is determined based on the type of attribute difference, including: Entity nodes are extracted from the cross-version knowledge graph of each branch. Cross-graph entity alignment is performed based on the semantic similarity of code entity names. Hierarchical clustering is used to cluster entity nodes with semantic similarity exceeding the threshold into aligned entity pairs corresponding to the same code entity. The attribute values ​​of the aligned entity pairs are read from the knowledge graph of each branch, and each aligned entity pair is compared. If the attribute set contains attribute differences and the difference exceeds a preset threshold, it is considered a value conflict; if the node... If a node has an outgoing edge in the first knowledge graph but not in the second knowledge graph, it is considered a reference conflict; if a node exists only in the first knowledge graph and not in the second knowledge graph, it is considered a structural conflict. Based on the first knowledge graph, the second knowledge graph, and the detected conflict types, conflict propagation analysis is performed through forward graph traversal and backward graph traversal, and a conflict list is output.

[0011] In one embodiment, when the arbitration strategy is to use the latest definition of the code repository symbol table as the standard, the latest code of the target branch is obtained from the code repository, and the actual definition of the conflicting code entity is extracted by the AST parser. The description of the corresponding entity in the document is compared with the actual definition to determine the type of inconsistency. Based on the actual definition, generate the proposed modifications to the merger draft.

[0012] In one embodiment, when the arbitration strategy is version decay priority or code repository symbol table as the standard and version decay priority are used in conjunction, the semantic version numbers of the first branch and the second branch are obtained, and the decay coefficient is calculated. After multiplying the weight of the document nodes in the lower version branch by the decay factor, the definition of the higher version branch is given priority in the arbitration decision; if the code symbol table definitions of the higher version branch and the lower version branch are consistent, the symbol table definition shall prevail, and the decay factor shall be used as a reference auxiliary weight.

[0013] In one embodiment, the merge draft includes a conflict identifier, conflict type, arbitration strategy, arbitration basis, proposed modifications, path of affected documents, decision tree path, and confidence score.

[0014] In one embodiment, the target software development documentation includes at least one of API interface documentation, code comments, and technical design documentation.

[0015] In one embodiment, the merge draft is visually presented to the user, and the target software development document is updated based on the merge draft after user confirmation. The method also includes: Record the conflict identifier, arbitration strategy, user actions, and final merger result for each merger draft; record the adopted merger draft as a positive sample and the rejected merger draft as a negative sample, and calculate the adoption rate of each arbitration strategy; Within a preset timeframe, the adoption rate of each arbitration strategy is statistically analyzed, and the strategy matching priority is dynamically adjusted.

[0016] A knowledge graph-based intelligent arbitration system for merging conflicts in multi-branch documents, the system comprising: The association matrix construction module is used to extract semantic entities and relationships between entities from the target software development documents and corresponding code repositories of the two parallel development branches that are requested to be merged, and to add a branch version identifier to each semantic entity to form a branch version association matrix; The knowledge graph construction module is used to build a cross-version knowledge graph for each branch, with semantic entities as nodes and relationships between entities as edges; The conflict type determination module is used to extract entity nodes from the cross-version knowledge graph of each branch, perform cross-graph entity alignment based on the semantic similarity of code entity names, identify aligned entity pairs corresponding to the same code entity, compare the attribute values ​​of the aligned entity pairs, and determine the conflict type based on the attribute difference type. The merger draft generation module is used to match arbitration strategies from a predefined arbitration strategy library based on the conflict type and generate a merger draft. The merge confirmation module is used to visually present the merge draft to the user and update the target software development documents based on the merge draft after the user confirms it.

[0017] The aforementioned intelligent arbitration method and system for multi-branch document merging conflicts based on knowledge graphs extracts semantic entities from documents and code separately, adds branch version identifiers to form a branch version association matrix, and further constructs a cross-version knowledge graph for each branch. This establishes cross-artifact dependencies between document fragments and code entities, effectively solving the problem that traditional text comparison tools can only detect string differences and cannot identify semantic conflicts. Entity alignment identifies aligned entity pairs corresponding to the same code entity, compares the attribute values ​​of the aligned entity pairs, and determines the conflict type based on the attribute difference type, thus effectively typifying semantic conflicts in multi-branch merging scenarios. By matching arbitration strategies from a predefined arbitration strategy library according to the conflict type, a merge draft is generated, and users review the merge draft. Combined with human confirmation of the merge draft, the effectiveness of the merge is effectively guaranteed. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating a knowledge graph-based intelligent arbitration method for merging conflicts in multi-branch documents, as shown in one embodiment. Figure 2 This is a block diagram of a knowledge graph-based intelligent arbitration system for merging conflicts between multiple documents, as shown in one embodiment. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0020] The knowledge graph-based intelligent arbitration method for multi-branch document merging conflicts provided in this application can be applied to distributed version control systems. Distributed version control systems are those capable of managing the parallel development of multiple branches, including but not limited to Git and Mercurial.

[0021] In one embodiment, such as Figure 1 As shown, a knowledge graph-based intelligent arbitration method for merging conflicts in multi-branch documents is provided. The method includes the following steps: Step 201: Extract semantic entities and relationships between entities from the target software development documents and corresponding code repositories of the multiple parallel development branches to be merged, and add a branch version identifier to each semantic entity to form a branch version association matrix.

[0022] Step 202 constructs a cross-version knowledge graph for each branch using semantic entities as nodes and relationships between entities as edges.

[0023] Step 203: Extract entity nodes from the cross-version knowledge graph of each branch, perform cross-graph entity alignment based on the semantic similarity of code entity names, identify aligned entity pairs corresponding to the same code entity, compare the attribute values ​​of the aligned entity pairs, and determine the conflict type based on the attribute difference type.

[0024] Step 204: Match arbitration strategies from a predefined arbitration strategy library based on the conflict type to generate a merger draft.

[0025] Step 205: Visualize the merger draft to the user, and update the target software development document according to the merger draft after user confirmation.

[0026] The aforementioned intelligent arbitration method for multi-branch document merging conflicts based on knowledge graphs extracts semantic entities from documents and code separately, adds branch version identifiers to form a branch version association matrix, and further constructs a cross-version knowledge graph for each branch. This establishes cross-artifact dependencies between document fragments and code entities, effectively solving the problem that traditional text comparison tools can only detect string differences and cannot identify semantic conflicts. Entity alignment identifies aligned entity pairs corresponding to the same code entity, compares the attribute values ​​of the aligned entity pairs, and determines the conflict type based on the attribute difference type, thus effectively typifying semantic conflicts in multi-branch merging scenarios. By matching arbitration strategies from a predefined arbitration strategy library according to the conflict type, a merge draft is generated, and users review the merge draft. This, combined with human confirmation, effectively ensures the validity of the merge.

[0027] In one embodiment, the target software development documentation includes at least one of API interface documentation, code comments, and technical design documentation.

[0028] In one embodiment, semantic entities and relationships between entities are extracted from the target software development documents and corresponding code repositories of multiple parallel development branches that are requested to be merged. A branch version identifier is added to each semantic entity to form a branch version association matrix, including: Iterate through the code repositories of multiple branches requesting a merge, obtain the latest CommitHash and semantic version number of each branch, and record the parent-child relationships between branches; Parse API documentation, code comments, and design documents to obtain a list of document entities; The code repository for each branch is traversed using an AST parser to obtain a list of code entities; Based on the latest CommitHash and semantic version number of each branch, a branch version identifier is added to each semantic entity to form a branch version association matrix.

[0029] Specifically, it iterates through all active branches in the repository (master, release / , feature / , hotfix / *), obtaining the latest commit hash and version tag (e.g., v1.8.0, v2.0.0) for each branch; it extracts semantic version numbers (major, minor, patch) from the branch name pattern (release / v1.8, v2.0.0) and distributed version control system tags (e.g., Git tags). If a branch does not conform to the naming convention, it inherits the version number of the source branch by default and marks it as "unmarked". It also records the parent-child relationships between branches.

[0030] For parsing API documentation, code comments, and design documents, specifically: API documentation parsing: recursively traverse each interface under `paths`, extracting API nodes; recursively parse the data structure definitions in `components / schemas`, extracting parameter nodes and return value nodes; parse the `requestBody` and `responses` fields, supplementing request parameters and response status codes. Code comment parsing: extract the `@param` tag (parameter name, description), `@return` tag (return value description), and `@throws` tag (exception declaration) from function comments. Design document parsing: use regular expressions to match the `###API name pattern` to locate the interface section, extracting the interface name, URL, and parameter table. The parsed results are then used to construct a document entity list.

[0031] The AST parser traverses the code repository of each branch, extracting function entities, parameter entities, return value entities, and constant entities to construct a list of code entities. Specifically, the function entity includes the function name, the list of function parameters (name + type + order), the function return value type, and the function exception declaration; after extracting the function entity, a function signature fingerprint is generated (e.g., getUser(String id):User). The parameter entity includes the parameter name, parameter type, parameter number, and the function to which the parameter belongs. The return value entity includes the return type, generic parameter, and whether it is nullable. The constant entity includes the constant name, constant type, and constant value.

[0032] Add a branch version identifier to each semantic entity to form a branch version association matrix. The resulting branch version association matrix is ​​as follows: branch_id: Branch identifier (e.g., feature / v2.0, release / v1.8); version_tag: Semantic version number (extracted from branch name or tag, such as v2.0.0); commit_hash: Corresponds to the CommitID (used for precise version tracking); modified_time: Last modified timestamp.

[0033] When storing the entity, record the source file path and starting line number.

[0034] In this embodiment, the originally disordered and heterogeneous cross-branch documents and generations are transformed into a structured, traceable, and version-comparable knowledge base through a branch version association matrix, laying the data foundation for subsequent arbitration operations. Simultaneously, by recording the parent-child relationships between branches, propagation chain tracing is supported, avoiding meaningless cross-branch comparisons.

[0035] For the construction of the cross-version knowledge graph for each branch, the node type definitions are as shown in Table 1.

[0036] Table 1 Node Types and Definitions

[0037] For extracting relationships between entities, specifically: Dependency relationships (depends_on): Parameter node → Belonging API node; Code block node → Called function entity. Semantic alias relationships (semantic_alias_of): Semantically similar entities across branches (e.g., userId and user_id), similarity can be calculated using Sentence-BERT or other semantic matching models (e.g., CodeBERT, GraphCodeBERT, etc.). Conflict relationships (conflicts_with): Conflict relationships dynamically added during arbitration.

[0038] The constructed cross-version knowledge graph is stored using Neo4j. Node types include APINode, ParameterNode, ReturnNode, CodeBlockNode, and ConstantNode, while edge types include depends_on, semantic_alias_of, and conflicts_with. To support multi-version branch queries, a branch_id index is created for each node.

[0039] In one embodiment, the method further includes: When code changes propagate from the source branch to the target branch via cherry-pick, merge, or rebase, the source branch, target branch, and a list of changed code entities are extracted through the version control system. Based on the branch version association matrix, the system retrieves document fragments that depend on the current code entity and their associated semantic version numbers. It then performs a compatibility determination based on the difference in semantic version numbers between the source branch and the target branch, and outputs the compatibility level and a list of affected documents.

[0040] Compatibility is determined based on the semantic version number differences between the source and target branches. Specifically, if the major version numbers of the source and target branches are the same (e.g., v1.8→v1.9, regardless of whether the minor version number or revision number has changed), they are considered compatible, and it is recommended to automatically import the document changes. If the major version numbers are different (e.g., v1.x→v2.x), they are considered incompatible, marked as requiring manual review, and will not be automatically merged.

[0041] In this embodiment, when code changes propagate from the source branch to the target branch via cherry-pick, merge, or rebase, a cross-branch propagation impact assessment is performed. This combines the code change event with document dependencies and version compatibility, allowing for an early assessment of the impact of the change on document fragments in the target branch. This provides a priority basis for subsequent conflict detection and arbitration decisions.

[0042] In one embodiment, entity nodes are extracted from the cross-version knowledge graph of each branch, cross-graph entity alignment is performed based on the semantic similarity of code entity names, aligned entity pairs corresponding to the same code entity are identified, and the attribute values ​​of the aligned entity pairs are compared. The conflict type is determined based on the type of attribute difference, including: Entity nodes are extracted from the cross-version knowledge graph of each branch. Cross-graph entity alignment is performed based on the semantic similarity of code entity names. Hierarchical clustering is used to cluster entity nodes with semantic similarity exceeding the threshold into aligned entity pairs corresponding to the same code entity. The attribute values ​​of the aligned entity pairs are read from the knowledge graph of each branch, and each aligned entity pair is compared. If the attribute set contains attribute differences and the difference exceeds a preset threshold, it is considered a value conflict; if the node... If a node has an outgoing edge in the first knowledge graph but not in the second knowledge graph, it is considered a reference conflict; if a node exists only in the first knowledge graph and not in the second knowledge graph, it is considered a structural conflict. Based on the first knowledge graph, the second knowledge graph, and the detected conflict types, conflict propagation analysis is performed through forward graph traversal and backward graph traversal, and a conflict list is output.

[0043] It should be noted that value conflicts indicate that the attribute values ​​of the same code entity differ in different branches; reference conflicts indicate that a dependency edge exists in one branch but disappears in another; and structural conflicts indicate that a node is deleted in one branch while it is retained in another. The attribute set includes differences in parameter types, parameter constraints, return value types, and descriptive text. The output conflict list includes `conflict_id` (a unique identifier for the conflict), `conflict_type` (the semantic category of the conflict), `source_branch` (the branch that initiated the merge request or provided the changes), `target_branch` (the branch that will receive the changes and be the target of the merge), `affected_nodes` (the set of knowledge graph nodes affected by the conflict in the conflict propagation analysis), and `impact_scope` (the list of the impact of the conflict at the physical document level, i.e., the specific software development documents affected by the conflict).

[0044] For forward and reverse graph traversal, conflict propagation analysis is performed. Specifically, forward graph traversal starts from the modified or deleted node, finds all successor nodes that depend on it (downstream of the dependency chain), and assesses the impact of the modification / deletion operation on downstream documents. The traversal depth is configurable (default 3 levels), and nodes exceeding the depth limit are marked as "potentially affected." Reverse graph traversal finds upstream nodes that depend on the target node, used to assess the impact of the modification operation on upstream documents. It should be noted that reverse graph traversal is two-hop, meaning a two-hop is the set of nodes reachable from the starting node through two edges in the graph structure.

[0045] In this embodiment, cross-graph entity alignment is performed using semantic similarity, and hierarchical clustering is used to obtain aligned entity pairs for the same code entity. This allows for the identification of entities with different naming styles but the same meaning across branches, effectively reducing missed conflicts caused by naming differences. Semantic-level conflict detection is performed by comparing the attribute sets of each aligned entity pair, automatically identifying value conflicts, reference conflicts, and structural conflicts during multi-branch merging, thus compensating for the blind spots of line-level merging. Conflict propagation analysis is conducted through forward and reverse graph traversal to assess the cascading impact of code changes on downstream branch documents and output a conflict list, thereby providing a preliminary analytical context for arbitration.

[0046] In one embodiment, when the arbitration strategy is to use the latest definition of the code repository symbol table as the standard, the latest code of the target branch is obtained from the code repository, and the actual definition of the conflicting code entity is extracted by the AST parser. The description of the corresponding entity in the document is compared with the actual definition to determine the type of inconsistency. Based on the actual definition, generate the proposed modifications to the merger draft.

[0047] It should be noted that the actual definition includes at least one of the function signature, parameter types, and return value types. Inconsistencies include inconsistent parameter types, inconsistent constraint ranges, and inconsistent return value types.

[0048] In this embodiment, by introducing an external authoritative arbitration basis based on the code repository symbol table, ambiguity and errors between documents and code are eliminated, achieving automatic alignment, accurate traceability, and low-cost maintenance of documents and code.

[0049] In one embodiment, when the arbitration strategy is version decay priority or code repository symbol table as the standard and version decay priority are used in conjunction, the semantic version numbers of the first branch and the second branch are obtained, and the decay coefficient is calculated. After multiplying the weight of the document nodes in the lower version branch by the decay factor, the definition of the higher version branch is given priority in the arbitration decision; if the code symbol table definitions of the higher version branch and the lower version branch are consistent, the symbol table definition shall prevail, and the decay factor shall be used as a reference auxiliary weight.

[0050] It's important to note that the decay coefficient is discretized based on the level of difference in semantic version numbers between branches. The semantic version numbers of the source and target branches are extracted, and then ranked from highest to lowest severity of the difference. Specifically, the decay coefficient is 0.5 when the major version number changes (e.g., v1.x → v2.x); 0.8 when the minor version number changes (e.g., v1.8 → v1.9) when the major and minor version numbers are the same; and 0.95 when the revision number changes (e.g., v1.8.0 → v1.8.1) when both major and minor version numbers are the same. If the version numbers are completely identical or there is no difference, no decay occurs, and the decay coefficient is 1.0. It should also be noted that if two branches have multiple levels of difference (e.g., both major and minor version numbers are different), the option with the smallest decay coefficient is selected.

[0051] In this embodiment, a version decay mechanism is introduced. When multiple version branches are merged, the version decay mechanism ensures that the definition of the higher version branch takes precedence and automatically guides the merge result to move towards the higher version, avoiding the old definition of the lower version from overwriting the new features of the higher version.

[0052] It's important to note that the version decay mechanism works synergistically with the code repository symbol table. If the symbol table definitions of higher and lower versions are identical, the symbol table takes precedence, and the decay coefficient serves only as a secondary reference weight. Through this synergy, on the one hand, the hard constraint of using the code repository symbol table is maintained, preventing version decay from overriding the actual code; on the other hand, when code definitions are identical but documentation descriptions differ, version decay automatically selects the more likely correct description. This creates a double layer of protection: the code facts provide the safety net, while version trends provide supplementary support.

[0053] Arbitration strategies are matched from a predefined arbitration strategy library based on the conflict type. It should be noted that the predefined arbitration strategy library is shown in Table 2. Table 2 Arbitration Strategy Library

[0054] After matching the arbitration strategy, construct the arbitration decision tree: Conflict type determination ├──Value conflict │├── Parameter types are inconsistent → Refer to the symbol table in the code repository (confirmed by AST parsing) │├──Inconsistent constraints → Take intersection (stricter) or union (preserve both) →User configurable │└── Inconsistent descriptions → Merge texts (concatenate or take the longer one) ├──Citation conflict │├──The dependent entity exists (renamed) → Update the reference based on the code repository. │└── The dependent entity has been deleted → Incompatibility flag + push for manual review └──Structural Conflict ├── Node deletion vs. node retention → Deletion is preferred (version evolution intention) └── New node vs. no new node → Merge newly added nodes.

[0055] In one embodiment, the merge draft includes a conflict identifier, conflict type, arbitration strategy, arbitration basis, proposed modifications, path of affected documents, decision tree path, and confidence score.

[0056] The confidence score is determined according to Table 3.

[0057] Table 3 Confidence Rating Table

[0058] The formula for calculating confidence level is: Confidence score = Rule matching deterministic weight × Conflict severity level coefficient Among them, the deterministic weights for rule matching are: AST direct confirmation = 1.0, dependency chain derivation = 0.7, and manual judgment = 0.3.

[0059] It should be noted that the confidence score table is a deterministic grading table. The score determines whether to automatically merge the scores, assists in quick manual review, and serves as the data foundation for long-term strategy optimization.

[0060] In one embodiment, the merge draft is visually presented to the user, and the target software development document is updated based on the merge draft after user confirmation. The method also includes: Record the conflict identifier, arbitration strategy, user actions, and final merger result for each merger draft; record the adopted merger draft as a positive sample and the rejected merger draft as a negative sample, and calculate the adoption rate of each arbitration strategy; Within a preset timeframe, the adoption rate of each arbitration strategy is statistically analyzed, and the strategy matching priority is dynamically adjusted.

[0061] Specifically, strategies with an adoption rate below 50% are downgraded, while those above 80% are prioritized.

[0062] In this embodiment, the adoption rate of each arbitration strategy is recorded and fed back to optimize the arbitration strategy, thereby achieving automated optimization of arbitration. User operation is also incorporated, enabling arbitration to adapt to the preferences of different users and the dynamic changes in software evolution.

[0063] Example 1: API parameter type value conflict detection and arbitration.

[0064] Scenario: A payment system maintains two Git branches simultaneously: feature / v2.0 (refactored version) and release / v1.8 (stable version). In the feature / v2.0 branch, the API documentation changed the timeout parameter type of the / api / order / create interface from int to long (to support a wider timeout range); in the release / v1.8 branch, this parameter type remains int. When the changes from the feature / v2.0 branch are cherry-picked into the release / v1.8 branch, Git, based on line matching, does not report any conflicts, resulting in the merged documentation containing both int and long descriptions.

[0065] Entity extraction: The system parses the API documentation of the release / v1.8 branch and the feature / v2.0 branch, extracts the timeout parameter node, records the attribute values ​​as type:int and type:long respectively, and appends branch_id and version_tag.

[0066] Knowledge graph construction: Attach branch version identifiers to the parameter nodes of the two branches and store them in Neo4j.

[0067] Cross-branch propagation assessment: The system detected a cherry-pick event from feature / v2.0 to release / v1.8, retrieved the association matrix, and found that the document fragments of the release / v1.8 branch depended on this parameter entity. The main versions were inconsistent, so it was marked as incompatible.

[0068] Conflict detection: After entity alignment, the system detects that the paramType attribute of the same parameter node is inconsistent in different branches, and determines it as "value conflict".

[0069] Arbitration execution: Based on the strategy library, match "parameter type value conflict → refer to the code repository symbol table". Retrieve the latest code from the release / v1.8 branch in the code repository, and AST parsing confirms that the timeout parameter is of type int.

[0070] Merge Draft Generation: Generate a JSON draft. It is recommended to unify the timeout parameter type to int in the document and indicate the arbitration basis.

[0071] User confirmation: The draft was pushed to the PR interface. After the developer accepted it, the document was automatically updated and the merge was successful.

[0072] Effect: Runtime type conversion exceptions caused by parameter type conflicts are avoided, and semantic conflicts that Git cannot detect are automatically discovered and resolved.

[0073] Example 2: Cross-document reference conflict propagation detection.

[0074] Scenario: An open-source project maintains its API documentation (OpenAPI specification) and SDK usage guide (Markdown) separately. In the feature branch, the developer renamed the function `getUser` to `fetchUser`. The function name in the API documentation was updated accordingly, but the example code in the SDK usage guide still referenced the old function name. When the feature branch was merged into the main branch, the function name in the API documentation was updated, but the example code lagged behind, resulting in inconsistencies in the merged documentation.

[0075] Entity Extraction: The system extracts the `getUser` call point from the code block in the SDK user guide, establishes a `CodeBlockNode`, and records the function name called as `getUser`. In this embodiment, the SDK user guide file extracts the function call point from the code block using a Markdown parser. The specific implementation of this extraction process is described in detail in Step 1.2 of this invention.

[0076] Knowledge graph construction: CodeBlockNode is connected to the getUser function entity node through the depends_on edge.

[0077] Conflict detection: In the feature branch, the getUser function entity node has a semantic_alias_of edge pointing to the fetchUser node. During entity alignment, the system detects that the function referenced by the SDK code block has been renamed, which is determined to be a "reference conflict".

[0078] Arbitration execution: The system matches "Reference conflict → Based on the code repository symbol table". It retrieves the actual function name `fetchUser` from the code repository for the current branch and generates a draft: replacing the function name `getUser` in the SDK usage guide with `fetchUser`.

[0079] User confirmation: After the draft is pushed out, the document manager confirms and the sample code is automatically updated.

[0080] Effect: Cross-document reference breaks are automatically detected and fixed, preventing developers from calling invalid functions due to errors in example code.

[0081] Example 3: Analysis of the impact of multi-branch propagation and version decay.

[0082] Scenario: A microservice renames the function `createPayment` to `initiatePayment` in its `feature` branch. The API documentation and SDK comments that depend on this function have been updated accordingly. This change propagates to the `release` branch via cherry-pick and is then merged into the `master` branch. In the `release` branch, some dependency documentation has not been updated, leading to inconsistencies when finally merged into the `master` branch. Furthermore, the two branches have different major version numbers (v1.x vs v2.x), requiring a version decay mechanism for arbitration.

[0083] Change propagation tracking: The system listens for cherry-pick events through the version control system Webhook and records the propagation path of changes from feature → release → master.

[0084] Conflict detection: In the release branch, the system detected that the createPayment function entity has been renamed, but the associated API documentation still has a depend_on edge pointing to the old function name, which is marked as a reference conflict.

[0085] Conflict propagation analysis: By traversing the forward graph, the system finds all document nodes (API documentation, SDK comments, architecture design documents) that depend on createPayment and assesses the scope of the impact.

[0086] Version decay determination: Obtain the semantic version numbers of the release branch (v1.8) and the master branch (v2.0). If the main version is inconsistent, for example, a higher decay degree is used (such as a decay coefficient of 0.5 when the main version number changes). The document node weight of the lower version branch is reduced, and the definition of the higher version branch is given priority during arbitration.

[0087] Arbitration and Drafts: The system generates an independent draft for each affected document node and summarizes them into a merged report, marking the propagation path and impact level. The version decay coefficient has been applied to the weight calculation.

[0088] User confirmation: The draft was pushed to the PR, and the developers confirmed each item and then updated all affected documents in batches.

[0089] Results: Document inconsistencies during multi-branch propagation are systematically detected and addressed, and the version decay mechanism makes arbitration decisions more reasonable, avoiding a chain reaction of document omissions.

[0090] The aforementioned 92% conflict detection recall rate is based on a test set of 100 simulated Git branch merging scenarios, including 50 value conflicts, 30 reference conflicts, and 20 structural conflict samples. The test environment was a Java / SpringBoot project, and the API documentation used the OpenAPI 3.0 format. The test set consisted of 50 Java SpringBoot projects, 25 Python Flask projects, 15 TypeScript Node.js projects, and 10 Go microservice projects selected from public GitHub repositories. Each project had three or more active branches (master, release, and feature). The recall rate was calculated using the standard formula TP / (TP+FN). After merging, the document-code consistency rate improved from approximately 65% ​​with manual maintenance to over 95%. After 50% cross-validation, the improvement was statistically significant, and the conflict resolution time was reduced by over 70%.

[0091] It should be understood that, although Figure 1 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0092] In one embodiment, such as Figure 2 As shown, a knowledge graph-based intelligent arbitration system for merging multi-branch documents is provided, the system comprising: The association matrix construction module 901 is used to extract semantic entities and relationships between entities from the target software development documents and corresponding code repositories of the two parallel development branches that are requested to be merged, and to add a branch version identifier to each semantic entity to form a branch version association matrix.

[0093] The knowledge graph construction module 902 is used to construct a cross-version knowledge graph for each branch, with semantic entities as nodes and relationships between entities as edges.

[0094] The conflict type determination module 903 is used to extract entity nodes from the cross-version knowledge graph of each branch, perform cross-graph entity alignment based on the semantic similarity of code entity names, identify aligned entity pairs corresponding to the same code entity, compare the attribute values ​​of the aligned entity pairs, and determine the conflict type based on the attribute difference type.

[0095] The merger draft generation module 904 is used to match arbitration strategies from a predefined arbitration strategy library based on the conflict type and generate a merger draft.

[0096] The merge confirmation module 905 is used to visually present the merge draft to the user and update the target software development documents based on the merge draft after the user confirms it.

[0097] Specific limitations regarding the knowledge graph-based multi-branch document merging conflict intelligent arbitration system can be found in the limitations of the knowledge graph-based multi-branch document merging conflict intelligent arbitration method described above, and will not be repeated here. Each module in the aforementioned knowledge graph-based multi-branch document merging conflict intelligent arbitration system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0098] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0099] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A knowledge graph-based multi-branch document merging conflict intelligent arbitration method, characterized in that, The method includes the following steps: Semantic entities and relationships between entities are extracted from the target software development documents and corresponding code repositories of the multiple parallel development branches that are requested to be merged, and a branch version identifier is added to each semantic entity to form a branch version association matrix; Construct a cross-version knowledge graph for each branch using semantic entities as nodes and relationships between entities as edges; Entity nodes are extracted from the cross-version knowledge graph of each branch. Cross-graph entity alignment is performed based on the semantic similarity of code entity names. Aligned entity pairs corresponding to the same code entity are identified, and the attribute values ​​of the aligned entity pairs are compared. The conflict type is determined based on the type of attribute difference. Arbitration strategies are matched from a predefined arbitration strategy library based on the conflict type to generate a merger draft; The merger draft is presented visually to the user, and the target software development documents are updated based on the merger draft after user confirmation.

2. The knowledge graph-based intelligent arbitration method for merging conflicts in multi-branch documents according to claim 1, characterized in that, Semantic entities and relationships between entities are extracted from the target software development documents and corresponding code repositories of the multiple parallel development branches requested for merging. A branch version identifier is added to each semantic entity to form a branch version association matrix, including: Iterate through the code repositories of multiple branches requesting a merge, obtain the latest CommitHash and semantic version number of each branch, and record the parent-child relationships between branches; Parse API documentation, code comments, and design documents to obtain a list of document entities; The code repository for each branch is traversed using an AST parser to obtain a list of code entities; Based on the latest CommitHash and semantic version number of each branch, a branch version identifier is added to each semantic entity to form a branch version association matrix.

3. The knowledge graph-based intelligent arbitration method for merging conflicts in multi-branch documents according to claim 2, characterized in that, The method further includes: When code changes propagate from the source branch to the target branch via cherry-pick, merge, or rebase, the source branch, target branch, and a list of changed code entities are extracted through the version control system. Based on the branch version association matrix, the system retrieves document fragments that depend on the current code entity and their associated semantic version numbers. It then performs a compatibility determination based on the difference in semantic version numbers between the source branch and the target branch, and outputs the compatibility level and a list of affected documents.

4. The intelligent arbitration method for merging conflicts of multi-branch documents based on knowledge graphs according to claim 1, characterized in that, Entity nodes are extracted from the cross-version knowledge graphs of each branch. Cross-graph entity alignment is performed based on the semantic similarity of code entity names. Aligned entity pairs corresponding to the same code entity are identified, and the attribute values ​​of the aligned entity pairs are compared. The conflict type is determined based on the type of attribute difference, including: Entity nodes are extracted from the cross-version knowledge graph of each branch. Cross-graph entity alignment is performed based on the semantic similarity of code entity names. Hierarchical clustering is used to cluster entity nodes with semantic similarity exceeding the threshold into aligned entity pairs corresponding to the same code entity. The attribute values ​​of the aligned entity pairs are read from the knowledge graph of each branch, and each aligned entity pair is compared. If the attribute set contains attribute differences and the difference exceeds a preset threshold, it is considered a value conflict; if the node... If a node has an outgoing edge in the first knowledge graph but not in the second knowledge graph, it is considered a reference conflict; if a node exists only in the first knowledge graph and not in the second knowledge graph, it is considered a structural conflict. Based on the first knowledge graph, the second knowledge graph, and the detected conflict types, conflict propagation analysis is performed through forward graph traversal and backward graph traversal, and a conflict list is output.

5. The intelligent arbitration method for merging conflicts of multi-branch documents based on knowledge graphs according to claim 4, characterized in that, When the arbitration strategy is to use the latest definition in the code repository symbol table as the standard, the latest code of the target branch is obtained from the code repository, and the actual definition of the conflicting code entity is extracted through the AST parser. The description of the corresponding entity in the document is compared with the actual definition to determine the type of inconsistency. Based on the actual definition, generate the proposed modifications to the merger draft.

6. The knowledge graph-based intelligent arbitration method for merging conflicts in multi-branch documents according to claim 4, characterized in that, When the arbitration strategy is version decay priority or code repository symbol table as the standard and version decay priority is used in conjunction, obtain the semantic version number of the first branch and the second branch, and calculate the decay coefficient; After multiplying the weight of document nodes in the lower version branch by a decay factor, the definition of the higher version branch is given priority in the arbitration decision. If the symbol table definitions of the higher version branch and the lower version branch are consistent, the symbol table definition shall prevail, and the decay coefficient shall be used as a reference auxiliary weight.

7. The intelligent arbitration method for merging conflicts of multi-branch documents based on knowledge graphs according to claim 5, characterized in that, The proposed merger includes conflict identifiers, conflict types, arbitration strategies, arbitration basis, suggested modifications, affected document paths, decision tree paths, and confidence scores.

8. The intelligent arbitration method for merging conflicts of multi-branch documents based on knowledge graphs according to claim 1, characterized in that, The target software development documentation includes at least one of the following: API interface documentation, code comments, and technical design documentation.

9. The intelligent arbitration method for merging conflicts of multi-branch documents based on knowledge graphs according to claim 7, characterized in that, The merger draft is presented visually to the user, and the target software development documents are updated based on the merger draft after user confirmation. This also includes: Record the conflict identifier, arbitration strategy, user actions, and final merger result for each merger draft; record the adopted merger draft as a positive sample and the rejected merger draft as a negative sample, and calculate the adoption rate of each arbitration strategy; Within a preset timeframe, the adoption rate of each arbitration strategy is statistically analyzed, and the strategy matching priority is dynamically adjusted.

10. A knowledge graph-based intelligent arbitration system for merging multi-branch documents, characterized in that: The system includes: The association matrix construction module is used to extract semantic entities and relationships between entities from the target software development documents and corresponding code repositories of the two parallel development branches that are requested to be merged, and to add a branch version identifier to each semantic entity to form a branch version association matrix; The knowledge graph construction module is used to build a cross-version knowledge graph for each branch, with semantic entities as nodes and relationships between entities as edges; The conflict type determination module is used to extract entity nodes from the cross-version knowledge graph of each branch, perform cross-graph entity alignment based on the semantic similarity of code entity names, identify aligned entity pairs corresponding to the same code entity, compare the attribute values ​​of the aligned entity pairs, and determine the conflict type based on the attribute difference type. The merger draft generation module is used to match arbitration strategies from a predefined arbitration strategy library based on the conflict type and generate a merger draft. The merge confirmation module is used to visually present the merge draft to the user and update the target software development documents based on the merge draft after the user confirms it.