CN114328566A - Relationship graph updating method, device, medium, equipment and generating method - Google Patents

Relationship graph updating method, device, medium, equipment and generating method Download PDF

Info

Publication number
CN114328566A
CN114328566A CN202111681755.9A CN202111681755A CN114328566A CN 114328566 A CN114328566 A CN 114328566A CN 202111681755 A CN202111681755 A CN 202111681755A CN 114328566 A CN114328566 A CN 114328566A
Authority
CN
China
Prior art keywords
data
node
message
relationship
initial database
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
CN202111681755.9A
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 Jindi Technology Co Ltd
Original Assignee
Beijing Jindi 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 Jindi Technology Co Ltd filed Critical Beijing Jindi Technology Co Ltd
Priority to CN202111681755.9A priority Critical patent/CN114328566A/en
Publication of CN114328566A publication Critical patent/CN114328566A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

The disclosure relates to a method, a device, a medium, a device and a method for updating a relationship graph, wherein the method comprises the following steps: monitoring a change log of an initial database, forming data change information into a message and issuing the message to a message queue when the data change information newly written into the initial database in the change log is changed, monitoring the message queue to obtain a newly added message, determining a first data main key contained in the newly added message when the data change type contained in the newly added message is a modification type, an insertion type or a deletion type, determining a first position in a relational graph based on the first data main key, deleting graph data stored at the first position, determining a second position in the initial database based on the first data main key, and introducing data stored at the second position into the first position in the relational graph to update the relational graph. The problems of disorder and data confusion caused by updating the relation maps based on the updating messages are avoided, and the relation maps can be accurately updated based on the changed data in the initial database.

Description

Relationship graph updating method, device, medium, equipment and generating method
Technical Field
The present disclosure relates to the field of data processing, and in particular, to a method, an apparatus, a medium, a device, and a method for updating a relationship graph.
Background
In the existing relational database, the connection relations among companies, employers, employees, legal persons and entities are recorded through tables, and when data is queried, all tables corresponding to the queried entities need to be found from the database, and then the corresponding relations among the entities are manually obtained according to the corresponding tables to generate a relational graph. Because the data capacity in the database is large and the content of the related data is easy to change, when the data in the database is changed, the related data in the corresponding relationship map is updated according to the update message, but the update message is easy to be out of order in the transmission process, so that the related data in the updated relationship map is disordered, and the relationship map cannot be accurately updated.
Disclosure of Invention
The present disclosure aims to provide a method, an apparatus, a medium, a device for updating a relationship graph, and a method for generating a relationship graph, so as to solve the technical problems in the prior art that updating a relationship graph based on an update message causes confusion in data transmission and incapability of accurately updating the relationship graph.
According to a first aspect of the embodiments of the present disclosure, there is provided a method for updating a relationship graph, including:
monitoring a change log of an initial database, and when data change information of the initial database is newly written in the change log, forming the data change information into a message and issuing the message to a message queue;
monitoring the message queue to obtain a newly added message, and determining a first data primary key contained in the newly added message when the data change type contained in the newly added message is a modification type, an insertion type or a deletion type;
determining a first position in a relation map based on the first data primary key, and deleting map data stored at the first position;
determining a second position in the initial database based on the first data primary key, and importing data stored in the second position to the first position in the relation map so as to update the relation map.
Optionally, the monitoring a change log of an initial database, and when data change information of the initial database is newly written in the change log, forming a message from the data change information and issuing the message to a message queue, includes:
monitoring a change log of an initial database, and analyzing new written contents when the new written contents exist in the change log;
and when the newly written content is analyzed to be the data change information of the initial database, forming a message by the first data main key in the data change information and the data content corresponding to the first data main key, and issuing the message to a message queue.
Optionally, the relationship map is an industrial-commercial relationship map, and the method further includes:
acquiring data to be imported in the initial database, wherein the data to be imported comprises node data and relationship data; wherein the node data includes node data corresponding to a company entity and node data corresponding to a person entity; the relationship data comprises legal relation data, investment relation data and/or parent company relation data among the node data;
and generating the relation graph according to the node data and the relation data.
Optionally, the method further comprises:
obtaining second data main keys of the difference data in batch, and writing the second data main keys into the difference list;
traversing the difference list, and deleting all business relations of nodes corresponding to second data primary keys in the relation graph aiming at any second data primary key in the difference list;
inquiring corresponding legal person records in the initial database based on the second data main key, and if legal person records exist, newly adding legal person relations corresponding to the nodes in the relation map;
inquiring corresponding investment records in the initial database based on the second data main key, and if the investment records exist, newly adding the investment relation corresponding to the node in the relation map;
and inquiring corresponding parent company records in the initial database based on the second data primary key, and if the parent company records exist, newly adding the parent company relationship corresponding to the node in the relationship map.
Optionally, the obtaining the second data primary key of the difference data in batch includes:
determining an error time period for the initial database, the message queue, or the relationship graph;
and in the change log, determining the change content recorded in the error time period, and acquiring the second data main key of the difference data in batch from the recorded change content.
According to a second aspect of the present embodiment, there is provided a method for generating a relationship map, including:
acquiring a first node to be checked and a second node to be checked;
generating a full-scale relational graph from the first node to be searched to the second node to be searched based on the relational graph obtained by the updating method, wherein the full-scale relational graph comprises all paths from the first node to be searched to the second node to be searched;
determining a shortest path from the first node to be checked to the second node to be checked based on the full-scale relational graph;
and generating a corresponding target relation map based on the shortest path.
According to a third aspect of the present embodiment, there is provided an updating apparatus of a relationship map, including:
the issuing module is used for monitoring a change log of an initial database, and when data change information of the initial database is newly written in the change log, the data change information is formed into a message and issued to a message queue;
the first determining module is used for monitoring the message queue to obtain a newly added message, and determining a data primary key contained in the newly added message when the data change type contained in the newly added message is a modification type, an insertion type or a deletion type;
the deleting module is used for determining a first position in a relation map based on the data main key and deleting map data stored in the first position;
and the updating module is used for determining a second position in the initial database based on the data primary key and importing the data stored in the second position into the first position in the relational map so as to update the relational map.
According to a fourth aspect of the present embodiment, there is provided an apparatus for generating a relationship map, including:
the system comprises an acquisition module, a searching module and a judging module, wherein the acquisition module is used for acquiring a first node to be searched and a second node to be searched;
a first generation module, configured to obtain a full-scale relationship graph from the first node to be searched to the second node to be searched based on the relationship graph obtained according to any one of the above updating methods, where the full-scale relationship graph includes all paths from the first node to be searched to the second node to be searched;
a second determining module, configured to determine a shortest path from the first node to be searched to the second node to be searched based on the full-scale relationship graph;
and the second generation module is used for generating a corresponding target relation map based on the shortest path.
According to a fifth aspect of the present embodiments, there is provided a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of any one of the first aspects.
According to a sixth aspect of the present embodiment, there is provided an electronic apparatus comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any one of the first aspect.
Through the technical scheme, the change log of the initial database is monitored, when the data change information newly written into the initial database in the change log is formed into a message and issued to a message queue, the message queue is monitored to obtain a newly added message, when the data change type contained in the newly added message is a modification type, an insertion type or a deletion type, a first data main key contained in the newly added message is determined, a first position in the relation map is determined based on the first data main key, map data stored at the first position is deleted, a second position in the initial database is determined based on the first data main key, and data stored at the second position is led into the first position in the relation map to update the relation map. Therefore, map data of a corresponding position in the relational map are deleted according to the first data main key, and then changed data of a second position in the initial database are led into the first position of the relational map according to the first data main key, so that updating of the relational map is achieved. The problems of disorder and data disorder caused by updating the relation maps based on the updating messages are solved, and the relation maps can be updated more accurately based on the changed data in the initial database.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
fig. 1 is a schematic diagram illustrating a relationship graph update method according to an exemplary embodiment.
FIG. 2 is a schematic diagram illustrating a relationship graph according to an exemplary embodiment.
Fig. 3 is a schematic diagram illustrating another relationship graph update method according to an example embodiment.
FIG. 4 is a schematic diagram illustrating a method of generating a relationship graph, according to an example embodiment.
FIG. 5 is a block diagram illustrating an apparatus for updating a relationship graph, according to an example embodiment.
FIG. 6 is a block diagram illustrating an apparatus for generating a relationship graph, according to an example embodiment.
FIG. 7 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
In order to solve the technical problem that the relationship graph cannot be accurately updated due to the fact that data transmission is disordered because the relationship graph is updated based on the update message in the prior art, an embodiment of the present disclosure provides an update method of the relationship graph, and fig. 1 is a schematic diagram of an update method of the relationship graph provided according to an exemplary embodiment. It will be appreciated that the method may be applied to a server to form a data platform. As shown in fig. 1, the method for updating the relationship map includes the following steps:
and S11, monitoring the change log of the initial database, and forming and issuing the data change information into a message to a message queue when the data change information of the initial database is newly written in the change log.
And S12, monitoring the message queue to obtain the new message, and determining the first data primary key contained in the new message when the data change type contained in the new message is modification type, insertion type or deletion type.
And S13, determining a first position in the relation map based on the primary key of the first data, and deleting the map data stored in the first position.
And S14, determining a second position in the initial database based on the primary key of the first data, and importing the data stored in the second position into the first position in the relationship map to update the relationship map.
In step S11, it is understood that when the data in the database changes, a corresponding change log is generated to record the update location and the update type of the update data. And when the data change information is newly written in the change log, forming a corresponding message based on the data change information and sending the message to the message queue. For example, with the MySQL database as the initial database and Neo4j as the database, when updated data is generated in the MySQL database, the corresponding binlog (binary log for recording the change operation performed in the MySQL database) is recorded based on the updated data, the canal component in the server parses the log in the binlog and sends the information of the updated data to the kafka message queue, and Neo4j reads the updated data information in kafka through the data synchronization item, thereby obtaining the address information of the changed data in the MySQL database.
Optionally, the step S11 includes:
monitoring a change log of an initial database, and analyzing newly written contents when the newly written contents exist in the change log;
and when the newly written content is analyzed to be the data change information of the initial database, forming a message by the first data main key in the data change information and the data content corresponding to the first data main key, and issuing the message to a message queue.
It can be understood that the newly written content in the change log is obtained by monitoring the information in the change log corresponding to the initial database in real time. When the newly written content is analyzed to be the data change information of the initial database, the change type of the data change information and the change position corresponding to the data change information in the initial database are obtained, a first data main key is further generated, a corresponding change message is formed by the first data main key and the corresponding data content, and the change message is sent to a message queue.
In step S12, the message queue includes, in addition to the message for updating data, other message information, and after a new message in the message queue is acquired, the new message is analyzed to determine that the type of the new message is a data change, and when the corresponding type of the data change is a modification, an insertion, or a deletion, the addresses of the new message in the initial database and the corresponding relationship map are determined, and the first data primary key included in the new message is determined according to the addresses.
In step S13, it can be understood that the messages in the message queue are prone to timing errors. For example: for a data table in the initial database, when a data record corresponding to a certain data primary key is changed, a possible operation mode is to delete the current data in the record corresponding to the primary key first, and then add the new data in the record corresponding to the primary key. Thus, two pieces of data change information are recorded in the change log, and two pieces of information are issued to the message queue.
If data updating is carried out based on related updating information in the information queue, the same updating data information is easy to cause that the updating information which is added after deleted is actually added, the instruction for adding data reaches the data processing center of the relational spectrogram before the instruction for deleting data, so that the data at the corresponding position in the relational spectrogram is added before deleted, and the relational spectrogram and the initial database have data inconsistency. Therefore, in this embodiment, the updating is not performed based on the data content recorded in the message, but based on the first location in the graph database of the data to be updated recorded in the first data primary key, the step of deleting the graph data in the first location is always performed first, and the initial database is reviewed based on the first data primary key, and the relational graph is updated based on the corresponding data in the initial database. And avoiding the inconsistency of the data in the relational graph and the data in the initial database.
In step S14, the initial database is traversed by the first data primary key, so as to obtain the data to be imported at the corresponding position in the initial database, and the data to be imported in the initial database is transmitted to the map database corresponding to the relational map.
Optionally, before the step S11, the updating method further includes:
acquiring data to be imported in an initial database, wherein the data to be imported comprises node data and relation data; wherein the node data includes node data corresponding to a company entity and node data corresponding to a person entity; the relationship data comprises legal relation data, investment relation data and/or parent company relation data among the node data;
and generating a relation graph according to the node data and the relation data.
It will be appreciated that the initial database is a relational database, which is a database that uses a relational model to organize data, wherein the data is stored in rows and columns, and that, for example, the data in the initial database may be represented as data tables of different relational types for ease of data processing. Optionally, a company is used as a header of a single table data in an initial database, an organization relationship between members of the company and identity information of each member are used as contents in the single table data to represent initial data corresponding to the company, and a related technician can obtain related information of the company by querying the initial data. The initial database records the organization relationship among the internal members of each company, the investment and invested relationship among each company, the corporate legal person, the primary and secondary company relationship and the like in a table form, and also records other data information such as the company management condition, the risk information of each company, the credit data of each company and the like. In order to obtain the relationship maps corresponding to the company relationship and the boss relationship of the company, corresponding data information needs to be screened from the initial database, for example, form data required for generating the relationship maps in the initial database can be captured by using keywords through a code function to serve as data to be imported, optionally, label classification can be performed on corresponding initial data during initial data storage, and when a relationship map generation signal is received, initial data corresponding to labels are directly screened out to serve as data to be imported.
It should be noted that the data to be imported generated through the above steps includes node data and relationship data, where the node data is used to represent information such as identity information of entity nodes, for example, identity card information of employees, history information of employees, identity information of legal persons, name information of companies, and the relationship data is used to represent a relationship between the nodes, for example, a primary-secondary company relationship between company entities, an employment relationship between employees and companies, an investment relationship between company entities, and a partnering relationship, a legal person relationship, an arbitrary relationship between entities. Fig. 2 is a schematic diagram of a relationship graph according to an exemplary embodiment, where the relationship graph shown in fig. 2 is generated according to each entity node in the data to be imported and the relationship between the entity nodes. For example, the company name and the personal name in the data to be imported may be captured according to a data capture function, and used as a plurality of initial nodes, and then the nodes corresponding to the relationship data in the data to be imported are extracted by applying a keyword extraction method, so as to establish a correspondence between each node data and generate a relationship graph.
It can be understood that, in general, the amount of data stored in the initial database is relatively large, and a single data extraction function is used to extract the first data to be imported from the initial database, which requires a large amount of computation and takes a lot of time. Therefore, an embodiment of the present disclosure provides a method for extracting first data to be imported, for example, in this embodiment, an initial database is MySQL, a database for storing a relational graph is a graph database, a graph database is Neo4j (graph database) in this embodiment, and the first data to be imported acquired in the above steps is sent to a data processing platform.
Fig. 3 is a schematic diagram illustrating another relationship map updating method according to an exemplary embodiment, and referring to fig. 3, the relationship map updating method further includes:
and S21, acquiring the second data primary key of the difference data in batch, and writing the second data primary key into the difference list.
And S22, traversing the difference list, and deleting all the business relations of the nodes corresponding to the second data primary keys in the relation graph aiming at any second data primary key in the difference list.
And S23, inquiring corresponding legal person records in the initial database based on the second data main key, and if legal person records exist, adding a legal person relationship corresponding to the node in the relationship map.
And S24, inquiring corresponding investment records in the initial database based on the second data main key, and if the investment records exist, adding the investment relation corresponding to the node in the relation map.
And S25, inquiring corresponding parent company records in the initial database based on the second data main key, and if the parent company records exist, adding the parent company relationship corresponding to the node in the relationship map.
For example, it can be understood that, when a user uses the relationship graph generated in the above embodiment, because actual node data and corresponding relationship data between the node data are changed, and related data in the initial database is not updated, or after the update, due to a line influence, a corresponding update message is not transmitted to the graph database corresponding to the relationship graph, the related data in the relationship graph is not updated in time, and an incorrect relationship graph is displayed. Therefore, another updating method is provided in this embodiment, and the relationship map is updated according to the difference data collected in the actual application. The second data primary keys corresponding to the difference data are obtained in batches, and it can be understood that the second data primary keys include position information of each difference data in the initial database and the graph database corresponding to the relational graph, and data needing to be updated can be determined at corresponding positions of the initial database and the graph database according to the position information. And writing the second data primary key into the difference list after the second data primary key is obtained in batches.
And traversing the difference list, determining entity nodes corresponding to the second data main keys in the relation graph aiming at each second data main key, and deleting all business relations corresponding to the entity nodes, so that the entity nodes corresponding to the difference data are isolated nodes at the moment, and no other entity nodes and the entity nodes have corresponding relation data. And according to the address information corresponding to each second data primary key, determining initial data, corresponding to the difference data, stored in the initial database, and inquiring whether the initial database contains corresponding relationship data, such as legal relation data, investment relation data, parent company relation data and the like, for expressing the mutual relationship among the nodes according to the initial data. And if the corresponding relationship data exists, reestablishing the corresponding node relationship in the relationship map based on the address information of the second data primary key in the relationship map, and updating the relationship map.
Optionally, the step S21 includes:
an error time period for the initial database, message queue, or relationship graph is determined.
And in the change log, determining the change content recorded in the error time period, and acquiring the second data main key of the difference data in batch from the recorded change content.
It can be understood that, in the generation of difference data in this embodiment, in the update process based on the above-mentioned relationship graph, an error occurs in the initial database or the message queue or the relationship graph in the update information transmission process, so that the case that the initial data corresponding to the initial database in the relationship graph is not matched occurs. Therefore, in this embodiment, according to the error time period, the change content recorded in the error time period may be determined in the change log, and the second data master key corresponding to the difference data may be acquired according to the change content, and the data in the relationship map may be updated based on the second data master key.
According to the embodiment of the present disclosure, a change log of an initial database is monitored, when data change information newly written in the initial database is written in the change log, the data change information is formed into a message and is issued to a message queue, the message queue is monitored to obtain a newly added message, when a data change type included in the newly added message is a modification type, an insertion type or a deletion type, a first data primary key included in the newly added message is determined, a first position in a relationship graph is determined based on the first data primary key, graph data stored at the first position is deleted, a second position in the initial database is determined based on the first data primary key, and data stored at the second position is imported to the first position in the relationship graph to update the relationship graph. Therefore, map data of a corresponding position in the relational map are deleted according to the first data main key, and then changed data of a second position in the initial database are led into the first position of the relational map according to the first data main key, so that updating of the relational map is achieved. The problems of disorder and data disorder caused by updating the relation maps based on the updating messages are solved, and the relation maps can be updated more accurately based on the changed data in the initial database.
FIG. 4 is a schematic diagram illustrating a method of generating a relationship graph, according to an example embodiment. It will be appreciated that the method may be applied to a server to form a data generation platform. As shown in fig. 4, the method for generating the relationship map includes the following steps:
and S31, acquiring the first node to be checked and the second node to be checked.
And S32, acquiring a full-scale relational graph from the first node to be searched to the second node to be searched based on the relational graph acquired by any one of the relational graph updating methods, wherein the full-scale relational graph comprises all paths from the first node to be searched to the second node to be searched.
And S33, obtaining the shortest path from the first node to be checked to the second node to be checked based on the full-scale relational graph.
And S34, generating a corresponding target relation map based on the shortest path.
For example, in step S31, the first node to be searched and the second node to be searched may be obtained from the mobile terminal, and the user inputs the node information to be searched through the app installed in the mobile terminal.
For example, in step S32, after receiving the first node to be searched and the second node to be searched, the server searches the relationship graph obtained by any of the above embodiments, obtains all different path information from the first node to be searched to the second node to be searched, where the path information includes corresponding nodes and relationships between the nodes, and generates the full-scale relationship graph from the first node to be searched to the second node to be searched according to the corresponding nodes and relationships between the nodes.
For example, in step S33 and step S34, the path with the fewest nodes passing through from the first node to be checked to the second node to be checked among the different paths is calculated according to the above-mentioned full-scale relationship graph, and the nodes and the relationships in the fewest paths are extracted, so as to generate the corresponding target relationship graph.
FIG. 5 is a block diagram illustrating an apparatus for updating a relationship graph, according to an example embodiment. Referring to fig. 5, the updating apparatus 100 includes a publishing module 110, a first determining module 120, a deleting module 130, and an updating module 140.
The publishing module 110 is configured to monitor a change log of the initial database, and when data change information written in the initial database is newly written in the change log, form a message with the data change information and publish the message to the message queue.
The first determining module 120 is configured to monitor the message queue to obtain the new message, and determine a primary key of data included in the new message when a data change type included in the new message is a modification type, an insertion type, or a deletion type.
The deleting module 130 is configured to determine a first position in the relationship map based on the data primary key, and delete map data stored in the first position.
And the updating module 140 is configured to determine a second location in the initial database based on the primary key of the data, and import the data stored in the second location into the first location in the relationship map to update the relationship map.
Optionally, the publishing module 110 may be further configured to:
monitoring a change log of the initial database, and analyzing the newly written content when the newly written content exists in the change log.
And when the newly written content is analyzed to be the data change information of the initial database, forming a message by the first data main key in the data change information and the data content corresponding to the first data main key, and issuing the message to a message queue.
Optionally, the updating apparatus 100 further includes:
the second acquisition module is used for acquiring data to be imported in the initial database, wherein the data to be imported comprises node data and relation data; wherein the node data includes node data corresponding to a company entity and node data corresponding to a person entity; the relationship data includes corporate relationship data, investment relationship data and/or parent company relationship data between the node data.
And the third generation module is used for generating a relation graph according to the node data and the relation data.
Optionally, the updating apparatus 100 further includes:
and the writing module is used for acquiring the second data main keys of the difference data in batches and writing the second data main keys into the difference list.
And the second deleting module is used for traversing the difference list and deleting all the business relations of the nodes corresponding to the second data primary keys in the relation graph aiming at any second data primary key in the difference list.
And the first newly-added module is used for inquiring the corresponding legal person record in the initial database based on the second data main key, and if the legal person record exists, the legal person relation corresponding to the node is newly added in the relation map.
And the second adding module is used for inquiring corresponding investment records in the initial database based on the second data main key, and if the investment records exist, adding the investment relation corresponding to the node in the relation map.
And the third newly-added module is used for inquiring corresponding parent company records in the initial database based on the second data main key, and if the parent company records exist, newly-added nodes in the relationship map correspond to the parent company relationships.
Optionally, the writing module is configured to:
an error time period for the initial database, message queue, or relationship graph is determined.
And in the change log, determining the change content recorded in the error time period, and acquiring the second data main key of the difference data in batch from the recorded change content.
FIG. 6 is a block diagram illustrating an apparatus for generating a relationship graph, according to an example embodiment. Referring to fig. 6, the generating apparatus 200 includes an obtaining module 210, a first generating module 220, a second determining module 230, and a second generating module 240.
The obtaining module 210 is configured to obtain a first node to be checked and a second node to be checked;
the first generating module 220 is configured to obtain a full-scale relationship graph from a first node to be searched to a second node to be searched based on a relationship graph obtained according to any one of the relationship graphs obtained by the updating method, where the full-scale relationship graph includes all paths from the first node to be searched to the second node to be searched.
The second determining module 230 is configured to obtain a shortest path from the first node to be checked to the second node to be checked based on the full-scale relationship graph.
The second generating module 240 is configured to generate a corresponding target relationship map based on the shortest path.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 7 is a block diagram illustrating an electronic device 700 in accordance with an example embodiment. For example, the electronic device 700 may be provided as a server. Referring to fig. 7, an electronic device 700 includes a processor 722, which may be one or more in number, and a memory 732 for storing computer programs that are executable by the processor 722. The computer programs stored in memory 732 may include one or more modules that each correspond to a set of instructions. Further, the processor 722 may be configured to execute the computer program to perform the above-described relationship map generation method.
Additionally, the electronic device 700 may also include a power component 726 that may be configured to perform power management of the electronic device 700 and a communication component 750 that may be configured to enable communication, e.g., wired or wireless communication, of the electronic device 700. The electronic device 700 may also include input/output (I/O) interfaces 758. The electronic device 700 may operate based on an operating system, such as Windows Server, stored in the memory 732TM,Mac OS XTM,UnixTM,LinuxTMAnd so on.
In another exemplary embodiment, there is also provided a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the method of generating a relationship map described above. For example, the non-transitory computer readable storage medium may be the memory 732 described above including program instructions executable by the processor 722 of the electronic device 700 to perform the method of generating a relationship map described above.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned method of generating a relationship map when executed by the programmable apparatus.
The preferred embodiments of the present disclosure are described in detail with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that, in the foregoing embodiments, various features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various combinations that are possible in the present disclosure are not described again.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.

Claims (10)

1. A method for updating a relationship graph, comprising:
monitoring a change log of an initial database, and when data change information of the initial database is newly written in the change log, forming the data change information into a message and issuing the message to a message queue;
monitoring the message queue to obtain a newly added message, and determining a first data primary key contained in the newly added message when the data change type contained in the newly added message is a modification type, an insertion type or a deletion type;
determining a first position in a relation map based on the first data primary key, and deleting map data stored at the first position;
determining a second position in the initial database based on the first data primary key, and importing data stored in the second position to the first position in the relation map so as to update the relation map.
2. The updating method according to claim 1, wherein the monitoring a change log of an initial database, and when data change information of the initial database is newly written in the change log, the data change information is formed into a message and issued to a message queue, comprises:
monitoring a change log of an initial database, and analyzing new written contents when the new written contents exist in the change log;
and when the newly written content is analyzed to be the data change information of the initial database, forming a message by the first data main key in the data change information and the data content corresponding to the first data main key, and issuing the message to the message queue.
3. The updating method of claim 1, wherein the relationship graph is an industrial-commercial relationship graph, the method further comprising:
acquiring data to be imported in the initial database, wherein the data to be imported comprises node data and relationship data; wherein the node data includes node data corresponding to a company entity and node data corresponding to a person entity; the relationship data comprises legal relation data, investment relation data and/or parent company relation data among the node data;
and generating the relation graph according to the node data and the relation data.
4. The updating method of claim 3, wherein the method further comprises:
obtaining second data main keys of the difference data in batch, and writing the second data main keys into the difference list;
traversing the difference list, and deleting all business relations of nodes corresponding to second data primary keys in the relation graph aiming at any second data primary key in the difference list;
inquiring corresponding legal person records in the initial database based on the second data main key, and if legal person records exist, newly adding legal person relations corresponding to the nodes in the relation map;
inquiring corresponding investment records in the initial database based on the second data main key, and if the investment records exist, newly adding the investment relation corresponding to the node in the relation map;
and inquiring corresponding parent company records in the initial database based on the second data primary key, and if the parent company records exist, newly adding the parent company relationship corresponding to the node in the relationship map.
5. The updating method of claim 4, wherein the obtaining the second data primary key of the difference data in batch comprises:
determining an error time period for the initial database, the message queue, or the relationship graph;
and in the change log, determining the change content recorded in the error time period, and acquiring the second data main key of the difference data in batch from the recorded change content.
6. A method for generating a relationship graph, comprising:
acquiring a first node to be checked and a second node to be checked;
generating a full-scale relational graph from the first node to be searched to the second node to be searched based on the relational graph obtained by the updating method according to any one of claims 1 to 5, wherein the full-scale relational graph comprises all paths from the first node to be searched to the second node to be searched;
determining a shortest path from the first node to be checked to the second node to be checked based on the full-scale relational graph;
and generating a corresponding target relation map based on the shortest path.
7. An apparatus for updating a relationship map, comprising:
the issuing module is used for monitoring a change log of an initial database, and when data change information of the initial database is newly written in the change log, the data change information is formed into a message and issued to a message queue;
the first determining module is used for monitoring the message queue to obtain a newly added message, and determining a data primary key contained in the newly added message when the data change type contained in the newly added message is a modification type, an insertion type or a deletion type;
the deleting module is used for determining a first position in a relation map based on the data main key and deleting map data stored in the first position;
and the updating module is used for determining a second position in the initial database based on the data primary key and importing the data stored in the second position into the first position in the relational map so as to update the relational map.
8. An apparatus for generating a relationship map, comprising:
the system comprises an acquisition module, a searching module and a judging module, wherein the acquisition module is used for acquiring a first node to be searched and a second node to be searched;
a first generation module, configured to obtain a full-scale relational graph from the first node to be examined to the second node to be examined based on the relational graph obtained according to the method of any one of claims 1 to 5, where the full-scale relational graph includes all paths from the first node to be examined to the second node to be examined;
a second determining module, configured to determine a shortest path from the first node to be searched to the second node to be searched based on the full-scale relationship graph;
and the second generation module is used for generating a corresponding target relation map based on the shortest path.
9. A non-transitory computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
10. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1 to 6.
CN202111681755.9A 2021-12-30 2021-12-30 Relationship graph updating method, device, medium, equipment and generating method Pending CN114328566A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111681755.9A CN114328566A (en) 2021-12-30 2021-12-30 Relationship graph updating method, device, medium, equipment and generating method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111681755.9A CN114328566A (en) 2021-12-30 2021-12-30 Relationship graph updating method, device, medium, equipment and generating method

Publications (1)

Publication Number Publication Date
CN114328566A true CN114328566A (en) 2022-04-12

Family

ID=81023800

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111681755.9A Pending CN114328566A (en) 2021-12-30 2021-12-30 Relationship graph updating method, device, medium, equipment and generating method

Country Status (1)

Country Link
CN (1) CN114328566A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116028651A (en) * 2023-03-28 2023-04-28 南京万得资讯科技有限公司 Knowledge graph construction system and method supporting ontology and data increment updating
CN117349297A (en) * 2023-12-06 2024-01-05 江西云眼视界科技股份有限公司 Data exchange method and system based on table structure change
CN118093614A (en) * 2024-04-28 2024-05-28 深圳市小赢信息技术有限责任公司 Data consistency and query method, device and system for multiple Neo4j

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116028651A (en) * 2023-03-28 2023-04-28 南京万得资讯科技有限公司 Knowledge graph construction system and method supporting ontology and data increment updating
CN117349297A (en) * 2023-12-06 2024-01-05 江西云眼视界科技股份有限公司 Data exchange method and system based on table structure change
CN118093614A (en) * 2024-04-28 2024-05-28 深圳市小赢信息技术有限责任公司 Data consistency and query method, device and system for multiple Neo4j

Similar Documents

Publication Publication Date Title
CN111522922B (en) Log information query method and device, storage medium and computer equipment
CN114328566A (en) Relationship graph updating method, device, medium, equipment and generating method
CN108647357B (en) Data query method and device
CN109740129B (en) Report generation method, device and equipment based on blockchain and readable storage medium
CN110990362A (en) Log query processing method and device, computer equipment and storage medium
CN112925757A (en) Method, equipment and storage medium for tracking operation log of intelligent equipment
CN111063183B (en) Bluetooth-based electric energy meter statistical method and device and storage medium
CN110347678A (en) A kind of storage method of finance data, system, device and equipment
CN116719750B (en) Software testing method and device, server equipment and storage medium
CN111209266B (en) Audit method and device based on Redis database and electronic equipment
CN117093556A (en) Log classification method, device, computer equipment and computer readable storage medium
CN111488386A (en) Data query method and device
CN115659375A (en) Data processing method, data processing device, storage medium and electronic equipment
CN110119337B (en) Data analysis method and device and server
CN107180072B (en) Method and device for processing time sequence data
CN111736848A (en) Packet conflict positioning method and device, electronic equipment and readable storage medium
CN111597235A (en) Data processing method and device and electronic equipment
CN114153830B (en) Data verification method and device, computer storage medium and electronic equipment
CN115994172B (en) Method, device, equipment and medium for determining service access relation
CN116260663B (en) Tax control management method and system for gas station
CN114519090B (en) Method and device for managing stop words and electronic equipment
CN111079199B (en) Enterprise credit data screenshot tamper-proofing method based on block chain technology
CN111723146B (en) Method for monitoring database, management system and storage medium
CN110895584B (en) Method and apparatus for generating data
CN109285036B (en) Internet of things service processing method and device and storage medium

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