A ranking method based on knowledge graph entities and relations
By using a ranking method based on knowledge graph entities and relationships, this paper solves the problems of single ranking strategies and lack of fine granularity in existing technologies, and achieves flexible and accurate graph display, which can adapt to different application scenarios and large-scale data processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technologies lack comprehensive sorting strategies, cannot flexibly integrate multiple sorting rules for sorting, cannot perform fine-grained sorting of different fields, and lack sorting of multiple relationships, resulting in insufficient flexibility and accuracy in graph display.
It adopts a sorting method based on knowledge graph entities and relations, comprehensively considers different perspectives of nodes and relations, supports field-level sorting, and sorts multiple relations. It achieves efficient sorting of TOPN nodes through heap sort algorithm.
It provides flexible and accurate graph display results, and can configure sorting rules according to actual needs to adapt to different application scenarios, thereby improving the efficiency and accuracy of sorting and supporting large-scale data processing.
Smart Images

Figure CN116842189B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of knowledge graph, in particular to a knowledge graph entity and relationship based sorting method, device and computer readable storage medium. BACKGROUND
[0002] The description of the background of the present application belongs to the related art related to the present application, and is only used to illustrate and facilitate the understanding of the content of the present application, and should not be understood as the applicant's recognition or presumption that the present application is the prior art on the date of the first filing of the application.
[0003] In the modern information age, the amount of data increases rapidly, and knowledge graph, as an efficient knowledge representation and association relationship expression method, is widely used in various fields such as search engines, social networks, recommendation systems, etc. In the knowledge graph, the sorting between entities and relationships is crucial for the quality and effect of user retrieval and result display. The existing graph sorting methods mainly include sorting according to node type, relationship type or connection number, etc. For example, sorting can be performed according to node type, but in the same node type, different fields cannot be sorted in detail. Sorting can also be performed according to relationship type, but in the case of multiple relationships, different fields cannot be sorted flexibly. In addition, the existing methods are also limited in sorting multiple relationships between nodes, and lack comprehensive sorting strategies.
[0004] In summary, the existing technology has the following shortcomings or deficiencies:
[0005] 1. Lack of comprehensive sorting strategy; the existing methods mainly focus on single-angle sorting, cannot flexibly combine multiple sorting rules for sorting, and cannot meet the complex sorting requirements in different application scenarios.
[0006] 2. Lack of field-level sorting; the existing methods cannot sort different fields in node type or relationship type sorting, cannot sort according to field values, and limit the flexibility and accuracy of sorting.
[0007] 3. Lack of sorting of multiple relationships; the existing methods are limited in sorting multiple relationships between nodes, cannot sort fields of different relationship types comprehensively, and lack comprehensive sorting strategies.
[0008] In order to solve the above technical problems, the present application provides a knowledge graph entity and relationship based sorting method, device and computer readable storage medium, which comprehensively considers different angles of nodes and relationships, supports field-level sorting, sorts multiple relationships at the same time, and provides more flexible and accurate graph display results. SUMMARY
[0009] The application provides a knowledge graph entity and relation-based sorting method, device and computer readable storage medium, which comprehensively considers different angles of nodes and relations, supports field-level sorting, simultaneously sorts multiple relations, and provides more flexible and accurate graph display results.
[0010] Embodiments of the first aspect of the application provide a knowledge graph entity and relation-based sorting method, including the following steps: obtaining sorting rules and graph node relation data; converting the graph node relation data into a tree data structure; sorting the nodes in each array in the tree data structure; parsing the node array to be sorted into a corresponding weight array according to the sorting rules; taking the top N nodes as TOPN nodes according to the sorting rules and the weight array; counting the unsorted or unshown nodes as remaining nodes, and sorting or showing the remaining nodes according to the sorting rules and the corresponding weight array until all nodes are sorted or shown according to the sorting rules.
[0011] Preferably, the sorting rules are to sort and show the nodes according to the angles of the nodes or relations.
[0012] Preferably, when the nodes are sorted and shown according to the angles of the nodes, the specific sorting rules are as follows: sorting according to the node type; after selecting the node type, adjusting the priority by dragging; sorting the nodes of the same type according to the fields; each type of node can be configured with multiple fields, each field can be configured with ascending or descending order, and if the values of the configured fields are the same, the next configured field is sorted according to the values; only the TOPN nodes of each type are sorted; configuring the number of TOPN nodes, and the nodes whose sorting number exceeds N are sorted behind other sibling nodes.
[0013] Preferably, when the nodes are sorted and shown according to the angles of the relations, the specific sorting rules are as follows: sorting according to the relation type; after selecting the relation type, adjusting the priority by dragging; sorting the relations of the same type according to the fields; each type of relation can be configured with multiple fields, each field can be configured with ascending or descending order, and if the values of the configured fields are the same, the next configured field is sorted according to the values; if there are multiple relations between parent and child nodes, if there are multiple relations of the same type, the field values are by default sorted according to the maximum values of the relations, or configured to be sorted according to the minimum values or the average values; only the TOPN nodes of each type are sorted; configuring the number of TOPN nodes, and the nodes whose sorting number exceeds N are sorted behind other sibling nodes; if there are multiple relations between parent and child nodes, if there are different types of relations, and the node is not sorted into the TOPN, the node will participate in the TOPN sorting of another type with a priority of the next level, until the last.
[0014] Preferably, the nodes are sorted and shown according to the number of connections, and the number of connections refers to the number of relations between parent and child nodes.
[0015] Preferably, the sorting rule is to sort and display multiple relationships between two points.
[0016] Preferably, the multiple relationships between two points are sorted and displayed according to the angle of the relationship, and the specific sorting rule is as follows: sorting according to the relationship type; after selecting the relationship type, dragging to adjust the priority; sorting the same type of relationship according to the field; each type can be configured with multiple fields, and each field can be individually configured to be in ascending order or descending order, and if the values of the configured fields are the same, the next field configured is sorted.
[0017] Preferably, the tree data structure is in the format of children, and the corresponding array is the children array.
[0018] The embodiment of the second aspect of the application also provides a knowledge graph entity and relationship-based sorting device, which comprises a memory and a processor; wherein the memory is used to store executable program code; the processor is used to read the executable program code stored in the memory to execute the knowledge graph entity and relationship-based sorting method.
[0019] The embodiment of the third aspect of the application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the knowledge graph entity and relationship-based sorting method.
[0020] The knowledge graph entity and relationship-based sorting method, device and computer readable storage medium provided by the application comprehensively consider different angles of nodes and relationships, support field-level sorting, simultaneously sort multiple relationships, and provide more flexible and accurate graph display results.
[0021] Additional aspects and advantages of the application will become apparent in the light of the following description, or will be learned by practice of the application. BRIEF DESCRIPTION OF DRAWINGS
[0022] The above and / or additional aspects and advantages of the application will become apparent and be readily understood by a person of ordinary skill in the art from the following description, taken in conjunction with the accompanying drawings in which:
[0023] Figure 1 A flowchart of the knowledge graph entity and relationship-based sorting method according to an embodiment of the application is shown;
[0024] Figure 2 is a structural diagram of one embodiment of the knowledge graph entity and relationship-based sorting device of the present specification;
[0025] Figure 3 is a structural diagram of one embodiment of the computer readable storage medium of the knowledge graph entity and relationship-based sorting method of the present specification. DETAILED DESCRIPTION
[0026] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the following further describes the present application in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0027] In the following description, a large number of specific details are set forth in order to facilitate a thorough understanding of the present application, however, the present application can also be implemented in other manners different from those described herein, and therefore, the protective scope of the present application is not limited by the specific embodiments disclosed below.
[0028] The following discussion provides a number of embodiments of the present application. Although each embodiment represents a single combination of the application, different embodiments of the present application can be replaced or combined, and therefore the present application can also be considered to include all possible combinations of the same and / or different embodiments described. Thus, if one embodiment includes A, B, and C, and another embodiment includes a combination of B and D, the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, even if the embodiment is not explicitly described in the following content.
[0029] Figure 1 A flowchart of a knowledge graph entity and relationship-based sorting method according to an embodiment of the present application is shown. As shown in Figure 1 The knowledge graph entity and relationship-based sorting method includes the following steps: obtaining sorting rules and graph node relationship data; converting the graph node relationship data into a children format tree data structure; sorting the nodes in each children array in the tree data structure; parsing the node array to be sorted into a corresponding weight array according to the sorting rules, for example, for node type sorting, mapping the node type into a corresponding weight value, and for multi-dimensional combination sorting, setting the weight array according to the priority, with the highest priority being the first item in the array; using heap sorting to take TOPN according to the sorting rules, and according to the sorting rules and the weight array, using the heap sorting algorithm to take the top N nodes as the TOPN nodes; counting the unsorted or unshown nodes as the remaining nodes, and sorting or showing the remaining nodes according to the sorting rules and the corresponding weight array, until all nodes are sorted or shown according to the sorting rules.
[0030] In a specific operation process, first, the atlas node relationship data is acquired, and the atlas node relationship data is converted into a tree data structure, and a breadth-first traversal is performed on the tree structure data. If the breadth-first traversal is completed, the process is ended; if the breadth-first traversal is not completed, the nodes in each array in the tree data structure are sorted, the node array (sibling node) to be sorted is parsed into a corresponding weight array according to the sorting rule, the top N nodes are taken out as TOPN nodes according to the sorting rule and the weight array, and it is judged whether the sorting is completed. If the sorting is completed, return to the breadth-first traversal completion judgment link; if the sorting is not completed, the nodes that are not sorted or not displayed are counted as remaining nodes, and the remaining nodes are sorted or displayed according to the sorting rule and the corresponding weight array, until all nodes are sorted or displayed according to the sorting rule.
[0031] The sorting method based on knowledge graph entities and relationships provided by the embodiment of the application sorts nodes and relationships on the graph in a layout with tree-like hierarchical relationships. The sorting method solves the problem of difficulty in sorting sibling nodes and relationships between two nodes in traditional layouts such as radial layout and tree layout, and solves the technical problem of sorting nodes and relationships in a knowledge graph by designing a sorting function module, thereby improving the readability and understandability of graph display.
[0032] The sorting method based on knowledge graph entities and relationships provided by the embodiment of the application has the following advantages: (1) multi-dimensional sorting: the embodiment of the application provides a function of sorting and displaying nodes according to the angle of nodes or relationships, and supports multi-dimensional sorting rules, including node type, field value, relationship type, etc., thereby enabling more flexible sorting; (2) flexible configuration: the embodiment of the application allows users to configure sorting rules according to actual needs, including node type, field sorting, TOPN number, etc., thereby enabling sorting strategies to be customized according to different scenarios and needs; (3) high efficiency: the embodiment of the application uses a heap sorting algorithm to sort node arrays and supports TOPN sorting, which can efficiently process large-scale node data and improve the speed and efficiency of sorting; (4) support for multiple relationship sorting: the embodiment of the application supports sorting and displaying multiple relationships between two points, thereby better displaying the associativity between nodes and providing more comprehensive sorting results; (5) applicable to knowledge graphs: the embodiment of the application sorts based on knowledge graph entities and relationships, which can be widely applied to the field of knowledge graphs, including search engines, information extraction, knowledge graph visualization, etc., thereby improving the display and application value of knowledge graphs.
[0033] In the sorting method based on knowledge graph entities and relations provided by the embodiment of the present application, the sorting rule is to sort and display nodes from the perspective of nodes or relations. When the nodes are sorted and displayed from the perspective of nodes, the specific sorting rule is as follows: sort by node type; after checking the node type, drag to adjust the priority; sort the nodes of the same type by field; each type can be configured with multiple fields, each field can be configured with ascending or descending order, and if the values of the configured fields are the same, the next field configured is sorted; only the top N nodes of each type are sorted; the number of TOPN nodes is configured, and the nodes whose number exceeds N are sorted behind other sibling nodes. When the nodes are sorted and displayed from the perspective of relations, the perspective of relations refers to the relationship information of parent and child nodes, which is used to sort the sibling nodes of the same parent node, and the specific sorting rule is as follows: sort by relation type; after checking the relation type, drag to adjust the priority; sort the relations of the same type by field; each type can be configured with multiple fields, each field can be configured with ascending or descending order, and if the values of the configured fields are the same, the next field configured is sorted; if there are multiple relations between parent and child nodes, if there are multiple relations of the same type, the field values are sorted by the maximum value of the relations, or configured to be sorted by the minimum value or the average value; only the top N nodes of each type are sorted; the number of TOPN nodes is configured, and the nodes whose number exceeds N are sorted behind other sibling nodes; if there are multiple relations between parent and child nodes, if there are different types of relations, and the node is not sorted into TOPN, the node will participate in the TOPN sorting of another type with the priority of the next type, until the last. The nodes can also be sorted and displayed according to the number of connections, which refers to the number of relations between parent and child nodes; whether to prioritize sorting by the number of connections can be configured, that is, the priority is above the sorting method of the nodes or relations from the perspective of the nodes or relations, if the sorting by the number of connections is not configured, the number of connections is sorted as the lowest priority field sorting rule of each type by default.
[0034] In a preferred embodiment of the present application, the sorting rule is to sort and display multiple relations between two points. The multiple relations between two points are sorted and displayed from the perspective of relations, and the specific sorting rule is as follows: sort by relation type; after checking the relation type, drag to adjust the priority; sort the relations of the same type by field; each type can be configured with multiple fields, each field can be configured with ascending or descending order, and if the values of the configured fields are the same, the next field configured is sorted.
[0035] The sorting method based on knowledge graph entities and relations provided by the embodiment has the following advantages: 1. Flexible sorting configuration and adjustment, allowing users to customize sorting rules according to specific application scenarios and needs, including node type, field sorting, TOPN sorting, etc. This flexibility makes the sorting method adaptable to different application scenarios and sorting needs, with strong practicality and adaptability; 2. Multi-dimensional sorting, the embodiment supports sorting according to nodes and relationships, and can consider multiple sorting dimensions at the same time, so as to fully utilize the diversified information in the knowledge graph and provide more fine-grained and accurate sorting results. This multi-dimensional sorting capability makes the sorting results more comprehensive and comprehensive, better meeting the sorting needs of users; 3. Efficient sorting algorithm, the embodiment adopts a heap sorting algorithm with high sorting efficiency, which can quickly obtain sorting results when processing large-scale knowledge graphs, improving user experience. This efficiency makes the sorting method adaptable to large-scale data processing needs, with strong practical application value; 4. Support for sorting multiple relationships between two points, the embodiment also supports sorting multiple relationships between two points, so as to better display the relationships between nodes and provide more rich sorting display methods. This ability to support sorting multiple relationships makes the sorting method more flexible and comprehensive when dealing with knowledge graphs with complex node relationships.
[0036] In the embodiment, a heap sorting algorithm is used, but in actual application, other sorting algorithms can also be considered, such as quicksort, merge sort, and insertion sort. These sorting algorithms may have different sorting effects and performance in different scenarios and data sizes. In the current scenario, sorting TOPN for multiple sorting under large data volume, the performance of heap sorting is the best and most suitable. In the embodiment, a tree structure sorting strategy of nodes and relationships is used, but other sorting strategies can also be considered, such as network structure-based sorting strategy and time axis-based sorting strategy. In the embodiment, sorting multiple relationships between two points is supported, but other sorting display methods can also be considered, such as graphical sorting display and time axis-based sorting display. These different sorting display methods may have different effects on user experience and sorting results.
[0037] Figure 2 is a structural diagram of an embodiment of the sorting device based on knowledge graph entities and relationships of the present specification. The following refers to Figure 2FIG. 1 shows a structural diagram of an electronic device 300 according to an embodiment of the present disclosure. The electronic device 300 can be a device of a type suitable for implementing the knowledge graph entity and relation based ranking device 300 according to an embodiment of the present disclosure. The electronic device in the present disclosure can include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet Personal Computer), a PMP (Portable Multimedia Player), a car terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. Figure 2 The electronic device shown is merely an example and should not impose any limitation on the functions and use range of the present disclosure.
[0038] As shown, the electronic device 300 can include a processing device (e.g., a central processing unit, a graphic processing unit, etc.) 301 that can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 302 or loaded into a random access memory (RAM) 303 from a storage device 308. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304. Figure 2 Generally, the following devices can be connected to the I / O interface 305: an input device 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, and the like; an output device 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, and the like; a storage device 308 including, for example, a magnetic tape, a hard disk, and the like; and a communication device 309. The communication device 309 can allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although
[0039] The electronic device 300 is shown with various devices, but it is understood that all of the shown devices are not required to be implemented or provided. More or fewer devices can alternatively be implemented or provided. Figure 2
[0040] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present disclosure. For example, an embodiment of the present disclosure includes a computer program product including a computer program carried on a computer readable medium, the computer program containing program code for executing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network through the communication device 309, or installed from the storage device 308, or installed from the ROM 302. When the computer program is executed by the processing device 301, the above-described functions defined in the methods of the present disclosure are performed.
[0041] Figure 3 is a structural diagram of one embodiment of a computer-readable storage medium of the knowledge graph entity and relation based ranking method of the present specification. As shown in Figure 3 The computer-readable storage medium 40 according to the embodiments of the present disclosure has non-transitory computer-readable instructions 41 stored thereon. When the non-transitory computer-readable instructions 41 are run by a processor, all or part of the steps of the knowledge graph entity and relation based ranking method of the embodiments of the present disclosure described above are performed.
[0042] It should be noted that the computer-readable medium of the present disclosure described above can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or component. In the present disclosure, the computer-readable signal medium can include a data signal carried in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or component. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to a wire, a cable, an RF (radio frequency) or the like, or any suitable combination thereof.
[0043] The computer-readable medium described above can be included in the electronic device described above; or can exist separately and not be assembled into the electronic device.
[0044] The computer readable medium carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to: construct a basic page, a page code of the basic page is used to build an environment required for running of the business page and / or implement a same workflow abstracted in a same business scenario; construct one or more page templates, the page templates are used to provide a code template for implementing a business function in the business scenario; generate a final page code of each page of the business scenario based on a specific function code of each page of the business scenario and a corresponding page template; and merge the final page code of each page into the page code of the basic page to generate a code of the business page.
[0045] Alternatively, the computer readable medium carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to: construct a basic page, a page code of the basic page is used to build an environment required for running of the business page and / or implement a same workflow abstracted in a same business scenario; construct one or more page templates, the page templates are used to provide a code template for implementing a business function in the business scenario; generate a final page code of each page of the business scenario based on a specific function code of each page of the business scenario and a corresponding page template; and merge the final page code of each page into the page code of the basic page to generate a code of the business page.
[0046] Computer program code for carrying out operations of the present disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0047] The flow and block diagrams in the drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow and block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may be executed in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0048] The units described in the embodiments of the present disclosure can be implemented by software or by hardware. In some cases, the names of the units do not limit the units themselves.
[0049] The knowledge graph entity and relationship-based sorting method, device and computer readable storage medium provided by the application comprehensively consider different angles of nodes and relationships, support field-level sorting, simultaneously sort multiple relationships, and provide more flexible and accurate graph display results.
[0050] In the present application, the terms "first", "second", "third" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance; the term "multiple" refers to two or more, unless otherwise explicitly limited. The terms "mounting", "connecting", "connecting", "fixing" and the like should be broadly understood, for example, "connecting" can be fixed connection, can also be detachable connection, or integral connection; "connected" can be directly connected, or indirectly connected through an intermediate medium. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0051] In the description of the present application, it should be understood that the positions or location relationships indicated by the terms "upper", "lower" and the like are based on the positions or location relationships shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or units referred to must have a particular direction, be constructed and operated in a particular position, therefore, cannot be understood as a limitation on the present application.
[0052] In the description of the specification, the description of the terms "one embodiment", "some embodiments", "certain embodiments" and the like is intended to indicate that the described implementation, feature, structure, material or characteristic is included in at least one embodiment or example of the present application. The illustrative representations of the above terms in the specification are not necessarily referring to the same embodiment or example. Moreover, the described specific features, structures, materials or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0053] The above merely provides some embodiments of the present application, but is not intended to limit the present application. The present application can have various modifications and changes for those skilled in the art. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A ranking method based on entities and relations in a knowledge graph, characterized in that, Includes the following steps: Obtain the sorting rules and graph node relationship data; The graph node relationship data is converted into a tree-like data structure; Sort the nodes in each array of the tree data structure; The array of nodes to be sorted is parsed into a corresponding weight array according to the sorting rules. Based on the sorting rules and the weight array, the top N nodes are selected as the TOPN nodes; Unsorted or undisplayed nodes are counted as remaining nodes. The remaining nodes are sorted or displayed according to the sorting rules and the corresponding weight array until all nodes are sorted or displayed according to the sorting rules, wherein the sorting rules are based on the nodes or relationships. When you choose to sort and display nodes based on their perspective, the specific sorting rules are as follows: Sort by node type; after selecting the node type, drag to adjust the priority; Nodes of the same type are sorted by field; each type can be configured with multiple fields, and each field can be configured for ascending or descending order. If the values of the configured fields are the same, they are sorted by the next configured field. Only the top N nodes are sorted for each type; configure the number of top N nodes, and nodes with a sort count exceeding N are placed after their sibling nodes. When choosing to sort and display nodes based on their relationships, the specific sorting rules are as follows: Sort by relation type; after selecting the relation types, drag to adjust the priority; Relationships of the same type are sorted by field; each type can be configured with multiple fields, and each field can be configured for ascending or descending order. If the values of the configured fields are the same, they are sorted by the next configured field; if there are multiple relationships between parent and child nodes, if there are multiple relationships of the same type, the field values are sorted by the maximum value of these relationships by default, or configured to be sorted by the minimum value or by the average value. Only TOPN nodes are sorted for each type; configure the number of TOPN nodes, and nodes with more than N sorted nodes are sorted after their sibling nodes; if there are multiple relationships between parent and child nodes, and if there are different types of relationships, and the node is not sorted in TOPN, then the node will participate in the TOPN sorting of another type with the next lower priority, until it is sorted to the end.
2. The ranking method based on knowledge graph entities and relations according to claim 1, characterized in that, The nodes are sorted and displayed according to the number of connections, where the number of connections refers to the number of relationships between parent and child nodes.
3. The ranking method based on knowledge graph entities and relations according to claim 1, characterized in that, The sorting rule is used to sort and display multiple relationships between two points.
4. The ranking method based on knowledge graph entities and relations according to claim 3, characterized in that, The multiple relationships between two points are sorted and displayed according to the relationship between them. The specific sorting rules are as follows: Sort by relation type; after selecting the relation types, drag to adjust the priority; Relationships of the same type are sorted by field; each type can be configured with multiple fields, and each field can be configured for ascending or descending order. If the values of the configured fields are the same, they are sorted by the next configured field.
5. The ranking method based on knowledge graph entities and relations according to any one of claims 1-4, characterized in that, The tree-like data structure is in children format, and the corresponding array is the children array.
6. A sorting device based on knowledge graph entities and relations, comprising a memory and a processor; wherein, The memory is used to store executable program code; The processor is used to read executable program code stored in the memory to execute the sorting method based on knowledge graph entities and relations according to any one of claims 1-5.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the sorting method based on knowledge graph entities and relations as described in any one of claims 1-5.
Citation Information
Patent Citations
Weighted node layering in graph drawing
US20180167289A1