Method and apparatus for visualizing query results for graph databases
Patent Information
- Application Number
- CN202211173498.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2042-09-26
AI Technical Summary
[0020] The visualization method and apparatus for query results of graph databases provided in one or more embodiments of this specification allow users to display first-order or higher-order neighboring nodes of any node in the query result graph simply by performing a first operation in the display area of any node. This helps to simplify the operation complexity for users to view neighboring nodes and improves the user experience.
Smart Images

Figure CN115563194B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to one or more embodiments in the field of databases, and more particularly to a method and apparatus for visualizing query results for graph databases. Background Technology
[0002] To make query results for graph databases more intuitive, the results are often visualized. Graph databases may store private data.
[0003] Currently, query results for graph databases are displayed in three formats: graph, table, and text. However, when displaying query results in a graph, users typically cannot quickly view the neighboring nodes of any given node.
[0004] Therefore, we hope to find an improved solution to simplify the process of users viewing the neighboring nodes of any given node, thereby enhancing the user experience. Summary of the Invention
[0005] This specification describes one or more embodiments of a method for visualizing query results for a graph database, which simplifies the operation complexity for users to view the neighboring nodes of any node, thereby improving the user experience.
[0006] Firstly, a method for visualizing query results from graph databases is provided, including:
[0007] Receive query content for a target relational network graph in a graph database; the target relational network graph includes multiple nodes and connecting edges between nodes;
[0008] Based on the query content, a matching query result graph is queried from the target relationship network graph, and the query result graph includes at least the target node from the plurality of nodes;
[0009] The query results are displayed in an image.
[0010] In response to the first operation performed by the user in the display area of the target node, the first-order neighbor nodes of the target node and the connection edges between the target node and the first-order neighbor nodes are newly displayed in the query result graph.
[0011] In response to a second operation performed by the user in a blank area outside the display area of the query results graph, the positions of the target node, the first-order neighbor node, and the connecting edge are adjusted simultaneously.
[0012] Secondly, a visualization device for query results from a graph database is provided, comprising:
[0013] The receiving unit is used to receive query content input for a target relational network graph in a graph database; the target relational network graph includes multiple nodes and connecting edges between nodes;
[0014] A query unit is configured to query a matching query result graph from the target relationship network graph based on the query content, wherein the query result graph includes at least the target node among the plurality of nodes;
[0015] The display unit is used to display the query result graph;
[0016] The display unit is also configured to respond to a first operation performed by the user in the display area of the target node, and to add a display of the first-order neighbor nodes of the target node and the connection edge between the target node and the first-order neighbor nodes in the query result graph.
[0017] The display unit is also configured to respond to a second operation performed by the user in a blank area other than the display area of the query result graph, and simultaneously adjust the positions of the target node, the first-order neighbor node, and the connecting edge.
[0018] Thirdly, a computer storage medium is provided that stores a computer program thereon, which, when executed in a computer, causes the computer to perform the method of the first aspect.
[0019] Fourthly, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method of the first aspect.
[0020] The visualization method and apparatus for query results of graph databases provided in one or more embodiments of this specification allow users to display first-order or higher-order neighboring nodes of any node in the query result graph simply by performing a first operation in the display area of any node. This helps to simplify the operation complexity for users to view neighboring nodes and improves the user experience. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments in this specification, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 A visual interface diagram is shown in one example;
[0023] Figure 2aThis shows a schematic diagram of the editing panel corresponding to a node in one example;
[0024] Figure 2b This is a schematic diagram of the editing panel corresponding to the connecting edge in one example;
[0025] Figure 2c A schematic diagram of a condition setting control is shown in one example;
[0026] Figure 3 A flowchart illustrating a method for visualizing query results for a graph database according to one embodiment is shown.
[0027] Figure 4a This is a schematic diagram showing the query results in one example;
[0028] Figure 4b This shows a tree layout of the query results graph in one example;
[0029] Figure 4c The circular layout of the query results graph is shown in one example.
[0030] Figure 4d A grid layout is shown for a query results graph in one example;
[0031] Figure 4e A schematic diagram of the query results is shown in another example;
[0032] Figure 4f This is a schematic diagram of the query results in yet another example;
[0033] Figure 4g A schematic diagram of an order selection menu is shown in one example;
[0034] Figure 4h A schematic diagram of the query results is shown in yet another example;
[0035] Figure 4i This is a schematic diagram of the query results in another example;
[0036] Figure 5a A schematic diagram of a text tree is shown in one example;
[0037] Figure 5b A diagram of a text tree is shown in another example;
[0038] Figure 6 A schematic diagram of a visualization apparatus for query results against a graph database according to one embodiment is shown. Detailed Implementation
[0039] The solution provided in this specification will now be described with reference to the accompanying drawings.
[0040] Figure 1 A visual interface diagram is shown in one example. Figure 1 The visual interface includes a query editing area and a display area.
[0041] The query statement editing area can include a graph selection control and a query statement input control. The graph selection control is used to select the relationship network graph to be queried, and the query statement input control is used to enter the graph query statement (explained later). In one example, the graph query statement here can be, for example, a Cypher query statement. Furthermore, the relationship network graph here can be, but is not limited to, any of the following: enterprise relationship network graph, product relationship network graph, person relationship network graph, information relationship network graph, stock relationship network graph, fund relationship network graph, and institutional relationship network graph, etc.
[0042] The aforementioned display area may include layout selection controls, edge merging controls, edit mode trigger controls, hover mode trigger controls, graph export controls, and toggle controls. It should be noted that all of these controls can be triggered by left-clicking.
[0043] Once the layout selection control is triggered, a layout selection menu will appear, offering options such as flexible layout, tree layout, circular layout, and grid layout. The query results image will then be adjusted according to the selected target layout. It's worth noting that in flexible layout, in response to user dragging within a node's display area, the position of that node and its neighboring nodes will be adjusted simultaneously. In other words, in flexible layout, a node's neighboring nodes move with that node.
[0044] Once the edge merging control is triggered, it can merge all connecting edges of the same direction and type for any two nodes in the query result graph.
[0045] After the edit mode trigger control is activated, the query results graph can be entered into edit mode. In edit mode, new controls for creating nodes and connecting edges can be added. Specifically, when a click command is received on a node creation control (or edge creation control), the corresponding edit panel can be displayed. In one example, this edit panel can be displayed in the display area. In another example, the edit panel can also be a separate page.
[0046] Figure 2a This diagram illustrates the editing panel corresponding to a node in an example. Through this panel, users can set node information such as node type and attribute parameters. Taking a relationship network diagram as an example, the node type could be, for example, a person, a movie, or a job, etc. Figure 2bThe diagram shows an example of an editing panel corresponding to a connecting edge. Through this editing panel, users can set edge information such as the edge type, starting node (start point), ending node (end point), and attribute parameters.
[0047] Back Figure 1 In the context of hover mode, once the hover mode trigger control is activated, hover mode can be entered. In hover mode, in response to the user's hover operation in the display area of a node, the first-order neighboring nodes of that node are displayed in a highlighted or flashing manner.
[0048] After the graph export control is triggered, a format selection menu will appear, allowing you to choose the target format. Options in the format selection menu include JSON, PNG, and CSV formats. The query result graph will then be exported as an image file in the target format.
[0049] The aforementioned toggle control is used to switch between graph display mode, text tree display mode, and table display mode. In graph display mode, the query results graph for the graph database is displayed, including nodes and connecting edges. In text tree display mode, a text tree corresponding to the query results set of the graph database is displayed, where text nodes can be collapsed and expanded. In table display mode, a table corresponding to the query results set of the graph database is displayed, where each row corresponds to one query result.
[0050] Of course, in practical applications, the aforementioned display area can also include other controls, such as style setting controls, used to set the color, size, or attribute parameters of nodes or connecting edges. Another example is condition setting controls, used to set filtering conditions for nodes or connecting edges. In one example, this condition setting control could be as follows: Figure 2c As shown. Figure 2c In this control, the condition setting control includes a display button, two drop-down boxes, and an input box. The display button is used to show the currently selected node or connection edge (e.g., a movie node). The first drop-down box is used to select attribute parameters (e.g., playback duration). The second drop-down box is used to select the condition symbol, and the supported options include: =, >=, >, <, and <=. The input box is used to enter the condition threshold (e.g., 136).
[0051] Taking a network diagram of relationships as an example, when the node type is "person," the attribute parameters could be, for example, identity, occupation, and hobbies. When the node type is "movie," the attribute parameters could be, for example, lead actor, director, and running time.
[0052] The following is a detailed explanation of the graph query statements mentioned above.
[0053] The above graph query statement includes at least the MATCH clause and the RETURN clause. The MATCH clause will be explained first below.
[0054] The MATCH clause above can include a matching expression (also called a path), which consists of nodes and / or connecting edges.
[0055] In one example, the matching expression can be represented as: (n)-[r]-(m), where “()” is the node identifier, with the letter n and m being aliases for the node, which can be omitted. “[]” is the edge identifier, with the letter r being an alias for the edge, which can also be omitted. Furthermore, “-[r]-” indicates that the edge connecting the nodes is undirected or bidirectional, and it can be replaced with “-[r]->” and “<-[r]-”, representing incoming and outgoing edges respectively. It should be understood that incoming and outgoing edges here are relative to node n.
[0056] Of course, in practical applications, the corresponding node type can also be set for nodes or connecting edges. For example, the matching expression can also be: (n: person)-[r]-(m: movie), where "person" is the node type of node "n" and "movie" is the node type of node "m".
[0057] It should be understood that, based on the above matching expression, several network subgraphs can be matched from the relational network graph to be queried.
[0058] The RETURN clause above can include several query fields, each of which can be any of the following: path, node, connection edge, attribute parameter, and objective function, where the objective function can be, for example, an aggregate function.
[0059] It should be noted that the above graph query statement may also include other clauses, such as the LIMIT clause, which is used to limit the number of query results returned. This specification will not elaborate on this further.
[0060] The following combination Figure 1 The visual interface shown illustrates this solution.
[0061] Figure 3 A flowchart illustrating a method for visualizing query results from a graph database according to one embodiment is shown. This method can be executed by any system, device, platform, or cluster of devices with computing and processing capabilities. For example, it can be executed by a visualization system that includes… Figure 1 The visual interface shown. Figure 3 As shown, the method may include the following steps.
[0062] Step 302: Receive the query content for the target relational network graph in the graph database.
[0063] The target relationship network graph includes multiple nodes and connecting edges between nodes.
[0064] In one example, the above query could be a graph query. Specifically, it can be done through... Figure 1 The query statement editing area in the visual interface shown receives the query statement from the above figure.
[0065] In another example, the query content mentioned above includes a combination of query conditions entered by the user through controls on the visual interface.
[0066] Step 304: Based on the query content, query the matching query result graph from the target relationship network graph. The query result graph includes at least the target node from multiple nodes.
[0067] In the case of a graph query, the graph result can be obtained by combining several subgraphs of the target relational network graph based on the matching expression in the MATCH clause of the graph query. Furthermore, in the case of a graph query, a query result set can also be obtained, where each query result is a subgraph of the matched network graph corresponding to the field values of each query field.
[0068] Step 306: Display the query results image.
[0069] When the query content is a graph query statement, the above query result graph can be obtained by drawing each network subgraph based on the detailed data of the nodes and connecting edges in each matched network subgraph, provided that each query field in the query result set includes graph elements (such as nodes, connecting edges, or paths).
[0070] The method for obtaining the aforementioned detailed data may include first parsing the query result set to determine the node and edge identifiers in each network subgraph, and then obtaining the detailed data of the nodes and connecting edges from the graph database based on the node and edge identifiers.
[0071] For a node, its detailed data may include node type, attribute parameters, and node identifier. For a connection edge, its detailed data may include edge type, starting node, ending node, attribute parameters, and edge identifier.
[0072] In step 306, it is possible to Figure 1 The visualization shown displays a graph of the query results. This graph may include the target node. Additionally, it may include all neighboring nodes of the target node within a predetermined order (greater than or equal to 1), as well as the connecting edges between the nodes.
[0073] Figure 4a This is a schematic diagram of the query results in one example. Figure 4a In the graph, the query result includes node 1 and each of node 1's first-order neighbor nodes (i.e., nodes 2-7), as well as the connecting edges between node 1 and each of its first-order neighbor nodes.
[0074] It should be understood that Figure 4a This is merely an illustrative example; in practical applications, Figure 4a The content displayed by nodes (also known as node values) can be replaced with node name, node type, node identifier, or node attribute parameters. Similarly, the content displayed by connecting edges (also known as edge values) can be edge name, edge type, edge identifier, or edge attribute parameters.
[0075] It should be noted that the query result image above can have multiple layouts, including: flexible layout, tree layout, ring layout, and grid layout.
[0076] In Flexbox layout, the position of the target node and its neighboring nodes are adjusted in response to the user's dragging action within the target node's display area. In other words, in Flexbox layout, the neighboring nodes of a given node move with that node.
[0077] by Figure 4a For example, in response to the user's drag operation on node 1, the positions of node 1 and nodes 2-7 can be adjusted simultaneously.
[0078] Figure 4b This shows a tree layout of the query results graph in one example. Figure 4c The image shows a circular layout of the query results graph in one example. Figure 4d The grid layout of a query results graph is shown in one example.
[0079] Step 308: In response to the first operation performed by the user in the display area of the target node, the first-order neighbor nodes of the target node and the connection edges between the target node and the first-order neighbor nodes are added to the query result graph.
[0080] The first operation mentioned above can be a single click or a double click, etc.
[0081] Of course, if the query result graph already includes some of the first-order neighbor nodes of the target node, then the above-mentioned newly added first-order neighbor nodes of the target node include: the remaining first-order neighbor nodes of the target node in the query result graph, and the connection edges between the target node and the remaining first-order neighbor nodes.
[0082] by Figure 4aFor example, in response to a user's double-click operation in the display area of node 6, the following can be obtained: Figure 4e The query results are shown in the image. Figure 4e The remaining two first-order neighbor nodes of node 6, node 8 and node 9, have been added to the display.
[0083] Step 310: In response to the user's second operation in the blank area outside the display area of the query result graph, the positions of the target node, first-order neighbor nodes, and connecting edges are adjusted.
[0084] The second operation mentioned above can be, for example, a drag operation or a swipe operation.
[0085] It should be understood that step 310 above is the second operation based on the user, which is to adjust the display position of the entire query result graph.
[0086] In practical applications, step 310 can be executed first, followed by step 308; or steps 308 and 310 can be executed simultaneously. This manual does not limit this to either method.
[0087] Optionally, the above method may further include the following steps: receiving a hover mode trigger command and entering hover mode. In hover mode, in response to the user's hover operation in the display area of the target node, the target node and its first-order neighbor nodes are displayed in a highlighted or flashing manner.
[0088] return Figure 4a For example, you can first receive user requests... Figure 1 The hover mode in the visual interface shown triggers a click command on the control, thus entering hover mode. In hover mode, in response to the user's hovering action in the display area of node 1, the following can be obtained: Figure 4f The query results are shown in the image. Figure 4f In the image, node 1 and its first-order neighbors (nodes 2 through 7) are highlighted.
[0089] Optionally, the above method may further include the following steps: In response to a right-click operation performed by the user in the display area of the target node, display an order selection menu. Based on the target order selected in the order selection menu, add and display all neighboring nodes within the target order of the target node.
[0090] It should be understood that the newly added neighbor nodes within the target order of the target node include first-order neighbor nodes not included in the newly added query result graph, as well as all neighbor nodes of the target node from second order to the target order.
[0091] by Figure 4e For example, in response to a user's right-click action in the display area of node 6, a pop-up window may appear as follows: Figure 4g The menu shown includes three selectable orders. It also includes an order input box and a query button for users to customize their target order.
[0092] Specifically, the target order can be determined based on the user's click command for any of the three selectable orders. Then, neighboring nodes within the target order of the target node, as well as the connecting edges between nodes, are added and displayed. These connecting edges can be determined based on the network structure of the target relational network graph.
[0093] Of course, the target order can also be determined based on the order entered by the user in the order input box.
[0094] In one embodiment, for the query result graph shown above, multiple connecting edges of the same direction and type between two nodes can also be merged.
[0095] For example, the query result graph above includes the target node and its first-order neighbor nodes, with the target node and its first-order neighbor nodes connected by multiple edges, all of which have the same direction and type. Then, an edge merging command can be received to merge the multiple edges connecting the target node and its first-order neighbor nodes, resulting in an aggregated edge. This aggregated edge has the same direction and type as the corresponding multiple edges. Finally, this aggregated edge can be used to replace and display the corresponding multiple edges.
[0096] For the above aggregated edges, a number attribute can also be added, the value of which is the total number of the corresponding multiple connecting edges.
[0097] In addition, the aforementioned edge merging command can be accessed by the user via a click. Figure 1 The edge merging control in the shown visualization interface is triggered.
[0098] Figure 4h This is a schematic diagram of the query results in another example. Figure 4h In the graph, node 1 and node 7 are connected by four edges, three of which have the same direction and type. Then, when an edge merging instruction is received, the resulting query graph can be as follows: Figure 4i As shown. Figure 4i In the example, node 1 is connected to nodes 2 through 7 via an aggregated edge, and the displayed content of this aggregated edge is the number of merged edges. Of course, in practical applications, the displayed content of the aggregated edge can also include edge type, etc.
[0099] In another embodiment, the query result graph shown above can also be filtered based on filtering conditions, specifically the nodes or connecting edges.
[0100] Specifically, it can receive filtering conditions set by the user for attribute parameters of nodes (e.g., target nodes or first-order neighbors of the target node) or connecting edges in the query result graph. Then, nodes or connecting edges that do not meet the filtering conditions are removed from the query result graph, resulting in a filtered query result graph. The filtered query result graph is then displayed.
[0101] Among them, users can Figure 1 The visual interface shown uses condition setting controls to set filter conditions; these condition setting controls can be found in [reference needed]. Figure 2c Assumption based on Figure 2c If we set the condition control in the query results and get the filter condition: movie.duration>=136, then we can delete movie nodes with a playback duration of less than 136 minutes from the query results graph.
[0102] In another embodiment, the query result image shown above can also be edited.
[0103] Specifically, the system can first receive an edit mode trigger command to enter edit mode. This edit mode trigger command can be accessed by the user clicking... Figure 1 The edit mode trigger control in the shown visual interface is activated.
[0104] After entering edit mode, you can add and display node creation controls and edge creation controls. Specifically, when a click command is received on a node creation control (or edge creation control), the corresponding editing panel can be displayed. See details below. Figure 2a or Figure 2b As shown. In one example, the editing panel can be displayed in the display area. In another example, the editing panel can also be a separate page.
[0105] Finally, the query result graph is updated based on the node and / or edge information set by the user through the editing panel.
[0106] Of course, in edit mode, it can also receive user commands to delete nodes and / or connecting edges, and delete the corresponding nodes and / or connecting edges according to the deletion commands. It can also receive user commands to modify the displayed content of nodes and / or connecting edges, and modify the displayed content of nodes and / or connecting edges according to the modification commands.
[0107] In yet another embodiment, the style of the query result image shown above can also be set.
[0108] Specifically, in response to user style settings of nodes (e.g., the target node or its first-order neighbor nodes) or connecting edges in the query result graph, the displayed query result graph is updated. Style setting operations include color / size settings or attribute parameter settings.
[0109] In another embodiment, the query result image shown above can also be exported as an image file.
[0110] Specifically, it can receive graph export commands and determine the target format to be exported based on these commands. The query result graph is then exported as an image file in the target format. The target format includes any of the following: JSON, PNG, and CSV formats, etc.
[0111] The above-mentioned image export command can be accessed by the user by clicking. Figure 1 The graph export control in the displayed visualization interface is triggered.
[0112] In other embodiments, the query result graph shown above can also be scaled.
[0113] Specifically, in response to a user's scrolling up / down wheel action in a blank area of the display area, the query results image is displayed in zoomed-in / zoomed mode. In one example, the zoom-in or zoom-out operation is performed according to a predetermined ratio.
[0114] In addition, in response to a user's click action in the display area of a node in the query results graph, additional attribute parameters of the target node can be added to be displayed.
[0115] Finally, this solution also supports switching the graph display mode to a tree display mode or a table display mode.
[0116] Specifically, it can receive a switching command to change from graph display mode to tree display mode. Based on the switching command, the query result graph is switched to a text tree. The switching command can be executed by the user clicking on it. Figure 1 The toggle control in the shown visualization interface is triggered.
[0117] The aforementioned text tree includes at least a first text node, which has two types of sub-text nodes. One type of sub-text node records each query result in the query result set corresponding to the query result graph, and the other type of sub-text node records each query field included in the query result set. Each query field is determined based on the RETURN clause, and each query field can be any of the following: path, node, connection edge, attribute parameter, and objective function, etc.
[0118] Of course, in practical applications, the above text tree may also include other text nodes, and the first text node may also include other types of sub-text nodes, such as the other types of sub-text nodes used to record query time, etc. This specification does not limit this.
[0119] It should be noted that all types of child text nodes of the first text node mentioned above support collapsing and expanding.
[0120] Figure 5a The diagram illustrates a text tree in an example, drawn from the result set of a graph query: `MATCH(n)-[r]-(m)RETURN n.name,r,m.title LIMIT 10`. Based on this query, the returned result set includes 10 results, each with three query fields: the attribute parameter `name` for node `n`, the connecting edge `r`, and the attribute parameter `title` for node `m`. In other words, each result includes the field value corresponding to these three query fields.
[0121] Figure 5a In this text tree, there are five text nodes: data, status, status Text, headers, config, and request. Each of data, headers, and config has sub-text nodes. Specifically, when an expand instruction is received for data, its various sub-text nodes can be expanded. See [link to documentation] for details. Figure 5b As shown.
[0122] Figure 5b The code displays four types of sub-text nodes for the `data` element: `elapsed`, `header`, `result`, and `size`. `elapsed` records the query time. `header` records the three query fields mentioned above. `result` records 10 query results, each containing the values of the three query fields. `size` records the number of query results: 10.
[0123] Of course, in Figure 5b When a folding instruction is received for the data, it can fold various sub-text nodes within it, thus returning to the previous state. Figure 5a .
[0124] In addition, it can also receive switching commands from graph display mode (or tree display mode) to table display mode. These switching commands can be executed by the user clicking on the graph. Figure 1The toggle control in the displayed visualization is triggered. Based on this toggle instruction, the query result graph (text tree) is switched to a table. The table header includes the query fields included in the query result set, and the table content includes each query result in the query result set.
[0125] In summary, the visualization method for query results of graph databases provided in this specification allows users to view all first-order neighbor nodes of a node simply by performing a first operation in the display area of that node. Furthermore, users can view neighbor nodes within a target order by selecting the desired order from the order selection menu. In short, this solution simplifies the operation complexity for users viewing neighbor nodes.
[0126] Furthermore, this solution allows for various operations on the displayed query results graph. For example, users can zoom in / out on the query results graph by scrolling up / down, and filter nodes or connecting edges within the graph.
[0127] Finally, in the text tree display mode, various sub-text nodes in the text tree can be collapsed and expanded, thereby improving text readability.
[0128] Corresponding to the above-described method for visualizing query results of graph databases, one embodiment of this specification also provides a device for visualizing query results of graph databases, such as... Figure 6 As shown, the device may include:
[0129] The receiving unit 602 is used to receive query content input for a target relational network graph in a graph database, the target relational network graph including multiple nodes and connecting edges between nodes.
[0130] The query unit 604 is used to query a matching query result graph from the target relationship network graph based on the query content. The query result graph includes at least the target node from multiple nodes in the target relationship network graph.
[0131] Display unit 606 is used to display the query results graph.
[0132] The display unit 606 is also used to respond to a first operation performed by the user in the display area of the target node, and to add a display of the first-order neighbor nodes of the target node and the connection edge between the target node and the first-order neighbor nodes in the query result graph.
[0133] The display unit 606 is also used to respond to a second operation performed by the user in a blank area other than the display area of the query result graph, while adjusting the position of the target node, first-order neighbor nodes and connecting edges.
[0134] Optionally, the receiving unit 602 is also configured to receive a hover mode trigger command and enter hover mode.
[0135] The display unit 606 is also used in hover mode to display the target node and its first-order neighbor nodes in a highlighted or flashing manner in response to a user's hover operation in the display area of the target node.
[0136] Optionally, the display unit 606 is also configured to display an order selection menu in response to a right-click operation performed by the user in the display area of the target node.
[0137] The display unit 606 is also used to add neighboring nodes within the target order of the target node based on the target order selected in the order selection menu.
[0138] Optionally, the target node in the query result graph is connected to the first-order neighbor node by multiple connecting edges, and the multiple connecting edges have the same direction and type; the device also includes: a merging unit 608 and a replacement unit 610;
[0139] The receiving unit 602 is also used to receive edge merging instructions;
[0140] Merging unit 608 is used to merge multiple connecting edges to obtain an aggregated edge, which has the same direction and type as the corresponding multiple connecting edges;
[0141] Replacement unit 610 is used to replace the corresponding multiple connection edges by using aggregated edges.
[0142] Optionally, the device further includes:
[0143] Add a unit (not shown in the figure) to add a number attribute to the aggregated edge. The value of the number attribute is the total number of the corresponding multiple connected edges.
[0144] Optionally, the device further includes: a deletion unit 612;
[0145] The receiving unit 602 is also used to receive the filtering conditions set by the user for the attribute parameters of the node or the connection edge;
[0146] The deletion unit 612 is used to delete nodes or connecting edges that do not meet the filtering conditions from the query result graph to obtain the filtered query result graph.
[0147] Display unit 606 is also used to display the query results graph after filtering.
[0148] Optionally, the receiving unit 602 is also configured to receive an edit mode trigger command and enter edit mode;
[0149] The display unit 606 is also used in edit mode to update the displayed query result image in response to the user's editing operation on the query result image;
[0150] The aforementioned editing operations include creating, deleting, or modifying nodes or connecting edges.
[0151] Optionally, the device further includes: a switching unit 614;
[0152] The receiving unit 602 is also used to receive a switching instruction from graph display mode to tree display mode;
[0153] The switching unit 614 is used to switch the query result graph to a text tree according to the switching instruction;
[0154] The text tree includes at least a first text node, which has two types of sub-text nodes. One type of sub-text node is used to record each query result in the query result set corresponding to the query result graph, and the other type of sub-text node is used to record each query field included in the query result set.
[0155] Among them, the two types of sub-text nodes mentioned above support collapsing and expanding.
[0156] Optionally, the layout of the query result image is a flexible layout, and the device further includes:
[0157] An adjustment unit (not shown in the figure) is used to respond to a user's drag operation in the display area of the target node, and simultaneously adjust the positions of the target node, first-order neighbor nodes, and the connection edges between the target node and the first-order neighbor nodes.
[0158] Optionally, the display unit 606 is also used to update the display query result graph in response to the user's style setting operation on the node or connecting edge;
[0159] The style setting operations mentioned above include color / size setting operations or attribute parameter setting operations.
[0160] Optionally, the display unit 606 is also configured to respond to a user's mouse click operation in the display area of the target node by adding and displaying various attribute parameters of the target node.
[0161] Optionally, the device further includes: a derivation unit (not shown in the figure);
[0162] The receiving unit 602 is also used to receive the drawing export instruction and determine the target format to be exported based on the drawing export instruction;
[0163] The export unit is used to export the query result graph as an image file in the target format;
[0164] The target formats mentioned above include any one of the following: JSON, PNG, and CSV.
[0165] Optionally, the display unit 606 is also configured to display a zoomed-in / zoomed query result image in response to a user's scrolling operation of the scroll wheel in a blank area of the display area.
[0166] The functions of each functional module of the apparatus in the above embodiments of this specification can be implemented through the steps of the above method embodiments. Therefore, the specific working process of the apparatus provided in one embodiment of this specification will not be repeated here.
[0167] This specification provides an embodiment of a visualization device for query results of a graph database, which simplifies the operation complexity for users to view neighboring nodes.
[0168] According to another embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed in a computer, causes the computer to perform a combination Figure 3 The method described in [the document / article].
[0169] According to another embodiment, a computing device is also provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements a combination... Figure 3 The method described.
[0170] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0171] The steps of the methods or algorithms described in conjunction with the disclosure in this specification can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in RAM, flash memory, ROM, EPROM, EEPROM, registers, hard disk, external hard disk, CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Alternatively, the ASIC can reside in a server. Of course, the processor and storage medium can also exist as discrete components in the server.
[0172] Those skilled in the art will recognize that, in one or more of the examples above, the functions described in this invention can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium accessible to a general-purpose or special-purpose computer.
[0173] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0174] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this specification. It should be understood that the above description is only a specific embodiment of this specification and is not intended to limit the scope of protection of this specification. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of this specification should be included within the scope of protection of this specification.
Claims
1. A method for visualizing query results from a graph database, comprising: Receive query content for a target relational network graph in a graph database; The target relationship network graph includes multiple nodes and connecting edges between nodes; Based on the query content, a matching query result graph is queried from the target relationship network graph, wherein the query result graph includes at least the target node among the plurality of nodes; wherein, the query content includes a graph query statement; The query result graph is displayed, and after the query result graph is displayed, in response to a first operation performed by the user in the display area of the target node, the remaining first-order neighbor nodes of the target node and the connection edges between the target node and the remaining first-order neighbor nodes are added to the query result graph; the remaining first-order neighbor nodes are the first-order neighbor nodes of the target node that are not displayed in the query result graph. In response to a second operation performed by the user in a blank area outside the display area of the query results graph, the positions of the target node, the first-order neighbor node, and the connecting edge are adjusted simultaneously.
2. The method according to claim 1, further comprising: Receive the hover mode trigger command and enter hover mode; In the hover mode, in response to a user's hover operation in the display area of the target node, the target node and the first-order neighbor nodes are displayed in a highlighted or flashing manner.
3. The method according to claim 1, further comprising: In response to a right-click operation performed by the user in the display area of the target node, a menu for selecting the order is displayed; Based on the target order selected in the order selection menu, add and display each neighbor node within the target order of the target node.
4. The method of claim 1, wherein, The target node has multiple connecting edges to its first-order neighbor nodes, and these edges have the same direction and type. The method further includes: Receive edge merging instructions; According to the received edge merging instruction, the multiple connecting edges are merged to obtain an aggregated edge; the aggregated edge has the same direction and type as the multiple connecting edges. The aggregated edge is used to replace the displayed multiple connecting edges.
5. The method according to claim 4, further comprising: Add a number attribute to the aggregated edge; the value of the number attribute is the number of the multiple connecting edges.
6. The method according to claim 1, further comprising: Receive the command to trigger edit mode and enter edit mode; In the edit mode, the query result image is updated and displayed in response to the user's editing operation on the query result image; The editing operations include creating, deleting, or modifying nodes or connecting edges.
7. The method according to claim 1, wherein, The layout of the query result graph includes any of the following: flexible layout, tree layout, circular layout, and grid layout.
8. The method according to claim 1, wherein, The layout of the query result image is a flexible layout; the method also includes: In response to a user's drag operation in the display area of the target node, the positions of the target node, the first-order neighbor node, and the connecting edge are adjusted simultaneously.
9. The method according to claim 1, further comprising: Receive filtering conditions set by the user for the attribute parameters of nodes or connecting edges; Delete nodes or connecting edges that do not meet the filtering conditions from the query result graph to obtain a filtered query result graph; Display the filtered query results in a graphical format.
10. The method according to claim 1, further comprising: In response to user style settings for nodes or connecting edges, update and display the query result graph; The style setting operation includes color / size setting operation or attribute parameter setting operation.
11. The method according to claim 1, further comprising: In response to a user's click action in the display area of the target node, new attribute parameters of the target node are displayed.
12. The method according to claim 1, further comprising: Receive the graph export command and determine the target format to be exported based on the graph export command; Export the query result image as an image file in the target format; The target format includes any one of the following: JSON format, PNG format, and CSV format.
13. The method according to claim 1, further comprising: In response to the user's scroll wheel movement up / down in the blank area, the query results graph is displayed in a zoomed-out / zoomed manner.
14. The method according to claim 1, further comprising: Receive a command to switch from graph display mode to tree display mode; According to the switching instruction, the query result graph is switched to a text tree; The text tree includes at least a first text node, which has two types of sub-text nodes. One type of sub-text node is used to record each query result in the query result set corresponding to the query result graph, and the other type of sub-text node is used to record each query field included in the query result set.
15. The method according to claim 14, wherein, The two types of sub-text nodes support collapsing and expanding.
16. A visualization device for query results of a graph database, comprising: The receiving unit is used to receive query content input for the target relational network graph in the graph database; The target relationship network graph includes multiple nodes and connecting edges between nodes; A query unit is configured to query a matching query result graph from the target relationship network graph based on the query content, wherein the query result graph includes at least the target node among the plurality of nodes; wherein the query content includes a graph query statement; The display unit is used to display the query result graph, and after displaying the query result graph, in response to a first operation performed by the user in the display area of the target node, to add and display the remaining first-order neighbor nodes of the target node and the connection edges between the target node and the remaining first-order neighbor nodes in the query result graph; the remaining first-order neighbor nodes are the first-order neighbor nodes of the target node that are not displayed in the query result graph. The display unit is also configured to respond to a second operation performed by the user in a blank area other than the display area of the query result graph, and simultaneously adjust the positions of the target node, the first-order neighbor node, and the connecting edge.
17. The apparatus according to claim 16, The receiving unit is also used to receive a hover mode trigger command and enter hover mode; The display unit is also used in the hover mode to display the target node and the first-order neighbor node in a highlighted or flashing manner in response to the user's hover operation in the display area of the target node.
18. The apparatus according to claim 16, The display unit is also used to display a level selection menu in response to a right-click operation performed by the user in the display area of the target node; The display unit is also used to add and display each neighbor node within the target order of the target node according to the target order selected in the order selection menu.
19. The apparatus according to claim 16, wherein, The target node has multiple connecting edges to its first-order neighbor nodes, and these multiple connecting edges have the same direction and type; the device also includes a merging unit and a replacement unit. The receiving unit is also used to receive edge merging instructions; The merging unit is further configured to merge the multiple connecting edges according to the received edge merging instruction to obtain an aggregated edge; the aggregated edge has the same direction and type as the multiple connecting edges; The replacement unit is also used to replace the multiple connecting edges displayed using the aggregated edges.
20. The apparatus of claim 16, further comprising: Delete unit; The receiving unit is also used to receive the filtering conditions set by the user for the attribute parameters of the node or the connecting edge; The deletion unit is used to delete nodes or connecting edges that do not meet the filtering conditions from the query result graph, so as to obtain a filtered query result graph. The display unit is also used to display a graph of the filtered query results.
21. The apparatus according to claim 16, The receiving unit is also used to receive an edit mode trigger command and enter edit mode; The display unit is also configured to update and display the query result image in response to the user's editing operation on the query result image in the editing mode; in, The editing operations include creating, deleting, or modifying nodes or connecting edges.
22. The apparatus of claim 16, further comprising: Switching unit; The receiving unit is also configured to receive a switching instruction from graph display mode to tree display mode; The switching unit is used to switch the query result graph into a text tree according to the switching instruction; The text tree includes at least a first text node, which has two types of sub-text nodes. One type of sub-text node is used to record each query result in the query result set corresponding to the query result graph, and the other type of sub-text node is used to record each query field included in the query result set.
23. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed in the computer, it causes the computer to perform the method according to any one of claims 1-15.
24. A computing device comprising a memory and a processor, wherein, The memory stores executable code, and when the processor executes the executable code, it implements the method of any one of claims 1-15.
Citation Information
Patent Citations
Query method and device based on graph database, computer equipment and storage medium
CN110765295A