Data retrieval methods, terminal devices, and servers for graph databases

CN121144573BActive Publication Date: 2026-09-01ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511691289.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-09-01
Estimated Expiration
2045-11-17

AI Technical Summary

Technical Problem

此时受终端设备渲染能力的限制,服务器无法向终端设备返回如此大规模的检索结果

Benefits of technology

[0032]由以上技术方案可知,本说明书提供的针对图数据库的数据检索方法,终端设备将用户输入的第一检索指令发送至服务器,以便服务器基于第一检索指令在图数据库中进行检索得到第一检索子图。在第一检索子图的数据量超过预设数据量的情况下,服务器基于第一检索子图生成第一数据量描述信息和第一示例子图,并将二者发送给终端设备进行展示。由此可见,上述方案在检索结果的数据量较大的情况下,也能够向用户展示检索结果的相关信息。其中,向用户展示的信息包括第一数据量描述信息和第一示例子图,第一数据量描述信息可以方便用户直观地感知全局数据规模,而第一示例子图可以方便用户了解检索结果的关键图结构特征。上述两方面的展示信息,使得用户能够直观了解检索结果的情况,从而方便用户精准设计进一步检索的指令,而不是盲目进行尝试,从而提升数据检索效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121144573B_ABST
    Figure CN121144573B_ABST
Patent Text Reader

Abstract

This specification provides a data retrieval method, terminal device, and server for graph databases. The terminal device receives a first retrieval command input by a user on an interactive page and sends it to the server. The server performs a retrieval in the graph database based on the first retrieval command to obtain a first retrieval subgraph. If the data volume of the first retrieval subgraph exceeds a preset data volume, the server generates first data volume description information to characterize its data volume based on the first retrieval subgraph, extracts a first example subgraph from the first retrieval subgraph whose data volume does not exceed the preset data volume, and then sends the first data volume description information and the first example subgraph to the terminal device. The terminal device displays the first data volume description information and the first example subgraph on the interactive page.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of graph data processing technology, and in particular to a data retrieval method, terminal device and server for graph databases. Background Technology

[0002] Graph databases are characterized by their efficient handling of complex relationships, flexible data models, and powerful real-time query capabilities, leading to their widespread application in many fields, such as social network analysis, financial risk control, knowledge graphs, recommendation systems, cybersecurity, and supply chain management. Graph databases use a graph structure to store data, with a graph consisting of many "nodes" and "edges" connecting different nodes.

[0003] In practical applications, some graph databases are very large. In such cases, user retrieval of graph databases presents certain challenges. For example, users can design query statements based on their search objectives and send these statements to the server via their terminal devices to trigger a retrieval of the graph database. In some cases, the amount of data in the retrieval results is enormous, potentially containing tens of millions of nodes and edges. Due to the limitations of the terminal device's rendering capabilities, the server cannot return such a large-scale retrieval result to the terminal device. Users can only continuously try adding various limiting conditions to the query statement until the amount of data in the retrieval results is sufficiently reduced before they can view the retrieval results on their terminal devices. Therefore, a more efficient data retrieval scheme is needed for large-scale databases.

[0004] The information in the background section is merely information known only to the inventor and does not imply that such information had entered the public domain before the date of this application, nor does it imply that it can be considered prior art in this disclosure. Summary of the Invention

[0005] This specification provides a data retrieval method, terminal device, and server for graph databases, which helps improve data retrieval efficiency when the graph database is large in scale.

[0006] In a first aspect, this specification provides a data retrieval method for a graph database, applied to a terminal device, comprising: obtaining a first retrieval instruction input by a user in an interactive page; sending the first retrieval instruction to a server, so that the server performs a retrieval in the graph database based on the first retrieval instruction to obtain a first retrieval subgraph; if the data volume of the first retrieval subgraph exceeds a preset data volume, receiving first data volume description information and a first example subgraph from the server, wherein the first data volume description information is used to describe the data volume of the first retrieval subgraph, and the first example subgraph is composed of a portion of the nodes and edges in the first retrieval subgraph, and its data volume does not exceed the preset data volume; and displaying the first data volume description information and the first example subgraph in the interactive page.

[0007] In some embodiments, the first example subgraph is a connected subgraph containing a set of key nodes in the first retrieval subgraph, wherein the set of key nodes is a set consisting of at least one key node sampled by the server from the first retrieval subgraph according to a preset sampling strategy.

[0008] In some embodiments, the sampling strategy instructs each key node to satisfy at least one of the following: the index value of the key node satisfies a preset condition, the index value including at least one of degree, degree centrality, proximity centrality, betweenness centrality, or eigenvector centrality; the key node belongs to a preset node type; or there is a preset association relationship between the key node and the target node specified in the first retrieval instruction.

[0009] In some embodiments, the preset association relationship includes at least one of the following: it is the target node itself; it is directly connected to the target node; or the number of hops between it and the target node is less than or equal to the preset number of hops.

[0010] In some embodiments, the first retrieval subgraph includes multiple types of nodes, and the sampling strategy indicates that the statistical distribution information of each type of node in the key node set is related to at least one of the following: the frequency of user interaction with each type of node in a historical period; or the statistical distribution information of each type of node in the first retrieval subgraph.

[0011] In some embodiments, the method further includes: obtaining the sampling strategy input by the user in the interactive page, and sending the sampling strategy to the server.

[0012] In some embodiments, the preset data volume is determined based on the maximum data volume that the terminal device supports for rendering and display. The method further includes sending device performance information of the terminal device to the server so that the server can determine or adjust the preset data volume.

[0013] In some embodiments, the first data volume description information includes at least one of the following: the total number of nodes in the first retrieval subgraph, the total number of edges in the first retrieval subgraph, the number of nodes of different types in the first retrieval subgraph, or the number of edges of different types in the first retrieval subgraph.

[0014] In some embodiments, when displaying the first example subgraph, nodes of different types in the first example subgraph are displayed differently, and / or edges of different types in the first example subgraph are displayed differently.

[0015] In some embodiments, after displaying the first example subgraph, the method further includes at least one of the following: in response to detecting a scaling operation on the first example subgraph, determining a scaling factor corresponding to the scaling operation, and adjusting the display detail of the first example subgraph based on the scaling factor; in response to detecting an interaction operation on a first node, displaying attribute information of the first node in the surrounding area of ​​the first node, wherein the first node is any node in the first example subgraph; or in response to detecting an interaction operation on a first side, displaying attribute information of the first side in the surrounding area of ​​the first side, wherein the first side is any edge in the first example subgraph.

[0016] In some embodiments, the first retrieval instruction is an instruction described using a graph query language or an instruction described using natural language.

[0017] In some embodiments, after displaying the first data volume description information and the first example subgraph, the method further includes: obtaining a second search instruction input by the user in the interactive page; sending the second search instruction to the server, so that the server performs a search in the first search subgraph based on the second search instruction to obtain a second search subgraph; if the data volume of the second search subgraph exceeds the preset data volume, receiving the second data volume description information and the second example subgraph from the server, wherein the second data volume description information is used to describe the data volume of the second search subgraph, the second example subgraph is composed of a portion of the nodes and edges in the second search subgraph, and its data volume does not exceed the preset data volume; and displaying the second data volume description information and the second example subgraph in the interactive page.

[0018] Secondly, this specification also provides a data retrieval method for a graph database, applied to a server, comprising: receiving a first retrieval instruction from a terminal device; performing a retrieval in the graph database based on the first retrieval instruction to obtain a first retrieval subgraph; if the data volume of the first retrieval subgraph exceeds a preset data volume, generating first data volume description information to characterize its data volume based on the first retrieval subgraph, and extracting a first example subgraph from the first retrieval subgraph whose data volume does not exceed the preset data volume, the first example subgraph being composed of a portion of nodes and edges in the first retrieval subgraph; and sending the first data volume description information and the first example subgraph to the terminal device for display by the terminal device.

[0019] In some embodiments, extracting a first example subgraph from the first retrieval subgraph with a data amount not exceeding the preset data amount includes: sampling a set of key nodes in the first retrieval subgraph based on a preset sampling strategy, wherein the set of key nodes includes at least one key node; and determining a connected subgraph containing the set of key nodes from the first retrieval subgraph with the constraint of not exceeding the preset data amount, and using the connected subgraph as the first example subgraph.

[0020] In some embodiments, the sampling strategy instructs each key node to satisfy at least one of the following: the index value of the key node satisfies a preset condition, the index value including at least one of degree, degree centrality, proximity centrality, betweenness centrality, or eigenvector centrality; the key node belongs to a preset node type; or there is a preset association relationship between the key node and the target node specified in the first retrieval instruction.

[0021] In some embodiments, the preset association relationship includes at least one of the following: it is the target node itself; it is directly connected to the target node; or the number of hops between it and the target node is less than or equal to the preset number of hops.

[0022] In some embodiments, the first retrieval subgraph includes multiple types of nodes, and the sampling strategy indicates that the statistical distribution information of each type of node in the key node set is related to at least one of the following: the frequency of user interaction with each type of node in a historical period; or the statistical distribution information of each type of node in the first retrieval subgraph.

[0023] In some embodiments, the method further includes receiving the sampling strategy from the terminal device.

[0024] In some embodiments, the method further includes: receiving device performance information from the terminal device, determining the maximum amount of data that the terminal device can support for rendering and display based on the device performance information, and determining the preset amount of data based on the maximum amount of data.

[0025] In some embodiments, the first data volume description information includes at least one of the following: the total number of nodes contained in the first retrieval subgraph, the total number of edges contained in the first retrieval subgraph, the number of nodes of different types in the first retrieval subgraph, or the number of edges of different types in the first retrieval subgraph.

[0026] In some embodiments, after obtaining the first retrieval subgraph, the method further includes: storing the first retrieval subgraph in a preset storage space.

[0027] In some embodiments, the method further includes: receiving a second retrieval instruction from the terminal device; retrieving the first retrieval subgraph from the preset storage space based on the second retrieval instruction to obtain a second retrieval subgraph; if the data volume of the second retrieval subgraph exceeds a preset data volume, generating second data volume description information to characterize its data volume based on the second retrieval subgraph, and extracting a second example subgraph from the second retrieval subgraph whose data volume does not exceed the preset data volume, the second example subgraph consisting of a portion of nodes and edges in the second retrieval subgraph; and sending the second data volume description information and the second example subgraph to the terminal device for display by the terminal device.

[0028] In some embodiments, the first retrieval instruction is an instruction described using a graph query language.

[0029] In some embodiments, the first search instruction is an instruction described in natural language, and the first search subgraph is obtained by searching the graph database based on the first search instruction, including: inputting the first search instruction into a large language model and guiding the large language model to generate a third search instruction described in graph query language; and obtaining the first search subgraph by searching the graph database based on the third search instruction.

[0030] Thirdly, another embodiment of this specification provides a terminal device including at least one storage medium and at least one processor, wherein the at least one storage medium stores at least one instruction set for performing data retrieval for a graph database; the at least one processor is communicatively connected to the at least one storage medium, wherein the at least one processor reads the at least one instruction set during operation and executes the method described in any of the first aspects above according to the instructions of the at least one instruction set.

[0031] Fourthly, another embodiment of this specification provides a server comprising: at least one storage medium storing at least one instruction set for performing data retrieval for a graph database; and at least one processor communicatively connected to the at least one storage medium, wherein the at least one processor reads the at least one instruction set during operation and executes the method described in any of the second aspects above according to the instructions of the at least one instruction set.

[0032] As can be seen from the above technical solution, the data retrieval method for graph databases provided in this specification involves the terminal device sending a first search command input by the user to the server. The server then performs a search in the graph database based on the first search command to obtain a first search subgraph. If the data volume of the first search subgraph exceeds a preset data volume, the server generates a first data volume description and a first example subgraph based on the first search subgraph, and sends both to the terminal device for display. Therefore, the above solution can display relevant information about the search results to the user even when the data volume of the search results is large. The information displayed to the user includes the first data volume description and the first example subgraph. The first data volume description allows the user to intuitively perceive the overall data scale, while the first example subgraph helps the user understand the key graph structure features of the search results. These two aspects of displayed information allow the user to intuitively understand the search results, thus facilitating the user to accurately design further search commands instead of blindly trying, thereby improving data retrieval efficiency.

[0033] The data retrieval methods, terminal devices, and servers for graph databases provided in this specification will be partially listed in the following description. The inventive aspects of the data retrieval methods, terminal devices, and servers for graph databases provided in this specification can be fully explained through practice or use of the methods, apparatus, and combinations described in the detailed examples below. Attached Figure Description

[0034] To more clearly illustrate the technical solutions in the embodiments of 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.

[0035] Figure 1 A schematic diagram of an application scenario provided according to an embodiment of this specification is shown; Figure 2 A schematic diagram of the hardware structure of a computing device provided according to some embodiments of this specification is shown; Figure 3A schematic flowchart of a data retrieval method for a graph database according to an embodiment of this specification is shown; Figure 4 A schematic diagram of an interactive page provided in one embodiment of this specification is shown; Figure 5 A schematic diagram of a server retrieval process provided in one embodiment of this specification is shown; Figure 6 A schematic diagram of another interactive page provided by another embodiment of this specification is shown; Figure 7 A schematic diagram of yet another interactive page provided in another embodiment of this specification is shown; and Figure 8 A schematic diagram of yet another interactive page provided in another embodiment of this specification is shown. Detailed Implementation

[0036] The following description provides specific application scenarios and requirements for this specification, intended to enable those skilled in the art to make and use the contents of this specification. Various partial modifications to the disclosed embodiments will be apparent to those skilled in the art, and the general principles defined herein can be applied to other embodiments and applications without departing from the spirit and scope of this specification. Therefore, this specification is not limited to the embodiments shown, but rather to the widest scope consistent with the claims.

[0037] The terminology used herein is for the purpose of describing particular exemplary embodiments only and is not restrictive. For example, unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “the” used herein may also include the plural forms. When used in this specification, the terms “comprising,” “including,” and / or “containing” mean that the associated integers, steps, operations, elements, and / or components are present, but do not exclude the presence of one or more other features, integers, steps, operations, elements, components, and / or groups, or that other features, integers, steps, operations, elements, components, and / or groups may be added to the system / method.

[0038] Considering the following description, these and other features of this specification, as well as the operation and function of the related components of the structure, and the economy of assembly and manufacture of the parts, can be improved. All of these form part of this specification, with reference to the accompanying drawings. However, it should be clearly understood that the drawings are for illustrative and descriptive purposes only and are not intended to limit the scope of this specification. It should also be understood that the drawings are not drawn to scale.

[0039] The flowcharts used in this specification illustrate operations implemented according to some embodiments of this specification. It should be clearly understood that the operations in the flowcharts may not be implemented in a sequential order. Instead, the operations may be implemented in reverse order or simultaneously. Furthermore, one or more additional operations may be added to the flowcharts. One or more operations may be removed from the flowcharts.

[0040] In this specification, "X includes at least one of A, B, or C" means that X includes at least A, or X includes at least B, or X includes at least C. That is, X may include only one of A, B, and C, or any combination of A, B, and C, as well as other possible content / elements. The arbitrary combination of A, B, and C can be A, B, C, AB, AC, BC, or ABC.

[0041] In this specification, unless explicitly stated otherwise, the relationships between structures can be direct or indirect. For example, when describing "A is connected to B," unless it is explicitly stated that A and B are directly connected, it should be understood that A can be directly connected to B or indirectly connected to B. Similarly, when describing "A is on top of B," unless it is explicitly stated that A is directly above B (AB is adjacent and A is above B), it should be understood that A can be directly above B or indirectly above B (AB is separated by other elements, and A is above B). And so on.

[0042] It should be noted that the user data obtained in this manual is authorized by the user and does not involve user privacy.

[0043] For ease of description, the terms that will appear later in this manual will be explained first.

[0044] Graph database: A type of database that stores and manages data using a graph structure (nodes, edges), specifically designed for handling highly connected data and supporting efficient graph traversal and relation queries.

[0045] Degree: refers to the number of edges directly connected to a node, indicating the degree of direct association of the node in the graph.

[0046] Degree centrality: measures how many direct connections a node has in a network. The higher the degree, the higher the degree centrality, indicating that it may be a "hub" node in the network.

[0047] Closeness Centrality: measures the reciprocal of the average shortest path length from a node to all other nodes in a graph. A higher value indicates that the node can reach other nodes more quickly and has a stronger information propagation ability.

[0048] Betweenness Centrality: Reflects the frequency with which a node acts as a "bridge" in a graph, that is, the proportion of the shortest paths passing through that node out of the total paths. A high value indicates that the node has a strong ability to control the flow of information in the network.

[0049] Eigenvector centrality: It considers not only the number of connections of a node itself, but also the importance of its neighboring nodes. Nodes connected to nodes with high influence have higher eigenvector centrality.

[0050] Graph databases are used in many fields for data storage. For example, in social network analysis, nodes in a graph database may include: user nodes (containing attributes such as name and account), topic nodes, and group nodes; edges may include: "friendships" and "following relationships" between users, "participation in discussion" between users and topics, and "joining relationships" between users and groups. In risk control scenarios, nodes in a graph database may include: personal nodes (containing identity information, contact information, etc.), enterprise nodes (containing identity information, registration information, etc.), account nodes, and transaction record nodes; edges may include: "employment relationships" and "investment relationships" between individuals and enterprises, "transfer relationships" between accounts, and "binding relationships" between individuals and accounts. In the logistics and supply chain field, nodes in a graph database may include: supplier nodes, store nodes, warehouse nodes, and vehicle nodes; edges may include: "supply relationships" between suppliers and warehouses, "delivery relationships" between warehouses and stores, and "assignment relationships" between suppliers and vehicles.

[0051] The embodiments described in this specification can be applied to situations requiring data retrieval in the aforementioned fields. For example, in social network analysis, searching graph databases allows for the analysis of user friend relationship graphs to identify potentially influential figures with high public opinion. In risk control scenarios, searching graph databases enables the construction of transaction relationship graphs, uncovering hidden connections between multiple accounts and thus identifying fraudulent activities. In recommendation system scenarios, searching graph databases allows for personalized recommendations based on the complex relationship network between users, products, and content. In logistics and supply chain management scenarios, searching graph databases allows for the modeling and optimization of dependencies and flow relationships between entities such as warehousing, transportation routes, and suppliers. For example, logistics companies can quickly query delivery routes or identify supply chain disruption risks using graph databases.

[0052] In scenarios involving retrieval of large-scale graph databases, the server uses the user's query to search the database. When the amount of data in the search results is substantial, the server may be unable to return the results to the terminal device due to limitations in the device's rendering capabilities. This prevents the user from understanding the specific details of the search results. Users are forced to blindly and continuously add various limiting conditions to their queries until the amount of data in the search results is sufficiently reduced before they can view the results on their terminal device. This results in low retrieval efficiency.

[0053] The data retrieval method for graph databases provided in this specification can return first data volume description information and a first example subgraph to the terminal device when the data volume of the retrieval results (first retrieval subgraph) obtained from the server exceeds a preset data volume. The first data volume description information characterizes the data volume of the retrieval results, and the first example subgraph consists of a subset of nodes and edges from the retrieval results, with a data volume not exceeding the preset data volume. This allows users to intuitively understand the retrieval results, facilitating the precise design of further retrieval instructions rather than blindly attempting searches, thereby improving data retrieval efficiency.

[0054] It should be noted that the above description of application scenarios is only one of the many usage scenarios provided in this specification. Those skilled in the art should understand that when the data retrieval method for graph databases provided in this specification is applied to other usage scenarios, its implementation and technical effects are similar.

[0055] Figure 1 A schematic diagram of an application scenario provided according to an embodiment of this specification is shown.

[0056] like Figure 1 As shown, application scenario 100 may include terminal device 130 and server 150. A communication connection exists between terminal device 130 and server 150.

[0057] In this application scenario, terminal device 130 can obtain the first search instruction entered by the user on the interactive page and send it to server 150. Subsequently, server 150 searches the graph database based on the first search instruction to obtain a first search subgraph. If the data volume of the first search subgraph exceeds a preset data volume, server 150 generates first data volume description information to characterize its data volume based on the first search subgraph, and extracts a first example subgraph from the first search subgraph whose data volume does not exceed the preset data volume. Then, server 150 sends the first data volume description information and the first example subgraph to terminal device 130 for display on the interactive page.

[0058] Terminal device 130 is an electronic device with a certain computing capability. In some embodiments, the data retrieval method based on a graph database provided in the embodiments of this specification can be executed on terminal device 130. In this case, terminal device 130 may store data or instructions for executing the above method, and may execute or be used to execute the data or instructions. In some embodiments, terminal device 130 may include a hardware device with data processing capabilities and the necessary programs required to drive the hardware device to operate. Terminal device 130 can implement the data retrieval method for the graph database by driving the hardware device to execute the above program.

[0059] In some embodiments, the terminal device 130 may have a display screen, through which the terminal device 130 can provide interactive capabilities. For example, the terminal device 130 may display an interactive page through the display screen.

[0060] Server 150 is a computing system with a certain computing capacity. Server 150 can correspond to a single computing device or a computing cluster composed of multiple computing devices. Server 150 can be deployed locally or remotely.

[0061] In some embodiments, the graph database-based data retrieval method provided in the embodiments of this specification can be executed on server 150. In this case, server 150 may store data or instructions for executing the above method, and may execute or be used to execute the data or instructions. In some embodiments, server 150 may include a hardware device with data processing capabilities and the necessary programs required to drive the hardware device. Server 150 can implement the graph database-based data retrieval method by driving the hardware device to execute the above program.

[0062] It should be noted that all user data obtained in this manual has been authorized by the user and does not involve user privacy.

[0063] Figure 2 A schematic diagram of the hardware structure of a computing device 200 according to some embodiments of this specification is shown. The terminal device 130 and server 150 may have, for example... Figure 2 The structure of the computing device 200 shown.

[0064] like Figure 2 As shown, the computing device 200 includes at least one storage medium 230 and at least one processor 220. In some embodiments, the computing device 200 may further include an internal communication bus 210. In some embodiments, the computing device 200 may further include a communication port 250. In some embodiments, the computing device 200 may further include I / O components 260.

[0065] The internal communication bus 210 can connect different system components, including storage medium 230 and processor 220. I / O component 260 supports input / output between computing device 200 and other components.

[0066] Communication port 250 is used for data communication between computing device 200 and the outside world. For example, computing device 200 can connect to a network through communication port 250.

[0067] Storage medium 230 may include a data storage device. The data storage device may be a non-transitory storage medium or a temporary storage medium. For example, the data storage device may include one or more of a disk 232, a read-only storage medium (ROM) 234, or a random access storage medium (RAM) 236. Storage medium 230 also includes at least one instruction set stored in the data storage device. The instruction set is computer program code, which may include programs, routines, objects, components, data structures, procedures, modules, etc., that execute the data retrieval methods for graph databases provided in this specification.

[0068] At least one processor 220 is communicatively connected to at least one storage medium 230 via an internal communication bus 210. The at least one processor 220 is used to execute the at least one instruction set described above. When the terminal device 130 is running, the at least one processor 220 reads the at least one instruction set and executes the data retrieval method for a graph database provided in this specification, applicable to the terminal device side, according to the instructions of the at least one instruction set. When the server 150 is running, the at least one processor 220 reads the at least one instruction set and executes the data retrieval method for a graph database provided in this specification, applicable to the server side, according to the instructions of the at least one instruction set.

[0069] Processor 220 can execute all the steps included in the data retrieval method for the graph database. Processor 220 can be in the form of one or more processors. Processor 220 can issue execution instructions. Processor 220 may include one or more hardware processors, such as microcontrollers, microprocessors, reduced instruction set computers (RISC), application-specific integrated circuits (ASICs), application-specific instruction set processors (ASIPs), central processing units (CPUs), graphics processing units (GPUs), physical processing units (PPUs), microcontroller units, digital signal processors (DSPs), field-programmable gate arrays (FPGAs), advanced RISC machines (ARMs), programmable logic devices (PLDs), any circuit or processor capable of performing one or more functions, or any combination thereof.

[0070] For illustrative purposes only, only one processor 220 is shown in the accompanying drawings of the computing device 200. However, it should be noted that the computing device 200 may also include multiple processors. Therefore, the operation and / or method steps disclosed herein may be executed by a single processor or by multiple processors in combination, as described herein. For example, if processor 220 of the computing device 200 in this specification executes steps A and B, it should be understood that steps A and B may also be executed jointly or separately by two different processors 220 (e.g., a first processor executes step A, a second processor executes step B, or the first and second processors jointly execute steps A and B).

[0071] Figure 3 A schematic flowchart of a data retrieval method P300 for a graph database according to an embodiment of this specification is shown. Figure 3 As shown, the method P300 provided in this specification can be executed by a terminal device and a server. Method P300 may include steps S310-S360.

[0072] S310: The terminal device receives the first search command entered by the user on the interactive page.

[0073] For example, the interactive page may include a search command input box, where users can enter their first search command. The command input box can be preset in a specific location on the interactive page, such as the left / right / top of the page.

[0074] In some embodiments, the first retrieval instruction may be an instruction described using a graph query language or an instruction described using natural language.

[0075] In some examples, the interactive page may also include a language selection control, which allows users to first select the target language from a number of preset languages ​​(graphic query language or natural language), and then enter the first search command in the target language in the command input box.

[0076] Figure 4 A schematic diagram of an interactive page provided in one embodiment of this specification is shown. For example... Figure 4 As shown, the left side of the interactive page is the input area, which includes a language selection control and a command input box. The right side of the interactive page is the display area, which displays relevant information about the search results. Before the user performs a search, the display area is blank. Users can select the description language for their search command in the input area and then input the search command in the corresponding language. Graph Query Language uses a precise and machine-parseable syntax to represent complex graph traversals and relational queries. For example, an instruction described using Graph Query Language might be: `gV().has('person', 'name', 'Alice').outE('knows').inV().has('age', gt(30))`. Here, `gV()` indicates traversing from all vertices in the graph database. `has('person', 'name', 'Alice')` indicates filtering out vertices labeled "person" with the attribute "name" equal to "Alice" (i.e., "Alice the person"). `inV()` indicates finding the endpoint vertex along these "knows" edges (i.e., "the person Alice knows"). `has('age', gt(30))` indicates filtering out vertices from "the person Alice knows" whose age is greater than 30. In other words, the above instruction means "find all vertices (V) of people named Alice, traverse the edges (outE) ​​emanating from Alice of type 'knows', obtain the vertices (inV) pointed to by these edges, and finally filter out vertices older than 30." Using a graph query language to describe the instruction requires the user to be familiar with graph database technology, thus enabling precise and flexible queries through the above-mentioned graph query language query method.

[0077] Retrieval instructions described in natural language do not require users to master the syntax of a specific graph query language, making them more in line with users' everyday expression habits. For example, a natural language description instruction might be: "Find all people who know Alice and are over 30 years old." Terminal devices or servers can use Natural Language Processing (NLP) modules or large language models to parse and convert these natural language description retrieval instructions into standard query statements that the graph database can execute.

[0078] The multiple input methods for the aforementioned first search command not only meet the needs of professional users for complex and precise data retrieval using graph query language, but also allow non-professional users to perform data retrieval using intuitive natural language, thus lowering the barrier to entry for the data retrieval methods provided in this manual. In other words, the multi-mode input methods of the first search command expand the applicable user group for the data retrieval methods provided in this manual, improve the ease of use and universality of the methods, and thereby enhance the user experience.

[0079] S320: The terminal device sends the first search command to the server.

[0080] The terminal device sends a first search instruction to the server, so that the server can perform a search in the graph database based on the first search instruction to obtain the first search subgraph.

[0081] S330: The server retrieves the first subgraph from the graph database based on the first retrieval instruction.

[0082] In some embodiments, the server can traverse the nodes and edges in the graph database based on the first search instruction, collecting all nodes, node attributes, edges, and edge attributes that meet the conditions, to construct a complete first search subgraph that conforms to the user's query intent. The first search subgraph contains all result data that satisfies the first search instruction.

[0083] The server-driven retrieval process of the graph database, with its high computing power, ensures efficient and accurate retrieval even with large datasets, while avoiding excessive consumption of terminal device computing resources. Furthermore, the server-constructed first retrieval subgraph provides an accurate data foundation for subsequent data volume assessment, sampling strategy application (such as generating example subgraphs), and metadata statistics (such as generating data volume description information), ensuring the reliability of subsequent decisions.

[0084] In some embodiments, when the first search instruction is described in natural language, the server can input the first search instruction into a large language model and guide the large language model to generate a third search instruction described in graph query language. Then, the server performs a search in the graph database based on the third search instruction to obtain the first search subgraph. Alternatively, the server can also convert the first search instruction into a third search instruction described in graph query language using a natural language processing engine, and then perform a search in the graph database based on the third search instruction to obtain the first search subgraph. It should be understood that the above embodiments are merely illustrative examples, and the specific method by which the server converts the first search instruction into a third search instruction described in graph query language can be flexibly adjusted according to user needs and is not limited to the methods given in the above embodiments.

[0085] In some embodiments, when the first search instruction uses a graph query language, the server can directly retrieve the first search subgraph from the graph database based on the first search instruction.

[0086] In some embodiments, after retrieving the first search subgraph, the server also needs to store the first search subgraph in a preset storage space. This preset storage space can be a cache system, a temporary file storage area, or a distributed storage system that supports fast read and write operations. When the server stores the first search subgraph, it can generate a unique identifier (e.g., a session ID or query ID) for it, so that the server can accurately locate and retrieve the first search subgraph from the preset storage space subsequently.

[0087] By storing the first retrieval subgraph in a pre-defined storage space, when a user inputs a second retrieval command based on the preview results of the first example subgraph, the server does not need to re-execute the time-consuming global graph traversal. Instead, it can quickly load the first retrieval subgraph directly from the pre-defined storage space using an identifier and perform an efficient secondary query within the first retrieval subgraph. This reduces the overhead of redundant calculations and improves the response speed of subsequent interactive operations. Furthermore, storing intermediate results (the first retrieval subgraph) in the pre-defined storage space effectively reduces the query pressure on the underlying graph database, avoids repeatedly executing the same or similar retrieval operations due to multiple interactions by the same user, saves database system resources, and improves the overall service stability and scalability.

[0088] S340: If the data volume of the first search subgraph exceeds the preset data volume, the server generates first data volume description information to characterize its data volume based on the first search subgraph, and extracts a first example subgraph from the first search subgraph whose data volume does not exceed the preset data volume. The first example subgraph is composed of a portion of the nodes and edges in the first search subgraph.

[0089] The aforementioned preset data volume can be a data volume threshold related to the performance of the terminal device. For example, the preset data volume can be the maximum data volume that the terminal device supports for rendering, or a value less than the maximum data volume.

[0090] In some embodiments, the server can receive device performance information from the terminal device. Then, the server determines the maximum amount of data the terminal device can support for rendering and display based on the device performance information, and determines a preset data amount based on the maximum data amount. In some embodiments, the device performance information of the terminal device can be sent to the server along with the first retrieval instruction. Alternatively, it can be sent to the server in advance when the terminal device and the server establish a connection.

[0091] In other words, the preset data volume is not a fixed value, but rather a dynamically determined value by the server based on the device performance information of the terminal device. Specifically, the server receives device performance information sent by the terminal device. This device performance information includes, but is not limited to, the terminal device's hardware configuration (such as CPU model, memory size, and image processor capabilities), currently available free memory resources, browser or client application version, and the current network environment (such as bandwidth). Based on the above device performance information, the server analyzes and determines the maximum data volume threshold that the terminal device can smoothly render and display graph data in the current environment by using a predefined performance model or querying a performance-data volume lookup table (or a preset mapping relationship, etc.). (For example, based on the terminal device's performance, the server determines that the current terminal device can smoothly render a maximum of 5000 nodes and 8000 edges). Subsequently, the server determines the maximum data volume threshold as the preset data volume corresponding to the current terminal device and uses this preset data volume as the basis for subsequent server decisions on whether sampling is necessary.

[0092] The aforementioned method of dynamically adapting the preset data volume based on device performance information fully considers the performance differences of various user terminal devices (e.g., the performance difference between high-end desktops and ordinary laptops). By dynamically configuring the preset data volume, the server can allocate a higher data volume limit to high-performance terminal devices, providing a more information-rich first example subgraph; and set a more conservative limit for low-performance terminal devices, ensuring smooth interaction. This achieves consistent and stable query services across various terminal devices, avoiding lag or even crashes caused by low-performance devices attempting to render excessively large amounts of data. Furthermore, this method of dynamically adjusting the preset data volume based on device performance also optimizes resource utilization. It not only avoids returning insufficient first example subgraphs to high-performance devices (failing to utilize their high-performance hardware advantages) but also prevents sending unbearable amounts of data to low-performance devices (causing resource waste and a degraded experience). This improves the intelligence of data retrieval and the efficiency of resource allocation, enhances the versatility of the method, and improves the user experience.

[0093] Figure 5 A schematic diagram of a server retrieval process provided in one embodiment of this specification is shown, such as... Figure 5 As shown, after receiving the first search instruction, the server searches the graph database according to the first search instruction to obtain the first search subgraph.

[0094] If the data volume of the first search subgraph is greater than the preset data volume, the server determines the corresponding first data volume description information based on the first search subgraph, and extracts the first example subgraph based on the sampling strategy in the first search subgraph.

[0095] The first data volume description information is used to describe the data volume of the first retrieval subgraph. In some embodiments, the first data volume description information may include at least one of the following: the total number of nodes contained in the first retrieval subgraph, the total number of edges contained in the first retrieval subgraph, the number of nodes of different types in the first retrieval subgraph, or the number of edges of different types in the first retrieval subgraph.

[0096] The first example subgraph consists of a portion of the nodes and edges in the first retrieval subgraph, and its data volume does not exceed the preset data volume.

[0097] The method described above for determining the first example subgraph in the first retrieval subgraph not only maintains the structural relationships between the first retrieval subgraphs, but also strictly controls its data volume to ensure it does not exceed the preset data volume that the terminal device can smoothly render and process. This fundamentally avoids problems such as device crashes, memory overflows, or prolonged interface unresponsiveness caused by the terminal device attempting to process excessive data, thus ensuring the stability and availability of the terminal device.

[0098] In some embodiments, the server may sample a set of key nodes in the first retrieval subgraph based on a preset sampling strategy, the set of key nodes including at least one key node. Then, the server determines a connected subgraph containing the set of key nodes from the first retrieval subgraph, subject to a constraint of not exceeding a preset data volume, and uses this connected subgraph as the first example subgraph.

[0099] For example, the sampling strategy can be received by the server from the terminal device. The terminal device can obtain the sampling strategy entered by the user in the interactive page and send the sampling strategy to the server. The user can, for example, customize the sampling strategy according to specific analysis objectives. For instance, the terminal device can obtain the personalized sampling strategy entered by the user by providing a configuration interface (drop-down menu, input box, or strategy template selector, etc.) on the interactive page. Subsequently, the terminal device sends the configured sampling strategy to the server. The timing of sending the sampling strategy is flexible; for example, the sampling strategy can be sent to the server by the terminal device along with the first search instruction. That is, the sampling strategy is sent to the server as a parameter or additional information of the first search instruction in the same network request.

[0100] Alternatively, the sampling strategy can be pre-sent by a separate configuration request and stored on the server before the first retrieval is executed, for use in subsequent retrieval queries.

[0101] The aforementioned method of configuring the sampling strategy in advance and involving user participation enhances the predictability and interpretability of the sampling results, allowing users to understand the generation logic of the first example subgraph. Furthermore, passing the sampling strategy before or during the retrieval process enables the server to perform sampling processing on the first retrieval subgraph based on the pre-passed sampling strategy after obtaining the complete subgraph, improving overall response efficiency and resource utilization. Finally, the multiple methods of sending sampling strategies provide users with greater operational flexibility and convenience. It should be understood that the above embodiments are merely illustrative, and the specific methods of sending sampling strategies can be flexibly adjusted according to user needs and are not limited to those given in the above embodiments.

[0102] Specifically, the server, based on a preset or user-specified sampling strategy (such as filtering based on node importance indicators or type), selects a set of key nodes from the first retrieval subgraph. This set of key nodes contains one or more nodes identified as important. However, since the set of key nodes consists of discrete points, it cannot reflect the relational structure of the graph. Therefore, with the data volume not exceeding a preset limit as a constraint, the server uses the set of key nodes as the seed and core to extract a connected subgraph from the first retrieval subgraph containing all key points in the set of key nodes. This connected subgraph not only contains all key nodes in the set of key nodes but also the intermediate nodes and edges necessary to connect these key nodes. This avoids the problem of broken relationships between nodes caused by simple random sampling or extracting only important nodes, ensuring that key nodes are reachable within the first example subgraph, thus forming a connected subgraph that maintains structural and semantic coherence. The server then returns this connected subgraph as the first example subgraph to the terminal device.

[0103] The first example subgraph extracted using the above method is not a collection of discrete nodes, but a subnetwork with analytical significance and a complete structure, thus improving the structural representativeness and usability of the first example subgraph. Secondly, by expanding connectivity around a set of key nodes and ensuring that the data volume does not exceed a preset limit during the expansion process, the server prioritizes the presentation of key nodes and the important connections between them, effectively improving the efficiency and depth of interaction with users.

[0104] In this specification, sampling strategies may include, but are not limited to: random sampling to provide an unbiased overview, importance sampling based on graph algorithms such as node degree centrality or PageRank to retain key hub nodes, or relevance sampling based on user query history.

[0105] For example, the sampling strategy instructs each key node contained in the key point set to satisfy at least one of (1)-(3) below.

[0106] (1) The index values ​​of the key nodes meet the preset conditions. The index values ​​include at least one of degree, degree centrality, proximity centrality, betweenness centrality or eigenvector centrality.

[0107] For example, when the graph database is a social network graph, the first subgraph retrieved based on the first search instruction may contain a large number of user nodes. In this case, the sampling strategy can be set to select the top 5% of nodes in the first subgraph based on their "degree centrality" (i.e., the number of connected friends) as key nodes. Based on the above selection strategy, the "influential figures" at the center of the social network graph in the graph database can be retained in the first example subgraph.

[0108] (2) The key node belongs to the preset node type.

[0109] For example, when the graph database is a risk control knowledge graph, the first subgraph retrieved based on the first search command may contain nodes of various types such as "user," "account," "transaction," and "device." In this case, the sampling strategy can be set to retain only nodes of type "user" and "account" as key nodes. This way, the generated first example subgraph will focus on core entity objects, filtering out secondary or auxiliary information such as "device," making the first example subgraph more aligned with the focus of risk control analysis users.

[0110] (3) There is a pre-defined association between the key node and the target node specified in the first search instruction.

[0111] In some embodiments, the preset association relationship includes at least one of the following: it is the target node itself (i.e., the core node that the user initially queried is forcibly retained); it is directly connected to the target node (i.e., all "first-degree neighbor" nodes and their associated edges that are directly connected to the target node by an edge are retained); or the number of hops between it and the target node is less than or equal to the preset number of hops (i.e., around the target node, nodes and subgraph structures within a certain distance of its influence are included in the scope of the key node), and the preset number of hops can be, for example, 2 hops or 3 hops.

[0112] The aforementioned multi-level association settings ensure that the generated first example subgraph closely revolves around the user's query intent, always expanding around the target node of interest to the user, effectively avoiding the problem of sampling results deviating from the user's query intent. Secondly, the preset associations offer a gradient selection from "self" to "directly connected" to "reachable by N hops," providing users with flexible control granularity. Users can choose the appropriate number of hops according to their analysis needs (such as analyzing direct relationships or exploring potential indirect effects), thus balancing data volume and information breadth. Finally, this sampling method, centered on the target node and radiating outwards by the number of hops, naturally preserves the complete local topology in the first example subgraph. For example, it retains all edges formed by the target node and its directly connected nodes, allowing users to clearly observe the direct environment and connection patterns of the target node through the first example subgraph, improving the structural integrity and interpretability of the first example subgraph.

[0113] For example, when a user's first search instruction indicates that the current search goal is "to find all entities related to person A", the sampling strategy can be set as follows: key nodes are nodes that have a direct connection with the target node A (i.e., first-degree neighbors). Alternatively, the sampling strategy can be set as "the number of hops between the target node A and the target node A is less than or equal to 2". The resulting first example subgraph is a structure centered on the target node A, radiating outwards through its direct or second-degree relationship circles, ensuring the relevance between the first example subgraph and the first search instruction, while also ensuring the integrity of the first example subgraph structure.

[0114] The aforementioned sampling strategy ensures that the first example subgraph retains the key structural and semantic information of the first retrieval subgraph, better aligning with the user's query intent. Furthermore, the server's method of selecting key points (such as hubs and bridges) that play important roles in the network topology according to the preset sampling strategy allows the first example subgraph to reveal the community structure, critical paths, and core influence points within the first retrieval subgraph, reducing the risk of losing important patterns due to sampling. Secondly, compared to random sampling, the sampling method based on the aforementioned sampling strategy has clear guidance and interpretability, enabling users to understand the compositional logic of the first example subgraph. This provides a high-quality and intuitive foundation for subsequent in-depth searches, improving the efficiency and accuracy of data analysis.

[0115] The aforementioned method of flexibly configuring sampling strategies by users realizes the transformation from fixed sampling to on-demand sampling. Users can choose appropriate sampling strategies (such as finding bridge nodes based on betweenness centrality, or filtering based on specific types) according to the current analysis scenario (e.g., path analysis, community discovery, or anomaly detection), so that the final generated first example subgraph can meet the user's analysis needs, thereby improving the flexibility and applicability of the retrieval method. In some embodiments, the first retrieval subgraph includes multiple types of nodes. The design of the sampling strategy not only focuses on the importance of individual nodes, but also constrains the key node set from the macro level of type distribution to ensure that the first example subgraph has high representativeness. Specifically, when the first retrieval subgraph contains multiple types of nodes (such as "people", "company", "product", "location", etc.), the sampling strategy will indicate that the statistical distribution information of each type of node in the key node set (i.e., the node composition of the first example subgraph) is related to at least one of (A)-(B) below.

[0116] (A) The frequency of user interaction with each type of node during a historical period. For example, if users click on "product" type nodes more frequently than "company" type nodes during a historical period, then the proportion of "product" type nodes in the sampled key node set will be greater than the proportion of "company" type nodes.

[0117] (B) Statistical distribution information of each type of node in the first retrieval subgraph. For example, assuming that the first retrieval subgraph includes three types of nodes, and the number of nodes of these three types is 5:3:2; then the proportion of the three types of nodes in the key node set obtained after sampling can also be 5:3:2.

[0118] The sampling strategy based on type distribution constraints described above comprehensively considers users' historical behavioral preferences, allowing the generated first example subgraph to prioritize displaying node types that users are more interested in. This significantly improves the personalization of the sampling results, enabling the server to proactively adapt to users' analysis habits. Secondly, the sampling strategy constrains the type distribution of the key node set to be correlated with the original distribution of the first retrieval subgraph. This ensures that the first example subgraph retains the key topological structure within the first retrieval subgraph while also maintaining the semantic hierarchy of the data, thereby enhancing the authenticity and credibility of the preview results.

[0119] In some embodiments, the sampling strategy may instruct key nodes to satisfy at least one of (1)-(3) above; or, the sampling strategy may instruct key nodes to satisfy at least one of (A)-(B) above; or, the sampling strategy may instruct key nodes to satisfy at least one of (1)-(3) above, while also satisfying at least one of (A)-(B) above. It should be understood that the above embodiments are merely illustrative examples, and the specific sampling strategy settings can be flexibly adjusted according to user needs, and are not limited to those given in the above embodiments.

[0120] S350: The server sends the first data volume description information and the first example sub-graph to the terminal device.

[0121] S360: The terminal device displays the first data volume description information and the first example sub-graph on the interactive page.

[0122] Figure 6 A schematic diagram of another interactive page provided by another embodiment of this specification is shown, such as... Figure 6 As shown, the left side of the current interactive page is the input area for search commands, and the right side is the display area for search results. The display area currently shows the first example sub-image and the first data volume description information.

[0123] The way the terminal device displays the initial data volume description and the first example subgraph on the interactive page allows users to clearly and comprehensively understand the overall picture and scale of the data in the first retrieval subgraph, avoiding misunderstandings caused by only seeing the first example subgraph. Furthermore, by receiving the first example subgraph, which has undergone intelligent sampling, controlled data volume, and preserved structural features, the terminal device provides users with a real-time interactive and responsive visual view. Consequently, users can make an initial judgment on the validity of the search by browsing the first example subgraph, enabling them to further decide on subsequent search directions (e.g., further refining the query or adjusting the sampling range), thus improving the efficiency of data retrieval and the user experience.

[0124] In some embodiments, when displaying the first example subgraph, nodes of different types in the first example subgraph are displayed differently, and / or edges of different types in the first example subgraph are displayed differently.

[0125] For example, the differentiated display method can be one or more of the following: different colors (e.g., blue for "Personnel" nodes, green for "Company" nodes, and yellow for "Product" nodes), different shapes (circles, squares, triangles), or different sizes (to indicate importance level, with larger sizes indicating higher importance). Similarly, different types of edges (relationships) can also be displayed using differentiated display methods, for example: different line styles (e.g., solid lines, dashed lines, dotted lines), different colors (e.g., black for "Shareholding" relationships, red for "Transaction" relationships), or different thicknesses to distinguish different types of edges. That is, the above differentiated display can be applied to both nodes and edges, or only to one type, and can be flexibly adjusted according to user needs, and is not limited to the examples given above.

[0126] Figure 7 A schematic diagram of yet another embodiment of the interactive page provided in this specification is shown, such as... Figure 7 As shown in the first example subgraph displayed in the demonstration area, nodes of different types have different line thicknesses, and nodes with lines of the same thickness are of the same type. Edges of different types have different line styles, and edges with the same style are of the same type.

[0127] The aforementioned differentiated display method reduces the cognitive load on users regarding complex graph structures, mapping the semantic types (such as node types and relationship types) in abstract graph data into intuitive and immediately distinguishable visual features. This allows users to quickly understand the category of each element in the first example subgraph, thereby accelerating their information acquisition and comprehension. Secondly, this visualization method helps users quickly identify patterns, anomalies, or specific paths of interest in the first example subgraph. For example, all red edges (representing transaction relationships) are more prominent, facilitating the tracking of abnormal nodes; or, a concentrated cluster of a certain node type may represent a potential cluster. In other words, by providing a clear and structured visual presentation, the aforementioned differentiated display method enhances the intuitiveness and comprehensibility of the first example subgraph, improving the user's interactive experience and efficiency.

[0128] In some embodiments, the differentiated display method can be preset by the user; for example, the user can trigger a configuration interface for the display method on the interactive page.

[0129] Figure 8 A schematic diagram of yet another interactive page provided in a further embodiment of this specification is shown, such as... Figure 8As shown, the interactive page can include a configuration area, which may be located on the left side of the page. Users can configure specific differentiated display methods in this area. For example, users can select whether the object to be configured is a dot style or an edge style. Taking the dot style as an example, users can browse multiple dot types included in the first example sub-image from the dot type dropdown menu and determine the target dot type. Furthermore, users can set the color, size, icon style, etc., corresponding to the target dot type. Specifically, users can select the target display size from multiple preset display sizes, the target display color from multiple preset colors, and the target icon from preset icon styles.

[0130] In some embodiments, the differentiated display method may also be preset on the terminal device, and the user can modify it according to their needs. It should be understood that the above embodiments are merely illustrative examples, and the specific differentiated display method can be flexibly adjusted according to user needs, and is not limited to the methods given in the above embodiments.

[0131] In some embodiments, after displaying the first example sub-image, the terminal device may also respond to detecting a scaling operation on the first example sub-image, determine the scaling factor corresponding to the scaling operation, and adjust the display detail of the first example sub-image based on the scaling factor.

[0132] In other words, the terminal device can dynamically adjust the first example sub-image in response to user zoom operations (such as scrolling the mouse wheel, pinching the touchpad with two fingers, or dragging the zoom slider). Specifically, the terminal device detects the user's zoom operation and determines the corresponding zoom factor (a numerical parameter representing whether the current scale of the first example sub-image is enlarged or reduced, and the specific degree of enlargement / reduction). Subsequently, based on this zoom factor, the terminal device adjusts the level of detail of each graphic element in the first example sub-image in real time. For example, when the user zooms in (zoom factor increases), the display interface gradually shows more detailed information in the first example sub-image, such as node labels and more detailed node attribute information. Conversely, when the user zooms out (zoom factor decreases), less information is presented on the display interface. For example, the terminal device automatically hides detailed text, reduces the number of detailed elements that need to be drawn (such as text and complex icons), aggregates multiple nodes into a general icon, or simplifies the display of edges, retaining only the core topological structure, thereby reducing the computational burden on the graphics engine and ensuring smooth zooming and translation operations.

[0133] The aforementioned technical solution, which dynamically adjusts the level of detail based on scaling factors, ensures that the amount of information presented on the interactive page adapts to the user's current analytical focus regardless of any zooming operation. This avoids visual confusion caused by over-display or analytical obstacles caused by insufficient information. Furthermore, this dynamic adjustment of display detail provides users with an intuitive and progressive data exploration path, allowing them to choose to understand the global structure of the first example subgraph from a macroscopic perspective or the specific details from a microscopic perspective, thereby enhancing the depth of data analysis and the smoothness of the user experience.

[0134] In some embodiments, the terminal device may also display attribute information of the first node in the surrounding area of ​​the first node in response to detecting an interactive operation on the first node, wherein the first node is any node in the first example subgraph.

[0135] Specifically, the interactive page provides a focused, detailed query method: after the first example subgraph is displayed on the interactive page, the terminal device can respond to the detection of user interaction with any node in the graph (referred to as the first node) (such as mouse hover, click, long press, right-click, etc.) and trigger a detailed attribute information display. That is, the terminal device does not display all information of all nodes in a cluttered manner in the initial first example subgraph, but only dynamically and temporarily displays the attribute information associated with the first node in the surrounding area of ​​the first node (e.g., next to it, below it, or in a pop-up small information box) after detecting an interaction with the first node. This attribute information can include all attribute key-value pairs corresponding to the first node retrieved from the graph database. For example, for a "product" node, it can display specific data such as its "name," "category," and "inventory."

[0136] The aforementioned on-demand display of node attributes ensures the simplicity and clarity of the initial display interface, avoiding text overlap and visual clutter caused by displaying all node information simultaneously. It also reduces the consumption of graphics rendering resources on the terminal device, allowing users to focus on understanding the overall graph structure and topological relationships of the first example subgraph. Furthermore, users can actively interact with the first node of interest in the first example subgraph based on their analytical needs and areas of interest, instantly obtaining the node's attribute information without requiring additional queries or page jumps, ensuring a smooth data viewing experience.

[0137] In some embodiments, the terminal device may also display attribute information of the first side in the surrounding area of ​​the first side in response to detecting an interactive operation on the first side. The first side is any edge in the first example subgraph. That is, after the first example subgraph is displayed on the interactive page, the terminal device can trigger the display of detailed attribute information in response to detecting a user's interactive operation (such as mouse hover, click, etc.) on any edge (referred to as the first side) in the graph. Specifically, the terminal device will dynamically and temporarily display attribute information associated with the first side in the surrounding area of ​​the first side (e.g., near the edge of the first side, or by popping up a small information box). This attribute information consists of attribute key-value pairs of the first side itself. For example, for a "transaction" edge, it can display specific data such as "transaction amount", "transaction time", and "transaction type"; for a "cooperation" edge, it can display information such as "cooperation start date" and "cooperation project name".

[0138] The aforementioned on-demand attribute display method for edges enhances the comprehensive viewability of the graph data in the first example subgraph. Since the graph data in the first example subgraph consists of nodes and edges, and the attributes of the edges often contain crucial information (such as the strength, time, and properties of relationships), this embodiment ensures that users can view not only the attributes of the nodes themselves but also detailed information about the "relationships" connecting these nodes. This avoids the common problem of edge information being overlooked in related visualization technologies, allowing users to obtain complete contextual information. Secondly, all edges in the initial first example subgraph are displayed with simple line styles, maintaining visual clarity and structural distinctness. The attribute information of the first edge is dynamically rendered only when the user actively focuses on it, effectively preventing the unreadable problem caused by excessive text information on the display interface when displaying the attribute information of all edges simultaneously. In other words, in the above embodiment, users can directly and quickly compare the attribute information of different edges through interaction (such as comparing the amounts of multiple transactions), thereby more easily identifying critical paths, abnormal connections, or important patterns, improving the efficiency and accuracy of in-depth analysis and decision support based on graph data.

[0139] The above embodiments provide an interactive method for iterative retrieval. After the terminal device displays an overview of the first round of retrieval (i.e., the first data volume description information and the first example subgraph) to the user, the user may develop a new query intent based on the initial viewing. At this time, the terminal device can obtain the second search instruction input by the user on the same interactive page (for example, the user can add filter conditions, specify a new central node, or modify the sampling strategy based on the existing first search instruction to form a second search instruction). Subsequently, the terminal device sends the second search instruction to the server. At this time, the server does not perform a search on the entire graph database, but performs a secondary search on the first search subgraph obtained from the first search based on the second search instruction, thereby obtaining a more accurate second search subgraph. Subsequently, the server follows the same processing flow: it determines the data volume of the second search subgraph. If the data volume of the second search subgraph still exceeds the preset data volume, it returns the second data volume description information and the second example subgraph with controlled data volume (whose sampling strategy can be the same as the first one, or can be re-specified by the user) and displays them.

[0140] In other words, the server can receive a second search instruction sent by the terminal device. Then, based on the second search instruction, the server searches the first search subgraph in a preset storage space to obtain a second search subgraph. Subsequently, if the data volume of the second search subgraph exceeds a preset data volume, the server generates second data volume description information to characterize its data volume based on the second search subgraph, and extracts a second example subgraph from the second search subgraph whose data volume does not exceed the preset data volume. The second example subgraph consists of a subset of nodes and edges from the second search subgraph. Finally, the server sends the second data volume description information and the second example subgraph to the terminal device for display.

[0141] Of course, the server can also store the second search subgraph in a preset storage space and, when the user still wants to perform further searches on the second example subgraph, retrieve the second search subgraph based on the user's search operation. This iterative retrieval method based on stored intermediate results improves query efficiency. Users can perform multiple rounds of queries, with each step based on the complete result of the previous step, until the final target data is obtained. This enhances support for complex analysis tasks and improves the smoothness of the user experience.

[0142] The iterative retrieval method described above eliminates the need for users to query massive amounts of raw data each time. Instead, it allows for focusing and deepening of the search based on the previous search results (the first search subgraph), thereby reducing the overhead of redundant server calculations and network transmission latency, and improving the response speed and analysis efficiency of subsequent search operations. Furthermore, users can flexibly adjust or refine their query intent by previewing the first search subgraph obtained in the first round of retrieval. Subsequent iterations gradually approach the target data the user desires, making the entire analysis process more efficient and controllable.

[0143] In summary, the data retrieval method for graph databases provided in this specification involves the terminal device sending a first search command input by the user to the server. The server then performs a search in the graph database based on this command to obtain a first search subgraph. If the data volume of the first search subgraph exceeds a preset data volume, the server generates a first data volume description and a first example subgraph based on the first search subgraph, and sends both to the terminal device for display. Therefore, this solution can display relevant information about the search results even when the data volume is large. The information displayed to the user includes the first data volume description and the first example subgraph. The first data volume description allows the user to intuitively perceive the overall data scale, while the first example subgraph helps the user understand the key graph structure features of the search results. These two aspects of information allow the user to intuitively understand the search results, facilitating the user to accurately design further search commands rather than blindly attempting searches, thereby improving data retrieval efficiency.

[0144] This specification, in another aspect, provides a computer-readable non-transitory storage medium storing at least one set of executable instructions for performing data retrieval of a graph database. When the at least one set of instructions is executed by a processor, it instructs the processor to implement the steps of the graph database data retrieval method of this specification. In some possible embodiments, various aspects of this specification can also be implemented as a program product comprising program code. When the program product is run on a terminal device 130, the program code causes the terminal device 130 to perform the steps of method P300 described in this specification. The program product for implementing the above method may employ a portable compact disk read-only memory (CD-ROM) containing program code and may run on the terminal device 130. When the program product is run on a server 150, the program code causes the server 150 to perform the steps of method P500 described in this specification. The program product for implementing the above method may employ a portable compact disk read-only memory (CD-ROM) containing program code and may run on the server 150. However, the program product of this specification is not limited thereto. In this specification, the readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system. The program product may take the form of any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. A computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof. Program code for performing the operations of this specification may be written in any combination of one or more programming languages, including object-oriented programming languages—such as Java, C++, etc.—and conventional procedural programming languages—such as the "C" language or similar programming languages.

[0145] 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 a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0146] In summary, after reading this detailed disclosure, those skilled in the art will understand that the foregoing detailed disclosure may be presented by way of example only and may not be restrictive. Although not explicitly stated herein, those skilled in the art will understand that this specification requires various reasonable changes, improvements, and modifications to the embodiments. These changes, improvements, and modifications are intended to be made by this specification and are within the spirit and scope of the exemplary embodiments described herein.

[0147] Furthermore, certain terms in this specification have been used to describe embodiments of this specification. For example, "an embodiment," "an embodiment," and / or "some embodiments" mean that a particular feature, structure, or characteristic described in connection with that embodiment may be included in at least one embodiment of this specification. Therefore, it is to be emphasized and understood that two or more references to "an embodiment" or "an embodiment" or "alternative embodiment" in various parts of this specification do not necessarily refer to the same embodiment. Moreover, specific features, structures, or characteristics may be suitably combined in one or more embodiments of this specification.

[0148] It should be understood that in the foregoing description of the embodiments in this specification, various features are combined in a single embodiment, drawing, or description for the purpose of simplifying the description and to aid in understanding a feature. However, this does not mean that the combination of these features is necessary, and those skilled in the art, upon reading this specification, may readily identify some of the devices as separate embodiments. That is, the embodiments in this specification can also be understood as an integration of multiple secondary embodiments. And the content of each secondary embodiment is valid even if it contains fewer than all the features of a single foregoing disclosed embodiment.

[0149] Every patent, patent application, publication of a patent application, and other material, such as articles, books, specifications, publications, documents, and literature (excluding any related historical examination documents), cited in this disclosure is incorporated herein for all purposes, including, for example, in the specification and claims of this disclosure. However, in the event of any inconsistency or conflict between the descriptions, definitions, and / or terms used in the foregoing and those used in this disclosure, the descriptions, definitions, and / or terms used in this disclosure shall prevail.

[0150] Finally, it should be understood that the embodiments disclosed herein are illustrative of the principles of the embodiments described in this specification. Other modified embodiments are also within the scope of this specification. Therefore, the embodiments disclosed in this specification are merely examples and not limitations. Those skilled in the art can implement the applications described in this specification using alternative configurations based on the embodiments in this specification. Therefore, the embodiments in this specification are not limited to the embodiments precisely described in the applications.

Claims

1. A data retrieval method for graph databases, applied to a terminal device, comprising: Obtain the first search command entered by the user on the interactive page; The first search instruction is sent to the server, and the first search instruction is configured to instruct the server to perform a search in the graph database based on the first search instruction to obtain a first search subgraph; If the data volume of the first retrieval subgraph exceeds a preset data volume threshold, a first example subgraph is received from the server. The first example subgraph consists of a subset of nodes and edges from the first retrieval subgraph, and its data volume does not exceed the preset data volume threshold. The first example subgraph is a connected subgraph extracted by the server from the first retrieval subgraph, using a key node set as the seed and core, constrained by the data volume not exceeding the preset data volume threshold. The key node set is a set of at least one discrete key node sampled by the server from the first retrieval subgraph according to a preset sampling strategy. The first example subgraph contains all key nodes from the key node set, as well as the necessary intermediate nodes and edges connecting these key nodes, ensuring that key nodes are reachable within the first example subgraph. The server receives first data volume description information; wherein the first data volume description information describes the data volume of the first retrieval subgraph, and receiving the first data volume description information indicates that the data volume of the first retrieval subgraph retrieved by the server exceeds the preset data volume threshold; and The interactive page displays the first data volume description information and the first example sub-graph.

2. The method according to claim 1, wherein, The sampling strategy instructs each critical node to satisfy at least one of the following: The index values ​​of the key nodes meet preset conditions, and the index values ​​include at least one of degree, degree centrality, proximity centrality, betweenness centrality, or eigenvector centrality. The key node belongs to a preset node type; or There is a preset association between the key node and the target node specified in the first search instruction.

3. The method according to claim 2, wherein, The preset association relationship includes at least one of the following: It is the target node itself; Directly connected to the target node; or The number of hops between the target node and the target node is less than or equal to the preset number of hops.

4. The method according to claim 1, wherein, The first retrieval subgraph includes multiple types of nodes, and the sampling strategy indicates that the statistical distribution information of each type of node in the key node set is related to at least one of the following: The frequency of user interaction with various types of nodes within a historical time period; or The statistical distribution information of each type of node in the first retrieval subgraph.

5. The method according to claim 1, wherein, The method further includes: obtaining the sampling strategy input by the user on the interactive page, and sending the sampling strategy to the server.

6. The method according to claim 1, wherein, The data volume threshold is determined based on the maximum data volume that the terminal device supports for rendering and display, and the maximum data volume is related to the device performance information.

7. The method according to claim 1, wherein, The first data volume description information includes at least one of the following: The total number of nodes in the first retrieval subgraph The total number of edges in the first retrieval subgraph The number of nodes of different types in the first retrieval subgraph, or The number of edges of different types in the first retrieval subgraph.

8. The method according to claim 1, wherein, When displaying the first example subgraph, nodes of different types in the first example subgraph are displayed differently, and / or In the first example subgraph, edges of different types are displayed differently.

9. The method according to claim 8, wherein, After displaying the first example subgraph, the method further includes at least one of the following: In response to detecting a scaling operation on the first example sub-image, a scaling factor corresponding to the scaling operation is determined, and the level of detail displayed on the first example sub-image is adjusted based on the scaling factor. In response to detecting an interaction with the first node, the attribute information of the first node is displayed in the area surrounding the first node, where the first node is any node in the first example subgraph. or In response to detecting an interaction with the first edge, the attribute information of the first edge is displayed in the surrounding area of ​​the first edge, where the first edge is any edge in the first example subgraph.

10. The method according to claim 1, wherein, The first search instruction is either an instruction described using a graph query language or an instruction described using natural language.

11. The method according to claim 1, wherein, After displaying the first data volume description information and the first example subgraph, the method further includes: Obtain the second search instruction entered by the user on the interactive page; The second search instruction is sent to the server, so that the server performs a search in the first search subgraph based on the second search instruction to obtain the second search subgraph; Receive a second example subgraph from the server; wherein the second example subgraph consists of a portion of the nodes and edges in the second retrieved subgraph, and its data volume does not exceed the data volume threshold; Receive second data volume description information from the server; wherein the second data volume description information describes the data volume of the second retrieval subgraph, and receiving the second data volume description information indicates that the number of the second retrieval subgraphs retrieved by the server exceeds the data volume threshold; and The interactive page displays the second data volume description information and the second example sub-graph.

12. A data retrieval method for graph databases, applied to a server, comprising: Receive the first search instruction from the terminal device; Based on the first search instruction, a search is performed in the graph database to obtain a first search sub-graph; When the data volume of the first retrieval subgraph exceeds a preset data volume threshold, a first data volume description information is generated based on the first retrieval subgraph to characterize its data volume, and a first example subgraph with a data volume not exceeding the preset data volume threshold is extracted from the first retrieval subgraph. The first example subgraph is composed of a portion of nodes and edges in the first retrieval subgraph. The extraction of a first example subgraph from the first retrieval subgraph, wherein the amount of data does not exceed the preset data volume threshold, includes: sampling at least one discrete key node from the first retrieval subgraph based on a preset sampling strategy to form a key node set; and, with the data volume not exceeding the preset data volume threshold as a constraint, and using the key node set as the seed and core, extracting a connected subgraph from the first retrieval subgraph containing all key points in the key node set, wherein the connected subgraph contains all key nodes in the key node set and the intermediate nodes and edges necessary to connect these key nodes, to ensure that the key nodes are reachable within the first example subgraph, and using the connected subgraph as the first example subgraph; and The first data volume description information and the first example sub-graph are sent to the terminal device for display by the terminal device.

13. The method according to claim 12, wherein, The sampling strategy instructs each critical node to satisfy at least one of the following: The index values ​​of the key nodes meet preset conditions, and the index values ​​include at least one of degree, degree centrality, proximity centrality, betweenness centrality, or eigenvector centrality. The key node belongs to a preset node type; or There is a preset association between the key node and the target node specified in the first search instruction.

14. The method according to claim 13, wherein, The preset association relationship includes at least one of the following: It is the target node itself; Directly connected to the target node; or The number of hops between the target node and the target node is less than or equal to the preset number of hops.

15. The method according to claim 12, wherein, The first retrieval subgraph includes multiple types of nodes, and the sampling strategy indicates that the statistical distribution information of each type of node in the key node set is related to at least one of the following: The frequency of user interaction with various types of nodes within a historical time period; or The statistical distribution information of each type of node in the first retrieval subgraph.

16. The method according to claim 12, wherein, The method further includes receiving the sampling strategy from the terminal device.

17. The method according to claim 12, wherein, The method further includes: Receive device performance information from the terminal device, and Based on the device performance information, the maximum amount of data that the terminal device can support for rendering and display is determined, and the data amount threshold is determined based on the maximum amount of data.

18. The method according to claim 12, wherein, The first data volume description information includes at least one of the following: The total number of nodes contained in the first retrieval subgraph The total number of edges contained in the first retrieval subgraph The number of nodes of different types in the first retrieval subgraph, or The number of edges of different types in the first retrieval subgraph.

19. The method according to claim 12, wherein, After obtaining the first retrieval subgraph, the method further includes: Store the first retrieval sub-graph in a preset storage space.

20. The method according to claim 19, wherein, The method further includes: Receive a second search instruction from the terminal device; Based on the second search instruction, the first search sub-graph is searched in the preset storage space to obtain the second search sub-graph; If the data volume of the second retrieval subgraph exceeds a data volume threshold, second data volume description information is generated based on the second retrieval subgraph to characterize its data volume, and a second example subgraph with a data volume not exceeding the data volume threshold is extracted from the second retrieval subgraph. The second example subgraph consists of a portion of the nodes and edges in the second retrieval subgraph. The second data volume description information and the second example sub-graph are sent to the terminal device for display by the terminal device.

21. The method according to claim 12, wherein, The first search instruction is an instruction described using a graph query language.

22. The method according to claim 12, wherein, The first search instruction is a natural language description, and the step of retrieving the first search sub-graph from the graph database based on the first search instruction includes: The first search instruction is input into the large language model, which then generates a third search instruction described in a graph query language. The first search sub-graph is obtained by searching the graph database based on the third search instruction.

23. A terminal device, comprising: At least one storage medium storing at least one instruction set for performing data retrieval for a graph database; as well as At least one processor is communicatively connected to the at least one storage medium, wherein the at least one processor reads the at least one instruction set during operation and executes the method according to any one of claims 1-11 as instructed by the at least one instruction set.

24. A server, comprising: At least one storage medium storing at least one instruction set for performing data retrieval for a graph database; as well as At least one processor is communicatively connected to the at least one storage medium, wherein the at least one processor reads the at least one instruction set during operation and executes the method according to any one of claims 12-22 as instructed by the at least one instruction set.

Citation Information

Patent Citations

  • Graph calculation result visualization method and system

    CN114490833A

  • Product retrieval method and device, electronic equipment and readable medium

    CN114969457A

  • Enterprise information management method and system

    CN118277638A

  • Information retrieval method and equipment

    CN120653823A