Knowledge graph construction method and system for complex relational business database
Through the knowledge graph construction method for complex relational business databases, including concept-level and data-level graph modeling, as well as graph migration integration, the problems of low efficiency and lack of reasoning ability in the existing technology are solved, and efficient and accurate knowledge graph construction and improvement of reasoning ability are achieved.
Patent Information
- Application Number
- CN202411677004.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-04-08
AI Technical Summary
The existing technology fails to effectively consider the characteristics of complex relationship business databases, resulting in low efficiency in building knowledge graphs, unfriendly business experts' interfaces, and lack of knowledge reasoning capabilities.
A knowledge graph construction method for complex relational business databases is proposed, including three parts: concept-level graph modeling, data-level graph modeling and graph migration integration. By automatically analyzing the library table structure and constraint relationships of the business database, a list of candidate concepts and candidate relationships for tree classification can be formed, and concept-level and data-level knowledge graphs can be quickly constructed, and new, modification and merging operations of nodes and relationships can be supported.
It significantly improves the efficiency and accuracy of the construction of knowledge graphs of complex relationship business databases, reduces operational complexity, enhances the consistency and reasoning capabilities of knowledge graphs, and supports cross-domain integration and continuous updates.
Smart Images

Figure CN119783803A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a data processing technology, and in particular to a method and system for quickly constructing a knowledge graph for a complex business database. Background Art
[0002] In the current data management field, with the rapid development of the Internet and big data, various complex relational business databases provide enterprises and organizations with the basis for business analysis, decision support and information sharing, and gradually become important assets for enterprises and organizations. However, due to the high query difficulty, rigid data model and lack of reasoning ability of complex relational business databases, they are unable to cope with modern data analysis, intelligent applications and rapidly changing business needs. In order to effectively extract and manage knowledge from these complex databases, many researchers and developers have begun to explore methods for building knowledge graphs.
[0003] Knowledge graph is a way to represent information in a graphical structure, describing the association between knowledge through nodes (entities) and edges (relationships). In current technology, the construction of knowledge graph mainly includes methods based on manual annotation and methods based on statistical learning. The method based on manual annotation constructs knowledge graphs by manually defining and annotating entities and their relationships. The patent "Method and device for constructing knowledge graph" (Chinese patent: CN201910942406.X) provides such a knowledge graph construction method. It is aimed at business experts in vertical fields, provides business expert login and target knowledge graph construction modules, returns to the target knowledge graph construction page according to the business expert login information, and constructs the knowledge graph through operations on this page. This patent provides convenience for the construction of vertical field knowledge graphs to a certain extent through interface operations, but the functions such as ontology management and entity management provided by its page require business experts to create a single node, create a single relationship, add new attributes, etc. This process is accurate, but requires a lot of manual intervention. In the case of large amount of vertical field business data and complex business structure, it will inevitably lead to low efficiency in knowledge graph construction. The statistical learning-based method uses machine learning algorithms to automatically extract entities and relationships from structured or unstructured data. The patent "A method for constructing a knowledge graph for power grid infrastructure project data based on machine learning" (Chinese patent: CN113486193A) provides such a knowledge graph construction method. It is aimed at unstructured data such as instructions and test reports generated in power grid infrastructure projects, as well as semi-structured data such as equipment lists. Based on the principles of the bidirectional LSTM+CRF machine learning model and the dependency model, it automatically identifies entities and extracts relationship attributes to form entity data sets and entity relationship attribute data sets. This method can improve processing efficiency to a certain extent, but it often requires a large amount of labeled data for training, and is more suitable for unstructured text data, and is not applicable to the construction of knowledge graphs for complex relational business databases.
[0004] Complex relational business databases, especially those designed in accordance with the database paradigm, usually have the following characteristics: 1) They follow standardized data standards, which are usually formulated and issued by business experts, data experts, business expert representatives, etc., to ensure data consistency; 2) There are complex constraint relationships, that is, data tables have composite primary keys, composite foreign keys, cascading operations, and there may be multi-level table associations between business data tables; 3) Data items in some data tables have hierarchical relationships, category relationships, and dependency relationships. Existing knowledge graph construction methods have not effectively considered the relevant characteristics of complex relational business databases, and there are problems such as low construction efficiency, unfriendly business expert interfaces, and lack of knowledge reasoning capabilities. Summary of the invention
[0005] Aiming at the problem that the existing knowledge graph construction methods fail to effectively consider the relevant characteristics of complex relational business databases, a knowledge graph construction method and system for complex relational business databases are proposed.
[0006] The technical solution of the present invention is:
[0007] A knowledge graph construction method for complex relational business databases includes three parts: concept-level graph modeling, data-level graph modeling, and graph migration and integration. By accessing the business database or importing a model file, the library table structure and its constraint relationship of the business database are automatically analyzed, and a tree-like classification candidate concept list and a candidate relationship list are formed according to certain rules. The concept-level knowledge graph can be quickly constructed based on the candidate concept list and the candidate relationship list, and concept-level nodes and relationships can also be added, modified, and merged according to needs. On the basis of the concept-level knowledge graph, data records of the data table of the concept source are further obtained, and classification and clustering algorithms are used to realize multi-layer classification and grouping of data records, and the data-level knowledge graph is quickly constructed. At the same time, category nodes, data-level nodes and relationships can be added, modified, and deleted according to needs, thereby completing the rapid construction of the business knowledge graph. The constructed business knowledge graph can be further migrated and integrated, and it supports its import into a graph database for storage and retrieval, so as to realize cross-domain integration and continuous updating with other knowledge graphs.
[0008] Furthermore, the specific process is as follows:
[0009] Step 1: Concept-level graph modeling
[0010] In the stage of constructing the concept knowledge graph, we first need to select or establish the domain metamodel of the graph. The domain metamodel defines the structure, components and relationships of the knowledge graph, including entity types, relationship types and relationships between entities. Then, we establish a connection with the business database or import the business database model file to analyze the table structure and constraint relationships, obtain the metadata information of the business database, including table name information, field information, commnet information, primary key information, and foreign key reference information, form business database metadata records, and further identify candidate concepts and candidate relationships.
[0011] The identification of candidate concepts is mainly based on mapping with data tables in the business database. Considering that complex relational business databases with graph construction value usually follow the three major database paradigms, candidate concepts are classified according to the following principles:
[0012] Dictionary candidate concept: The primary key of the data table is a single primary key, and the data table name or table name comment conforms to the dictionary rules;
[0013] Entity candidate concept: The primary key of the data table is a single primary key, and the primary key field is not a foreign key field;
[0014] Sub-entity candidate concept: The primary key of the data table is a single primary key, and the primary key field is a foreign key field;
[0015] Dynamic candidate concepts: The primary key of the data table is a composite primary key, and the composite primary key contains a time type field;
[0016] Extended candidate concepts: The primary key of the data table is a composite primary key, and one or more fields in the composite primary key are foreign key fields and refer to the same parent table;
[0017] Other candidate concepts: candidate concepts that do not meet the above rules;
[0018] The identification of candidate relationships is mainly based on mapping with foreign key reference information in the business database. It is particularly important to note that when the primary key of a data table is a composite primary key, and multiple fields in the composite primary key refer to multiple parent tables, the data table is an association table, or a connection table, which is used to implement a many-to-many relationship, and therefore also needs to be identified as a candidate relationship.
[0019] After the candidate concepts and candidate relationships are identified, a tree-like classification list is formed, completing the decomposition from a complex business data model to a simple classification hierarchy, making it easier to quickly sort out the business data model, effectively reducing the difficulty of building a knowledge graph and improving construction efficiency;
[0020] Based on the candidate concept list and candidate relationship list, concepts and relationships can be recommended in a single, batch, or category manner to quickly build a concept-level business knowledge graph. In the candidate concept recommendation process, the candidate relationships related to the candidate concept are obtained synchronously, and the candidate relationships are further screened based on whether the other end of the candidate relationship is already in the graph to form a candidate relationship recommendation list for the candidate concept, so that the operator can synchronously complete the establishment of relevant relationships in the graph based on the candidate relationship recommendation list when recommending concepts. By default, when a candidate concept recommendation becomes a concept in the graph, all fields in its source data table will be mapped to the attributes of the concept. Optionally, the concept attributes can be trimmed, modified, or added during the recommendation process. In the candidate relationship recommendation process, the head and tail nodes of the candidate relationship are obtained synchronously and it is determined whether the head and tail nodes are already in the graph. If both the head and tail nodes are already in the graph, the candidate relationship recommendation only establishes the relationship between the nodes. If one or both of the head and tail nodes are not in the graph, the candidate relationship recommendation will synchronously complete the establishment of nodes and relationships.
[0021] Considering that the candidate concepts obtained based on the business database analysis may be similar or overlapping, causing confusion, it is necessary to merge concepts; the concept merging process mainly completes the merging of concepts, attributes and relationships; first, select several candidate concepts to be merged and name the merged concepts; second, according to the actual situation, select a candidate concept as the main concept, and the other concepts automatically become the concepts to be merged. Based on the main concept attributes, the attributes of each concept to be merged can be selectively screened for attribute merging to form the attribute information of the merged concept, and the association between the main concept and each concept to be merged is established, which provides a basis for the extraction of data-level nodes for the merged concept in the subsequent data-level graph modeling process; finally, the candidate relationships formed by the foreign key reference identification of the source fields of each attribute after the merger and the candidate relationships identified by the related association table are the original merged relationship set, and the association relationship between the main concept and the concept to be merged and the association relationship between each concept to be merged are filtered to form a relationship list of the merged concept to complete the relationship merging;
[0022] The operation process of constructing the above-mentioned concept-level knowledge graph is controlled by the business end, which can modify, adjust and supplement nodes, relationships and attributes in real time according to the needs, and associate concept nodes, relationships between concepts with entity types and relationships between entities in the domain metamodel; the business end can be a program, module, business expert, operator, technician;
[0023] Step 2: Data-level graph modeling
[0024] The data-level graph modeling phase mainly involves extracting, converting, and loading specific business data objects from the business database into the established concept-level knowledge graph to achieve the integration and presentation of actual data.
[0025] Data-level graph modeling can be roughly divided into four parts: data extraction, data processing organization, data selection and mounting, and implicit relationship analysis and derivation;
[0026] Data extraction first obtains the corresponding business data records according to the source data table of the concept, and then screens and converts the record fields in combination with the attribute information of the concept to form flat data records; in the process of data extraction, special attention should be paid to the data extraction of the merged concept. Since the merged concept is recommended by merging multiple candidate concepts, there are also multiple corresponding source data tables. In the process of data extraction, the main concept is taken as the main focus, and multi-table connection query is performed to obtain data records;
[0027] Data processing organization needs to organize and classify data effectively; data processing organization mainly includes data classification and data clustering; data classification is aimed at data records with explicit relationships, with concept attributes as predefined category labels, and single or multiple category labels are selected according to specific circumstances to classify data, forming a multi-layer tree-structured data record view; data clustering is aimed at records without explicit relationships and predefined labels, and the internal structure of data is discovered through clustering algorithms to form a multi-category data record view; the hierarchical nodes or category nodes of the multi-layer tree or multi-category tree processed by data classification and clustering algorithms will form category nodes in the atlas during the following data selection and mounting process;
[0028] Data selection and mounting is when the operator selects data according to actual needs and mounts it into the knowledge graph, thus forming entities in the graph, namely data nodes and relationships;
[0029] Data selection and mounting specifically includes three parts: data selection, graph preview, and data mounting. Data selection is based on the data record view of the data processing organization, and the operator selects all, part, or by category. Graph preview is to mount the selected data on the business knowledge graph in preview form, and intuitively display the results of this operation in a graphical structure of nodes and edges, so as to timely discover the problems of node redundancy, inaccurate relationships, and missing attributes in the data extraction and processing stages. Data mounting is to mount the data-level entities and relationships that the operator has viewed through the data record view and confirmed through the graph preview to the business knowledge graph. It should be noted that in the process of data-level graph modeling, the metamodel entity type of the data-level node inherits from the entity type of its concept node, and the relationship between data-level nodes is established according to the relationship matching between concept-level nodes, and its metamodel relationship type inherits from the relationship type of the concept-level relationship.
[0030] Based on the above operations, the construction of the business knowledge graph has been basically completed, forming a graphical knowledge structure including concept nodes, category nodes, data nodes and related relationships, and possessing the reasoning ability based on graph theory algorithms; currently, the concept-level node relationships and data-level node relationships in the graph are mainly established based on the results of the constraint relationship analysis of the business database, and the deeper association information between nodes cannot be effectively captured. Therefore, in the process of data-level graph modeling, further implicit relationship analysis and derivation are performed; implicit relationship analysis and derivation utilizes the advantages of the graph structure, and analyzes the connection paths between the nodes in the current graph based on graph theory algorithms, forming an implicit relationship list sorted by the head and tail node names and node types, and obtaining detailed path information for each implicit relationship, helping operators discover potential connections between nodes that are not apparent, and further establishing appropriate and reasonable relationships between nodes based on implicit relationship derivation, thereby making the knowledge graph more comprehensive and rich;
[0031] Step 3: Graph Migration and Integration
[0032] Graph migration integration is to extract the built knowledge graph into the Neo4j graph database, and establish a dynamic update mechanism for the knowledge graph to ensure the timeliness of the graph. It also supports exporting in multiple formats in the form of graph databases to achieve subsequent cross-domain integration with other knowledge graphs.
[0033] Graph migration integration mainly includes graph extraction and graph export. Considering that graph databases have more advantages in knowledge graph storage, node relationship processing, complex query support and knowledge reasoning, after the operator completes concept-level graph modeling and data-level graph modeling, the knowledge graph is further extracted into the Neo4j graph database for storage and management through graph extraction. The graph extraction process extracts nodes, attributes, and relationship information into the Neo4j graph database in turn, completing the storage of the knowledge graph in the graph database. At the same time, since the business database is dynamically changing, its knowledge graph is also dynamically changing, so a scheduled task is used to incrementally extract and update the graph to ensure the timeliness of the graph information in the graph database. Graph export refers to exporting graphs from the Neo4j graph database in CSV, GraphML, and JSON formats. The exported graph can be integrated with other knowledge graphs across domains on the one hand, and it is convenient to use other visualization analysis tools and data processing tools for further analysis and research on the other hand.
[0034] A knowledge graph construction system for complex relational business databases, including three parts: concept-level graph modeling, data-level graph modeling, and graph migration integration; concept-level graph modeling mainly includes metamodel management, data source management, candidate concept / candidate relationship management and recommendation, concept merging, and concept graph management; data-level graph modeling includes graph display and control, graph operation, data extraction and preview, and implicit relationship derivation; graph migration integration includes graph extraction and graph export; each module is described in detail as follows:
[0035] Conceptual graph modeling
[0036] Metamodel management: Metamodel management includes metamodel definition, metamodel editing, and metamodel deletion. Metamodel definition is defined for new business areas, including the definition of hierarchical entity types, sub-entity types, hierarchical relationship types, sub-relationship types, and inter-entity relationships. The entity type definition process including sub-entity types requires the entity type name, entity type identification, classification, color, and description content to be specified. The relationship type definition process including sub-relationship types requires the relationship type name, relationship type identification, classification, color, and description content to be specified. The inter-entity relationship definition process requires the head entity type name, tail entity type name, and inter-entity relationship type content to be specified. Metamodel editing is to update and adjust the existing metamodel according to actual needs and changes. Metamodel deletion is to remove metamodels that are no longer used.
[0037] Data source management: Data source management includes adding data sources, modifying data sources, and analyzing data sources. Adding data sources means defining the data source connection parameters, including the data source connection name, IP address, port number, service name, database type name, and password. After the configuration is completed, the data source connection is performed. After the connection is successful, the status bar will display "Connection successful, pending analysis", otherwise it will display "Connection failed". If the data source connection fails, the IP address, port number, service name, database type name, and password can be modified through the data source modification, and then the connection can be tried again. After the connection is successful, the database table structure and constraint relationship of the connected business database will be analyzed through the data source analysis, and the table name information, field information, commnet information, primary key information, and foreign key information of the table will be obtained and stored as the basis for candidate concepts / candidate relationships.
[0038] Management and recommendation of candidate concepts / candidate relationships: Based on the table name information, field information, commnet information, primary key information, and foreign key information obtained through analysis, the system forms a tree-like classified list of candidate concepts and candidate relationships in accordance with the candidate concept classification principles and candidate relationship mapping methods mentioned in the above-mentioned knowledge graph construction method; if the constraints of the business database table are not designed properly or do not fully comply with the three normal forms, the candidate concepts and candidate relationships may be inaccurately identified, and the candidate concepts and candidate relationships can be adjusted according to the actual situation; the candidate concept list includes the candidate concept category, name, source data table, source database, recommended status, and operation column; the candidate relationship list includes the relationship name, head concept name, tail concept name, recommended status, and operation column; the recommendation of candidate concepts can be made individually through the recommendation in the operation column of the candidate concept list, or multiple candidate concepts can be selected at one time or a candidate concept category can be selected for batch recommendation Recommendation; During the candidate concept recommendation process, the system will synchronously obtain and recommend candidate relationships related to the candidate concepts, and screen the candidate relationships based on whether the other end of the candidate relationship is already in the graph, forming a pop-up prompt for the candidate relationship recommendation list, and you can choose which candidate relationships to recommend synchronously; the recommendation of candidate relationships can be made individually through the recommendation in the operation column of the candidate relationship list, or multiple candidate relationships can be selected at one time for batch recommendation; During the candidate relationship recommendation process, the system will synchronously obtain the head and tail nodes of the candidate relationship and determine whether the head and tail nodes are already in the graph. If both the head and tail nodes are already in the graph, the candidate relationship recommendation will only establish the relationship between the nodes. If one or both of the head and tail nodes are not in the graph, the candidate relationship recommendation will complete the synchronous establishment of nodes and relationships; In addition, the candidate concept / candidate relationship management and recommendation also provide a search box to support fuzzy search of candidate concepts and candidate relationships to help operators quickly search;
[0039] Concept merging: Check several candidate concepts to be merged to perform concept merging operation and name the merged concepts; select a candidate concept as the main concept and merge the concept screening attributes; select the associated fields between the main concept and the concepts to be merged to establish the association relationship. The system uses the candidate relationship formed by the foreign key reference identification of the attribute source fields after the merger and the candidate relationship identified by the related association table as the original merged relationship set, filters the association relationship between the main concept and the concepts to be merged and the association relationship between the concepts to be merged, forms a relationship list of the merged concepts, and completes the relationship merging; after the concept merger is completed, it can become a node in the map through the recommendation button;
[0040] Concept map management: Concept map management includes concept list management and concept relationship list management; the concept list includes concept name, source data table, source database, ontology and operation column; through the modification in the operation column, the concept name in the concept can be edited and the appropriate metamodel entity type can be selected; the concept relationship list includes relationship name, head concept, head source data table, tail concept, tail source data table and operation column; the modification in the operation column can edit the relationship name, and the system filters the list of relationship types between entities according to the relationship head concept and tail concept entity type, which is convenient for operators to choose; through the deletion in the operation column of the concept list, the deletion in the operation column of the concept relationship list and batch deletion, the concepts and concept relationships in the map can be deleted, and the deleted concepts and concept relationships become candidate concepts and candidate relationships again; for some concepts or relationships that are missing in the business database and need to be added manually, the operator can supplement them by adding new concepts and relationships;
[0041] Data-level graph modeling
[0042] Graph display and control: The main interface of the data-level graph displays the current knowledge graph in a graphical structure of nodes and edges. The node color is inherited from the metamodel entity type, and the edge color is inherited from the metamodel relationship type. Considering the complexity of data and the diversity of display requirements, the system provides graph display control functions, including control by entity type, control by relationship type, and control by hierarchical type. Control by entity type refers to the display and hiding control of the entity type defined in the metamodel, and the graph is controlled by clicking the entity type label in the label bar. Control by relationship type refers to the display and hiding control of the relationship type defined in the metamodel, and the graph display is controlled by clicking the relationship type label in the label bar. Control by hierarchy refers to the control of the graph at the concept level, classification level, data level, and customization.
[0043] Graph operation: Graph operation mainly involves interactive operation, including node operation, relationship operation, navigation operation, and search operation. Click a node in the graph to highlight it. You can right-click to view the node properties, edit the node, and delete the node. Click a relationship in the graph to highlight it. You can right-click to view the relationship properties, edit the relationship, and delete the relationship. Click Add Node to manually add a node to the graph. Click Add Relationship to manually add a relationship to the graph. Use the mouse wheel to zoom in and out of the graph to view a wider range of graphs or focus on specific nodes. Drag the graph to move between different areas, making it easier to find entities or relationships of interest. Enter keywords in the search box for fuzzy search to quickly locate related entities and relationships and highlight them.
[0044] Data extraction and preview: Data extraction can further obtain data-level nodes and relationships based on the concept-level knowledge graph; select a concept-level node on the graph to perform data extraction, and the system will obtain the corresponding business data record from the source data table of the concept, and filter and convert the record fields in combination with the attribute information of the concept, and display it to the user in a flat list in pages; for data records that need to be classified, you can first use the predefined category labels created by the concept attributes above the list to perform classification operations; by clicking one or more business labels, the system will convert the flat list into a multi-layer tree-structured record tree for display according to the order of the clicked labels; you can click "+" to expand the record tree to check whether the classification results meet expectations, and you can use the graph preview operation to directly mount the classification nodes, data nodes and relationships to the graph for viewing; for unsatisfactory results using classification labels, you can use clustering methods to group data, and the clustering results can be viewed through the multi-layer tree-structured record tree and graph preview;
[0045] Implicit relationship derivation: Implicit relationships are derived using path derivation. Considering the requirements of different scenarios, a configurable parameter for the maximum depth of the path is provided. The result of implicit relationship derivation is presented in a list format, including the current node name, current node type, target node name, and target node type information. Select a row in the list to further view the detailed path information of the implicit relationship, and highlight the path in the graph to help determine whether there is a reasonable implicit relationship between the current node and the target node. If so, a direct relationship between the nodes can be established based on the implicit relationship path.
[0046] Data migration and integration
[0047] Extraction task management: Extraction task management is to manage the extraction process from knowledge graph to Neo4j graph database in the form of tasks. Extraction task management specifically includes creating new extraction tasks, viewing extraction task lists, controlling extraction status, and deleting extraction tasks. New extraction tasks are divided into basic information configuration and specific configuration of extraction tasks. Basic information configuration includes configuration of task name, associated graph, task description, node type, execution strategy, and update mode elements. The execution strategy supports immediate execution and scheduled execution, and the update mode supports full update and incremental update. The specific configuration of extraction tasks is to configure the attributes of extracted nodes and relationships and the metamodel information to which they belong. After the extraction task is established, it will be executed according to the execution strategy. The extraction task list view displays the task name, associated graph name, task execution status, execution strategy, update mode, and task description information in the form of a paged list. The operation bar provided in the task list provides a view of the task status, including not started, executing, successful execution, and failed execution. For an extraction task in execution, the extraction task can be interrupted by stopping the operation. For extraction tasks that are executed successfully or failed, the stop operation button is grayed out.
[0048] Graph export management: Graph export management is to manage the export of knowledge graphs. You can choose to support CSV, GraphML, and JSON formats for graph export. The exported records are displayed in a paginated list. The exported results can be downloaded through the download button in the operation bar.
[0049] Preferably, the system adopts a B / S architecture, uses the SpringBoot framework to build a Rest API on the back end, uses MySQL database and Neo4j database for software system data storage, uses the Vue.js framework for page construction on the front end, and uses the D3.js graphics library technology for knowledge graph display and interaction.
[0050] The beneficial effects of the present invention are:
[0051] (1) The present invention automatically analyzes the business data model and its constraint relationships, obtains the table name information, field information, commnet information, primary key information, foreign key information, etc. of the data table based on the analysis, identifies the data table type, and forms a tree-like classification of candidate concepts and candidate relationship lists according to certain rules. It provides concept recommendations (from candidate concepts to concepts in the graph) and relationship recommendations (from candidate relationships to relationships in the graph) in various forms such as single, batch, and by category through a visual interface, and is supplemented by intelligent association operations, which greatly reduces the complexity of operations and improves the efficiency of building knowledge graphs for complex relational business databases.
[0052] (2) When modeling the concept-level knowledge graph, the present invention uses concept merging to effectively merge concepts such as concept overlap and concept similarity, thereby forming a clearer and more accurate knowledge representation, eliminating redundant information, and improving the consistency of the knowledge graph.
[0053] (3) When modeling the data-level knowledge graph, the present invention systematically organizes and classifies explicit relational data through a classification algorithm, automatically groups and recognizes patterns of implicit relational data through a clustering algorithm, and constructs a multi-level data record view to improve the accessibility and comprehensibility of the data, thereby resolving graph construction errors caused by difficulty in viewing and understanding the data.
[0054] (4) In order to address the problem that the graph relationships established only by analyzing the constraint relationships of the business database are not comprehensive enough, especially when facing complex and changeable data environments and business logic, it is impossible to fully capture the deep connections and implicit information between data. The present invention fully captures the deep connections and implicit information between data through implicit relationship analysis and deduction, helps business experts discover potential connections between nodes that are not visible, and can establish graph relationships based on implicit relationship deduction, further enriching and improving the knowledge graph.
[0055] (5) The present invention displays data in a graphical manner through a graph preview method, which is convenient for business experts to intuitively understand the structure and relationship between the data, so that business experts can quickly identify potential problems and errors during the preview process, and have an intuitive and visual understanding of the construction results, thereby improving the accuracy of graph data and the efficiency of graph construction. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is a schematic diagram of the overall process of the knowledge graph construction method for complex relational business databases of the present invention;
[0057] Figure 2 This is a schematic diagram of the candidate concept classification process of the present invention;
[0058] Figure 3 It is a schematic diagram of the combined flow chart of the concept of the present invention;
[0059] Figure 4 Schematic diagram of the basic process of data level graph modeling of the present invention. DETAILED DESCRIPTION
[0060] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0061] In view of the defects in the above-mentioned technology, the main ways in which the present invention solves the technical problems are embodied in the following points:
[0062] (1) In view of the difficulties in combing the data model of complex relational business databases and the existence of complex constraint relationships, directly constructing a knowledge graph is highly professional and labor-intensive, requiring business experts to have high professional capabilities and technical levels. The present invention automatically analyzes the business data model and its constraint relationships, obtains the table name information, field information, commnet information, primary key information, foreign key information, etc. of the data table based on the analysis, identifies the data table type, and forms a tree-like classification of candidate concepts and candidate relationship lists according to certain rules. It provides concept recommendations (from candidate concepts to concepts in the graph) and relationship recommendations (from candidate relationships to relationships in the graph) in various forms such as single, batch, and by category through a visual interface, and is supplemented by intelligent association operations, which greatly reduces the complexity of operations and improves the efficiency of building knowledge graphs for complex relational business databases.
[0063] (2) In complex business scenarios, considering the complexity of business logic, similar concepts may exist in database tables, especially hierarchically related data tables, such as the "key position personnel" data table, the "key position personnel_driver" data table, the "key position personnel_commander" data table, etc. There are overlapping concepts, which may cause confusion. When modeling the concept-level knowledge graph, the present invention achieves a clearer and more accurate knowledge representation through concept merging, eliminates redundant information, and improves the consistency of the knowledge graph.
[0064] (3) In view of the situation that there are many data records in data tables in complex business databases, and the data in some data tables have explicit or implicit hierarchical relationships, category relationships, dependency relationships, etc., the present invention systematically organizes and classifies explicit relationship data through classification algorithms when modeling data-level knowledge graphs, and realizes automatic grouping and pattern recognition of implicit relationship data through clustering algorithms, thereby improving the accessibility and comprehensibility of data.
[0065] (4) In order to address the problem that the graph relationships established only by analyzing the constraint relationships of the business database are not comprehensive enough, especially when facing complex and changeable data environments and business logic, it is impossible to fully capture the deep connections and implicit information between data. The present invention provides more comprehensive and rich data association information through implicit relationship analysis and derivation, and can establish node relationships in the graph based on the relationships derived from implicit relationships, enrich the relationship network in the knowledge graph, and make the graph more comprehensive and accurate.
[0066] (5) In the process of knowledge graph construction, complex data structures and relationships are difficult to clearly represent through text or tables. In addition, due to defects in the data extraction or processing stage, there are node redundancy, inaccurate relationships, missing attributes, etc., which lead to problems such as graph construction errors that need to be corrected later. The present invention uses a graph preview method to display data in a graphical manner, which is convenient for business experts to intuitively understand the structure and relationship between data, allowing business experts to quickly identify potential problems and errors before actual operation, improve visual understanding, and improve the accuracy of graph data and construction efficiency.
[0067] A method for rapidly constructing knowledge graphs for complex relational business databases, which mainly includes three parts: concept-level graph modeling, data-level graph modeling, and graph migration and integration. The overall process diagram is shown in the figure. Figure 1 As shown in the figure, by accessing the business database or importing the model file, the database table structure and its constraint relationship of the business database are automatically analyzed, and according to certain rules, a tree-like classification candidate concept list and candidate relationship list are formed. Based on the candidate concept list and candidate relationship list, the concept-level knowledge graph can be quickly constructed, and the concept-level nodes and relationships can also be added, modified, merged, etc. according to the needs; on the basis of the concept-level knowledge graph, the data records of the data table of the concept source are further obtained, and the multi-layer classification and grouping of the data records are realized by using the classification and clustering algorithms, and the data-level knowledge graph is quickly constructed. At the same time, the category nodes, data-level nodes and relationships can be added, modified, deleted, etc. according to the needs, so as to complete the rapid construction of the business knowledge graph. The constructed business knowledge graph can be further migrated and integrated, and it supports its import into the Neo4j graph database for storage and retrieval, so as to realize cross-domain integration and continuous update with other knowledge graphs.
[0068] The specific process is as follows:
[0069] 1. Conceptual Graph Modeling
[0070] The conceptual knowledge graph construction phase focuses on the analysis and understanding of complex business data models, and forms a higher-level knowledge graph structure by defining core concepts and their relationships.
[0071] In the stage of constructing the concept knowledge graph, we first need to select or establish the domain metamodel of the graph. The domain metamodel defines the structure, components and relationships of the knowledge graph, including entity types, relationship types and relationships between entities. Then, by establishing a connection with the business database or importing the business database model file, we analyze the table structure and constraint relationships, obtain the metadata information of the business database, including table name information, field information, commnet information, primary key information, foreign key reference information, etc., form business database metadata records, and further identify candidate concepts and candidate relationships.
[0072] The identification of candidate concepts is mainly mapped with the data table in the business database. Considering that complex relational business databases with graph construction value usually follow the three major database paradigms, the present invention classifies candidate concepts according to the following principles. The flow chart is as follows: Figure 2 shown.
[0073] (1) Dictionary candidate concept: The primary key of the data table is a single primary key, and the data table name or table name comment conforms to the dictionary rules;
[0074] (2) Entity candidate concept: The primary key of the data table is a single primary key, and the primary key field is not a foreign key field;
[0075] (3) Sub-entity candidate concept: The primary key of the data table is a single primary key, and the primary key field is a foreign key field;
[0076] (4) Dynamic candidate concept: The primary key of the data table is a composite primary key, and the composite primary key contains a time type field;
[0077] (5) Extended candidate concept: The primary key of the data table is a composite primary key. One or more fields in the composite primary key are foreign key fields and refer to the same parent table.
[0078] (6) Other candidate concepts: candidate concepts that do not meet the above rules.
[0079] The identification of candidate relationships is mainly mapped with the foreign key reference information in the business database. It is particularly important to note that when the primary key of a data table is a composite primary key, and multiple fields in the composite primary key refer to multiple parent tables, the data table is an association table (also called a connection table), which is used to implement a many-to-many relationship, and therefore also needs to be identified as a candidate relationship.
[0080] After the candidate concepts and candidate relationships are identified, a tree-like classification list is formed, completing the decomposition from a complex business data model to a simple classification hierarchy, which facilitates the rapid sorting of the business data model, effectively reduces the difficulty of knowledge graph construction, and improves construction efficiency.
[0081] Based on the candidate concept list and candidate relationship list, concepts and relationships can be recommended in a variety of forms such as single, batch, and by category, and a concept-level business knowledge graph can be quickly constructed. In the candidate concept recommendation process, the candidate relationship related to the candidate concept is obtained synchronously, and the candidate relationship is further screened according to whether the other end of the candidate relationship is already in the graph to form a candidate relationship recommendation list for the candidate concept. When recommending a concept, the establishment of related relationships in the graph can be completed synchronously according to the candidate relationship recommendation list. By default, when a candidate concept recommendation becomes a concept in the graph, all the fields of its source data table will be mapped to the attributes of the concept. Optionally, the concept attributes can be trimmed, modified, or added during the recommendation process. In the candidate relationship recommendation process, the head and tail nodes of the candidate relationship are obtained synchronously and it is determined whether the head and tail nodes are already in the graph. If both the head and tail nodes are already in the graph, the candidate relationship recommendation only establishes the relationship between the nodes. If one or both of the head and tail nodes are not in the graph, the candidate relationship recommendation will synchronously complete the establishment of the node (the head and tail nodes of the candidate relationship are not in the graph) and the relationship.
[0082] In particular, considering that the candidate concepts obtained based on the analysis of the business database may be similar or overlapping, for example, the candidate concepts formed by the analysis of the "key position personnel" data table, the "key position personnel_driver" data table, the "key position personnel_commander" data table, etc., have certain overlaps, which cause confusion and require concept merging. The concept merging process mainly completes the merging of concepts, attributes and relationships. First, select several candidate concepts that need to be merged and name the merged concepts; secondly, according to the actual situation, select a candidate concept as the main concept, and the other concepts automatically become the concepts to be merged. Based on the main concept attributes, the attributes of each concept to be merged can be selectively screened for attribute merging to form the attribute information of the merged concept, and establish the association between the main concept and each concept to be merged, which provides a basis for the extraction of data-level nodes for the merged concept in the subsequent data-level graph modeling process; finally, the candidate relationships formed by the foreign key reference identification of the source fields of each attribute after the merger and the candidate relationships identified by the relevant association table are the original merged relationship set, and the association relationship between the main concept and the concept to be merged and the association relationship between each concept to be merged are filtered to form a relationship list of the merged concept to complete the relationship merger. The concept merging process diagram is shown below. Figure 3 shown.
[0083] The operation process of constructing the above concept-level knowledge graph is controlled by the business end, which can modify, adjust and supplement nodes, relationships and attributes in real time according to the needs, and associate concept nodes, relationships between concepts with entity types and relationships between entities in the domain metamodel. The business end can be a program, module, business expert, operator, technician, etc.
[0084] 2. Data-level graph modeling
[0085] The data-level graph modeling phase mainly involves extracting, converting, and loading specific business data objects from the business database into the established concept-level knowledge graph to achieve the integration and presentation of actual data. Figure 4 shown.
[0086] Data-level graph modeling can be roughly divided into four parts: data extraction, data processing organization, data selection and mounting, and implicit relationship analysis and derivation.
[0087] Data extraction first obtains the corresponding business data records based on the source data table of the concept, and then screens and converts the record fields based on the attribute information of the concept to form a flat data record. In the data extraction process, special attention should be paid to the data extraction of the merged concept. Since the merged concept is recommended by merging multiple candidate concepts, there are also multiple corresponding source data tables. In the data extraction process, the main concept is the main focus, and multi-table connection query is performed to obtain data records.
[0088] Data processing organization mainly takes into account the large volume, multiple fields, and hierarchical relationships between business data records. The flat form lacks a hierarchical structure, making it difficult to view and understand data records. Directly building a data-level graph will lead to unclear categories and chaotic relationships, and the quality and availability of the graph cannot be guaranteed. Effective classification and organization of data is required. Data processing organization mainly includes data classification and data clustering. Data classification is aimed at data records with explicit relationships. The attributes of the concept are used as predefined category labels. According to the specific situation, single or multiple category labels are selected for data classification to form a multi-layer tree-structured data record view; data clustering is aimed at records without explicit relationships and predefined labels. The internal structure of the data is discovered through clustering algorithms to form a multi-category data record view. The multi-layer tree or multi-category tree processed by data classification and clustering algorithms, its hierarchical nodes or category nodes will form category nodes in the graph during the following data selection and mounting process.
[0089] Data selection and mounting is to select data according to actual needs and mount it into the knowledge graph, thereby forming entities (also known as data nodes) and relationships in the graph.
[0090] Data selection and mounting specifically includes three parts: data selection, graph preview, and data mounting. Data selection is based on the data record view of the data processing organization, and business experts select all, part, or by category of data; graph preview is to mount the selected data on the business knowledge graph in preview form, and intuitively show the results of this operation to business experts in the form of a graphical structure of nodes and edges, so as to timely discover problems such as node redundancy, inaccurate relationships, and missing attributes in the data extraction and processing stages; data mounting is to mount data-level entities and relationships that business experts have confirmed through data record view viewing, graph preview, etc., to the business knowledge graph. It should be noted that in the process of data-level graph modeling, the metamodel entity type of the data-level node inherits from the entity type of its concept node, and the relationship between data-level nodes is established based on the relationship matching between concept-level nodes, and its metamodel relationship type inherits from the relationship type of the concept-level relationship.
[0091] Based on the above operations, the construction of the business knowledge graph has been basically completed, forming a graphical knowledge structure containing concept nodes, category nodes, data nodes and related relationships, and possessing the reasoning ability based on graph theory algorithms. At present, the concept-level node relationships and data-level node relationships in the graph are mainly established based on the results of the constraint relationship analysis of the business database. The deeper association information between nodes cannot be effectively captured. Therefore, the implicit relationship analysis and derivation are further performed in the data-level graph modeling process. The implicit relationship analysis and derivation takes advantage of the graph structure and analyzes the connection paths between the nodes in the current graph based on the graph theory algorithm to form an implicit relationship list sorted by the head and tail node names and node types, obtain detailed path information for each implicit relationship, discover potential connections between nodes that are not apparent, and further establish appropriate and reasonable relationships between nodes based on the implicit relationship derivation, thereby making the knowledge graph more comprehensive and rich.
[0092] 3. Graph Migration and Integration
[0093] Graph migration integration is to extract the already constructed knowledge graph into the Neo4j graph database, establish a dynamic update mechanism for the knowledge graph to ensure the timeliness of the graph, and support export in multiple formats in the form of graph databases to achieve subsequent cross-domain integration with other knowledge graphs.
[0094] Graph migration integration mainly includes graph extraction and graph export. Considering that graph databases have more advantages in knowledge graph storage, node relationship processing, complex query support, and knowledge reasoning, after business experts complete concept-level graph modeling and data-level graph modeling, they further extract the knowledge graph into the Neo4j graph database for storage and management through graph extraction. The graph extraction process extracts node, attribute, and relationship information into the Neo4j graph database in turn, completing the storage of the knowledge graph in the graph database. At the same time, since the business database is dynamically changing, its knowledge graph is also dynamically changing, so the incremental extraction and update of the graph is performed in a scheduled task mode to ensure the timeliness of the graph information in the graph database. Graph export refers to exporting graphs from the Neo4j graph database in formats such as CSV, GraphML, and JSON. The exported graph can be integrated with other knowledge graphs across domains on the one hand, and it is convenient to use other visualization analysis tools, data processing tools, etc. for further analysis and research on the other hand.
[0095] Based on the above-mentioned knowledge graph construction method, the present invention implements an example to develop a corresponding software system. The system adopts a B / S architecture, uses the SpringBoot framework to build a Rest API in the back end, uses MySQL database and Neo4j database for software system data storage, uses the Vue.js framework for page construction in the front end, and uses technologies such as the D3.js graphics library to display and interact with the knowledge graph.
[0096] The knowledge graph construction software for structured databases developed by the implementation example of the present invention is divided into three parts: concept-level graph modeling, data-level graph modeling, and graph migration integration. Concept-level graph modeling mainly includes metamodel management, data source management, candidate concept / candidate relationship management and recommendation, concept merging, and concept graph management. Data-level graph modeling mainly includes graph display and control, graph operation, data extraction and preview, and implicit relationship derivation. Graph migration integration mainly includes two parts: graph extraction and graph export. The following is a detailed description of each module of the software system.
[0097] 1. Conceptual Graph Modeling
[0098] (1) Metamodel management: Metamodel management includes metamodel definition, metamodel editing, and metamodel deletion. Metamodel definition is defined for new business areas, including the definition of hierarchical entity types, sub-entity types, hierarchical relationship types, sub-relationship types, and inter-entity relationships. The entity type (including sub-entity types) definition process needs to specify the entity type name, entity type identifier, classification, color, description, etc. The relationship type (including sub-relationship type) definition process needs to specify the relationship type name, relationship type identifier, classification, color, description, etc. The inter-entity relationship definition process needs to specify the head entity type name, tail entity type name, inter-entity relationship type, etc. Metamodel editing is to update and adjust the existing metamodel according to actual needs and changes. Metamodel deletion is to remove metamodels that are no longer used.
[0099] (2) Data source management: Data source management includes adding data sources, modifying data sources, and analyzing data sources. Adding data sources means defining the data source connection parameters, including the data source connection name, IP address, port number, service name, database type name, password, etc. After the configuration is completed, the data source connection is performed. After the connection is successful, the status bar will display "Connection successful, pending analysis", otherwise it will display "Connection failed". If the data source connection fails, you can modify the IP address, port number, etc. through the data source modification and try to connect again. After the connection is successful, the data source analysis will analyze the library table structure and constraint relationships of the connected business database, obtain the table name information, field information, commnet information, primary key information, foreign key information, etc., and store them as the basis for candidate concepts / candidate relationships.
[0100] (3) Management and recommendation of candidate concepts / candidate relationships: Based on the table name information, field information, commnet information, primary key information, foreign key information, etc. obtained by analysis, the system forms a tree-like classification list of candidate concepts and candidate relationships in accordance with the candidate concept classification principle and candidate relationship mapping method mentioned in the above-mentioned knowledge graph construction method. In the case of unreasonable design of business database table constraints or failure to fully comply with the three normal forms, the candidate concepts and candidate relationships may be inaccurately identified. The candidate concepts and candidate relationships can be adjusted according to the actual situation. The candidate concept list includes candidate concept category, name, source data table, source database, recommendation status and operation column. The candidate relationship list includes relationship name, head concept name, tail concept name, recommendation status and operation column. The recommendation of candidate concepts can be made individually through the recommendation in the operation column of the candidate concept list, or multiple candidate concepts can be selected at one time or a candidate concept category can be selected for batch recommendation. During the candidate concept recommendation process, the system will simultaneously obtain and recommend candidate relationships related to the candidate concepts, and form a pop-up prompt for the candidate relationship recommendation list based on whether the other end of the candidate relationship has been screened in the graph. You can choose which candidate relationships to recommend synchronously. The recommendation of candidate relationships can be made individually through the recommendation in the operation column of the candidate relationship list, or multiple candidate relationships can be selected at one time for batch recommendation. During the candidate relationship recommendation process, the system will synchronously obtain the head and tail nodes of the candidate relationship and determine whether the head and tail nodes are already in the graph. If the head and tail nodes are already in the graph, the candidate relationship recommendation will only establish the relationship between the nodes. If one or both of the head and tail nodes are not in the graph, the candidate relationship recommendation will complete the synchronous establishment of nodes and relationships. In addition, the candidate concept / candidate relationship management and recommendation also provides a search box to support fuzzy search of candidate concepts and candidate relationships, helping business experts, operators, etc. to quickly search.
[0101] (4) Concept merging: Check several candidate concepts to be merged to perform concept merging operations and name the merged concepts; select a candidate concept as the main concept and merge the concept screening attributes; select the associated fields between the main concept and the concepts to be merged to establish an association relationship. The system uses the candidate relationships formed by the foreign key references of the attribute source fields after the merger and the candidate relationships identified by the related association tables as the original merged relationship set, filters the associations between the main concept and the concepts to be merged and the associations between the concepts to be merged, forms a relationship list for the merged concepts, and completes the relationship merging. After the concept merging is completed, it can become a node in the graph through the recommendation button.
[0102] (5) Concept map management: Concept map management includes concept list management and concept relationship list management. The concept list contains concept name, source data table, source database, ontology, and operation column. Through the modification in the operation column, the concept name in the concept can be edited and the appropriate metamodel entity type can be selected. The concept relationship list contains relationship name, head concept, head source data table, tail concept, tail source data table, and operation column. The modification in the operation column can edit the relationship name. The system filters the list of relationship types between entities according to the relationship head concept and tail concept entity type, which is convenient for business experts, operators, etc. to select. Through the deletion in the operation column of the concept list, the deletion in the operation column of the concept relationship list, and batch deletion, the concepts and concept relationships in the map can be deleted, and the deleted concepts and concept relationships become candidate concepts and candidate relationships again. For some concepts or relationships that are missing in the business database and need to be added manually, they can be supplemented by adding new concepts and relationships.
[0103] 2. Data-level graph modeling
[0104] (1) Graph display and control: The main interface of the data-level graph displays the current knowledge graph in a graphical structure of nodes and edges. The node color is inherited from the metamodel entity type, and the edge color is inherited from the metamodel relationship type. Taking into account the complexity of data and the diversity of display requirements, the system provides graph display control functions, including control by entity type, control by relationship type, and control by hierarchical type. Control by entity type refers to the display and hiding control of the entity type defined in the metamodel, and the graph is controlled by clicking the entity type label in the label bar; control by relationship type refers to the display and hiding control of the relationship type defined in the metamodel, and the graph is displayed by clicking the relationship type label in the label bar; control by hierarchy refers to the control of the graph at the concept level, classification level, data level, and customization.
[0105] (2) Graph operations: Graph operations mainly involve interactive operations, including node operations, relationship operations, navigation operations, and search operations. Click a node in the graph to highlight it. Right-click to view node properties, edit nodes, and delete nodes. Click a relationship in the graph to highlight it. Right-click to view relationship properties, edit relationships, and delete relationships. Click Add Node to manually add nodes to the graph. Click Add Relationship to manually add relationships to the graph. Use the mouse wheel to zoom in and out of the graph to view a wider range of graphs or focus on specific nodes. Drag the graph to move between different areas, making it easier to find entities or relationships of interest. Enter keywords in the search box to perform fuzzy searches to quickly locate related entities and relationships and highlight them.
[0106] (3) Data extraction and preview: Data extraction can further obtain data-level nodes and relationships based on the concept-level knowledge graph. Select a concept-level node on the graph to perform data extraction. The system will obtain the corresponding business data record from the source data table of the concept, and filter and convert the record fields based on the attribute information of the concept, and display it to the user in a flat list in a paged manner. For data records that need to be classified, you can first use the predefined category labels created by the concept attributes above the list to perform classification operations. By clicking one or more business labels, the system will convert the flat list into a multi-layer tree-structured record tree for display according to the order of the clicked labels. You can click "+" to expand the record tree to check whether the classification results meet expectations, and you can use the graph preview operation to directly mount the classification nodes, data nodes and relationships to the graph for viewing. If the effect of using classification labels is not ideal, you can use clustering methods to group data. The clustering results can be viewed through the multi-layer tree-structured record tree and graph preview.
[0107] (4) Implicit relationship derivation: Implicit relationships are derived using a path derivation method. Considering the requirements of different scenarios, a configurable parameter for the maximum depth of the path is provided. The result of the implicit relationship derivation is presented in a list format, including the current node name, current node type, target node name, target node type, and other information. Select a row in the list to further view the detailed path information of the implicit relationship, and highlight the path in the graph to assist in determining whether there is a reasonable implicit relationship between the current node and the target node. If so, a direct relationship between the nodes can be established based on the implicit relationship path.
[0108] (III) Data Migration and Integration
[0109] (1) Extraction task management: Extraction task management is to manage the extraction process from the knowledge graph to the Neo4j graph database in the form of tasks. The specific extraction task management includes creating a new extraction task, viewing the extraction task list, controlling the extraction status, and deleting the extraction task. Creating a new extraction task is divided into basic information configuration and specific extraction task configuration. The basic information configuration includes the configuration of elements such as the task name, associated graph, task description, node type, execution strategy, and update mode. The execution strategy supports immediate execution and scheduled execution, and the update mode supports full update and incremental update. The specific extraction task configuration is to configure the attributes of the extracted nodes and relationships, the metamodel to which they belong, and other information. After the extraction task is established, it will be executed according to the execution strategy. The extraction task list view displays information such as the task name, associated graph name, task execution status, execution strategy, update mode, and task description in a paginated list. The operation bar provided in the task list provides a way to view the task status, including not started, executing, successful execution, and failed execution. For an extraction task in progress, you can interrupt the task by stopping it. For an extraction task that is successfully or unsuccessfully executed, the stop button will be grayed out.
[0110] (2) Graph export management: Graph export management is to manage the export of knowledge graphs. You can choose to support CSV, GraphML, JSON and other formats for graph export. The exported records are displayed in a paged list. The exported results can be downloaded using the download button in the operation bar.
[0111] The above-mentioned embodiment only expresses one implementation mode of the present invention, and its description is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be based on the attached claims.
Claims
1. A knowledge graph construction method for complex relational business database, characterized in that: It includes three parts: concept-level graph modeling, data-level graph modeling, and graph migration integration. By accessing the business database or importing the model file, it automatically analyzes the database table structure and its constraint relationships of the business database, and forms a tree-like classification of candidate concept lists and candidate relationship lists according to certain rules. Based on the candidate concept list and candidate relationship list, the concept-level knowledge graph can be quickly constructed. At the same time, the concept-level nodes and relationships can be added, modified, and merged according to needs. On the basis of the concept-level knowledge graph, we further obtain data records from the data table of the concept source, use classification and clustering algorithms to realize multi-layer classification and grouping of data records, and quickly build the data-level knowledge graph. At the same time, we can also add, modify, and delete category nodes, data-level nodes, and relationships as needed, so as to complete the rapid construction of the business knowledge graph. The constructed business knowledge graph can be further migrated and integrated, and support its import into the graph database for storage and retrieval, so as to realize cross-domain integration and continuous updating with other knowledge graphs.
2. The method for constructing a knowledge graph for a complex relational business database according to claim 1, characterized in that: The specific process is as follows: Step 1: Concept-level graph modeling In the stage of constructing the concept knowledge graph, we first need to select or establish the domain metamodel of the graph. The domain metamodel defines the structure, components and relationships of the knowledge graph, including entity types, relationship types and relationships between entities. Then, we establish a connection with the business database or import the business database model file to analyze the table structure and constraint relationships, obtain the metadata information of the business database, including table name information, field information, commnet information, primary key information, and foreign key reference information, form business database metadata records, and further identify candidate concepts and candidate relationships. The identification of candidate concepts is mainly based on mapping with data tables in the business database. Considering that complex relational business databases with graph construction value usually follow the three major database paradigms, candidate concepts are classified according to the following principles: Dictionary candidate concept: The primary key of the data table is a single primary key, and the data table name or table name comment conforms to the dictionary rules; Entity candidate concept: The primary key of the data table is a single primary key, and the primary key field is not a foreign key field; Sub-entity candidate concept: The primary key of the data table is a single primary key, and the primary key field is a foreign key field; Dynamic candidate concepts: The primary key of the data table is a composite primary key, and the composite primary key contains a time type field; Extended candidate concepts: The primary key of the data table is a composite primary key, and one or more fields in the composite primary key are foreign key fields and refer to the same parent table; Other candidate concepts: candidate concepts that do not meet the above rules; The identification of candidate relationships is mainly based on mapping with foreign key reference information in the business database. It is particularly important to note that when the primary key of a data table is a composite primary key, and multiple fields in the composite primary key refer to multiple parent tables, the data table is an association table, or a connection table, which is used to implement a many-to-many relationship, and therefore also needs to be identified as a candidate relationship. After the candidate concepts and candidate relationships are identified, a tree-like classification list is formed, completing the decomposition from a complex business data model to a simple classification hierarchy, making it easier to quickly sort out the business data model, effectively reducing the difficulty of building a knowledge graph and improving construction efficiency; Based on the candidate concept list and candidate relationship list, concepts and relationships can be recommended in a single, batch, or category manner to quickly build a concept-level business knowledge graph. In the candidate concept recommendation process, the candidate relationships related to the candidate concept are obtained synchronously, and the candidate relationships are further screened based on whether the other end of the candidate relationship is already in the graph to form a candidate relationship recommendation list for the candidate concept, so that the operator can synchronously complete the establishment of relevant relationships in the graph based on the candidate relationship recommendation list when recommending concepts. By default, when a candidate concept recommendation becomes a concept in the graph, all fields in its source data table will be mapped to the attributes of the concept. Optionally, the concept attributes can be trimmed, modified, or added during the recommendation process. In the candidate relationship recommendation process, the head and tail nodes of the candidate relationship are obtained synchronously and it is determined whether the head and tail nodes are already in the graph. If both the head and tail nodes are already in the graph, the candidate relationship recommendation only establishes the relationship between the nodes. If one or both of the head and tail nodes are not in the graph, the candidate relationship recommendation will synchronously complete the establishment of nodes and relationships. Considering that the candidate concepts obtained based on the business database analysis may be similar or overlapping, causing confusion, it is necessary to merge concepts; the concept merging process mainly completes the merging of concepts, attributes and relationships; first, select several candidate concepts to be merged and name the merged concepts; second, according to the actual situation, select a candidate concept as the main concept, and the other concepts automatically become the concepts to be merged. Based on the main concept attributes, the attributes of each concept to be merged can be selectively screened for attribute merging to form the attribute information of the merged concept, and the association between the main concept and each concept to be merged is established, which provides a basis for the extraction of data-level nodes for the merged concept in the subsequent data-level graph modeling process; finally, the candidate relationships formed by the foreign key reference identification of the source fields of each attribute after the merger and the candidate relationships identified by the related association table are the original merged relationship set, and the association relationship between the main concept and the concept to be merged and the association relationship between each concept to be merged are filtered to form a relationship list of the merged concept to complete the relationship merging; The operation process of constructing the above-mentioned concept-level knowledge graph is controlled by the business end, which can modify, adjust and supplement nodes, relationships and attributes in real time according to the needs, and associate concept nodes, relationships between concepts with entity types and relationships between entities in the domain metamodel; the business end can be a program, module, business expert, operator, technician; Step 2: Data-level graph modeling The data-level graph modeling phase mainly involves extracting, converting, and loading specific business data objects from the business database into the established concept-level knowledge graph to achieve the integration and presentation of actual data. Data-level graph modeling can be roughly divided into four parts: data extraction, data processing organization, data selection and mounting, and implicit relationship analysis and derivation; Data extraction first obtains the corresponding business data records according to the source data table of the concept, and then screens and converts the record fields in combination with the attribute information of the concept to form flat data records; in the process of data extraction, special attention should be paid to the data extraction of the merged concept. Since the merged concept is recommended by merging multiple candidate concepts, there are also multiple corresponding source data tables. In the process of data extraction, the main concept is taken as the main focus, and multi-table connection query is performed to obtain data records; Data processing organization needs to organize and classify data effectively; data processing organization mainly includes data classification and data clustering; data classification is aimed at data records with explicit relationships, with concept attributes as predefined category labels, and single or multiple category labels are selected according to specific circumstances to classify data, forming a multi-layer tree-structured data record view; data clustering is aimed at records without explicit relationships and predefined labels, and the internal structure of data is discovered through clustering algorithms to form a multi-category data record view; the hierarchical nodes or category nodes of the multi-layer tree or multi-category tree processed by data classification and clustering algorithms will form category nodes in the atlas during the following data selection and mounting process; Data selection and mounting is when the operator selects data according to actual needs and mounts it into the knowledge graph, thus forming entities in the graph, namely data nodes and relationships; Data selection and mounting specifically includes three parts: data selection, graph preview, and data mounting. Data selection is based on the data record view of the data processing organization, and the operator selects all, part, or by category. Graph preview is to mount the selected data on the business knowledge graph in preview form, and intuitively display the results of this operation in a graphical structure of nodes and edges, so as to timely discover the problems of node redundancy, inaccurate relationships, and missing attributes in the data extraction and processing stages. Data mounting is to mount the data-level entities and relationships that the operator has viewed through the data record view and confirmed through the graph preview to the business knowledge graph. It should be noted that in the process of data-level graph modeling, the metamodel entity type of the data-level node inherits from the entity type of its concept node, and the relationship between data-level nodes is established according to the relationship matching between concept-level nodes, and its metamodel relationship type inherits from the relationship type of the concept-level relationship. Based on the above operations, the construction of the business knowledge graph has been basically completed, forming a graphical knowledge structure including concept nodes, category nodes, data nodes and related relationships, and possessing the reasoning ability based on graph theory algorithms; currently, the concept-level node relationships and data-level node relationships in the graph are mainly established based on the results of the constraint relationship analysis of the business database, and the deeper association information between nodes cannot be effectively captured. Therefore, in the process of data-level graph modeling, further implicit relationship analysis and derivation are performed; implicit relationship analysis and derivation utilizes the advantages of the graph structure, and analyzes the connection paths between the nodes in the current graph based on graph theory algorithms, forming an implicit relationship list sorted by the head and tail node names and node types, and obtaining detailed path information for each implicit relationship, helping operators discover potential connections between nodes that are not apparent, and further establishing appropriate and reasonable relationships between nodes based on implicit relationship derivation, thereby making the knowledge graph more comprehensive and rich; Step 3: Graph Migration and Integration Graph migration integration is to extract the built knowledge graph into the Neo4j graph database, and establish a dynamic update mechanism for the knowledge graph to ensure the timeliness of the graph. It also supports exporting in multiple formats in the form of graph databases to achieve subsequent cross-domain integration with other knowledge graphs. Graph migration integration mainly includes graph extraction and graph export. Considering that graph databases have more advantages in knowledge graph storage, node relationship processing, complex query support and knowledge reasoning, after the operator completes concept-level graph modeling and data-level graph modeling, the knowledge graph is further extracted into the Neo4j graph database for storage and management through graph extraction. The graph extraction process extracts nodes, attributes, and relationship information into the Neo4j graph database in turn, completing the storage of the knowledge graph in the graph database. At the same time, since the business database is dynamically changing, its knowledge graph is also dynamically changing, so a scheduled task is used to incrementally extract and update the graph to ensure the timeliness of the graph information in the graph database. Graph export refers to exporting graphs from the Neo4j graph database in CSV, GraphML, and JSON formats. The exported graph can be integrated with other knowledge graphs across domains on the one hand, and it is convenient to use other visualization analysis tools and data processing tools for further analysis and research on the other hand.
3. A knowledge graph construction system for complex relational business databases, characterized in that: It includes three parts: concept-level graph modeling, data-level graph modeling, and graph migration and integration; Concept-level graph modeling mainly includes metamodel management, data source management, candidate concept / candidate relationship management and recommendation, concept merging, and concept graph management; data-level graph modeling includes graph display and control, graph operation, data extraction and preview, and implicit relationship derivation; graph migration integration includes graph extraction and graph export; each module is described in detail as follows: Conceptual graph modeling Metamodel management: Metamodel management includes metamodel definition, metamodel editing, and metamodel deletion. Metamodel definition is defined for new business areas, including the definition of hierarchical entity types, sub-entity types, hierarchical relationship types, sub-relationship types, and inter-entity relationships. The entity type definition process including sub-entity types must specify the entity type name, entity type identification, classification, color, and description content. The relationship type definition process including sub-relationship types must specify the relationship type name, relationship type identification, classification, color, and description content. The inter-entity relationship definition process must specify the head entity type name, tail entity type name, and inter-entity relationship type content. Metamodel editing is to update and adjust the existing metamodel according to actual needs and changes; Metamodel deletion is the removal of metamodels that are no longer used; Data source management: Data source management includes adding data sources, modifying data sources, and analyzing data sources; The new addition of data source is to define the data source connection parameters, including data source connection name, IP address, port number, service name, database type name, and password. After the configuration is completed, the data source is connected. If the connection is successful, the status bar will display "Connection successful, waiting for analysis", otherwise it will display "Connection failed"; If the data source connection fails, you can modify the IP address, port number, service name, database type name, and password through the data source modification and try to connect again; After the connection is successful, the data source analysis will be used to analyze the database table structure and constraint relationships of the connected business database, obtain the table name information, field information, commnet information, primary key information, and foreign key information of the table and store them as the basis for candidate concepts / candidate relationships; Management and recommendation of candidate concepts / candidate relationships: Based on the table name information, field information, commnet information, primary key information, and foreign key information obtained through analysis, the system forms a tree-like classification list of candidate concepts and candidate relationships in accordance with the candidate concept classification principles and candidate relationship mapping methods mentioned in the above-mentioned knowledge graph construction method. In case of unreasonable design of business database table constraints or failure to fully comply with the three normal forms, the candidate concepts and candidate relationships may be inaccurately identified, and the candidate concepts and candidate relationships can be adjusted according to the actual situation. The candidate concept list includes the candidate concept category, name, source data table, source database, recommendation status and operation column; the candidate relationship list includes the relationship name, head concept name, tail concept name, recommendation status and operation column; the recommendation of candidate concepts can be made individually through the recommendation in the operation column of the candidate concept list, or multiple candidate concepts can be selected at one time or a candidate concept category can be selected for batch recommendation; During the candidate concept recommendation process, the system will simultaneously obtain and recommend candidate relationships related to the candidate concepts, and screen the candidate relationships based on whether the other end of the candidate relationship has been in the graph, forming a pop-up box prompt for the candidate relationship recommendation list, and you can choose which candidate relationships to recommend synchronously; The recommendation of candidate relationships can be made individually through the Recommend in the Operation column of the Candidate Relationship List, or multiple candidate relationships can be selected at one time for batch recommendation; During the candidate relationship recommendation process, the system will synchronously obtain the head and tail nodes of the candidate relationship and determine whether the head and tail nodes are already in the graph. If both the head and tail nodes are already in the graph, the candidate relationship recommendation will only establish the relationship between the nodes. If one or both of the head and tail nodes are not in the graph, the candidate relationship recommendation will complete the synchronous establishment of the nodes and the relationship. In addition, the candidate concept / candidate relationship management and recommendation also provides a search box to support fuzzy search of candidate concepts and candidate relationships to help operators quickly search. Concept merging: Check several candidate concepts to be merged to perform concept merging operation and name the merged concepts; select a candidate concept as the main concept and merge the concept screening attributes; select the associated fields between the main concept and the concepts to be merged to establish the association relationship. The system uses the candidate relationship formed by the foreign key reference identification of the attribute source fields after the merger and the candidate relationship identified by the related association table as the original merged relationship set, filters the association relationship between the main concept and the concepts to be merged and the association relationship between the concepts to be merged, forms a relationship list of the merged concepts, and completes the relationship merging; after the concept merger is completed, it can become a node in the map through the recommendation button; Concept map management: Concept map management includes concept list management and concept relationship list management; the concept list includes concept name, source data table, source database, ontology and operation column; through the modification in the operation column, the concept name in the concept can be edited and the appropriate metamodel entity type can be selected; the concept relationship list includes relationship name, head concept, head source data table, tail concept, tail source data table and operation column; the modification in the operation column can edit the relationship name, and the system filters the list of relationship types between entities according to the relationship head concept and tail concept entity type, which is convenient for operators to choose; through the deletion in the operation column of the concept list, the deletion in the operation column of the concept relationship list and batch deletion, the concepts and concept relationships in the map can be deleted, and the deleted concepts and concept relationships become candidate concepts and candidate relationships again; for some concepts or relationships that are missing in the business database and need to be added manually, the operator can supplement them by adding new concepts and relationships; Data-level graph modeling Graph display and control: The main interface of the data-level graph displays the current knowledge graph in a graphical structure of nodes and edges. The node color is inherited from the metamodel entity type, and the edge color is inherited from the metamodel relationship type. Considering the complexity of data and the diversity of display requirements, the system provides graph display control functions, including control by entity type, control by relationship type, and control by hierarchical type. Control by entity type refers to the display and hiding control of the entity type defined in the metamodel, and the graph is controlled by clicking the entity type label in the label bar. Control by relationship type refers to the display and hiding control of the relationship type defined in the metamodel, and the graph display is controlled by clicking the relationship type label in the label bar. Control by hierarchy refers to the control of the graph at the concept level, classification level, data level, and customization. Graph operation: Graph operation mainly involves interactive operation, including node operation, relationship operation, navigation operation, and search operation. Click a node in the graph to highlight it. You can right-click to view the node properties, edit the node, and delete the node. Click a relationship in the graph to highlight it. You can right-click to view the relationship properties, edit the relationship, and delete the relationship. Click Add Node to manually add a node to the graph. Click Add Relationship to manually add a relationship to the graph; use the mouse wheel to zoom in and out of the graph to view a wider graph or focus on a specific node; drag the graph to move between different areas to find entities or relationships of interest; enter keywords in the search box to perform fuzzy search to quickly locate related entities and relationships and highlight them; Data extraction and preview: Data extraction can further obtain data-level nodes and relationships based on the concept-level knowledge graph; Select a concept-level node on the graph to perform data extraction. The system will obtain the corresponding business data record from the source data table of the concept, and filter and convert the record fields in combination with the attribute information of the concept, and display it to the user in a flat list in pages. For data records that need to be classified, you can first use the predefined category labels created by the concept attributes above the list to perform classification operations. By clicking one or more business labels, the system will convert the flat list into a multi-layer tree-structured record tree for display according to the order of the clicked labels. You can click "+" to expand the record tree to check whether the classification result meets your expectations, and you can use the graph preview operation to directly mount the classification node, data node and relationship to the graph for viewing. For unsatisfactory results using classification labels, you can use clustering methods to group data, and the clustering results can be viewed through the multi-layer tree-structured record tree and graph preview. Implicit relationship derivation: Implicit relationships are derived using path derivation. Considering the requirements of different scenarios, a configurable parameter for the maximum depth of the path is provided. The result of implicit relationship derivation is presented in the form of a list, including the current node name, current node type, target node name, and target node type information. Select a row in the list to further view the detailed path information of the implicit relationship and highlight the path in the graph to help determine whether there is a reasonable implicit relationship between the current node and the target node. If so, a direct relationship between the nodes can be established based on the implicit relationship path. Data Migration and Integration Extraction task management: Extraction task management is to manage the extraction process from knowledge graph to Neo4j graph database in the form of tasks. Extraction task management specifically includes creating new extraction tasks, viewing extraction task lists, controlling extraction status, and deleting extraction tasks. New extraction tasks are divided into basic information configuration and specific configuration of extraction tasks. Basic information configuration includes configuration of task name, associated graph, task description, node type, execution strategy, and update mode elements. The execution strategy supports immediate execution and scheduled execution, and the update mode supports full update and incremental update. The specific configuration of extraction tasks is to configure the attributes of extracted nodes and relationships and the metamodel information to which they belong. After the extraction task is established, it will be executed according to the execution strategy. The extraction task list view displays the task name, associated graph name, task execution status, execution strategy, update mode, and task description information in the form of a paged list. The operation bar provided in the task list provides a view of the task status, including not started, executing, successful execution, and failed execution. For an extraction task in execution, the extraction task can be interrupted by stopping the operation. For extraction tasks that are executed successfully or failed, the stop operation button is grayed out. Graph export management: Graph export management is to manage the export of knowledge graphs. You can choose to support CSV, GraphML, and JSON formats for graph export. The exported records are displayed in a paginated list. The exported results can be downloaded through the download button in the operation bar.
4. The knowledge graph construction system for complex relational business database according to claim 3 is characterized in that: The system adopts B / S architecture. The back-end uses SpringBoot framework to build Rest API, MySQL database and Neo4j database are used for software system data storage. The front-end uses Vue.js framework for page construction, and uses D3.js graphics library technology for knowledge graph display and interaction.
Citation Information
Patent Citations
A surface coating device for power insulators
CN110624748B
Power grid infrastructure engineering data knowledge graph construction method based on machine learning
CN113486193A
Cited By
Data modeling method and device based on knowledge graph and medium
CN120471153A
A knowledge graph-based data modeling method, device and medium
CN120471153B
Debugging recording method based on knowledge graph
CN121255809A
Atlas construction method and device and electronic equipment
CN121542473A