Visualization method of domain knowledge graph

By optimizing the layout of nodes in the visualization canvas through multi-level layout algorithms and interactive functions, the problems of ambiguous display and insufficient interactivity of large-scale complex knowledge graphs are solved, and clear, real-time graph display and efficient user interaction are achieved.

CN120632090APending Publication Date: 2025-09-12BEIHANG UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510641175.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-19
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing knowledge graph visualization methods have problems such as reduced display clarity, node overlap, high computing resource consumption, and lack of real-time interactive adjustment in large-scale and multi-level complex graphs, making it difficult to meet users' needs for dynamic display of specific information.

Method used

It adopts a multi-level layout algorithm, presets the number of display levels and nodes, combines dynamic adjustment of node size, position and distribution, introduces local bloat prevention mechanism and interactive functions, supports node folding, fallback, local query and cross-dimensional relationship display, and optimizes the layout of nodes in the visualization canvas.

Benefits of technology

It achieves clear visualization of domain knowledge graphs, improves the readability and interactivity of graphs, reduces the complexity of knowledge graph construction and maintenance, adapts to different display resolutions, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120632090A_ABST
    Figure CN120632090A_ABST
Patent Text Reader

Abstract

The invention relates to a visualization method of a domain knowledge graph, belongs to the technical field of knowledge graphs, and solves the technical problems of fuzzy display, poor visualization effect and only static display caused by huge quantity, numerous types and deep hierarchical structure of the domain knowledge graph. According to the domain knowledge graph visualization method, a multi-layer distribution layout is constructed by presetting display levels and node parameters, the node size and position are optimized, and overlapping is prevented; calculating an area distribution canvas space by using a heap algorithm; and node folding, local query and cross-dimension relation display are supported, and an anti-bloating mechanism and an interaction function are combined. Clear and multi-layer visual layout is realized, node overlapping is avoided, and readability is improved; flexible interaction enhances user experience, and efficient space utilization adapts to multiple resolutions; anti-bloating and detail display are combined, so that information overload is reduced; and the method is suitable for dynamic knowledge management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of knowledge graph technology and relates to a visualization method for domain knowledge graphs. In particular, in complex knowledge graphs with multiple dimensions and multiple levels, a dynamic visualization method is implemented based on user clicks, the number and level of nodes, which can evenly distribute and clearly display the graph. Background Art

[0002] There are a variety of common domain knowledge graph visualization methods. Graph-based visualizations intuitively present the relationships between nodes and edges, presenting knowledge connections in a graphical form. Node-link graphs, with nodes representing entities and edges representing relationships, clearly depict direct connections between entities and are suitable for simple and clear knowledge graphs. Current visualization research focuses on optimizing layout algorithms.

[0003] At present, patents in the field of knowledge graph visualization show diverse characteristics and development trends, with the characteristics of large amount of knowledge, complex types, and numerous hierarchical structures. These characteristics still lead to a series of problems in the display process of knowledge graphs.

[0004] First, existing methods suffer from a loss of clarity when knowledge graphs scale. Numerous nodes and edges become intertwined, making it difficult to distinguish information from different dimensions. For example, in a large knowledge graph encompassing multidisciplinary knowledge, the complex interweaving of nodes and edges creates a cluttered interface.

[0005] Secondly, in terms of node layout, although various existing methods aim to arrange nodes reasonably, it is still difficult to completely avoid unreasonable situations. In practical applications, nodes of different categories may intersect, and some nodes may even overlap, which seriously affects the readability of the knowledge graph and makes it difficult for users to accurately understand the hierarchical and categorical relationships between knowledge. Furthermore, some solutions that attempt to use 3D technology to enhance visualization require a large amount of computing resources, resulting in long rendering times, which is a major obstacle for disciplinary application scenarios with high real-time requirements.

[0006] Furthermore, most current knowledge graph visualization methods lack the ability to adjust layouts in real time based on user actions. When browsing a knowledge graph, users may be interested in specific nodes or regions and, through actions like clicking, expect the visualization interface to automatically optimize the layout and highlight relevant information. However, existing visualization tools often struggle to meet this requirement, limiting users' ability to explore and utilize knowledge graphs in depth and flexibly. Summary of the Invention

[0007] In view of the above problems, the present invention provides a visualization method for a 2D domain knowledge graph with clear hierarchy, reasonable distribution, and real-time interaction, which solves the technical problems of domain knowledge graphs such as fuzzy display, poor visualization effect, and only static display due to their large number, numerous types, and deep hierarchical structure.

[0008] The present invention provides a method for visualizing a domain knowledge graph, and the specific steps are as follows:

[0009] S101: Obtain the organizational structure level of the domain knowledge graph and the nodes of each level;

[0010] S102: Setting the background color of the domain knowledge graph visualization and the graph screen zoom display;

[0011] S103: Setting the number of display layers of nodes in the domain knowledge graph and the total central node of all display layers;

[0012] S104: Setting the node radius of the visualization node in each display layer of the domain knowledge graph;

[0013] S105: The child nodes of the lower display layer of the display layer where the central node is located are stacked according to the first lower display layer where they are located, and newly added attribute keys of all the child nodes are obtained;

[0014] S106: Based on the newly added attribute keys of the child nodes in all lower-level presentation layers in step 105, the areas of all sub-heaps are obtained;

[0015] S107: Obtain the current display length and display height to obtain a canvas ratio; obtain pixel values ​​of the length and height of the rectangle of the visualization canvas of the domain knowledge graph based on the canvas ratio and all the pile areas obtained in step 106;

[0016] S108: Allocate the angle and area of ​​the occupied area of ​​all the sub-piles starting from the central node display layer based on the length pixel value and the height pixel value of the visualization canvas;

[0017] S109: Draw a node graph based on the angle and area distribution obtained in step S108 and the node coordinate constraints;

[0018] S110: Set up a mechanism to prevent local bloat in the domain knowledge graph, a pop-up window with graph node details, and a local search function;

[0019] S111: When the user clicks a node, the clicked node is turned into the central node, and the multi-layer display is rebuilt according to the method of step 103;

[0020] S112: Setting the font size and maximum allowed font width of the text in the node, as well as the node background color, so that the text is inside the node and the font size is clear enough;

[0021] S113: List and display the nodes in the split heap.

[0022] Optionally, the organizational structure hierarchy of the knowledge graph includes a domain name layer, a dimension name layer under the domain, a dimension classification layer, a dimension instance layer, and a dimension material layer.

[0023] Optionally, the maximum number of display layers of nodes is five;

[0024] When the central node has a parent node, the central node display layer has an upper display layer, which is the parent node display layer;

[0025] When the central node has no parent node, the central node display layer does not have the upper display layer, and the display central node layer is the central node;

[0026] The lower display layers of the display layer where the central node is located include a first lower display layer, a second lower display layer and a third lower display layer.

[0027] Optionally, the sub-nodes connected to the central node include all nodes across dimensions and the same dimension as the central node, and their lower-level display layer is the first lower-level display layer;

[0028] The second-level sub-node connected to the sub-node has the second lower display layer.

[0029] The lower display layer of the third-level child node connected to the second-level child node is the third lower display layer.

[0030] Optionally, the sub-nodes of the first lower presentation layer, the second lower presentation layer, and the third lower presentation layer are stacked according to the first lower presentation layer in which they are located.

[0031] Optionally, use the node's own ID to mark the corresponding nodes in all the first lower display layer, the second lower display layer, and the third lower display layer with additional key-value pairs to obtain the newly added attribute key. The specific steps are as follows:

[0032] For all child nodes of the first lower presentation layer, use the child node's own ID to mark the corresponding child node with an additional key-value pair to obtain the newly added attribute key;

[0033] For all second-level child nodes of the second lower presentation layer, use the ID of the child node of the first lower presentation layer corresponding to the second-level child node to mark the second-level child node with an additional key-value pair to obtain a newly added attribute key;

[0034] For all third-level child nodes of the third lower presentation layer, additional key-value pairs are marked on the third-level child nodes using the IDs of the second-level child nodes of the second lower presentation layer corresponding to the third-level child nodes to obtain newly added attribute keys.

[0035] Optionally, the specific steps of step S108 are:

[0036] Step 1081. Let i = 1. When i = 1, it is the initial heap; initialize the starting angle theta = 0;

[0037] Step 1082: Calculate the angle and area of ​​the area occupied by the i-th sub-pile based on the angle of the area occupied by the i-1-th sub-pile;

[0038] Step 1083. Determine whether i is greater than N level3 -1, N level3 Indicates the total number of nodes in the three-level lower display layer; if it is greater than N level3 -1, angle allocation ends; if it is less than or equal to N level3 -1, set i=i+1, and return to step 1082.

[0039] Optionally, based on the length and width of the rectangle of the visualization canvas, the ending angle of the (i-1)th sub-pile, and the area ratio of the (i)th sub-pile, a graphic corresponding to the ending angle of the (i)th sub-pile is obtained, and the expression is:

[0040] S ratio_i *S canvas =calculate(W,H,end_theta i )-calculate(W,H,theta i )

[0041] Among them, S ratio_i is the area ratio of the i-th pile; S canvas Represents the pixel area of ​​the visualization canvas; H is the height pixel value of the visualization canvas, W is the width pixel value of the visualization canvas; end_theta i The ending angle of the i-1th stack; theta i Indicates the starting angle of the i-th stack.

[0042] Optionally, the expression for the area ratio of the i-th sub-pile is:

[0043] S ratio_i =S 3i / SUM(S 3i )

[0044] Among them, S 3i is the area of ​​the ith pile; SUM(S 3i ) represents the sum of the areas of all the piles.

[0045] Optionally, it also includes the establishment of new node relationships in the knowledge graph. Click on the blank area of ​​the visual graph to create a new node.

[0046] Compared with the prior art, the present invention has at least the following beneficial effects:

[0047] (1) Multi-level visualization layout: By presetting the number of display levels and nodes and combining it with a multi-level distribution layout algorithm, a clear visualization of the domain knowledge graph is achieved. Dynamic adjustment of node size, position, and distribution effectively avoids node overlap and local redundancy, improving the readability and aesthetics of the graph.

[0048] (2) Flexible interactive functions: It supports operations such as node folding, rollback, local query, and multi-select display of cross-dimensional relationships. Users can dynamically adjust the graph display content according to their needs, which enhances the interactivity and practicality of the knowledge graph and is suitable for knowledge exploration in complex fields. It supports the rapid establishment of new nodes and their relationships by dragging and dropping, and automatically guides users to improve the properties of nodes and relationships, reducing the complexity of knowledge graph construction and maintenance, making it suitable for dynamic knowledge management scenarios.

[0049] (3) Efficient space utilization: Through area-ratio-based angle allocation and canvas adaptive algorithms, the layout of nodes in the visualization canvas is optimized to ensure reasonable node distribution and high space utilization, adapting to different display resolutions. A local bloat prevention mechanism is introduced. Through warning signs and node detail pop-ups, the needs of large-scale node relationship display and local detail viewing are balanced, avoiding information overload and improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 The organizational structure of the knowledge graph in the field of the present invention;

[0051] Figure 2 The angle and area distribution of the first pile in the visualization method of the present invention;

[0052] Figure 3 The angle and area distribution of the second pile in the visualization method of the present invention;

[0053] Figure 4 This is a visualization diagram of the domain knowledge graph of the present invention. DETAILED DESCRIPTION

[0054] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. In addition, the present invention can also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited by the specific embodiments disclosed below.

[0055] A specific embodiment of the present invention, as Figure 1-4 , discloses a method for visualizing domain knowledge graphs, the basic idea of ​​which is: preset parameters such as the number of display levels and the number of display nodes for the domain knowledge graph, and obtain a multi-layer distribution layout of the graph according to the preset parameters. The multi-layer distribution layout specifically includes the size and position of the central node of each layer, the distribution of domain nodes around the central node, the distribution of lower-level nodes and local anti-redundancy of nodes, as well as anti-overlap methods between nodes; non-top-level domain nodes can be folded, rolled back, locally queried and other operations.

[0056] It can be understood that the domain knowledge graph is a structured knowledge base built for a specific domain. Through the nodes of various dimensions in the domain (such as in the technology graph, each node is a technical field, and in the product graph, each node is a product), attributes and the relationship between nodes (edges), a semantic network with a fixed architecture is formed. Generally, within a specific dimension of the domain, the relationship between nodes includes superior-subordinate, parent-child and adjacent relationships, so as to obtain the knowledge content of the corresponding range according to the user's level number parameter.

[0057] The specific steps are as follows:

[0058] S101: Obtain the organizational structure level of the domain knowledge graph and the nodes of each level;

[0059] Specifically, the organizational structure of the knowledge graph includes the domain name layer, the dimension name layer under the domain, the dimension classification layer, the dimension instance layer and the dimension material layer.

[0060] For example, see Figure 1Taking the product dimension (i.e., the domain-level dimension name layer) within the cyberspace security domain (i.e., the domain name layer) as an example, the cyberspace security domain can be described by multiple dimensions, including technology, academics, patents, engineering, products, manufacturers, and standards. The product dimension can be divided into two layers, including network critical equipment and network security specialized products, with a total of forty categories serving as corresponding dimension classification nodes. The relationships between nodes are called subcategories. For example, the "Server (Rack-Mounted)" node in the dimension classification layer is connected to the "H3C UniServer R8900 G3 Server" node in the dimension instance layer, with a relationship name (i.e., relationship). The text and document information related to the server is connected to the "H3C UniServer R8900 G3 Server" node in the dimension material layer (nodes in this layer are: official website description, product white paper, and product review), with a relationship name (i.e., relationship).

[0061] Each node may have multiple attributes, such as the node's label, weight, description, etc.; the relationships between nodes include superior-subordinate, parent-child, and adjacent relationships, etc.; each relationship also has attributes, such as the strength and weight of the relationship.

[0062] S102: Setting the background color of the domain knowledge graph visualization and the graph screen zoom display.

[0063] Preferably, the domain knowledge graph is configured to be able to be displayed in full screen or reduced screen size.

[0064] Preferably, the background color of the knowledge graph on the screen is set to a light color to better reflect the nodes and relationships.

[0065] S103: Set the number of display layers of the nodes of the domain knowledge graph, the total central node of all display layers, and the relationship between the nodes.

[0066] Specifically, the maximum number of display layers for a node is five;

[0067] When the central node has a parent node, the central node display layer has an upper display layer, which is the parent node display layer;

[0068] When the central node has no parent node, the central node display layer does not have an upper display layer, and the display central node layer is the central node.

[0069] It can be understood that the parent node is the node connected to the upper layer of the same dimension as the total center node; the total center node display layer is the total center node;

[0070] The sub-nodes connected to the central node, including all nodes across dimensions and the same dimension as the central node, are located in the first lower display layer;

[0071] It can be understood that the same-dimensional relationship includes the parent-child relationship between dimension classification layers, the connection relationship between the dimension classification layer and the dimension instance layer, and the connection relationship between the dimension material layer and the dimension instance layer; the cross-dimensional relationship is not fixed, but the nodes at both ends of the relationship do not belong to the same dimension, such as an institution testing products and a company issuing patents.

[0072] The secondary sub-node connected to the sub-node is located in the second lower display layer;

[0073] The display layer of the third-level child node connected to the second-level child node is the third lower display layer.

[0074] S104: Setting the node radius of the visualization node in each display layer of the domain knowledge graph.

[0075] Specifically, the radius decreases gradually (in pixels) from the central node display layer to the third lower layer, for example, 20, 18, 16, and 14. This ensures that nodes displayed on the canvas have varying radii while also preventing them from being rendered inaccessible due to a radius that is too small. The parent node display layer and the first lower layer are assigned the same radius, for example, 18. Therefore, the radius from the parent node display layer to the third lower layer is 18, 20, 18, 16, and 14.

[0076] The present invention sets the node radius of the visualization node in each display layer in the domain knowledge graph so that after the nodes are divided into regions and piled according to the method of step S105, the area of ​​the node region is calculated to allocate a position for the node region in the visualization canvas according to the area occupied by the region.

[0077] As you can understand, the canvas is a virtual drawing area where developers can programmatically draw various graphics, text, or images. After drawing on the canvas, the drawing information is converted into pixel data and output to the display. Therefore, each point on the canvas can be mapped to one or more pixels on the display, depending on the canvas resolution setting and the actual resolution of the display. Therefore, the proportions of the virtual area of ​​the canvas are consistent with the proportions of the display, which can improve the utilization of visual space.

[0078] S105: All child nodes of the first lower display layer, the second lower display layer and the third lower display layer are stacked according to their respective first lower display layers, and newly added attribute keys level3father of all child nodes are obtained.

[0079] Specifically, use the node's own ID (the node's ID is a unique identifier) ​​to mark the corresponding nodes in all the first lower display layer, the second lower display layer, and the third lower display layer with additional key-value pairs. The specific steps are as follows:

[0080] For all child nodes of the first lower display layer, use the child node's own ID to mark the corresponding child node with an additional key-value pair to obtain the newly added attribute key level3father;

[0081] For all second-level child nodes of the second lower presentation layer, use the ID of the child node of the first lower presentation layer corresponding to the second-level child node to mark the second-level child node with an additional key-value pair to obtain the newly added attribute key level3father;

[0082] For all third-level child nodes of the third lower presentation layer, the ID of the second-level child node of the second lower presentation layer corresponding to the third-level child node is used to mark the third-level child node with an additional key-value pair to obtain a newly added attribute key level3father.

[0083] At this point, by adding additional key-value pairs corresponding to the node ID for nodes with three or more layers, preliminary heaping is achieved at the node data level, making it easier to obtain the area of ​​each heap in subsequent steps to allocate the visualization area.

[0084] It is understood that there is only one central node in the central node display layer, and the parent node is the parent node of the central node, which can be one or zero. However, for display nodes with a display layer number greater than or equal to the first lower display layer, which have a large number of display nodes and two lower display nodes, if they share the same upper display node, they generally have similar meanings and are assigned to the same heap, with the same first lower display layer as the first level of the heap. For example, the "Server" and "Switch" nodes in the same layer of the product category share the same parent node, "Critical Network Equipment." Therefore, the "Server" and "Switch" nodes should be relatively close in distance during visualization, and drawn close to their parent node, "Critical Network Equipment."

[0085] S106: Based on the newly added attribute key level3father of the child nodes in all the first lower display layer, the second lower display layer, and the third lower display layer in step 105, the areas of all sub-heaps are obtained. Nodes with the same newly added attribute key level3father are traversed through all nodes. Nodes with the same newly added attribute key level3father belong to the same node heap. The area calculation expression for each node heap is:

[0086] S 3i =R3+R4*NUM 4i +R5*NUM 5i , i=1,2,...,N level3

[0087] Among them, S 3i Indicates the area of ​​the i-th pile; NUM 4iRepresents the number of secondary child nodes in the second lower display layer in the i-th sub-pile; NUM 5i Represents the number of third-level child nodes in the third lower display layer in the i-th sub-heap; R3 represents the radius of the first lower display layer; R4 represents the radius of the second lower display layer; R5 represents the radius of the third lower display layer; N level3 Indicates the total number of nodes in the three lower presentation layers.

[0088] At this point, we have obtained the area of ​​each three-layer node and its sub-node pile after the three-layer node piles in the graph are divided. This will facilitate the allocation of drawing angles on the canvas based on the ratio of the area.

[0089] See also Figure 4 , the area of ​​each color node pile is stored as a list for future use.

[0090] It can be understood that the area of ​​the stack is the sum of the areas occupied by the sub-nodes included in the first lower display layer, the second lower display layer and the third lower display layer having the same first lower display layer.

[0091] S107: Obtain the current display length and display height to obtain the canvas ratio Ratio; based on the canvas ratio Ratio and all the pile areas obtained in step 106, obtain the pixel values ​​of the length and height of the rectangle of the visualization canvas (rectangle) of the domain knowledge graph to ensure that there is enough space to draw all the nodes.

[0092] Specifically, the sum of the areas occupied by all nodes is obtained as follows:

[0093] S all =SUM(S 3i )+R2+R1*NUM1

[0094] Among them, S all Represents the area occupied by all nodes; SUM(S 3i ) represents the sum of the areas of all sub-heaps; R2 represents the radius of the total central node display layer; R1 represents the radius of the parent node display layer; NUM1 represents the number of parent node display layers, and the value is 0 or 1.

[0095] It can be understood that the display is a physical device, and the canvas is a virtual canvas on the display. The display ratio is obtained by calculating the canvas size and then filling the display. This achieves adaptation to all display ratios.

[0096] Furthermore, based on the obtained area occupied by all nodes and the hyperparameter ratio, the pixel area of ​​the visualization canvas is obtained, and the expression is:

[0097] S canvas =S all *thres

[0098] Among them, S canvas Represents the pixel area of ​​the visualization canvas; thres is a hyperparameter value, such as 2, which is manually set. The larger the value, the greater the ratio of the canvas area to the total node area, and the sparser the node distribution will be.

[0099] Furthermore, based on the pixel area and canvas ratio of the visualization canvas, the length pixel value and height pixel value of the visualization canvas are obtained, and the expressions are:

[0100]

[0101] W=H*Ratio

[0102] Where H is the height of the visualization canvas in pixels, and W is the width of the visualization canvas in pixels.

[0103] S108: Allocate the angle and area of ​​the occupied area of ​​all the sub-piles starting from the central node display layer based on the length pixel value and the height pixel value of the visualization canvas. The specific steps are as follows:

[0104] Step 1081. Set i = 1. When i = 1, it is the initial heap division; initialize the starting angle theta = 0, which is used to record the total angle allocated in the rectangle, and set the initial angle of the area occupied by it to 0;

[0105] It is understandable that the value of i ranges from 1 to N. lecel3 The -1 closed interval indicates that the total number of nodes in the three lower display layers minus one is calculated for each heap, and the angles within the rectangles allocated to the areas they occupy are calculated. The remaining angles are directly allocated to the last node heap.

[0106] Step 1082: Calculate the angle and area of ​​the area occupied by the i-th sub-pile based on the angle of the area occupied by the i-1-th sub-pile;

[0107] Specifically, based on the final angle of the area occupied by the (i-1)th pile, the angle required for the i-th pile is calculated such that the area of ​​the figure enclosed by the rectangle and the two angled rays originating from the center of the visualization canvas / the area of ​​the visualization canvas rectangle = the area of ​​the i-th pile / the area of ​​all piles. Specifically, for the initial pile i = 1, the initial angle is 0.

[0108] The area ratio of the i-th pile is the area of ​​the i-th pile / the area of ​​all piles, which can be expressed as:

[0109] S ratio_i =S 3i / SUM(S 3i )

[0110] Sratio_i is the area ratio of the i-th pile, S 3i is the area of ​​the ith pile.

[0111] Furthermore, based on the length and width of the rectangle of the visualization canvas, the end angle of the i-1th sub-pile, and the area ratio of the i-th sub-pile, the graph corresponding to the end angle of the i-th sub-pile is obtained. The expression of the end angle end_theta is:

[0112] S ratio_i *S canvas =calculate(W,H,end_theta i )-calculate(W,H,theta i )

[0113] Based on the length W and height H of the rectangle and the starting angle theta of the i-th sub-pile, calculate the ending angle end_theta of the i-1-th sub-pile. Use the calculate function to calculate the area of ​​the rectangle from 0 degrees to the end angle end_theta, subtracting the area from 0 degrees to the starting angle theta, which is equal to the ratio of the sub-pile area of ​​this pile multiplied by the area of ​​the rectangle.

[0114] As for the area calculation function that calculates the area from the angle to the zero angle within the rectangle, it is a mathematical calculation that is considered in different cases and is not within the scope of protection of this patent. However, considering that there are many cases, the calculation method is listed as follows:

[0115] The function is named calculate. Its formal parameter is w, and the value passed to it is the length W of the canvas rectangle. Its formal parameter is h, and the value passed to it is the height H of the canvas rectangle. Its formal parameter is t, and the value passed to it is the ending angle end_theta or the initial angle theta. tan is the tangent function, and arctan is the inverse tangent function.

[0116]

[0117]

[0118] See also Figure 2 , the first calculated three-layer node stack, the initial angle is 0, assuming that here the calculation requires a 30-degree angle to meet the area ratio. Figure 3 , then the second three-layer node stack calculated starts from an angle of 30 degrees to calculate the area of ​​the figure. Assuming that the angle required for the second node stack is 120 degrees, the third three-layer node stack starts from 30+120=150.

[0119] Step 1083. Determine whether i is greater than Nlevel3 -1, if greater than N level3 -1, angle allocation ends; if it is less than or equal to N level3 -1, set i=i+1, and return to step 1082.

[0120] Through this process, the present invention can achieve angle distribution of all the piles within the rectangle of the visualization canvas.

[0121] S109: Draw a node graph based on the angle and area distribution obtained in step S108 and the node coordinate constraints.

[0122] Specifically, according to the node coordinate constraints, all sub-piles are restricted to the interior of the visualization canvas rectangle divided by angle, so that the nodes inside the sub-piles do not overlap. The node coordinate constraints are:

[0123] The angle between the node and the center of the rectangle of the visualization canvas should be contained between starttheta_i and endtheta_i, where starttheta_i is the starting angle of the i-th sub-stack and endtheta_i is the ending angle of the i-th sub-stack.

[0124] The x-coordinate of the node on the visualization canvas is no greater than half the width of the canvas, W / 2, and no less than the negative width of the canvas, -W / 2.

[0125] The y-coordinate of the node on the visualization canvas is no greater than half the height of the canvas, H / 2, and no less than the negative general height of the canvas, -H / 2;

[0126] S110: Set up a mechanism to prevent local bloat in the domain knowledge graph, a pop-up window for graph node details, and a local search function.

[0127] Specifically, the knowledge graph's mechanism for preventing local bloat is to display a warning icon indicating that a node has too many connected nodes in its lower layer, when the number of connected nodes and relationships exceeds a display threshold. Preferably, the warning icon is a small yellow exclamation mark in the upper right corner of the node.

[0128] For example, if a single subnode in the first lower display layer has hundreds of connected subnodes in the second lower display layer, not all of these subnodes will be displayed in the graph. Instead, a warning icon will be displayed for the single subnode in the first lower display layer, and only a threshold number of subnodes will be displayed. To view all connected nodes and relationships, click on the graph node details pop-up window.

[0129] Specifically, the graph node details pop-up window is the details pop-up window that you jump to when you click on the node, and displays the lower-level connected nodes and connection relationships of the node in a list format.

[0130] Preferably, the overwritten right-click logic is used to realize right-clicking a node in the graph, displaying the node attributes, all the same-dimensional relationships of the node, and the cross-dimensional relationships of the node by label.

[0131] Specifically, the local search function is a search box that is used to quickly filter the names of connected nodes and corresponding dimension relationship names of each node to obtain the selected connected nodes and dimension relationships. It can be understood that each node in the domain knowledge graph has connected nodes, and each connected node has a node name and a dimension relationship name.

[0132] For example, if the currently clicked node has 200 connected nodes, the selected connected nodes and relationships are obtained according to the dimension relationship names and dimension relationship names of the connected nodes.

[0133] Specifically, by left-clicking a node on the knowledge graph, or clicking to view its subgraph in the details pop-up window, you can select the node as the central node to view its visualization.

[0134] S111: When the user clicks a node, the clicked node is turned into the central node, and the multi-layer display is rebuilt according to the method of step 103.

[0135] S112: Setting the font size and maximum allowed font width of the text in the node, as well as the node background color, so that the text is inside the node and the font size is clear enough.

[0136] Correspondingly, since the node name is written inside the circle where the node is located, the principle of a maximum of two lines, with a maximum of three characters per line, is adopted to ensure that the length of the three characters does not exceed the diameter of the node (radius * 2). Therefore, the font size of the three sub-nodes from the parent node display layer to the third lower display layer is set to 10, 12, 10, 8, and 6 (in pixels). While ensuring the readability of the node text, the font size is appropriately reduced as the node level increases.

[0137] The background color of the knowledge graph node is divided into the following two cases:

[0138] (1) If there are multiple dimension nodes in the entire domain knowledge graph, the rendering color is assigned according to the dimension name.

[0139] (2) If there is only one dimension in the entire domain knowledge graph, the color will be assigned according to the third-layer display node directly connected to the second-layer central node. The fourth-layer display node will have the same color as the third-layer display node connected to it, so as to avoid the entire domain knowledge graph being all the same color for the same dimension.

[0140] Specifically, the font color of the node text is determined by the background color of the node to determine whether the node text is black or white, making the text clearer. The specific steps are as follows:

[0141] First, get the hexadecimal value of the node's background RGB color;

[0142] Then, separate the hexadecimal red R, green G, and blue B values ​​of the node background RGB color;

[0143] Next, the red, green, and blue colors are weighted according to the ratio of red R, green G, and blue B to obtain the brightness value.

[0144] Preferably, the ratio of red R, green G, and blue B is red 0.299: green 0.587: blue 0.114.

[0145] Determines whether the text in the node should be black or white based on the brightness value.

[0146] Specifically, if the brightness is greater than 128, the text is black, otherwise the text is white.

[0147] S113: List and display the nodes in the split heap.

[0148] Specifically, by clicking on some three-layer nodes, it is possible to view and hide specific three-layer node stacks; in addition, the cross-dimensional relationship of the total center node is displayed in multiple selections, and the path from the second-layer total center node to the domain name node can be quickly rolled back.

[0149] It can be understood that the three-layer nodes are sub-nodes in the first lower presentation layer, the second lower presentation layer, and the third lower presentation layer.

[0150] Specifically, multiple-selection display of sub-heaps and nodes in sub-heaps: For multiple three-layer nodes of the same dimension directly connected to the central node, they are converted into multiple-selection boxes, and all are selected by default to display all three-layer nodes and node stacks. If a three-layer node is deselected in the multiple-selection box, the three-layer node and sub-node stack are not displayed in the diagram to enable viewing of some specific content.

[0151] Among them, some specific content is the third-level display node and its child node stack.

[0152] Specifically, multi-select display of cross-dimensional relationships: For multiple cross-dimensional nodes and relationships directly connected to the central node, they are converted into multiple-selection boxes, and all are unchecked and hidden by default. If a selection is added to a lower-level display node in the multiple-selection box, the cross-dimensional relationship is displayed to filter the viewing of the relationship between the central node and the selected cross-dimensional node.

[0153] Specifically, follow the steps below to obtain the path from the central node to the domain name node. When visualizing, simultaneously obtain the same-dimensional path from the central node to the domain name node, and display them as clickable names. This allows you to understand the classification source of the knowledge while quickly clicking back to the previous level to view higher-level content. The specific steps are:

[0154] Get the node's unique identifier id from the node's json (JavaScript Object Notation) data.

[0155] Set the maximum number of relationship levels maxlevels for loop query;

[0156] Initialize the node name path namelist and the node corresponding id path idlist;

[0157] Get the node label information. If it is a domain name, return it directly. Otherwise, record the node name and id name value to initialize the node name list and id list.

[0158] The loop will loop up to maxlevels times. In each loop, the node information of the search node in the knowledge graph will be displayed directly on the upper layer of the same dimension. If it is a domain name, it means that the domain name root node has been found, and the recorded node name list namelist and node ID list idlist will be returned.

[0159] Determine whether the number of loops reaches the maximum number of relationship levels maxlevels. If so, obtain all nodes that are connected to the domain name node through the inter-node relationship.

[0160] Preferably, if the domain name root node has not been traversed after the maximum number of relationship levels (maxlevels), it means that the path to the node has not been obtained temporarily, and the name and id of the node itself are returned.

[0161] After obtaining the node names and idlist of the node IDs along the path with the most relationship layers, the front-end renders the node names along the path from the domain name to that node, separated by a / symbol. For example, "Cyberspace Security / Products / Critical Network Equipment / Router." Furthermore, JavaScript is used to assign click logic to the text, passing the node's unique ID upon click. The clicked node is then used as the central node on the second layer to recreate the visual graph, enabling quick return to the previous level and access to higher-level content.

[0162] Furthermore, it also includes the establishment of new node relationships in the knowledge graph. Clicking a blank area in the visual graph will create a new node and guide the user to specify the node's label information, as well as complete the node's name and attributes. Then, dragging the node will automatically create a relationship with the node closest to the dragged position, and guide the user to specify the relationship name and complete the relationship attributes, completing the convenient node relationship addition. The specific steps are as follows:

[0163] Get the maximum distance thres between the new node object newnode created by clicking on the blank area, the entire container graph of the visual graph, and the new node without establishing a relationship with any node;

[0164] Get the coordinate information of all existing nodes based on the entire container graph of the visualization graph;

[0165] When a new node is dragged, the distances from each existing node to the new node are calculated;

[0166] If the distance distances from an existing node to the new node is less than the maximum distance thres, then establish a relationship between the minimum distance node and the new node, add it to the visual drawing relationship list, and add the new node object newnode to the visual drawing node list.

[0167] The visualization graph container graph is redrawn based on the relationship between all updated nodes and the minimum distance node and the new node, showing the automatically connected nodes to obtain the connection between nodes and draw the relationship.

[0168] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with this technical field within the technical scope disclosed by the present invention should be covered by the scope of protection of the present invention.

Claims

1. A method for visualizing a domain knowledge graph, characterized in that: The specific steps are as follows: S101: Obtain the organizational structure level of the domain knowledge graph and the nodes of each level; S102: Setting the background color of the domain knowledge graph visualization and the graph screen zoom display; S103: Setting the number of display layers of nodes in the domain knowledge graph and the total central node of all display layers; S104: Setting the node radius of the visualization node in each display layer of the domain knowledge graph; S105: The child nodes of the lower display layer of the display layer where the central node is located are stacked according to the first lower display layer where they are located, and newly added attribute keys of all the child nodes are obtained; S106: Based on the newly added attribute keys of the child nodes in all lower-level presentation layers in step 105, the areas of all sub-heaps are obtained; S107: Obtain the current display length and display height to obtain a canvas ratio; obtain pixel values ​​of the length and height of the rectangle of the visualization canvas of the domain knowledge graph based on the canvas ratio and all the pile areas obtained in step 106; S108: Allocate the angle and area of ​​the occupied area of ​​all the sub-piles starting from the central node display layer based on the length pixel value and the height pixel value of the visualization canvas; S109: Draw a node graph based on the angle and area distribution obtained in step S108 and the node coordinate constraints; S110: Set up a mechanism to prevent local bloat in the domain knowledge graph, a pop-up window with graph node details, and a local search function; S111: When the user clicks a node, the clicked node is turned into the central node, and the multi-layer display is rebuilt according to the method of step 103; S112: Setting the font size and maximum allowed font width of the text in the node, as well as the node background color, so that the text is inside the node and the font size is clear enough; S113: List and display the nodes in the split heap.

2. The visualization method according to claim 1, characterized in that The organizational structure of the knowledge graph includes the domain name layer, the dimension name layer under the domain, the dimension classification layer, the dimension instance layer and the dimension material layer.

3. The visualization method according to claim 1, characterized in that The maximum number of display layers for a node is five; When the central node has a parent node, the central node display layer has an upper display layer, which is the parent node display layer; When the central node has no parent node, the central node display layer does not have the upper display layer, and the display central node layer is the central node; The lower display layers of the display layer where the central node is located include a first lower display layer, a second lower display layer and a third lower display layer.

4. The visualization method according to claim 3, characterized in that: The sub-nodes connected to the central node include all nodes across dimensions and the same dimension as the central node. Their lower display layer is the first lower display layer. The second-level sub-node connected to the sub-node has the second lower display layer. The lower display layer of the third-level child node connected to the second-level child node is the third lower display layer.

5. The visualization method according to claim 4, characterized in that: The sub-nodes of the first lower display layer, the second lower display layer and the third lower display layer are stacked according to the first lower display layer where they are located.

6. The visualization method according to claim 4, characterized in that Use the node's own ID to mark the corresponding nodes in all the first, second, and third lower display layers with additional key-value pairs to obtain the newly added attribute key. The specific steps are as follows: For all child nodes of the first lower presentation layer, use the child node's own ID to mark the corresponding child node with an additional key-value pair to obtain the newly added attribute key; For all second-level child nodes of the second lower presentation layer, use the ID of the child node of the first lower presentation layer corresponding to the second-level child node to mark the second-level child node with an additional key-value pair to obtain a newly added attribute key; For all third-level child nodes of the third lower presentation layer, additional key-value pairs are marked on the third-level child nodes using the IDs of the second-level child nodes of the second lower presentation layer corresponding to the third-level child nodes to obtain newly added attribute keys.

7. The visualization method according to claim 1, characterized in that: The specific steps of step S108 are: Step 1081. Let i = 1. When i = 1, it is the initial heap; initialize the starting angle theta1 = 0; Step 1082: The angle and area of ​​the area occupied by the i-th sub-pile are obtained based on the angle of the area occupied by the i-1-th sub-pile; Step 1083. Determine whether i is greater than N level3 -1, N level3 Indicates the total number of nodes in the three-level lower display layer; if it is greater than N level3 -1, angle allocation ends; If less than or equal to N level3 -1, set i=i+1, and return to step 1082.

8. The visualization method according to claim 7, characterized in that: Based on the length and width of the rectangle of the visualization canvas, the ending angle of the i-1th sub-pile, and the area ratio of the i-th sub-pile, the figure enclosed by the ending angle of the i-th sub-pile is obtained. The expression is: S ratio_i *S canvas =calculate(W,H,end_theta i )-calculate(W,H,theta i ) Among them, S ratio_i is the area ratio of the i-th pile; S canvas Represents the pixel area of ​​the visualization canvas; H is the height pixel value of the visualization canvas, W is the width pixel value of the visualization canvas; end_theta i The ending angle of the i-1th stack; theta i Indicates the starting angle of the i-th stack.

9. The visualization method according to claim 8, characterized in that: The expression for the area ratio of the i-th pile is: S ratio_i =S 3i / SUM(S 3i ) Among them, S 3i is the area of ​​the ith pile; SUM(S 3i ) represents the sum of the areas of all the piles.

10. The visualization method according to claim 8, characterized in that: It also includes the establishment of new node relationships in the knowledge graph. Click on the blank area of ​​the visual graph to create a new node.

Citation Information

Cited By

  • System and Method for Text Editing Using Large Language Models

    US20250077762A1