CN115687656A - Knowledge graph backtracking method and device, electronic equipment and storage medium - Google Patents

Knowledge graph backtracking method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115687656A
CN115687656A CN202211430045.3A CN202211430045A CN115687656A CN 115687656 A CN115687656 A CN 115687656A CN 202211430045 A CN202211430045 A CN 202211430045A CN 115687656 A CN115687656 A CN 115687656A
Authority
CN
China
Prior art keywords
cluster
backtracking
time
snapshot
moment
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
CN202211430045.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.)
Shanghai Shizhuang Information Technology Co ltd
Original Assignee
Shanghai Shizhuang Information 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 Shanghai Shizhuang Information Technology Co ltd filed Critical Shanghai Shizhuang Information Technology Co ltd
Priority to CN202211430045.3A priority Critical patent/CN115687656A/en
Publication of CN115687656A publication Critical patent/CN115687656A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a knowledge graph backtracking method, a knowledge graph backtracking device, electronic equipment and a storage medium, wherein the method comprises the following steps: obtaining a backtracking request, wherein the backtracking request comprises: backtracking time and cluster identification; acquiring a cluster snapshot at the latest updating moment corresponding to the backtracking moment, wherein the cluster snapshot is obtained by inquiring a cluster corresponding to a cluster identifier at the latest updating moment from a knowledge graph; obtaining an operation log between the latest updating moment and the backtracking moment; and backtracking to the cluster at the backtracking moment according to the cluster snapshot and the operation log. In the implementation process of the scheme, the cluster of the backtracking time is backtracked according to the cluster snapshot of the latest updating time corresponding to the backtracking time and the operation log between the latest updating time and the backtracking time, so that the condition that a knowledge map database needs to be backtracked in a full amount is improved, and the timeliness of the backtracking of the knowledge map is effectively improved.

Description

Knowledge graph backtracking method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of computer data processing and knowledge graphs, in particular to a knowledge graph backtracking method and device, electronic equipment and a storage medium.
Background
Currently, databases for knowledge profiles are typically full backup solutions, such as: the knowledge map database is backed up in a distributed Object Storage Device (OSD) every 1 day every month, or in a remote Storage server. However, in a specific practical process, when a customer complaint or needs to obtain evidence of the knowledge graph, it takes several days to trace back the knowledge graph database from the OSD or the remote storage server, so that the timeliness of tracing back the knowledge graph is poor at present.
Disclosure of Invention
An embodiment of the present application aims to provide a method and an apparatus for knowledge graph backtracking, an electronic device, and a storage medium, which are used for solving the problem of poor timeliness of knowledge graph backtracking.
The embodiment of the application provides a knowledge graph backtracking method, which comprises the following steps: obtaining a backtracking request, wherein the backtracking request comprises: backtracking time and cluster identification; acquiring a cluster snapshot at the latest updating moment corresponding to the backtracking moment, wherein the cluster snapshot is obtained by inquiring a cluster corresponding to a cluster identifier at the latest updating moment from a knowledge graph; obtaining an operation log between the latest updating moment and the backtracking moment; and backtracking to the cluster at the backtracking moment according to the cluster snapshot and the operation log. In the implementation process of the scheme, the cluster of the backtracking time is backtracked according to the cluster snapshot of the latest updating time corresponding to the backtracking time and the operation log between the latest updating time and the backtracking time, so that the condition that a knowledge graph database needs to be backtracked in a full amount is improved, and the timeliness of knowledge graph backtracking is effectively improved.
Optionally, in this embodiment of the application, before obtaining the cluster snapshot at the latest update time corresponding to the backtracking time, the method further includes: classifying clusters corresponding to the cluster identifications to obtain cluster classes; judging whether the cluster type is a preset type or not; and if so, storing the cluster corresponding to the cluster identification as a cluster snapshot. In the implementation process of the scheme, the cluster corresponding to the cluster identifier is stored as the cluster snapshot only when the cluster type is the preset type, so that the storage space is saved, the condition that the map backtracking is slow due to too many cluster snapshots is avoided, and the timeliness of knowledge map backtracking is effectively improved.
Optionally, in this embodiment of the present application, before obtaining the cluster snapshot at the latest update time corresponding to the backtracking time, the method further includes: and if the current time is the latest updating time and the cluster corresponding to the cluster identifier changes, querying the cluster corresponding to the cluster identifier from the knowledge graph, and storing the cluster corresponding to the cluster identifier as a cluster snapshot in the distributed database HBase. In the implementation process of the scheme, the previous moment is the latest updating moment, and the cluster corresponding to the cluster identifier changes, so that the cluster corresponding to the cluster identifier is stored as the cluster snapshot in the distributed database HBase, the storage space is saved, the condition that the map backtracking is slow due to too many cluster snapshots is avoided, and the timeliness of the knowledge map backtracking is effectively improved.
Optionally, in this embodiment of the present application, the obtaining a cluster snapshot at a latest update time corresponding to a backtracking time includes: and reading the cluster snapshot at the latest updating moment corresponding to the backtracking moment from the distributed database HBase. In the implementation process of the scheme, the cluster snapshot of the latest updating moment corresponding to the backtracking moment is read from the distributed database HBase, so that the condition that a knowledge map database needs to be backtracked in a full amount is improved, and the timeliness of the backtracking of the knowledge map is effectively improved.
Optionally, in this embodiment of the application, before obtaining the operation log between the latest update time and the backtracking time, the method further includes: and if the cluster corresponding to the cluster identifier changes between the latest updating time and the backtracking time, storing an operation log between the latest updating time and the backtracking time in a distributed database HBase. In the implementation process of the scheme, the operation log between the latest updating time and the backtracking time is stored in the distributed database HBase, so that the condition that a knowledge graph database needs to be backtracked in a full amount is improved, and the timeliness of knowledge graph backtracking is effectively improved.
Optionally, in this embodiment of the present application, the obtaining an operation log between a latest update time and a backtracking time includes: and reading the operation log from the distributed database HBase through the message queue Kafka. In the implementation process of the scheme, the operation logs are read from the distributed database HBase through the message queue Kafka, so that the speed of reading the operation logs from the distributed database HBase is increased, and the timeliness of knowledge graph backtracking is effectively improved.
Optionally, in an embodiment of the present application, the backtracking request further includes: a user identification; after backtracking to the cluster of the backtracking time according to the cluster snapshot and the operation log, the method further comprises the following steps: judging whether the user corresponding to the user identification is an authorized user; and if so, sending the cluster at the backtracking moment to a user corresponding to the user identifier. In the implementation process of the scheme, the cluster at the backtracking time is sent to the user corresponding to the user identifier under the condition that the user corresponding to the user identifier is an authorized user, so that the backtracking safety of the knowledge graph is effectively improved.
The embodiment of the present application further provides a knowledge graph backtracking apparatus, including: a backtracking request obtaining module, configured to obtain a backtracking request, where the backtracking request includes: backtracking time and cluster identification; the cluster snapshot acquisition module is used for acquiring a cluster snapshot at a latest updating moment corresponding to the backtracking moment, and the cluster snapshot is obtained by inquiring a cluster corresponding to the cluster identifier at the latest updating moment from the knowledge map; the operation log obtaining module is used for obtaining the operation log between the latest updating time and the backtracking time; and the map cluster backtracking module is used for backtracking to clusters at the backtracking time according to the cluster snapshots and the operation logs.
Optionally, in this embodiment of the present application, the knowledge-graph backtracking apparatus further includes: the cluster type obtaining module is used for classifying clusters corresponding to the cluster identifications to obtain cluster types; the preset type judging module is used for judging whether the cluster type is a preset type or not; and the cluster snapshot processing module is used for storing the cluster corresponding to the cluster identifier as a cluster snapshot if the cluster type is a preset type.
Optionally, in this embodiment of the present application, the knowledge-graph backtracking apparatus further includes: and the cluster snapshot storage module is used for querying a cluster corresponding to the cluster identifier from the knowledge graph and storing the cluster corresponding to the cluster identifier as a cluster snapshot in the distributed database HBase if the current time is the latest updating time and the cluster corresponding to the cluster identifier changes.
Optionally, in an embodiment of the present application, the second obtaining module includes: and the cluster snapshot reading submodule is used for reading the cluster snapshot at the latest updating moment corresponding to the backtracking moment from the distributed database HBase.
Optionally, in this embodiment of the present application, the knowledge-graph backtracking apparatus further includes: and the operation log storage module is used for storing the operation log between the latest updating moment and the backtracking moment in the distributed database HBase if the cluster corresponding to the cluster identifier changes between the latest updating moment and the backtracking moment.
Optionally, in an embodiment of the present application, the operation log obtaining module includes: and the operation log processing submodule is used for reading the operation log from the distributed database HBase through the message queue Kafka.
Optionally, in an embodiment of the present application, the backtracking request further includes: a user identification; knowledge map device of backtracking still includes: the authorized user judging module is used for judging whether the user corresponding to the user identification is an authorized user; and the backtracking cluster sending module is used for sending the cluster at the backtracking moment to the user corresponding to the user identifier if the user corresponding to the user identifier is an authorized user.
An embodiment of the present application further provides an electronic device, including: a processor and a memory, the memory storing processor-executable machine-readable instructions, the machine-readable instructions when executed by the processor performing the method as described above.
Embodiments of the present application also provide a computer-readable storage medium having a computer program stored thereon, where the computer program is executed by a processor to perform the method as described above.
Additional features and advantages of embodiments of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of embodiments of the present application.
Drawings
To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments in the embodiments of the present application and therefore should not be considered as limiting the scope, and it will be apparent to those skilled in the art that other relevant drawings may be obtained based on the drawings without inventive effort.
FIG. 1 is a schematic flow chart diagram illustrating a method for knowledge graph backtracking according to an embodiment of the present application;
fig. 2 is a schematic processing diagram of a cluster snapshot provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram of a knowledge-graph backtracking apparatus provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as presented in the figures, is not intended to limit the scope of the claimed embodiments of the application, but is merely representative of selected embodiments of the application. All other embodiments obtained by a person skilled in the art based on the embodiments of the present application without any creative effort belong to the protection scope of the embodiments of the present application.
It is to be understood that "first" and "second" in the embodiments of the present application are used to distinguish similar objects. Those skilled in the art will appreciate that the terms "first," "second," and the like do not denote any order or importance, but rather the terms "first," "second," and the like do not denote any order or importance.
Before introducing the method for backtracking a knowledge graph provided in the embodiment of the present application, some concepts related in the embodiment of the present application are introduced:
knowledge map (Knowledge Graph) refers to a method or a tool for linking Knowledge together according to a certain rule and showing the Knowledge in the form of map, is called a Knowledge domain visual Knowledge domain mapping map in the book intelligence field, is a series of different graphs for displaying the relationship between the Knowledge development process and the structure, describes Knowledge resources and carriers thereof by using a visual technology, and excavates, analyzes, constructs, draws and displays the Knowledge and the mutual link between the Knowledge and the carriers.
It should be noted that the method for retrieving a knowledge graph provided in the embodiments of the present application may be executed by an electronic device, where the electronic device refers to a device terminal or a server having a function of executing a computer program, and the device terminal includes: smart phones, personal computers, tablet computers, personal digital assistants, or mobile internet access devices, and the like. A server refers to a device that provides computing services over a network, such as: the server system comprises an x86 server and a non-x 86 server, wherein the non-x 86 server comprises: mainframe, minicomputer, and UNIX server.
Application scenarios to which the knowledge graph backtracking method is applicable are described below, where the application scenarios include, but are not limited to: electronic commerce, finance, social group friend making and the like are taken as examples for explanation, when a worker receives a user complaint (such as e-commerce order brushing), because the knowledge graph is dynamically updated and changed in real time, and the worker needs to trace back the knowledge graph of the business system for business analysis, the knowledge graph tracing method can be used for tracing back the clusters in the knowledge graph, and certainly, the worker can also use the clusters in the knowledge graph as evidence for explaining and communicating, so that the condition that the worker needs to trace back the database of the knowledge graph in full is avoided, and the timeliness of knowledge graph tracing is effectively improved.
Please refer to fig. 1, which is a schematic flow chart diagram of a knowledge graph backtracking method provided in the embodiment of the present application; the embodiment of the application provides a knowledge graph backtracking method, which comprises the following steps:
step S110: obtaining a backtracking request, wherein the backtracking request comprises: backtracking time and cluster identification.
The above embodiments of step S110 include, but are not limited to: in a first embodiment, the electronic device obtains a backtracking request from the terminal device, specifically for example: a User (e.g., a service processing worker) operates on a terminal device, so that the terminal device sends a backtracking request to an electronic device through a Transmission Control Protocol (TCP) or a User Datagram Protocol (UDP); after receiving a backtracking request sent by a user through terminal equipment, the electronic equipment analyzes the time needing backtracking and cluster identification from the backtracking request. In a second embodiment, the electronic device obtains a trace-back request from a server (e.g., a proxy server or a load balancing server), specifically for example: the method comprises the following steps that a proxy server or a load balancing server receives a backtracking request sent by terminal equipment and forwards the backtracking request to the electronic equipment; after receiving a backtracking request sent by a proxy server or a load balancing server, the electronic device analyzes the time and cluster identification required to be backtracked from the backtracking request.
Step S120: and acquiring a cluster snapshot at the latest updating moment corresponding to the backtracking moment, wherein the cluster snapshot is obtained by inquiring a cluster corresponding to the cluster identifier at the latest updating moment from the knowledge graph.
Please refer to fig. 2, which is a schematic processing diagram of a cluster snapshot provided in the embodiment of the present application; it is to be understood that, in a specific implementation process, the cluster snapshot may be triggered to be stored when the number of nodes in the cluster is greater than the node threshold or the total number of edges in the cluster is greater than the preset number threshold, that is, a combination of the number of nodes, the number of edges, or a preset time interval may be set as a trigger condition for storing the cluster snapshot. Here, the number of nodes and the preset time interval are taken as an example of the combined trigger condition, and specifically, for example: when the number of nodes in a cluster is greater than or equal to 2 (in practice, it may also be set to 20 or 50, etc.), it is triggered to store a cluster snapshot at the first update time on day 1, and then store a cluster snapshot at every preset time interval (for example, 5 days or 7 days), and if it is stored every 5 days, it is to store a cluster snapshot at the second update time on day 6, and store an operation log between the first update time and the second update time in a database (for example, a distributed database HBase or OceanBase, etc.). Similarly, the cluster snapshot at the third update time in fig. 2 will be stored on day 11, and the cluster snapshot at the fourth update time will be stored on day 15, and these two cluster snapshots are also stored through the above similar technical principle, and therefore will not be described again.
Step S130: and obtaining an operation log between the latest updating time and the backtracking time.
It is understood that, in a specific practical process, the cluster snapshot and the operation log may be stored in a Distributed database such as HBase or OceanBase, or may be stored in a Distributed File System (DFS), where the DFS includes but is not limited to: hadoop Distributed File System (HDFS), ceph, lustre, mogileFS, mooseFS, fastDFS, TFS, gridFS, and the like.
Step S140: and backtracking to the cluster at the backtracking moment according to the cluster snapshot and the operation log.
It can be understood that, since the trace-back time is different from the update time stored in the cluster snapshot with a high probability, after the cluster snapshot at the latest update time is obtained, the operation log between the latest update time and the trace-back time needs to be obtained, so that the cluster snapshot at the trace-back time can be recovered according to the cluster snapshot and the operation log. Specific examples thereof include: assuming that the trace-back time is day 7, the latest update time corresponding to day 7 is the second update time of day 6, and therefore, it is necessary to first obtain the cluster snapshot stored at the second update time of day 6, obtain the oplogs between the second update time of day 6 and the trace-back time of day 7, and then restore the cluster snapshot at the trace-back time of day 7 according to the cluster snapshot stored at the second update time of day 6 and the oplogs between the second update time of day 6 and the trace-back time of day 7.
In the implementation process, the cluster of the backtracking time is backtracked according to the cluster snapshot of the latest updating time corresponding to the backtracking time and the operation log between the latest updating time and the backtracking time, so that the condition that a knowledge map database needs to be backtracked in full is improved, and the timeliness of the backtracking of the knowledge map is effectively improved.
As an optional implementation manner of the step S120, before the cluster snapshot at the latest update time corresponding to the backtracking time is obtained, it may be determined that the cluster snapshot is a preset category (for example, a large cluster) and then stored as the cluster snapshot, where the method includes:
step S121: and classifying the clusters corresponding to the cluster identifications to obtain cluster categories.
Embodiments of the above step S121 include, but are not limited to: in a first embodiment, a neural network model is used to classify clusters corresponding to cluster identifiers, for example: classifying clusters corresponding to the cluster identifications by using Neural Network models such as a Text-Convolutional Network layer (Text-CNN), a LeNet Network model, an AlexNet Network model, a VGG Network model, a google LeNet Network model, a ResNet Network model and the like to obtain cluster categories, wherein the cluster categories comprise: micro-clusters (also known as small clusters) and super-clusters (also known as large clusters), and so on. In a second embodiment, the cluster type is determined according to the number of nodes in the cluster corresponding to the cluster identifier, for example: judging whether the number of nodes in the cluster corresponding to the cluster identifier exceeds a node threshold value, and if the number of nodes in the cluster corresponding to the cluster identifier exceeds the node threshold value, determining the cluster corresponding to the cluster identifier as a super cluster (also called as a large cluster); if the number of nodes in the cluster corresponding to the cluster identifier does not exceed the node threshold, the cluster corresponding to the cluster identifier is determined as a micro cluster (also referred to as a small cluster). In a third embodiment, the cluster type is determined according to the number of edges in the cluster corresponding to the cluster identifier, for example: judging whether the number of edges in the cluster corresponding to the cluster identifier exceeds a preset number threshold, and if the number of edges in the cluster corresponding to the cluster identifier exceeds the preset number threshold, determining the cluster corresponding to the cluster identifier as a super cluster (also called a large cluster); if the number of edges in the cluster corresponding to the cluster identifier does not exceed the preset number threshold, the cluster corresponding to the cluster identifier is determined as a micro cluster (also referred to as a small cluster). In the fourth embodiment, in combination with the second and third embodiments, the cluster type may be determined according to the number of nodes and the number of edges in the cluster corresponding to the cluster identifier, and the technical principle of this embodiment is similar to that of the second and third embodiments, and therefore is not described again.
Step S122: and judging whether the cluster type is a preset type or not.
The embodiment of the step S122 is, for example: judging whether the cluster type is a preset type or not by using an executable program compiled or interpreted by a preset programming language; among others, programming languages that may be used are, for example: C. c + +, java, BASIC, javaScript, LISP, shell, perl, ruby, python, and PHP, among others.
Step S123: and if the cluster type is a preset type, storing the cluster corresponding to the cluster identification as a cluster snapshot.
The embodiment of the step S123 is, for example: assuming that the preset category is a super cluster (also referred to as a large cluster), if it is determined that the cluster category is a super cluster, then storing the cluster corresponding to the cluster identification as a cluster snapshot may be triggered. In a specific implementation process, the cluster snapshot may be triggered and stored when the number of nodes in the cluster is greater than a node threshold or the total number of edges in the cluster is greater than a preset number threshold, that is, a combination of the number of nodes, the number of edges, or a preset time interval may be set as a trigger condition for storing the cluster snapshot. When the cluster corresponding to the cluster identifier is stored as the cluster snapshot, a command may be used to store the cluster, where the command includes, for example: create 'graph _ id', { NAME = > 'f1' }; here, graph _ id represents a cluster identifier, and f1 represents a file name of the cluster snapshot after storage.
As an optional implementation manner of the step S120, before obtaining the cluster snapshot at the latest update time corresponding to the backtracking time, the cluster snapshot may be stored in the distributed database HBase or OceanBase, and the implementation manner may include:
step S124: and if the current moment is the latest updating moment and the cluster corresponding to the cluster identifier changes, querying the cluster corresponding to the cluster identifier from the knowledge graph, and storing the cluster corresponding to the cluster identifier as a cluster snapshot in a distributed database HBase or OceanBase.
It is to be understood that the knowledge graph in the embodiment of the present application is also referred to as a graph database, and specifically, a Nebula, a Neo4j graph database, a grakn knowledge graph system, or the like may be used.
Step S125: and if the current moment is the latest updating moment and the cluster corresponding to the cluster identifier is not changed, creating a file link corresponding to the cluster snapshot stored last time in the distributed database HBase or OceanBase, and determining the file link as the access mode of the cluster snapshot at this time.
The embodiments of the above steps S124 to S125 are, for example: and if the cluster corresponding to the cluster identifier changes at the second updating time of day 6, querying the cluster corresponding to the cluster identifier from the knowledge graph, and storing the cluster corresponding to the cluster identifier in a distributed database HBase or OceanBase as a cluster snapshot file. If the second update time on day 6 is reached and the cluster corresponding to the cluster identifier is not changed, a file Link (Link) may be created according to the cluster snapshot file stored at the last update time, that is, a file Link storing the cluster snapshot at the first update time on day 1 is created, and the file Link of the cluster snapshot at the first update time is determined as an access manner of the cluster snapshot at the second update time on day 6, so that when accessing the cluster snapshot at the second update time on day 6, it is sufficient to directly access the cluster snapshot at the first update time on day 1.
As an optional implementation of step S120, when obtaining a cluster snapshot at the latest update time corresponding to the backtracking time, the cluster snapshot may be read from the distributed database HBase or OceanBase, and the implementation may include:
step S126: and reading cluster snapshots of the latest updating time corresponding to the backtracking time from the distributed database HBase or OceanBase.
The embodiment of step S126 described above is, for example: when the cluster snapshot at the latest update time corresponding to the backtracking time is read from the distributed database HBase or OceanBase, a command such as scan may be used to read the cluster snapshot at the latest update time corresponding to the backtracking time from the distributed database HBase or OceanBase.
As an optional implementation manner of the step S130, before obtaining the operation log between the latest update time and the backtracking time, the operation log may be stored in a distributed database, and the method includes:
step S131: and if the cluster corresponding to the cluster identifier changes between the latest updating time and the backtracking time, storing an operation log between the latest updating time and the backtracking time in a distributed database.
The embodiment of step S131 described above is, for example: if the cluster corresponding to the cluster identifier changes between the latest updating time and the backtracking time, storing an operation log between the latest updating time and the backtracking time in a Distributed Database (DDB) such as HBase or OceanBase.
As an optional implementation manner of the step S130, when obtaining the operation log between the latest update time and the trace-back time, the operation log may be read from the HBase or OceanBase through the message queue Kafka, and the implementation manner may include:
step S132: and reading the operation log from the distributed database through the message queue Kafka.
The embodiment of the step S132 is, for example: reading an operation log from a distributed database such as HBase or OceanBase and the like through a message queue Kafka, wherein the operation log can be acquired by using a Flink data stream tool, the Flink is an open source stream processing framework, and the core of the operation log is a distributed stream data stream engine written by Java language and Scala language; flink executes arbitrary stream data programs in a data parallel and pipelined manner, and Flink's pipelined runtime system can execute batch and stream processing programs.
As an optional implementation manner of the above knowledge graph backtracking method, the backtracking request may further include: a user identification; after backtracking to the cluster at the backtracking time according to the cluster snapshot and the operation log, the cluster at the backtracking time may be further sent to an authorized user, and the embodiment may include:
step S150: and judging whether the user corresponding to the user identification is an authorized user.
The embodiment of the step S150 is, for example: judging whether the user corresponding to the user identifier is an authorized user or not by using an executable program compiled or interpreted by a preset programming language; among others, programming languages that may be used are, for example: C. c + +, java, BASIC, javaScript, LISP, shell, perl, ruby, python, and PHP, among others.
Step S160: and if the user corresponding to the user identification is an authorized user, sending the cluster at the backtracking moment to the user corresponding to the user identification.
The embodiment of step S160 described above is, for example: inquiring user information corresponding to the user identification from a relational database, analyzing the user type from the user information, and if the user type corresponding to the user identification is an authorized user, sending the cluster at the backtracking moment to a user (such as a worker) corresponding to the user identification; among these, relational databases that can be used are, for example: mysql, postgreSQL, oracle, SQLSever, etc.
Please refer to fig. 3, which is a schematic structural diagram of a knowledge-graph backtracking apparatus provided in an embodiment of the present application; the embodiment of the present application provides a knowledge graph backtracking apparatus 200, including:
a backtracking request obtaining module 210, configured to obtain a backtracking request, where the backtracking request includes: backtracking time and cluster identification.
The cluster snapshot obtaining module 220 is configured to obtain a cluster snapshot at a latest update time corresponding to the backtracking time, where the cluster snapshot is obtained by querying a cluster corresponding to the cluster identifier at the latest update time from the knowledge graph.
An operation log obtaining module 230, configured to obtain an operation log between the latest update time and the backtracking time.
And the map cluster backtracking module 240 is configured to backtrack to a cluster at a backtracking time according to the cluster snapshot and the operation log.
Optionally, in this embodiment of the present application, the knowledge-graph backtracking apparatus further includes:
and the cluster type obtaining module is used for classifying the clusters corresponding to the cluster identifications to obtain cluster types.
And the preset category judgment module is used for judging whether the cluster category is a preset category.
And the cluster snapshot processing module is used for storing the cluster corresponding to the cluster identifier as a cluster snapshot if the cluster type is a preset type.
Optionally, in this embodiment of the present application, the knowledge-graph backtracking apparatus further includes:
and the cluster snapshot storage module is used for inquiring the cluster corresponding to the cluster identifier from the knowledge graph and storing the cluster corresponding to the cluster identifier as a cluster snapshot in the distributed database HBase if the current moment is the latest updating moment and the cluster corresponding to the cluster identifier changes.
Optionally, in an embodiment of the present application, the second obtaining module includes:
and the cluster snapshot reading submodule is used for reading the cluster snapshot at the latest updating moment corresponding to the backtracking moment from the distributed database HBase.
Optionally, in this embodiment of the present application, the knowledge-graph backtracking apparatus further includes:
and the operation log storage module is used for storing the operation log between the latest updating moment and the backtracking moment in the distributed database HBase if the cluster corresponding to the cluster identifier changes between the latest updating moment and the backtracking moment.
Optionally, in an embodiment of the present application, the operation log obtaining module includes:
and the operation log processing submodule is used for reading the operation log from the distributed database HBase through the message queue Kafka.
Optionally, in an embodiment of the present application, the backtracking request further includes: a user identification; knowledge map device of backtracking still includes:
and the authorized user judgment module is used for judging whether the user corresponding to the user identification is an authorized user.
And the backtracking cluster sending module is used for sending the cluster at the backtracking moment to the user corresponding to the user identifier if the user corresponding to the user identifier is an authorized user.
It should be understood that the apparatus corresponds to the above-mentioned embodiment of the method for retrieving knowledge map, and can perform the steps related to the above-mentioned embodiment of the method, and the specific functions of the apparatus can be referred to the above description, and the detailed description is appropriately omitted herein to avoid redundancy. The device includes at least one software function that can be stored in memory in the form of software or firmware (firmware) or solidified in the Operating System (OS) of the device.
Please refer to fig. 4 for a schematic structural diagram of an electronic device according to an embodiment of the present application. An electronic device 300 provided in an embodiment of the present application includes: a processor 310 and a memory 320, the memory 320 storing machine-readable instructions executable by the processor 310, the machine-readable instructions, when executed by the processor 310, performing the method as described above.
Embodiments of the present application further provide a computer-readable storage medium 330, where the computer-readable storage medium 330 stores a computer program, and the computer program is executed by the processor 310 to perform the above method. The computer-readable storage medium 330 may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as a Static Random Access Memory (SRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
It should be noted that, in this specification, each embodiment is described in a progressive manner, and each embodiment focuses on differences from other embodiments, and portions that are the same as and similar to each other in each embodiment may be referred to. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and reference may be made to the partial description of the method embodiment for relevant points.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may 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 sometimes be executed in the reverse order, depending upon the functionality involved.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part. Furthermore, in the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the embodiments of the present application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
The above description is only an alternative embodiment of the embodiments of the present application, but the scope of the embodiments of the present application is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present application, and all the modifications and substitutions should be covered by the scope of the embodiments of the present application.

Claims (10)

1. A knowledge graph backtracking method is characterized by comprising the following steps:
obtaining a backtracking request, wherein the backtracking request comprises: backtracking time and cluster identification;
obtaining a cluster snapshot of a latest updating moment corresponding to the backtracking moment, wherein the cluster snapshot is obtained by inquiring a cluster corresponding to the cluster identifier at the latest updating moment from a knowledge graph;
obtaining an operation log between the latest updating moment and the backtracking moment;
and backtracking to the cluster at the backtracking time according to the cluster snapshot and the operation log.
2. The method according to claim 1, further comprising, before the obtaining a cluster snapshot of a most recent update time corresponding to the backtracking time:
classifying the clusters corresponding to the cluster identifications to obtain cluster classes;
judging whether the cluster type is a preset type or not;
and if so, storing the cluster corresponding to the cluster identification as the cluster snapshot.
3. The method according to claim 1, further comprising, before said obtaining a cluster snapshot of a most recent update time corresponding to the backtracking time:
and if the current moment is the latest updating moment and the cluster corresponding to the cluster identifier changes, inquiring the cluster corresponding to the cluster identifier from a knowledge graph, and storing the cluster corresponding to the cluster identifier as the cluster snapshot in a distributed database HBase.
4. The method according to claim 3, wherein the obtaining the cluster snapshot of the latest update time corresponding to the backtracking time comprises:
and reading the cluster snapshot at the latest updating moment corresponding to the backtracking moment from the distributed database HBase.
5. The method of claim 3, further comprising, prior to said obtaining the oplog between the most recent update time and the backtracking time:
and if the cluster corresponding to the cluster identifier changes between the latest updating time and the backtracking time, storing an operation log between the latest updating time and the backtracking time in the distributed database HBase.
6. The method of claim 5, wherein the obtaining the operation log between the latest update time and the backtracking time comprises:
and reading the operation log from the distributed database HBase through a message queue Kafka.
7. The method of claim 1, wherein the backtracking request further comprises: a user identification; after the cluster is backtracked to the backtracking time according to the cluster snapshot and the operation log, the method further comprises the following steps:
judging whether the user corresponding to the user identification is an authorized user;
and if so, sending the cluster at the backtracking moment to a user corresponding to the user identification.
8. A knowledge graph backtracking apparatus, comprising:
a backtracking request obtaining module, configured to obtain a backtracking request, where the backtracking request includes: backtracking time and cluster identification;
a cluster snapshot obtaining module, configured to obtain a cluster snapshot at a latest update time corresponding to the backtracking time, where the cluster snapshot is obtained by querying a cluster corresponding to the cluster identifier at the latest update time from a knowledge graph;
an operation log obtaining module, configured to obtain an operation log between the latest update time and the backtracking time;
and the map cluster backtracking module is used for backtracking to the cluster at the backtracking moment according to the cluster snapshot and the operation log.
9. An electronic device, comprising: a processor and a memory, the memory storing machine-readable instructions executable by the processor, the machine-readable instructions, when executed by the processor, performing the method of any of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs the method of any one of claims 1 to 7.
CN202211430045.3A 2022-11-15 2022-11-15 Knowledge graph backtracking method and device, electronic equipment and storage medium Pending CN115687656A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211430045.3A CN115687656A (en) 2022-11-15 2022-11-15 Knowledge graph backtracking method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211430045.3A CN115687656A (en) 2022-11-15 2022-11-15 Knowledge graph backtracking method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115687656A true CN115687656A (en) 2023-02-03

Family

ID=85052027

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211430045.3A Pending CN115687656A (en) 2022-11-15 2022-11-15 Knowledge graph backtracking method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115687656A (en)

Similar Documents

Publication Publication Date Title
CN112464084B (en) Service optimization method based on big data positioning and artificial intelligence and cloud computing center
US11196633B2 (en) Generalized correlation of network resources and associated data records in dynamic network environments
CN112394942A (en) Distributed software development compiling method and software development platform based on cloud computing
CN108446110B (en) Lua script generation method, Lua script generation device, Lua script generation terminal and computer readable medium
CN112702195A (en) Gateway configuration method, electronic device and computer readable storage medium
CN116088846A (en) Processing method, related device and equipment for continuous integrated code format
CN111796855B (en) Incremental version updating method and device, storage medium and computer equipment
CN110795331A (en) Software testing method and device
CN113220907A (en) Business knowledge graph construction method and device, medium and electronic equipment
CN111159142B (en) Data processing method and device
CN115687656A (en) Knowledge graph backtracking method and device, electronic equipment and storage medium
CN115203260A (en) Abnormal data determination method and device, electronic equipment and storage medium
US9996799B2 (en) Migrating a legacy system by inferring context-sensitive business rules from legacy source code
CN111400243B (en) Development management system based on pipeline service and file storage method and device
CN108874625B (en) Information processing method and device, electronic equipment and storage medium
CN110221952B (en) Service data processing method and device and service data processing system
CN111080250B (en) Flow backspacing compensation method and device, storage medium and electronic equipment
CN113672514A (en) Test method, test device, server and storage medium
CN114065045A (en) Label management method, device, equipment and storage medium
CN112084114A (en) Method and apparatus for testing an interface
CN114253595A (en) Code warehouse management method and device, computer equipment and storage medium
CN113760695A (en) Method and device for positioning problem code
CN111538651A (en) Interface testing method, device, server and storage medium
CN112784133B (en) Link visualization method, device, equipment and storage medium
CN117389908B (en) Dependency analysis method, system and medium for interface automation test case

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