Patent ID: 11907390
Assignee: ZHEJIANG LAB
Field: Computer technology (Electrical engineering)
Classification: CPC G  H | IPC G  H

Claim 0:
1. A method for visual construction of a knowledge graph system, comprising:
determining, by a central server, a data permission of a distributed client;
initiating, by the distributed client, a data permission request to the central server; and
generating quadruple information (φ,ε,ζ,η) conforming to a target data structure after the data permission request passes verification of the central server to obtain a master template of the knowledge graph system, wherein φ,ε,ζ,η represent a root node name, a node id, an original child node set and a recommended child node set respectively, comprising:
traversing, by the central server, a tree structured database corresponding to a target database address and calculating to obtain a number of child nodes of each root node, and marking the number of child nodes of the root node n as f(n), recording a two-tuple mapping relation (n, f(n)) and establishing a two-tuple mapping relation set F corresponding to the tree structured database;
arranging the two-tuple mapping relation (n, f(n)) in the set F in a descending order according to a size of f(n), and marking a root node in the two-tuple mapping relation ranking first as φ;
traversing child nodes of each root node in the tree structured database except for the root node φ, and when a certain traversed child node e does not belong to child nodes of the root node φ, incorporating the child node e into a child node set of the root node φ, and marking the child node set of the root node φ after traversing ends as to serve as the original child node set;
taking, by the central server, the root node φ and the child node set ζ as an input, denoting each child node i in the child node set ζ as ζ(i), crawling a number of knowledge entries corresponding to each search combination φ+ζ(i) on the Internet, denoted as N(i); arranging the child nodes in the child node set ζ in a descending order according to the number of knowledge entries corresponding to the child nodes, and forming, by child nodes ranking top R, a recommended child node set η;
defining a data structure of the master template of the knowledge graph system to obtain the master template of the knowledge graph system, wherein the data structure of the master template of the knowledge graph system comprises the root node name, the node id, the original child node set and the recommended child node set; a data structure of elements in the original child node set/recommended child node set comprises a child node name, a child node id, and a relationship between the child node and the root node;
sending, by the central server, the master template of the knowledge graph system to the distributed client through an HTTP request;
receiving and parsing, by the distributed client, the master template of the knowledge graph system for rendering; and
receiving, by the distributed client, a natural language inputted by a user, parsing to generate an abstract syntax tree and processing a drag node behavior of the user to obtain a subtemplate of the knowledge graph system, encrypting the subtemplate, and sending the subtemplate to the central server;
wherein said processing a drag node behavior of the user comprises:
traversing all child nodes in the abstract syntax tree, and binding a mouse clicking event to each child node; denoting a node radius in the knowledge graph system as R; starting a drag process, triggering, by the distributed client, the mouse clicking event of the child node; monitoring a mouse releasing event; ending dragging, and triggering, by the distributed client, the mouse releasing event; recording coordinates (X1, Y1) of a terminal point position of release marking nodes except for the drag node as filter nodes, traversing all the filter nodes, and denoting horizontal and vertical coordinates of a circle center of the filter node as (Xi, Yi);
calculating an offset (Offsetx, Offsety) of the terminal point position and the filter node, wherein a filter node n_min corresponding to a minimum value of Offsetx+Offsety represents a node closest to the terminal point position of a drag node; when the filter node n_min satisfies max{Offsetx, Offsety}≤R, dragging is valid this time, max represents taking a maximum value, the filter node n_min is marked as a parent node of the drag node this time, and the drag node is added into a child node set of the parent node; and otherwise, dragging is regarded to be invalid this time, and the drag node returns to an original position;
storing, by the central server, the encrypted subtemplate of the knowledge graph system into the tree structured database;
using, by the user, a knowledge concept and a knowledge graph depth as an input requirement when the distributed client requests for using the knowledge graph system, and sending, by the distributed client, the knowledge concept and the knowledge graph depth to the central server;
reading, by the central server, the encrypted subtemplate of the knowledge graph system from the tree structured database, decrypting and searching the encrypted subtemplate of the knowledge graph system to obtain a tree structure knowledge graph and sending the tree structure knowledge graph to the distributed client; and
parsing, by the distributed client, the tree structure knowledge graph, and rendering to generate a knowledge graph meeting the input requirement.