Knowledge graph generation method and device based on data resources
By acquiring and constructing a knowledge graph of data resources, the problems of low data resource maintenance efficiency and insufficient data timeliness in the existing technology are solved, and efficient maintenance and timely updating of data resources are achieved.
Patent Information
- Application Number
- CN202011124070.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-20
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-10-20
AI Technical Summary
The existing technology is inefficient in data resource maintenance and cannot guarantee the timeliness of data. Maintenance personnel need to understand the system business data structure, data volume, and module relationships, and need to pay attention to system adjustments at any time to avoid upgrades and documents not being updated synchronously.
By obtaining the basic information of the system to be maintained, extracting data resources, creating data table node information and node association information, constructing a knowledge graph, and verifying it to determine the knowledge graph of data resources, intuitively reflect the data resource structure, and realize data resources maintenance and timely updates.
It improves the efficiency of data resource maintenance and the timeliness of data, intuitively reflects the system structure through the knowledge graph, reduces the workload and time cost of maintenance personnel, and ensures timely updates of data resources.
Smart Images

Figure CN112231285B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method and device for generating a knowledge graph based on data resources. Background Art
[0002] With the development of Internet technology and Internet of Things technology, the degree of informatization of various enterprises is increasing day by day, accompanied by the gradual increase of various information systems and the explosive growth of data resources. While bringing convenience to enterprises, it also increases the pressure on maintenance personnel. Maintenance personnel need to understand the system business data structure, data volume, modules, and module relationships, which increases the time cost of maintenance. In addition, data needs to be updated, which requires maintenance personnel to have a special understanding of the system structure and pay attention to the adjustment of the system at any time. Otherwise, it is easy to encounter the situation where the system has been upgraded but the documents have not been updated synchronously. It can be seen that the existing maintenance of data resources is inefficient and cannot guarantee the timeliness of data. Summary of the invention
[0003] In response to the above problems, the present invention provides a method and device for generating a knowledge graph based on data resources, which realizes the maintenance of data resources based on the knowledge graph and ensures maintenance efficiency and timeliness of data.
[0004] In order to achieve the above object, the present invention provides the following technical solutions:
[0005] A method for generating a knowledge graph based on data resources, comprising:
[0006] Obtaining basic information of the system to be maintained, the basic information including the name of the system to be maintained, system attribute information and database address information;
[0007] Extracting data resources based on the data block address information;
[0008] Based on the data resources, create data table node information and node association information;
[0009] Constructing a knowledge graph according to the data table node information and node association information;
[0010] The knowledge graph is verified, and the verified knowledge graph is determined as the knowledge graph of the data resources of the system to be maintained.
[0011] Optionally, creating data table node information and node association information based on the data resource includes:
[0012] Based on the data resources, create the nodes, data table nodes and field nodes of the system to be maintained;
[0013] Obtaining fields and data tables corresponding to the data resources;
[0014] Creating first association information between the segment and the data table;
[0015] According to the field reference relationship in the data, second association information between the data tables is created.
[0016] Optionally, the method further comprises:
[0017] The data table is identified to obtain identification information, wherein the identification information includes a data table name, field information, and data table annotation information.
[0018] Optionally, the node association information includes association information of a service node, and the method further includes:
[0019] Create the service nodes of the system to be maintained and the association information between the service nodes.
[0020] Optionally, the method further comprises:
[0021] Generate display information of the knowledge graph, wherein the display information is information displayed in different display formats for different nodes;
[0022] The knowledge graph is displayed based on the display information.
[0023] A knowledge graph generation device based on data resources, comprising:
[0024] An acquisition unit, used for acquiring basic information of the system to be maintained, wherein the basic information includes the name of the system to be maintained, system attribute information and database address information;
[0025] An extraction unit, configured to extract data resources based on the data block address information;
[0026] A creation unit, used to create data table node information and node association information according to the data resource;
[0027] A construction unit, used to construct a knowledge graph according to the data table node information and node association information;
[0028] A verification unit is used to verify the knowledge graph and determine the verified knowledge graph as the knowledge graph of the data resources of the system to be maintained.
[0029] Optionally, the creating unit includes:
[0030] A first creation subunit is used to create nodes, data table nodes and field nodes of the system to be maintained according to the data resources;
[0031] An acquisition subunit, used to acquire fields and data tables corresponding to the data resource;
[0032] A second creating subunit, used for creating first association information between the segment and the data table;
[0033] The third creation subunit is used to create second association information between the data tables according to the field reference relationship in the data.
[0034] Optionally, the device further comprises:
[0035] The identification unit is used to identify the data table and obtain identification information, wherein the identification information includes the data table name, field information and data table annotation information.
[0036] Optionally, the creation unit further includes:
[0037] The fourth creating subunit is used to create the service nodes of the system to be maintained and the association information between the service nodes.
[0038] Optionally, the device further comprises:
[0039] A generating unit, used to generate display information of the knowledge graph, wherein the display information is information displayed in different display formats for different nodes;
[0040] A display unit is used to display the knowledge graph based on the display information.
[0041] Compared with the prior art, the present invention provides a method and device for generating a knowledge graph based on data resources, which obtains basic information of the system to be maintained; extracts data resources based on data block address information; creates data table node information and node association information based on data resources; constructs a knowledge graph based on the data table node information and node association information; verifies the knowledge graph, and if the verification passes, determines the knowledge graph as the knowledge graph of the data resources of the system to be maintained. The present invention creates a knowledge graph of data resources by creating systems, businesses, sub-businesses, tables, field nodes, and the associations between these nodes, which intuitively reflects the structure of data resources, so that data resource maintenance can be performed based on the knowledge graph, ensuring maintenance efficiency and timeliness of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0043] Figure 1 A schematic diagram of a flow chart of a method for generating a knowledge graph based on data resources provided in an embodiment of the present invention;
[0044] Figure 2 A schematic diagram of a node provided by an embodiment of the present invention;
[0045] Figure 3 A schematic diagram of a node association relationship provided by an embodiment of the present invention;
[0046] Figure 4 A schematic diagram of field identification provided by an embodiment of the present invention;
[0047] Figure 5 A schematic diagram of a knowledge graph provided by an embodiment of the present invention;
[0048] Figure 6 A schematic diagram of the structure of a knowledge graph generation device based on data resources provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] The terms "first" and "second" and the like in the specification and claims of the present invention and the above drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0051] The method for generating a knowledge graph based on data resources provided in the embodiment of the present invention is based on the data tables, fields, table data, etc. of the system, and is based on the data table design specifications and data table field association information to create a data resource knowledge graph of systems, businesses, sub-businesses, tables, field nodes, and the associations between these nodes, which intuitively reflects the structure of data resources and provides two view modes, graph and document, to reflect the structure of the data resources of the system. At the same time, the data resource information is monitored regularly, and the graph data is updated to ensure the timeliness of the data.
[0052] See also Figure 1 , which shows a schematic flow chart of a method for generating a knowledge graph based on data resources provided by an embodiment of the present invention. The method may include:
[0053] S101. Obtain basic information of the system to be maintained.
[0054] The basic information includes the name of the system to be maintained, system attribute information and database address information. The system to be maintained refers to a business system that needs data resource maintenance. The system data information may refer to system profile information.
[0055] S102: Extract data resources based on the data block address information.
[0056] Data resources include data tables, fields, table associations, table data and other information. Among them, the data table refers to the table in the database, including table name, remarks, number of data rows and other information; the field refers to all fields corresponding to the data table, including field name, remarks, type, etc. Table association refers to the field reference relationship between tables in the database, mainly foreign keys (FK). Foreign keys represent the correlation between two relationships. A table with a foreign key of another relationship as the primary keyword is called a primary table, and a table with this foreign key is called a slave table of the primary table. Foreign keys are also called foreign keywords. Table data is extracted based on actual conditions and is only used for verification in the knowledge graph generation process to improve the accuracy of the knowledge graph.
[0057] S103: Create data table node information and node association information based on the data resources.
[0058] The knowledge graph aims to describe the concepts, entities, events and relationships of the objective world, with entity concepts as nodes and relationships as variables, providing a way to view the world from a relational perspective. Therefore, building a knowledge graph is roughly divided into two parts: creating nodes and creating relationships between nodes.
[0059] Among them, creating data table node information and node association information based on the data resources includes: creating nodes, data table nodes and field nodes of the system to be maintained based on the data resources; obtaining fields and data tables corresponding to the data resources; creating first association information between the segment and the data table; and creating second association information between the data tables based on the field reference relationship in the data.
[0060] The method further includes identifying the data table to obtain identification information, wherein the identification information includes the data table name, field information and data table annotation information. Correspondingly, the node association information includes association information of the business node, and the method further includes: creating the business node of the system to be maintained and association information between the business nodes.
[0061] The creation of nodes and node relationships are described in detail below.
[0062] See also Figure 2, which shows a schematic diagram of a node provided by an embodiment of the present invention. Create a basic node and extract entities as nodes according to data resources:
[0063] (1) Create a system node with the system name as the node name. This node is similar to the root of the tree structure.
[0064] (2) Create data table nodes and field nodes.
[0065] See also Figure 3 , which shows a schematic diagram of a node association relationship provided by an embodiment of the present invention. Create a basic association, and create a node association based on the existing relationship in the data resource.
[0066] (1) Create an association between a field and a table. This relationship is explicitly defined in the database and is a confirmed association.
[0067] (2) Create associations between tables based on foreign key relationships, which are also defined in the database.
[0068] Identify possible table associations. In specific system development, the associations between tables may not be displayed and defined. Further sorting out the relationships between tables is required to improve the accuracy of the graph. This process includes:
[0069] (1) Table name identification: Identify associations based on table names. This is mainly used to identify master and slave tables. For example, if the master table is named T_A_B, then tables with names in the format of T_A_B_X are considered to be child tables of T_A_B.
[0070] (2) Field identification, Figure 4 For example, split the table name with "_" and take the last digit (role), and then connect it with the primary key field of this table with "_" to form a field name (role_id). If this field name exists in other tables, it is case-insensitive and has the same field type as the id field (both are int types in the figure below), then it is considered that the two tables may be related, and then data verification is performed, that is, 5 role_id values are randomly queried from the table t_common_role_permission. If at least 4 or more of these 5 values can be found in the id value in t_common_role, then the relationship is considered to be created successfully.
[0071] It should be noted that Figure 4 This is just one case of field identification, which is relatively common. The field combination used to find relationships may also be t_common_role_id, roleId, and common_role_id.
[0072] (3) Table annotation identification: Relationships are identified through table annotations. For example, if the annotation of table A is “table A”, other data tables annotated as “table AXX” are considered to be sub-tables of table A.
[0073] When creating an association, it also includes creating business and sub-business nodes and their associations. In the above process, the association has been created. At this time, the main table (a table that is not associated with other forms and may be associated with other tables) is isolated from the system node, and this part of the content needs to be supplemented. According to the current software industry's common data refinement hierarchy system -> business module -> sub-module -> table -> data row, it is necessary to supplement the business module and sub-business module nodes and the relationship between these two types of nodes. Specifically including:
[0074] (1) Table name identification method: Create nodes through the main table name. When prefixes (such as t_) are ignored, most table names conform to the format specifications of business_sub-business_function; business_sub-business_function; business_function, etc., and can be created accordingly.
[0075] (2) Table annotation identification method: Less module information will be reflected in the table annotation, and business-related nodes and associations can also be created based on the table annotation information.
[0076] It should be noted that when creating business and sub-business nodes, duplicate processing is required, that is, nodes with duplicate names do not need to be created repeatedly.
[0077] S104. Construct a knowledge graph based on the data table node information and node association information.
[0078] After the above process creates the nodes and related information associated with the nodes, the construction of the data resource knowledge graph is completed, including the system, business, sub-business, table, field nodes and the relationship between the nodes. Specifically, the display information of the knowledge graph can also be generated, and the display information is information displayed in different display formats for different nodes; the knowledge graph is displayed based on the display information. So that the constructed knowledge graph has a visualization effect, for example, see Figure 5 , which shows a schematic diagram of a knowledge graph provided by an embodiment of the present invention, Figure 5 Nodes are represented in different shapes. Different node types can also be presented in different colors or shapes to form an intuitive data knowledge graph.
[0079] S105. Verify the knowledge graph, and determine the verified knowledge graph as the knowledge graph of the data resources of the system to be maintained.
[0080] In the embodiment of the present invention, verification can be performed by editing the knowledge graph according to the needs. The constructed knowledge graph provides online editing, which can add and adjust node data and associated data to make the data graph and data resources fully match. At the same time, the node data is updated in a timed scheduling manner, such as the data volume of the data table node, the fields associated with the data table, etc.
[0081] The present invention provides a method for generating a knowledge graph based on data resources, which obtains basic information of a system to be maintained; extracts data resources based on data block address information; creates data table node information and node association information based on data resources; constructs a knowledge graph based on the data table node information and node association information; verifies the knowledge graph, and if the verification passes, determines the knowledge graph as a knowledge graph of data resources of the system to be maintained. The present invention creates a knowledge graph of data resources by creating systems, services, sub-services, tables, field nodes, and the associations between these nodes, which intuitively reflects the structure of data resources, so that data resource maintenance can be performed based on the knowledge graph, ensuring maintenance efficiency and timeliness of data.
[0082] See also Figure 6 In an embodiment of the present invention, a knowledge graph generation device based on data resources is also provided, including:
[0083] An acquisition unit 10 is used to acquire basic information of the system to be maintained, wherein the basic information includes the name of the system to be maintained, system attribute information and database address information;
[0084] An extraction unit 20, configured to extract data resources based on the data block address information;
[0085] A creation unit 30, used to create data table node information and node association information according to the data resource;
[0086] A construction unit 40, configured to construct a knowledge graph according to the data table node information and node association information;
[0087] The verification unit 50 is used to verify the knowledge graph and determine the verified knowledge graph as the knowledge graph of the data resources of the system to be maintained.
[0088] Optionally, the creating unit includes:
[0089] A first creation subunit is used to create nodes, data table nodes and field nodes of the system to be maintained according to the data resources;
[0090] An acquisition subunit, used to acquire fields and data tables corresponding to the data resource;
[0091] A second creating subunit, used for creating first association information between the segment and the data table;
[0092] The third creation subunit is used to create second association information between the data tables according to the field reference relationship in the data.
[0093] Optionally, the device further comprises:
[0094] The identification unit is used to identify the data table and obtain identification information, wherein the identification information includes the data table name, field information and data table annotation information.
[0095] Optionally, the creation unit further includes:
[0096] The fourth creating subunit is used to create the service nodes of the system to be maintained and the association information between the service nodes.
[0097] Optionally, the device further comprises:
[0098] A generating unit, used to generate display information of the knowledge graph, wherein the display information is information displayed in different display formats for different nodes;
[0099] A display unit is used to display the knowledge graph based on the display information.
[0100] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0101] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating a knowledge graph based on data resources, characterized in that: include: Obtaining basic information of the system to be maintained, the basic information including the name of the system to be maintained, system attribute information and database address information; Extracting data resources based on the database address information; According to the data resources, create the nodes, data table nodes and field nodes of the system to be maintained; Obtaining fields and data tables corresponding to the data resources; According to the relationship between the field and the data table that already exists in the data resource, a first association relationship between the field and the data table is created; Creating a second association relationship between data tables according to the foreign key relationship in the data resource and identification information obtained by identifying the data tables; the identification information includes a data table name, field information, and data table annotation information; Construct a knowledge graph based on the data table node information and node association information; The data table node information includes the node of the system to be maintained, the data table node and the field node; the node association information includes the first association relationship and the second association relationship; Verifying the knowledge graph, and determining the verified knowledge graph as the knowledge graph of the data resources of the system to be maintained; The creating a second association relationship between the data tables according to the foreign key relationship in the data resource and the identification information obtained by identifying the data table includes: Creating a second association relationship between data tables based on the foreign key relationship already existing in the data resource; And, identifying the data table to obtain a data table name; creating a second association relationship between the data tables based on the subordinate relationships represented by the multiple data table name formats; and, concatenating the fields in the data table name and the primary key fields of the data table to obtain the field names; performing data verification on two data tables having the same field names and the same primary key field types, randomly querying five field values corresponding to the field names in one of the two data tables, and establishing a second association relationship between the two data tables if the other of the two data tables includes at least four of the five field values; And, the data table is identified to obtain data table annotation information; based on the subordinate relationship represented by the data table annotation information, a second association relationship between the data tables is established.
2. The method according to claim 1, characterized in that The node association information includes association information of the service node, and the method further includes: Create the service nodes of the system to be maintained and the association information between the service nodes.
3. The method according to claim 1, characterized in that: The method further comprises: Generate display information of the knowledge graph, wherein the display information is information displayed in different display formats for different nodes; The knowledge graph is displayed based on the display information.
4. A knowledge graph generation device based on data resources, characterized in that: include: An acquisition unit, used for acquiring basic information of the system to be maintained, wherein the basic information includes the name of the system to be maintained, system attribute information and database address information; An extraction unit, used for extracting data resources based on the database address information; A creation unit, used for creating nodes, data table nodes and field nodes of the system to be maintained according to data resources; Obtaining fields and data tables corresponding to the data resources; According to the relationship between the fields and data tables that already exist in the data resource, a first association relationship between the fields and the data tables is created; according to the foreign key relationship in the data resource and the identification information obtained by identifying the data tables, a second association relationship between the data tables is created; the identification information includes the data table name, field information and data table annotation information; The creating a second association relationship between the data tables according to the foreign key relationship in the data resource and the identification information obtained by identifying the data table includes: Creating a second association relationship between data tables based on the foreign key relationship already existing in the data resource; And, identifying the data table to obtain a data table name; creating a second association relationship between the data tables based on the subordinate relationships represented by the multiple data table name formats; and, concatenating the fields in the data table name and the primary key fields of the data table to obtain the field names; performing data verification on two data tables having the same field names and the same primary key field types, randomly querying five field values corresponding to the field names in one of the two data tables, and establishing a second association relationship between the two data tables if the other of the two data tables includes at least four of the five field values; And, identifying the data table to obtain data table annotation information; and establishing a second association relationship between the data tables based on the subordinate relationship represented by the data table annotation information; A construction unit, configured to construct a knowledge graph according to data table node information and node association information; the data table node information includes the node of the system to be maintained, the data table node and the field node; the node association information includes the first association relationship and the second association relationship; A verification unit is used to verify the knowledge graph and determine the verified knowledge graph as the knowledge graph of the data resources of the system to be maintained.
5. The device according to claim 4, characterized in that The creation unit also includes: The fourth creating subunit is used to create the service nodes of the system to be maintained and the association information between the service nodes.
6. The device according to claim 4, characterized in that The device also includes: A generating unit, used to generate display information of the knowledge graph, wherein the display information is information displayed in different display formats for different nodes; A display unit is used to display the knowledge graph based on the display information.
Citation Information
Patent Citations
Method, apparatus, storage medium and processor for processing knowledge map
CN109508384A
Domain knowledge graph construction method and system based on big data driving
CN109597855A
Knowledge graph construction method and device based on multiple visual angles and computer equipment
CN109657066A
Knowledge graph display method and device, computer equipment and storage medium
CN109657067A
Hospital doctor-seeing navigation method and device
CN110470303A
