CN112749282A - Knowledge graph display method, device, equipment and storage medium - Google Patents

Knowledge graph display method, device, equipment and storage medium Download PDF

Info

Publication number
CN112749282A
CN112749282A CN201911052276.3A CN201911052276A CN112749282A CN 112749282 A CN112749282 A CN 112749282A CN 201911052276 A CN201911052276 A CN 201911052276A CN 112749282 A CN112749282 A CN 112749282A
Authority
CN
China
Prior art keywords
node
dragging
knowledge
knowledge graph
graph
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911052276.3A
Other languages
Chinese (zh)
Inventor
厉宗梅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201911052276.3A priority Critical patent/CN112749282A/en
Publication of CN112749282A publication Critical patent/CN112749282A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour

Abstract

The application discloses a method, a device, equipment and a storage medium for displaying a knowledge graph, and belongs to the technical field of computers. The method comprises the following steps: when a target node in a knowledge graph is dragged, acquiring real-time coordinates of each node in the knowledge graph; when the target node is detected to stop dragging, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when dragging is stopped, and displaying the knowledge graph according to the final position of each node in the knowledge graph. The technical scheme provided by the embodiment of the application can solve the problems of complex operation and low flexibility to a certain extent.

Description

Knowledge graph display method, device, equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for displaying a knowledge graph.
Background
A knowledge graph is a topological graph used for showing the association relationship among a plurality of entities. In general, a knowledge-graph may include a plurality of nodes, each node representing an entity, and lines connecting the nodes representing associations between the entities.
When the knowledge graph comprises a plurality of nodes, the nodes in the knowledge graph and the lines connecting the nodes may overlap with each other, and in order to clearly observe each node and each line in the knowledge graph, a user may drag the nodes in the knowledge graph to pull apart the nodes and the lines which overlap with each other.
However, in the related art, after the dragging is finished, the nodes and lines in the knowledge graph can be rebounded to the original positions, so that the user needs to frequently drag the nodes in the knowledge graph to ensure that each node and each line in the knowledge graph can be clearly observed, and the problems of complex operation and low flexibility are caused.
Disclosure of Invention
Therefore, it is necessary to provide a method, an apparatus, a device and a storage medium for displaying a knowledge graph, aiming at the problems of complicated operation and low flexibility in the prior art.
In a first aspect, a method for displaying a knowledge graph is provided, and the method includes:
when a target node in the knowledge graph is dragged, acquiring real-time coordinates of each node in the knowledge graph; when the target node is detected to stop dragging, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when dragging is stopped; and displaying the knowledge graph according to the final position of each node in the knowledge graph.
In one embodiment, when a target node in a knowledge graph is dragged, before acquiring real-time coordinates of each node in the knowledge graph, the method includes:
when the clicking operation on the target node is detected, judging whether a dragging event exists at present; if the drag event does not exist currently, dragging the target node according to the movement of the mouse.
In one embodiment, obtaining real-time coordinates of each node in the knowledge-graph comprises:
when the drag mode of the target node is a single-node drag mode, acquiring real-time coordinates of the target node according to a movement track of a mouse when the target node is dragged, and determining original coordinates of other nodes except the target node in the knowledge graph as the real-time coordinates of the other nodes; the single-node dragging mode is a dragging mode in which only a single node moves and other nodes do not move during dragging.
In one embodiment, obtaining real-time coordinates of each node in the knowledge-graph comprises:
when the drag mode of the target node is a map drag mode, acquiring the real-time coordinates of the target node according to the movement track of a mouse when the target node is dragged, and acquiring the real-time coordinates of other nodes except the target node in the knowledge map according to the real-time coordinates of the target node; the map dragging mode is a dragging mode in which each node in the knowledge map moves during dragging.
In one embodiment, the determining from the real-time coordinates of each node in the knowledge-graph when the dragging is stopped comprises:
and determining the real-time coordinates of each node in the knowledge graph when the dragging is stopped as the final position of each node in the knowledge graph.
In one embodiment, when it is detected that the target node stops dragging, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when dragging is stopped includes:
judging whether a dragging event exists at present; and if the dragging event does not exist at present, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph.
In one embodiment, when a target node in a knowledge graph is dragged, acquiring real-time coordinates of each node in the knowledge graph includes:
restarting the force simulator of D3.js when dragging the target node; and in the process of dragging the target node, acquiring real-time coordinates of each node in the knowledge graph by using the force simulator.
In a second aspect, there is provided a display device of knowledge-graph, the device comprising:
the acquisition module is used for acquiring real-time coordinates of each node in the knowledge graph when a target node in the knowledge graph is dragged;
the determining module is used for determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when the target node is detected to stop dragging;
and the display module is used for displaying the knowledge graph according to the final position of each node in the knowledge graph.
In one embodiment, the device further comprises a dragging module, wherein the dragging module is used for judging whether a dragging event exists currently or not when the clicking operation on the target node is detected; if the drag event does not exist currently, dragging the target node according to the movement of the mouse.
In one embodiment, the obtaining module is specifically configured to: when the drag mode of the target node is a single-node drag mode, acquiring real-time coordinates of the target node according to a movement track of a mouse when the target node is dragged, and determining original coordinates of other nodes except the target node in the knowledge graph as the real-time coordinates of the other nodes; the single-node dragging mode is a dragging mode in which only a single node moves and other nodes do not move during dragging.
In one embodiment, the obtaining module is specifically configured to: when the drag mode of the target node is a map drag mode, acquiring the real-time coordinates of the target node according to the movement track of a mouse when the target node is dragged, and acquiring the real-time coordinates of other nodes except the target node in the knowledge map according to the real-time coordinates of the target node; the map dragging mode is a dragging mode in which each node in the knowledge map moves during dragging.
In one embodiment, the determining module is specifically configured to: and determining the real-time coordinates of each node in the knowledge graph when the dragging is stopped as the final position of each node in the knowledge graph.
In one embodiment, the determining module is specifically configured to: judging whether a dragging event exists at present; and if the dragging event does not exist at present, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph.
In one embodiment, the obtaining module is specifically configured to: restarting the force simulator of D3.js when dragging the target node; and in the process of dragging the target node, acquiring real-time coordinates of each node in the knowledge graph by using the force simulator.
In a third aspect, a computer device is provided, which includes a memory and a processor, the memory stores a computer program, and the computer program is executed by the processor to implement the method for displaying a knowledge-graph according to any one of the first aspect.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor, implements the method for displaying a knowledge-graph according to any one of the first aspect.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
the method comprises the steps of obtaining real-time coordinates of each node in a knowledge graph when a target node in the knowledge graph is dragged, then determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when the dragging is stopped when the target node is detected to be dragged, and displaying the knowledge graph according to the final position of each node in the knowledge graph.
Drawings
FIG. 1 is a schematic diagram of a knowledge-graph;
FIG. 2 is a flowchart of a method for displaying a knowledge-graph according to an embodiment of the present disclosure;
FIG. 3 is a flow chart of another method for displaying a knowledge-graph provided in an embodiment of the present application;
FIG. 4 is a flow chart of another method for displaying a knowledge-graph provided in an embodiment of the present application;
FIG. 5 is a block diagram of a knowledge-graph displaying apparatus provided in an embodiment of the present application;
FIG. 6 is a block diagram of another knowledge-graph displaying apparatus provided by an embodiment of the present application;
fig. 7 is a block diagram of a computer device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
A knowledge graph is a topological graph used for showing the association relationship among a plurality of entities. Fig. 1 is a schematic diagram of an exemplary knowledge graph, which may include a plurality of nodes (circles are nodes in fig. 1) and lines connecting the nodes (lines connecting the circles in fig. 1), as shown in fig. 1, where the nodes in the knowledge graph may represent one entity, for example, node a in fig. 1 may represent an entity of "intelligent document generation", and the lines in the knowledge graph may represent associations between the entities.
Although the knowledge graph shown in fig. 1 includes a small number of nodes, in practical applications, the number of nodes included in the knowledge graph may be very large, in which case, the nodes in the knowledge graph and the lines connecting the nodes may overlap, and in the case of the overlap, the nodes and the lines in the knowledge graph may not be clearly observed by the user. To facilitate viewing, typically, a user may drag nodes in the knowledge-graph to pull apart nodes and lines that overlap each other.
However, in the related art, after the dragging is finished, the nodes and lines in the knowledge graph can be rebounded to the original positions, so that the nodes and lines in the knowledge graph are restored to the overlapped state, and thus, a user needs to frequently drag the nodes in the knowledge graph to ensure that each node and each line in the knowledge graph can be clearly observed, and the problems of complex operation and low flexibility are caused.
In view of the above problems, an embodiment of the present application provides a method for displaying a knowledge graph, which can be applied to a terminal, where the terminal can be installed with d3.js, where the english of d3.js is called Data-drive Document, and translated into chinese as a Data-Driven Document, which is a JavaScript function library and mainly provides a Data visualization function, and the method for displaying a knowledge graph provided by the embodiment of the present application can be implemented depending on d3. js.
Please refer to fig. 2, which shows a flowchart of a method for displaying a knowledge graph according to an embodiment of the present application, and the method for displaying a knowledge graph can be applied to the terminal described above. As shown in fig. 2, the method for displaying the knowledge graph may include the following steps:
step 201, when a target node in the knowledge graph is dragged, the terminal acquires real-time coordinates of each node in the knowledge graph.
The target node refers to any node in the knowledge graph, and dragging the target node refers to an operation of controlling the target node to move according to the movement track of the mouse.
In an embodiment of the application, a drag mode for a target node may be a single-node drag mode or a graph drag mode. As the name suggests, the single-node dragging mode refers to a dragging mode in which only a single node moves and other nodes do not move during dragging, and the map dragging mode refers to a dragging mode in which each node in a knowledge map moves during dragging.
Referring to fig. 1, assuming that a target node is a node a, if a drag mode of the target node is a single-node drag mode, only the node a moves while other nodes do not move when the target node (that is, the node a) is dragged, and if the drag mode of the target node is a graph drag mode, not only the node a moves but also other nodes move along with the movement of the node a when the target node (that is, the node a) is dragged.
Optionally, when the drag mode of the target node is the single-node drag mode, the terminal may obtain the real-time coordinates of the target node according to the movement track of the mouse when the target node is dragged, and determine the original coordinates of each of the other nodes except the target node in the knowledge graph as the real-time coordinates of each of the other nodes.
It should be noted that the "original coordinates" referred to herein refer to the coordinates of the node before the drag.
Optionally, when the drag mode of the target node is the map drag mode, the terminal may obtain the real-time coordinates of the target node according to the movement track of the mouse when the target node is dragged, and since the other nodes in the knowledge map except the target node move along with the target node in the map drag mode, the real-time coordinates of the other nodes in the knowledge map except the target node may be obtained according to the real-time coordinates of the target node.
Optionally, when a target node in the knowledge graph is dragged, the terminal may restart the force simulator of d3.js, and during the process of dragging the target node, the terminal may obtain real-time coordinates of each node in the knowledge graph by using the force simulator.
The force simulator (english: simulation) of d3.js is a functional module capable of simulating a force (for example, a drag force) in d3. js.
Optionally, in step 201, the force simulator may be restarted by using a function of magnitude, alphatarget (a). restart (), where a in this function is an attenuation coefficient, the higher the value of the attenuation coefficient, the faster the target node moves, and the attenuation coefficient is continuously decreased during the movement of the target node, and when the attenuation coefficient is decreased to a certain value, the target node stops moving. In the embodiment of the present application, a in the simulation alphatarget (a) restart () function may be set to a random value between 0 and 1, for example, a may be set to 0.3.
Meanwhile, the coordinates of each node in the knowledge graph when the target node starts to be dragged can be assigned to fx and fy in the force simulator to serve as initial values of the force simulator.
Optionally, in this embodiment of the application, the moving position of the mouse may be obtained by using a d3.event.x function and a d3.event.y function in the force simulator, and meanwhile, the coordinates of each node in the knowledge graph may be assigned according to the moving position of the mouse, so that each node in the knowledge graph moves along with the movement of the mouse, which is a dragging process. The function of d3.event.x can obtain the abscissa when the mouse moves, and the function of d3.event.y can obtain the ordinate when the mouse moves.
Since the coordinates of each node in the knowledge graph can be assigned according to the movement position of the mouse, the coordinates of each node in the knowledge graph on the x axis can be acquired through the d3.event.
Step 202, when the target node is detected to stop dragging, the terminal determines the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when dragging is stopped.
Optionally, when it is detected that the target node stops being dragged, that is, when it is detected that the mouse is released, the embodiment of the present application may set the random value a in the relation of similarity.
When all the nodes in the knowledge graph stop moving, implementation coordinates of all the nodes in the knowledge graph in the force simulator are not emptied, real-time coordinates of all the nodes in the knowledge graph when the movement stops are obtained, and the final positions of all the nodes in the knowledge graph are determined according to the real-time coordinates of all the nodes in the knowledge graph when the movement stops. Optionally, when it is detected that the target node stops being dragged, the terminal may determine the real-time coordinates of each node in the knowledge graph when the dragging stops as the final position of each node in the knowledge graph.
And step 203, the terminal displays the knowledge graph according to the final position of each node in the knowledge graph.
In the method for displaying the knowledge graph provided by the embodiment of the application, when the target node in the knowledge graph is dragged, the real-time coordinates of each node in the knowledge graph are obtained, and then, when the target node is detected to stop dragging, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when the dragging is stopped, displaying the knowledge graph according to the final position of each node in the knowledge graph, because in the technical solution provided by the embodiment of the present application, the knowledge graph can be displayed according to the final position of each node in the indication graph at the end of the dragging, that is, after the dragging is finished, the nodes and lines in the knowledge graph cannot rebound to the original positions, and therefore the user does not need to frequently drag the nodes in the knowledge graph, the operation process can be simplified, and the flexibility of knowledge graph display is improved.
Please refer to fig. 3, which shows a flowchart of another method for displaying a knowledge graph according to an embodiment of the present application, and the method for displaying a knowledge graph can be applied to the terminal described above. As shown in fig. 3, on the basis of the above-mentioned embodiment, the method for displaying a knowledge graph may further include the following steps:
step 301, when the click operation on the target node is detected, the terminal judges whether a drag event exists at present.
Optionally, in an embodiment of the present application, the terminal may determine whether a drag event currently exists through a d3.event.
In d3.js, only one drag event is allowed at a time, and therefore, when a click operation on a target node is detected, that is, when a drag action is ready to start, whether a drag event exists at present can be determined by the d3.event.active function in d3. js. Wherein, when the value of the d3.event. active function is 0, that is, when! And when the function of d3.event. active is true, the current drag event does not exist, otherwise, the current drag event exists.
And 302, if the dragging event does not exist currently, dragging the target node according to the movement of the mouse.
If there is no drag event currently, the target node may be dragged, and the technical process of step 201 may be performed. If a drag event exists currently, the target node needs to be dragged until the current drag event is finished, and the technical process of step 201 is executed.
Please refer to fig. 4, which shows a flowchart of another method for displaying a knowledge graph according to an embodiment of the present application, and the method for displaying a knowledge graph can be applied to the terminal described above. As shown in fig. 4, on the basis of the above-mentioned embodiment, step 202 can be implemented by the following technical process:
step 401, the terminal judges whether a drag event exists currently.
Optionally, the terminal may determine whether there is a drag event currently through a d3.event.active function in the d3.js, as described above, when a value of the d3.event.active function is 0, that is, when! And when the function of d3.event. active is true, the current drag event does not exist, otherwise, the current drag event exists.
Step 402, if no drag event exists at present, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph.
If the dragging event does not exist at present, the target node is indicated to be stopped being dragged, at the moment, the final position of each node in the knowledge graph can be determined according to the real-time coordinates of each node in the knowledge graph when dragging is stopped, and the knowledge graph can be displayed according to the final position of each node in the knowledge graph.
Referring to fig. 5, a block diagram of an apparatus 500 for displaying a knowledge graph according to an embodiment of the present application is shown, where the apparatus 500 for displaying a knowledge graph can be configured in the terminal described above. As shown in fig. 5, the knowledge-graph displaying apparatus 500 may include: an acquisition module 501, a determination module 502 and a presentation module 503.
The obtaining module 501 is configured to obtain real-time coordinates of each node in the knowledge graph when a target node in the knowledge graph is dragged.
The determining module 502 is configured to determine, when it is detected that the target node stops dragging, a final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when dragging is stopped.
The display module 503 is configured to display the knowledge-graph according to the final position of each node in the knowledge-graph.
In an embodiment of the present application, the obtaining module 501 is specifically configured to: when the drag mode of the target node is a single-node drag mode, acquiring real-time coordinates of the target node according to a movement track of a mouse when the target node is dragged, and determining original coordinates of other nodes except the target node in the knowledge graph as the real-time coordinates of the other nodes; the single-node dragging mode is a dragging mode in which only a single node moves and other nodes do not move during dragging.
In an embodiment of the present application, the obtaining module 501 is specifically configured to: when the drag mode of the target node is a map drag mode, acquiring the real-time coordinates of the target node according to the movement track of a mouse when the target node is dragged, and acquiring the real-time coordinates of other nodes except the target node in the knowledge map according to the real-time coordinates of the target node; the map dragging mode is a dragging mode in which each node in the knowledge map moves during dragging.
In an embodiment of the present application, the determining module 502 is specifically configured to: and determining the real-time coordinates of each node in the knowledge graph when the dragging is stopped as the final position of each node in the knowledge graph.
In an embodiment of the present application, the determining module 502 is specifically configured to: judging whether a dragging event exists at present; and if the dragging event does not exist at present, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph.
In an embodiment of the present application, the obtaining module 501 is specifically configured to: restarting the force simulator of D3.js when dragging the target node; and in the process of dragging the target node, acquiring real-time coordinates of each node in the knowledge graph by using the force simulator.
Referring to fig. 6, another knowledge graph display apparatus 600 is provided in the embodiments of the present application, where the knowledge graph display apparatus 600 includes, in addition to the modules included in the knowledge graph display apparatus 500, optionally, the knowledge graph display apparatus 600 may further include a dragging module 504.
The dragging module 504 is configured to, when a click operation on the target node is detected, determine whether a dragging event exists at present; if the drag event does not exist currently, dragging the target node according to the movement of the mouse.
The display device of the knowledge graph provided by the embodiment of the application can realize the method embodiment, the realization principle and the technical effect are similar, and the details are not repeated.
For specific limitations of the knowledge graph display device, reference may be made to the above limitations on the display method of the knowledge graph, and details are not described here. The modules in the display device of the knowledge graph can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
Referring to fig. 7, the apparatus for displaying a knowledge graph may be a computer device, the computer device includes a processor 701, a memory 702, and a bus 703, the obtaining module, the determining module, the dragging module, the displaying module, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the knowledge graph is displayed by adjusting the kernel parameters.
An embodiment of the present invention provides a storage medium on which a program is stored, and the program implements the display method of the knowledge graph when executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the display method of the knowledge graph is executed when the program runs.
The embodiment of the invention provides equipment, which comprises at least one processor, at least one memory and a bus, wherein the memory and the bus are connected with the processor; the processor and the memory complete mutual communication through a bus; the processor is used for calling the program instructions in the memory so as to execute the display method of the knowledge graph. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
when a target node in the knowledge graph is dragged, acquiring real-time coordinates of each node in the knowledge graph; when the target node is detected to stop dragging, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when dragging is stopped; and displaying the knowledge graph according to the final position of each node in the knowledge graph.
When the clicking operation on the target node is detected, judging whether a dragging event exists at present; if the drag event does not exist currently, dragging the target node according to the movement of the mouse.
When the drag mode of the target node is a single-node drag mode, acquiring real-time coordinates of the target node according to a movement track of a mouse when the target node is dragged, and determining original coordinates of other nodes except the target node in the knowledge graph as the real-time coordinates of the other nodes; the single-node dragging mode is a dragging mode in which only a single node moves and other nodes do not move during dragging.
When the drag mode of the target node is a map drag mode, acquiring the real-time coordinates of the target node according to the movement track of a mouse when the target node is dragged, and acquiring the real-time coordinates of other nodes except the target node in the knowledge map according to the real-time coordinates of the target node; the map dragging mode is a dragging mode in which each node in the knowledge map moves during dragging.
And determining the real-time coordinates of each node in the knowledge graph when the dragging is stopped as the final position of each node in the knowledge graph.
Judging whether a dragging event exists at present; and if the dragging event does not exist at present, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph.
Restarting the force simulator of D3.js when dragging the target node; and in the process of dragging the target node, acquiring real-time coordinates of each node in the knowledge graph by using the force simulator.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for displaying a knowledge graph, the method comprising:
when a target node in a knowledge graph is dragged, acquiring real-time coordinates of each node in the knowledge graph;
when the target node is detected to stop dragging, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when dragging is stopped;
and displaying the knowledge graph according to the final position of each node in the knowledge graph.
2. The method of claim 1, wherein before obtaining real-time coordinates of each node in the knowledge-graph while dragging the target node in the knowledge-graph, the method comprises:
when the clicking operation on the target node is detected, judging whether a dragging event exists at present;
and if the current drag event does not exist, dragging the target node according to the movement of the mouse.
3. The method of claim 1, wherein the obtaining real-time coordinates of each node in the knowledge-graph comprises:
when the drag mode of the target node is a single-node drag mode, acquiring real-time coordinates of the target node according to a movement track of a mouse when the target node is dragged, and determining original coordinates of other nodes except the target node in the knowledge graph as the real-time coordinates of the other nodes;
the single-node dragging mode is a dragging mode in which only a single node moves and other nodes do not move during dragging.
4. The method of claim 1, wherein the obtaining real-time coordinates of each node in the knowledge-graph comprises:
when the dragging mode of the target node is a map dragging mode, acquiring real-time coordinates of the target node according to a moving track of a mouse when the target node is dragged, and acquiring real-time coordinates of other nodes except the target node in the knowledge map according to the real-time coordinates of the target node;
and the map dragging mode is a dragging mode in which each node in the knowledge map moves during dragging.
5. The method of claim 1, wherein determining the final position of each node in the knowledge-graph from the real-time coordinates of each node in the knowledge-graph at the time of stopping dragging comprises:
and determining the real-time coordinates of each node in the knowledge graph when the dragging is stopped as the final position of each node in the knowledge graph.
6. The method of claim 1, wherein determining the final position of each node in the knowledge-graph according to the real-time coordinates of each node in the knowledge-graph when the dragging of the target node is stopped is detected, and comprises:
judging whether a dragging event exists at present;
and if the dragging event does not exist at present, determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph.
7. The method of claim 1, wherein obtaining real-time coordinates of each node in the knowledge-graph while dragging a target node in the knowledge-graph comprises:
restarting the force simulator of D3.js when dragging the target node;
and in the process of dragging the target node, acquiring real-time coordinates of each node in the knowledge graph by using the force simulator.
8. An apparatus for displaying a knowledge graph, the apparatus comprising:
the acquisition module is used for acquiring real-time coordinates of each node in the knowledge graph when a target node in the knowledge graph is dragged;
the determining module is used for determining the final position of each node in the knowledge graph according to the real-time coordinates of each node in the knowledge graph when the target node is detected to stop dragging;
and the display module is used for displaying the knowledge graph according to the final position of each node in the knowledge graph.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the computer program, when executed by the processor, implements a method of displaying a knowledge-graph as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of displaying a knowledge-graph according to any one of claims 1 to 7.
CN201911052276.3A 2019-10-31 2019-10-31 Knowledge graph display method, device, equipment and storage medium Pending CN112749282A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911052276.3A CN112749282A (en) 2019-10-31 2019-10-31 Knowledge graph display method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911052276.3A CN112749282A (en) 2019-10-31 2019-10-31 Knowledge graph display method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112749282A true CN112749282A (en) 2021-05-04

Family

ID=75641406

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911052276.3A Pending CN112749282A (en) 2019-10-31 2019-10-31 Knowledge graph display method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112749282A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996440A (en) * 2022-07-19 2022-09-02 北京金堤科技有限公司 Map display method and device, storage medium and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101587438A (en) * 2009-06-18 2009-11-25 南京联创科技股份有限公司 Graphic process template method for drafting under the ARP framework
CN106648319A (en) * 2016-12-19 2017-05-10 广州视源电子科技股份有限公司 Operation method and apparatus used for mind map
CN107291802A (en) * 2017-05-12 2017-10-24 北京金堤科技有限公司 Relation map methods of exhibiting and device
US20180025093A1 (en) * 2016-07-21 2018-01-25 Ayasdi, Inc. Query capabilities of topological data analysis graphs
CN109189309A (en) * 2018-07-17 2019-01-11 小草数语(北京)科技有限公司 Map nodal operation method and apparatus
CN109446760A (en) * 2018-09-17 2019-03-08 江苏敏行信息技术有限公司 Electronic Signature localization method in a kind of webpage PDF
CN109508384A (en) * 2018-10-31 2019-03-22 北京国双科技有限公司 Processing method, device, storage medium and the processor of knowledge mapping

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101587438A (en) * 2009-06-18 2009-11-25 南京联创科技股份有限公司 Graphic process template method for drafting under the ARP framework
US20180025093A1 (en) * 2016-07-21 2018-01-25 Ayasdi, Inc. Query capabilities of topological data analysis graphs
CN106648319A (en) * 2016-12-19 2017-05-10 广州视源电子科技股份有限公司 Operation method and apparatus used for mind map
CN107291802A (en) * 2017-05-12 2017-10-24 北京金堤科技有限公司 Relation map methods of exhibiting and device
CN109189309A (en) * 2018-07-17 2019-01-11 小草数语(北京)科技有限公司 Map nodal operation method and apparatus
CN109446760A (en) * 2018-09-17 2019-03-08 江苏敏行信息技术有限公司 Electronic Signature localization method in a kind of webpage PDF
CN109508384A (en) * 2018-10-31 2019-03-22 北京国双科技有限公司 Processing method, device, storage medium and the processor of knowledge mapping

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
学王: "使用d3.js创建关系图", pages 1 - 15, Retrieved from the Internet <URL:https://www.jianshu.com/p/d768505cab78> *
黎萌: "网络协议分析及可视化系统的设计", 《中国优秀硕士学位论文全文数据库 (信息科技辑)》, vol. 2010, no. 12, 15 December 2010 (2010-12-15), pages 139 - 38 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996440A (en) * 2022-07-19 2022-09-02 北京金堤科技有限公司 Map display method and device, storage medium and electronic equipment
CN114996440B (en) * 2022-07-19 2022-11-04 北京金堤科技有限公司 Map display method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
US8775923B1 (en) Web page restoration
CN109446570B (en) Business process display method, device, computer equipment and storage medium
CN108287708B (en) Data processing method and device, server and computer readable storage medium
US10789111B2 (en) Message oriented middleware with integrated rules engine
CN112947969B (en) Page off-screen rendering method, device, equipment and readable medium
CN107608609A (en) A kind of event object sending method and device
WO2023226371A1 (en) Target object interactive reproduction control method and apparatus, device and storage medium
EP3738027A1 (en) Feature usage prediction using shell application feature telemetry
CN106294463B (en) Data point updating method and equipment for dynamic curve
CN109857964B (en) Thermodynamic diagram drawing method and device for page operation, storage medium and processor
CN112749282A (en) Knowledge graph display method, device, equipment and storage medium
CN111240678B (en) Pop-up window setting method and device, electronic equipment and storage medium
CN110908552B (en) Multi-window operation control method, device, equipment and storage medium
CN110058996B (en) Program debugging method, device, equipment and storage medium
CN110780955A (en) Method and equipment for processing emoticon message
CN112559050A (en) Method and device for processing concurrency number of client asynchronous request information
CN106873866B (en) Content amplification display method and device
CN115688102A (en) Window processing method and device, processor and electronic equipment
US11501172B2 (en) Accurately identifying members of training data in variational autoencoders by reconstruction error
CN108762957B (en) Method and device for generating cloud platform demonstration system
CN107370785B (en) Method and equipment for processing user service state information
CN112463626A (en) Memory leak positioning method and device, computer equipment and storage medium
CN110020285B (en) Histogram processing method and device
CN113973060A (en) Internet of things simulation method, device and system and storage medium
CN111857451B (en) Information editing interaction method and device, storage medium and processor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination