Index creation method and apparatus based on knowledge graph
By creating and storing target indexes in the knowledge graph, the problems of maintenance cost and synchronization efficiency in the face of knowledge growth are solved, and dynamic updates and efficient data management are achieved.
Patent Information
- Application Number
- CN202111630367.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2041-12-28
AI Technical Summary
Existing knowledge graphs need to be rebuilt when faced with an increase in knowledge, resulting in a waste of human and material resources and an increase in maintenance costs. In addition, the real-time synchronization efficiency is low, which affects the real-time synchronization effect of the data source.
By defining the database of the target knowledge graph, extracting global data information, creating a target index, and storing it in the index database in combination with structural and data information, the dynamic updating and maintenance of the knowledge graph can be supported.
It reduces maintenance costs, saves resource consumption, reduces the risk of data loss due to emergencies, and improves the real-time synchronization efficiency of knowledge graphs.
Smart Images

Figure CN114297334B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, in particular to an index creation method and device based on a knowledge graph. BACKGROUND
[0002] With the development of Internet technology, a knowledge graph has become an important component of most search engines. By providing knowledge graphs in different fields, not only can the knowledge in the field be searched, but also the search efficiency and search accuracy can be guaranteed. However, in the prior art, most knowledge graphs are pre-constructed, and when facing an increase in knowledge, a re-constructed method is generally used, resulting in a waste of a large amount of manpower and resources, and the maintenance cost will also increase, so an effective solution is urgently needed to solve the above problems. SUMMARY
[0003] Therefore, the embodiments of the present application provide an index creation method based on a knowledge graph to solve the technical defects in the prior art. The embodiments of the present application also provide an index creation device based on a knowledge graph, a computing device, and a computer readable storage medium.
[0004] According to a first aspect of the embodiments of the present application, an index creation method based on a knowledge graph is provided, comprising:
[0005] determining a database corresponding to a target knowledge graph;
[0006] extracting global data information in the database, and creating a target index corresponding to the target knowledge graph according to the global data information;
[0007] storing the target index into an index database based on structure information of the target knowledge graph and the global data information.
[0008] Optionally, the creating the target index corresponding to the target knowledge graph according to the global data information comprises:
[0009] determining graph data corresponding to graph elements contained in the target knowledge graph according to the global data information;
[0010] reading data identifiers and memory identifiers associated with the graph data in the database;
[0011] establishing a mapping relationship between the data identifiers and the memory identifiers, and creating the target index corresponding to the target knowledge graph according to the mapping relationship.
[0012] Optionally, the storing the target index into an index database based on the structure information of the target knowledge graph and the global data information comprises:
[0013] obtain structure information corresponding to the target knowledge graph, and determine a relationship type contained in the target knowledge graph based on the structure information;
[0014] store the target index into the index database based on the relationship type and the global data information.
[0015] Optionally, the storing of the target index into the index database based on the relationship type and the global data information comprises:
[0016] parsing the global data information to obtain target field data, and constructing a target field data set based on the target field data;
[0017] establishing a data relationship between the target index and the target field data set;
[0018] grouping the target index for establishing the data relationship based on the relationship type to obtain a plurality of sub-target indexes, and writing the plurality of sub-target indexes into the index database respectively.
[0019] Optionally, the storing of the target index into the index database based on the relationship type and the global data information comprises:
[0020] parsing the global data information to obtain a target field name;
[0021] establishing an index relationship between the target index and the relationship type;
[0022] grouping the target index for establishing the index relationship based on the target field name to obtain a plurality of sub-target indexes, and writing the plurality of sub-target indexes into the index database respectively.
[0023] Optionally, the storing of the target index into the index database based on the structure information of the target knowledge graph and the global data information comprises:
[0024] determining a storage strategy corresponding to the index database;
[0025] storing the target index into the index database according to the storage strategy based on the structure information and the global data information.
[0026] Optionally, after the storing of the target index into the index database based on the structure information of the target knowledge graph and the global data information, the method further comprises:
[0027] receiving an adjustment instruction, and determining a data constraint of the target knowledge graph according to the adjustment instruction.
[0028] write the adjustment data into the database, and determine first storage information corresponding to the adjustment data, in a case where it is detected that the adjustment data carried in the adjustment instruction satisfies the data constraint;
[0029] update the target knowledge graph and the target index in the index database based on the first storage information.
[0030] Optionally, after the step of storing the target index into the index database based on the structure information of the target knowledge graph and the global data information is executed, the method further includes:
[0031] receiving a deletion instruction, and determining to-be-deleted data in the database according to the deletion instruction;
[0032] determining second storage information of the to-be-deleted data in the database, and performing deletion processing on the to-be-deleted data according to the second storage information;
[0033] updating the target knowledge graph and the target index in the index database according to a deletion processing result.
[0034] Optionally, after the step of storing the target index into the index database based on the structure information of the target knowledge graph and the global data information is executed, the method further includes:
[0035] receiving a stop instruction submitted for the target knowledge graph;
[0036] performing release processing on a storage space of the index database according to the stop instruction.
[0037] According to a second aspect of an embodiment of the present application, a knowledge graph-based index creation apparatus is provided, including:
[0038] a determination module configured to determine a database corresponding to a target knowledge graph;
[0039] a creation module configured to extract global data information in the database, and create a target index corresponding to the target knowledge graph according to the global data information;
[0040] a storage module configured to store the target index into an index database based on structure information of the target knowledge graph and the global data information.
[0041] According to a third aspect of an embodiment of the present application, a computing device is provided, including:
[0042] a memory and a processor;
[0043] The memory is configured to store computer executable instructions, and the processor executes the computer executable instructions to implement the steps of the knowledge graph based index creation method.
[0044] According to a fourth aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores computer executable instructions, and the instructions are executed by a processor to implement the steps of the knowledge graph based index creation method.
[0045] The knowledge graph based index creation method provided by the present application, when facing the add / delete / modify operation, firstly determines the database corresponding to the target knowledge graph, secondly extracts the global data information of the database, and combines the global data information to create the target index of the target knowledge graph, and finally stores the target index by combining the structure information and the global data information of the target knowledge graph. When facing any operation, the index information can be updated and stored by using this method, which not only can save more resource consumption, but also can reduce the maintenance cost, and greatly reduces the risk of data loss caused by unexpected events. BRIEF DESCRIPTION OF DRAWINGS
[0046] Figure 1 is a structural schematic diagram of a knowledge graph based index creation method provided by an embodiment of the present application;
[0047] Figure 2 is a flowchart of a first knowledge graph based index creation method provided by an embodiment of the present application;
[0048] Figure 3 is a flowchart of a second knowledge graph based index creation method provided by an embodiment of the present application;
[0049] Figure 4 is a flowchart of a third knowledge graph based index creation method provided by an embodiment of the present application;
[0050] Figure 5 is a flowchart of a fourth knowledge graph based index creation method provided by an embodiment of the present application;
[0051] Figure 6 is a processing flowchart applied to a knowledge graph index management scene provided by an embodiment of the present application;
[0052] Figure 7 is a structural schematic diagram of a knowledge graph based index creation device provided by an embodiment of the present application;
[0053] Figure 8 is a structural block diagram of a computing device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0054] In the following description, numerous specific details are set forth to provide a thorough understanding of the present application. However, the present application can be practiced without the specific details. In other instances, well-known methods have not been described in detail in order not to unnecessarily obscure aspects of the present application.
[0055] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present application. As used in this disclosure and the appended claims, the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0056] It will be understood that, although the terms first, second, etc. can be used herein to describe various information, these terms are not intended to denote a temporal or chronological order. Rather, these terms are used solely to distinguish one from another only. For example, a first entity discussed below could later be discussed as a second entity, and similarly, a second entity discussed below could later be discussed as a first entity without departing from the scope of one or more embodiments of the present application.
[0057] First, the noun terms related to one or more embodiments of the present application are explained.
[0058] Knowledge graph: (Knowledge Graph / Vault) is a series of various different graphs that show the development process and structural relationship of knowledge, and use visualization technology to describe knowledge resources and their carriers, mine, analyze, construct, draw and display knowledge and their mutual relationships. It is a modern theory that combines the theories and methods of mathematics, graphics, information visualization technology, information science, and other disciplines with citation analysis, co-occurrence analysis, and other methods, and uses visual graph to visually display the core structure, development history, frontier field and overall knowledge architecture of the subject to achieve the purpose of multi-disciplinary integration.
[0059] Neo4j: is a high-performance NOSQL graph database that stores structured data on a network rather than in tables. It is an embedded, disk-based, fully transactional Java persistence engine.
[0060] Schema: define the knowledge graph data model and the vocabulary used to describe the physical world, standardize the expression of structured data; it is an abstract set of metadata, the organization and structure of the database, which contains schema objects, which can be tables, columns, data types, views, stored procedures, relationships, primary keys, foreign keys, etc. The database schema can be represented by a visual graph, which shows the database objects and their relationships with each other.
[0061] Redis: (Remote Dictionary Server, Remote Dictionary Server) is an open source using ANSI C language, supporting network, based on memory can also be persistent log type, Key-Value database, and provides API in multiple languages.
[0062] In the present application, a knowledge graph-based index creation method is provided. The present application also relates to a knowledge graph-based index creation device, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments.
[0063] In practical applications, considering the dynamic characteristics of knowledge, after the construction of the knowledge graph is completed, the dynamic synchronization of the knowledge graph and the data source needs to be supported, that is, after the data source is modified (data is added or deleted), the knowledge graph needs to automatically obtain the modification information and complete the data synchronization in the knowledge graph in real time. In the synchronization process, the data interface provided by Neo4j is used to reduce the speed using the statement, and the corresponding modification can be completed.
[0064] In the synchronization process, the graph data that needs to be modified needs to be located in the knowledge graph. In the case of more than one million data, the query efficiency problem is faced, and the problem will worsen with the growth of the data volume. This will seriously affect the real-time synchronization effect of the knowledge graph and the data source. Currently, Neo4j provides the function of creating an index for node attributes, but the efficiency problem of relationship and relationship index synchronization still affects the efficiency of real-time update. Further, since Neo4j is used as a graph storage tool, it needs to face the interface calls of the application layer and the data layer at the same time. A large number of query modification calls in the real-time update process cause the interface load to be too large, affecting the use effect of the application layer. Using memory and other methods to dynamically maintain index data in the system will face the risk of system loss due to sudden situations such as breakpoints.
[0065] Reference Figure 1As shown in the schematic diagram, when facing the add / delete / modify operation, first, the database corresponding to the target knowledge graph is determined, second, the global data information of the database is extracted, and the target index of the target knowledge graph is created in combination with the global data information, and finally the storage of the target index can be completed through the joint of the structure information of the target knowledge graph and the global data information. When facing any operation, the index information can be updated and stored in this way, which not only can save more resource consumption, but also can reduce the maintenance cost, and greatly reduces the risk of data loss caused by unexpected events.
[0066] Figure 2 A flowchart of a knowledge graph-based index creation method according to an embodiment of the present application is shown, which specifically includes the following steps:
[0067] Step S202, determining the database corresponding to the target knowledge graph.
[0068] Specifically, the target knowledge graph specifically refers to the knowledge graph associated with any field or any search engine, and the knowledge graph has the demand of being updated, and the update refers to adding new entities, relationships, or deleting entities, relationships, or modifying entities, relationships, etc. Correspondingly, the database corresponding to the target knowledge graph specifically refers to the storage space for providing storage data for the target knowledge graph. Since the knowledge graph is a graphical structure embodying a large number of entities and relationships, in order to support the use of entities and relationships in the knowledge graph, the data corresponding to the entities and relationships needs to be stored in the database to support the service function of the knowledge graph. The database can be a Neo4j database.
[0069] It should be noted that the knowledge graph constructed in different fields will correspond to different databases. For example, the knowledge graph corresponding to the sports field will store a large amount of sports knowledge in the corresponding database, including but not limited to sports star names, sports types, and serving teams. For example, the knowledge graph corresponding to the geographical field will store a large amount of geographical knowledge in the corresponding database, including but not limited to geographical coordinates, country names, and terrain names. For example, the knowledge graph corresponding to the person field will store a large amount of person knowledge in the corresponding database, including but not limited to person names, serving relationships, and kinship relationships. The index creation process of the knowledge graph corresponding to different fields can be referred to the corresponding description content of the present embodiment, which is not limited here.
[0070] Step S204, extracting global data information in the database, and creating a target index corresponding to the target knowledge graph according to the global data information.
[0071] Specifically, after determining the database corresponding to the target knowledge graph, further, in order to quickly create index information for the target knowledge graph, global data information can be extracted from the database at this time, and the target index corresponding to the target knowledge graph is created based on the global data information, thereby facilitating subsequent storage to support the use of the target knowledge graph.
[0072] The global data information specifically refers to information related to all data involved in the database corresponding to the target knowledge graph, which includes but is not limited to the relationship type, data level identifier, data memory location level identifier, and data bit shift field corresponding to the data involved in the database, so as to facilitate subsequent creation of the target index based thereon; the relationship type is used to represent the relationship between the entities; the data level identifier specifically refers to the unique identifier of each entity at the data level; the data memory location level identifier specifically refers to the unique identifier of each entity at the storage location level; accordingly, the target index specifically refers to the index information that can query each entity in the database.
[0073] Based on this, after determining the database corresponding to the target knowledge graph, the global data information involved in the target knowledge graph can be extracted from the database, and the target index of the target knowledge graph is created based on the global data information, which can ensure that the created target index corresponds to the global information of the target knowledge graph, and can support the modification of the target knowledge graph and other operations.
[0074] Further, when creating the target index corresponding to the target knowledge graph based on the global data information, in order to ensure the comprehensiveness of the created target index, the data identifier and the memory identifier can be combined to achieve the following specific implementation in this embodiment:
[0075] Determine the graph data corresponding to the graph element contained in the target knowledge graph according to the global data information;
[0076] Read the data identifier and the memory identifier associated with the graph data in the database;
[0077] Establish a mapping relationship between the data identifier and the memory identifier, and create the target index corresponding to the target knowledge graph according to the mapping relationship.
[0078] Specifically, the graph element specifically refers to the basic element of the target knowledge graph, i.e., the entity and the relationship in the target knowledge graph; accordingly, the graph data specifically refers to the data related to the entity and the data related to the relationship; the data identifier specifically refers to the unique identifier of each relationship and adjacent entity at the data level, and the memory identifier specifically refers to the unique identifier of each relationship and adjacent entity at the storage level.
[0079] Based on this, after determining the global data information corresponding to the database, the graph data corresponding to the graph elements contained in the target knowledge graph can be determined according to the global data information at this time, and the data corresponding to the entities and relationships contained in the target knowledge graph can be determined according to the graph data at this time; then the data identifier and the memory identifier associated with the graph data can be read in the database, and the mapping relationship between the data identifier and the memory identifier is established based on this, so as to determine the mapping relationship of each relationship, that is, to determine the corresponding relationship of each relationship at the data level and the storage level, and finally the index for each relationship and entity can be created according to the mapping relationship, which is used as the target index of the target knowledge graph.
[0080] For example, the pre-established knowledge graph corresponding to the sports field contains that the coach of A is B, the partner of A is C, the age of B is 32, B is the legal person of S Club, the age of A is 18, and the age of C is 19; when creating an index for the knowledge graph corresponding to the sports field, in order to improve the index creation efficiency and reduce the maintenance cost of the knowledge graph, the relationship types {subordinate relationship and age relationship} and data constraints {unique constraint and check constraint} contained in the knowledge graph can be obtained by using Schema, wherein the data constraint refers to the condition for adjusting the knowledge graph, which is used to constrain how to adjust the knowledge graph for subsequent creation of the index.
[0081] Further, the unique identifier of the relationship at the data level (i.e., the data identifier) is obtained according to the relationship type, and it is determined that the unique identifier of “the coach of A is B” at the data level is D_ID1; the unique identifier of “the partner of A is C” at the data level is D_ID2; the unique identifier of “the age of B is 32” at the data level is D_ID3; the unique identifier of “B is the legal person of S Club” at the data level is D_ID4; the unique identifier of “the age of A is 18” at the data level is D_ID5; and the unique identifier of “the age of C is 19” at the data level is D_ID6.
[0082] At the same time, the unique identifier of the relationship at the storage level (i.e., the storage identifier) is determined, and it is determined that the unique identifier of “the coach of A is B” at the storage level is M_ID1; the unique identifier of “the partner of A is C” at the storage level is M_ID2; the unique identifier of “the age of B is 32” at the storage level is M_ID3; the unique identifier of “B is the legal person of S Club” at the storage level is M_ID4; the unique identifier of “the age of A is 18” at the storage level is M_ID5; and the unique identifier of “the age of C is 19” at the storage level is M_ID6.
[0083] Further, at this time, the index of each relationship data can be constructed according to the unique identifier at the data level and the unique identifier at the storage level, that is, it is determined that the index In1 corresponding to "the coach of A is B" is D / M_ID1; the index In2 corresponding to "the partner of A is C" is D / M_ID2; the index In3 corresponding to "the age of B is 32" is D / M_ID3; the index In4 corresponding to "B is the legal person of S Club" is D / M_ID4; the index In5 corresponding to "the age of A is 18" is D / M_ID5; and the index In6 corresponding to "the age of C is 19" is D / M_ID6, so as to facilitate subsequent storage of index information.
[0084] In summary, by combining the data identifier and the memory identifier to create the target index, the comprehensiveness and accuracy of the created index can be ensured, so as to fully reflect the storage relationship of the entities and relationships involved in the target knowledge graph, and facilitate direct reuse and adjustment when the target knowledge graph needs to be updated.
[0085] Step S206, store the target index to the index database based on the structure information of the target knowledge graph and the global data information.
[0086] Specifically, after the index creation for the target knowledge graph is completed, further, the target index can be stored to the index database corresponding to the target knowledge graph at this time; and in this process, in order to fully reflect the relationship between the target index and each relationship and entity, and to achieve direct reuse and adjustment when the target index is used, the storage of the target index can be completed in combination with the structure information of the target knowledge graph and the global data information, so as to reduce the maintenance cost and loss risk when the graph needs to be adjusted.
[0087] Based on this, the structure information specifically refers to the information corresponding to the graph structure of the target knowledge graph, and the relationship types involved in the target knowledge graph can be determined through the structure information, so as to facilitate mapping of the mapping relationship between the data in the database and the relationships in the graph; correspondingly, the index database specifically refers to a database for storing all index information (i.e., the target index) corresponding to the target knowledge graph, and the index database can change according to the adjustment of the target knowledge graph, that is, after the target knowledge graph changes, the corresponding index will also change, at this time the index database will dynamically update the changed index to ensure that the target knowledge graph can be used. In practical application, the index database can use Redis.
[0088] Further, when storing the target index, in order to ensure that the target index stored in the index database can be dynamically updated, the structure information and the global data information can be combined to achieve the following specific implementation in the embodiment:
[0089] In step S2062, the structural information corresponding to the target knowledge graph is obtained, and the relationship types contained in the target knowledge graph are determined based on the structural information.
[0090] Specifically, the relationship types refer to all types of relationships contained in the target knowledge graph. For example, in a person knowledge graph, relationships such as family relationship, position relationship, and age relationship are involved; in a sports knowledge graph, relationships such as position relationship, age relationship, gender relationship, and affiliation relationship are involved; in a geographical knowledge graph, relationships such as location relationship, attribute relationship, and history relationship are involved.
[0091] Based on this, after obtaining the structural information corresponding to the target knowledge graph, the relationships contained in the graph can be determined by analyzing the structural information. Then, by integrating all the relationships involved in the knowledge graph, the relationship types contained in the knowledge graph can be determined. That is, by combining the structural information to determine all the relationship types contained in the target knowledge graph, the mapping relationship between the relationships and the indexes can be established when storing the target index subsequently, so as to reflect the relationship between the database and the target knowledge graph, and to support the use of the target knowledge graph.
[0092] In step S2064, the target index is stored in the index database based on the relationship types and the global data information.
[0093] Specifically, after determining the relationship types contained in the target knowledge graph, the target index can be stored in the index database in combination with the relationship types and the global data information. In this process, since the global data information contains not only the information for constructing the target index, but also other information for storing the target index, in consideration of the storage efficiency of the target index and the convenience of subsequent use, the target index can be grouped by selecting the target field data or the target field name. Then, the grouped target index is stored. In this embodiment, the specific implementation is as follows:
[0094] (1) The target field data is obtained by analyzing the global data information, and a target field data set is constructed based on the target field data. A data relationship between the target index and the target field data set is established. The target index with the established data relationship is grouped based on the relationship types to obtain a plurality of sub-target indexes, and the plurality of sub-target indexes are written into the index database respectively.
[0095] Specifically, the target field data specifically refers to the fields corresponding to each relationship in the target knowledge graph in the database; correspondingly, the target field data set specifically refers to a set composed of all the fields corresponding to the relationships in the database; the data relationship specifically refers to the association relationship between the target index and the target field data set, and the target data field can be written into the target index through the data relationship, so that the mapping relationship between the relationship type and the target field data can be established when the sub-target index is generated subsequently, to realize the successful writing of the grouped sub-target index into the index database; the sub-target index is each target index grouped according to the relationship type.
[0096] Based on this, in order to ensure that the target index can be successfully written into the index database, and to support the use of the target knowledge graph, the global data information of the database (such as Neo4j) can be parsed to obtain the target field data corresponding to the relationship in the target knowledge graph, wherein the global data information is parsed, specifically referring to traversing all the data information contained in the global data information, to determine the target field data corresponding to the relationship according to the traversal result; that is, when traversing all the data information contained in the global data information, after traversing each data information, it is determined that the traversed data information belongs to the field data corresponding to the relationship or entity stored in the database, and then the field data corresponding to the relationship after traversal is selected as the target field data. Then, based on all the target field data involved, a target field data set is constructed, and a data relationship between all target indexes and the target field data set is established, that is, a mapping relationship between each target index and each target field data is established, so that the target indexes establishing the data relationship can be grouped based on the relationship type to obtain multiple sub-target indexes, and finally the multiple sub-target indexes are written into the index database.
[0097] In summary, by establishing the data relationship, the relationship type and the target field data can be associated, multiple sub-target indexes can be divided based on this, which facilitates the storage of index information in the index database, and effectively improves the storage efficiency.
[0098] (2) The global data information is parsed to obtain the target field name; the index relationship between the target index and the relationship type is established; the target index establishing the index relationship is grouped based on the target field name to obtain multiple sub-target indexes, and the multiple sub-target indexes are written into the index database.
[0099] Specifically, the target field name specifically refers to a unique name of a field corresponding to each relationship in the target knowledge graph in the database; correspondingly, the index relationship specifically refers to an association relationship between the target index and each target field name, and the target field name and the corresponding target index can be associated through the index relationship, so that when the sub-target index is written into the index database, a mapping relationship between the relationship type and the target field name can be established, so that the grouped sub-target index can be successfully written into the index database; the sub-target index is each target index obtained after grouping according to the relationship type; wherein the target field name represents a field corresponding to a relationship in the database, and each relationship corresponds to a data type, so when grouping, grouping based on the target field name is grouping according to the relationship type to which the field corresponding to the target field name belongs.
[0100] Based on this, in order to ensure that the target index can be successfully written into the index database and support the use of the target knowledge graph, the global data information of the database can be analyzed to obtain the target field name corresponding to each relationship in the target knowledge graph; then the index relationship between all target indexes and all target field names is established, so that the target indexes establishing the index relationship can be grouped based on the relationship type of each relationship to obtain multiple sub-target indexes, and finally the multiple sub-target indexes can be written into the index database.
[0101] In summary, by establishing the index relationship, the relationship type and the target field name can be associated, multiple sub-target indexes can be divided based thereon, the storage of index information to the index database is facilitated, and the storage efficiency is effectively improved.
[0102] In addition, when writing the target index into the index database, it can also be completed according to the preset storage strategy. In this embodiment, the specific implementation manner is as follows:
[0103] Determine the storage strategy corresponding to the index database;
[0104] Store the target index into the index database according to the storage strategy based on the structure information and the global data information.
[0105] Specifically, the storage strategy specifically refers to storing the target index according to the characteristics of the index database, combining the set algorithm and mode; if the index database is Redis, the target index can be written into Redis in the form of hash and set by grouping according to the structure information and global data information, and the data storage characteristics of Redis are combined to ensure the storage success rate and efficiency. Correspondingly, the storage strategy can also be to store by covering according to the characteristics of the index database; if the index database is Redis, the target index can be converted into the same format as the index to be replaced and written into the database according to the structure information and global data information. In practical applications, the way of writing into the index database can be selected according to the actual application scene, and the present embodiment does not make any limitation here.
[0106] In the above example, after determining the index, the unique fields corresponding to each data in the database can also be determined according to the global data information, the unique field of "M's coach is E" is UF1, the unique field of "M's partner is C" is UF2, the unique field of "E's age is 32" is UF3, the unique field of "E is the legal person of S Club" is UF4, the unique field of "M's age is 18" is UF5, and the unique field of "C's age is 19" is UF6.
[0107] Further, at this time, the data can be stored in the form of hash and set by grouping according to the relationship type, the target field name and the data storage characteristics of Redis. Based on this, the relationship type is {subordinate relationship S1 and age relationship S2}, and since Redis is a key-value storage system, at this time, the index of each data can be stored by combining the above information, that is, the index storage format corresponding to "M's coach is E" is S1 / UF1 / key1-value1 / D / M_ID1, the index storage format corresponding to "M's partner is C" is S2 / UF2 / key2-value2 / D / M_ID2, the index storage format corresponding to "E's age is 32" is S3 / UF3 / key3-value3 / D / M_ID3, the index storage format corresponding to "E is the legal person of S Club" is S4 / UF4 / key4-value4 / D / M_ID4, the index storage format corresponding to "M's age is 18" is S5 / UF5 / key5-value5 / D / M_ID5, and the index storage format corresponding to "C's age is 19" is S6 / UF6 / key6-value6 / D / M_ID6, and the index creation and storage for the above knowledge graph are completed.
[0108] In actual application, as the use time of the knowledge graph becomes longer, the related content may be modified, deleted or increased. For example, the chairman of a company is changed, at this time, the knowledge graph related to the position relationship of the company needs to be adjusted. The adjustment may involve deleting the original position relationship, adding a new position relationship, adjusting the other relationships of the original chairman, etc. If the knowledge graph is reconstructed based on such changes, a large amount of manpower, material resources and resource waste will be consumed. Therefore, in the face of different adjustment requirements, in order to save maintenance costs and avoid resource waste, different processing strategies can be used to update the knowledge graph, the database corresponding to the knowledge graph, and the index database according to different requirements.
[0109] Referring to Figure 3 The second knowledge graph-based index creation method provided by the embodiment of the application is shown in the flowchart. When there is an adjustment requirement for the knowledge graph, steps S302 to S306 can be used to implement the adjustment:
[0110] In step S302, an adjustment instruction is received, and data constraints of a target knowledge graph are determined according to the adjustment instruction.
[0111] In step S304, when it is detected that the adjustment data carried in the adjustment instruction satisfies the data constraints, the adjustment data is written into the database, and first storage information corresponding to the adjustment data is determined.
[0112] In step S306, the target knowledge graph and the target index in the index database are updated based on the first storage information.
[0113] Specifically, the adjustment instruction specifically refers to an instruction for increasing or modifying the target knowledge graph. Based on the instruction, the content to be added or modified can be determined, such as adding a new entity or modifying an original relationship. The adjustment instruction is submitted by a development user who needs to update the index of the target knowledge graph. Correspondingly, the data constraints specifically refer to the conditions for adjusting the target knowledge graph. When the adjustment instruction is received, it indicates that the index of the knowledge graph needs to be adjusted. In order to ensure that the adjusted index can be reused on the knowledge graph, the data constraints of the target knowledge graph need to be queried based on the adjustment instruction to complete the subsequent processing operation. It should be noted that in the scenario of updating the target index, the adjustment instruction will carry data information of the updated index. Based on the data information carried by the adjustment instruction, the data constraints to be queried can be determined. After receiving the adjustment instruction, the adjustment instruction is triggered to trigger the update processing operation of the index according to the pre-established mechanism. The adjustment data specifically refers to the data corresponding to the relationship or entity to be added to the target knowledge graph. Correspondingly, the first storage information specifically refers to the storage location information corresponding to the adjustment data after being written into the database.
[0114] It should be noted that when a new relationship or entity is added in the knowledge graph, new data will also be written in the corresponding database. At this time, in order to support the new relationship or entity that can be queried, a new target index will also be created for the new data, and the update of the target index already stored in the index database will be completed by writing the index database. The creation process of the new target index can refer to the same or similar description in the above embodiments, and will not be described in detail in this embodiment.
[0115] Based on this, when the adjustment instruction is received, the data constraint of the target knowledge graph can be determined according to the adjustment instruction. If it is detected that the adjustment data carried in the adjustment instruction meets the data constraint, it means that the relationship or entity in the target knowledge graph can be adjusted based on the current adjustment instruction, or a new entity or relationship is added to the knowledge graph. At this time, the adjustment data can be directly written into the database corresponding to the target knowledge graph, and the first storage information corresponding to the adjustment data is determined, and the index corresponding to the adjustment data is determined. Finally, the target knowledge graph and the target index in the index database are updated based on the first storage information, which realizes the writing of new data and the update of the target knowledge graph.
[0116] Based on the above example, when it is determined that new relationship data needs to be added based on the data source, the gender of A is male. In order to be able to query the gender of A through the knowledge graph later, the data constraint of the knowledge graph can be queried by using the index management system at this time, and the data constraint of the knowledge graph is determined as {unique constraint and check constraint}. The unique constraint is used to limit the uniqueness of the relationship between entities in the knowledge graph, that is, the uniqueness of the knowledge graph entity and relationship. Correspondingly, the check constraint is used to limit the query standard when the knowledge graph is used to be in accordance with the set logic. That is, if new relationship data is to be added to the knowledge graph, it needs to be preprocessed according to the data constraint, so as to ensure that it can be reused in the use stage. At this time, the graph data requirement of the knowledge graph can be determined according to the data constraint. If the data meets the data requirement of the graph, the data of the gender of A is male can be written into the database at this time, and the storage information of the relationship data is returned. The information of adding data in Neo4j is added to the index relationship system, information synchronization is realized, and the creation and storage of the index of the new relationship data can refer to the description above, and will not be described in detail here.
[0117] In summary, the update of the target knowledge graph is realized by adopting the adjustment mode, which not only can reduce the maintenance cost of the target knowledge graph, but also can reduce the consumption of resources.
[0118] Referring to Figure 4 The third knowledge graph-based index creation method provided by the application embodiment shown in the flowchart; when there is a deletion requirement for the knowledge graph, steps S402 to S406 can be used to achieve:
[0119] Step S402, receiving the deletion instruction, and determining the data to be deleted in the database according to the deletion instruction.
[0120] Step S404, determining the second storage information of the data to be deleted in the database, and performing deletion processing on the data to be deleted according to the second storage information.
[0121] Step S406, updating the target knowledge graph and the target index in the index database according to the deletion processing result.
[0122] Specifically, the deletion instruction specifically refers to an instruction for deleting entities or relationships in the knowledge graph. Based on the instruction, the entity or relationship to be deleted can be determined. The deletion instruction is submitted by a development user who needs to adjust the index of the target knowledge graph. Correspondingly, the data to be deleted specifically refers to the data corresponding to the entity or relationship in the database that cannot be used in the target knowledge graph. When the deletion instruction is received, it means that the index of the knowledge graph needs to be adjusted. In order to ensure that the adjusted index no longer contains the index corresponding to the data to be deleted, the data to be deleted in the database needs to be determined based on the deletion instruction. That is, when the deletion instruction is received, the data to be deleted in the database is determined as the data to be deleted based on the preset establishment mechanism for subsequent processing. Correspondingly, the second storage information specifically refers to the storage location information of the data to be deleted in the database.
[0123] Based on this, after receiving the deletion instruction, the data to be deleted in the database can be determined based on the deletion instruction, and the second storage information of the data to be deleted in the database can be determined. Then, the data to be deleted is deleted according to the second storage information. Finally, the target knowledge graph and the target index in the index database are updated according to the deletion processing result.
[0124] That is, when the relationship data to be deleted is determined based on the data source, the ID of the deleted relationship data can be used to query the storage location information of the data in the Neo4j database in the index system. The data deletion operation in Neo4j is completed using the location information, and the index information of the data is deleted from the index system to ensure data synchronization.
[0125] In the above example, when the coach of A in the knowledge graph is C, the data to be deleted corresponding to the coach of A is determined in the database corresponding to the knowledge graph, and the storage information of the data to be deleted in Neo4j is determined. The data to be deleted is deleted according to the storage information. At the same time, in order to avoid affecting other searches after deletion, the knowledge graph and the index in the index database are updated according to the deletion processing result.
[0126] In summary, when data needs to be deleted, updating the target knowledge graph, the database and the index database synchronously can avoid the problem of affecting the mapping relationship among the three after deletion, thereby ensuring consistency among the three.
[0127] Referring to Figure 5 The fourth knowledge graph-based index creation method provided by the embodiment of the application provides a flowchart. When there is a stop requirement for a knowledge graph, steps S502 to S504 can be implemented to:
[0128] Step S502 receives a stop instruction submitted for a target knowledge graph.
[0129] Step S504 releases the storage space of the index database according to the stop instruction.
[0130] Specifically, the stop instruction specifically refers to a stop using instruction submitted for the target knowledge graph, wherein the stop instruction is submitted by a development user who needs to close the index of the target knowledge graph. Based on this, when the stop instruction submitted for the target knowledge graph is received, it indicates that the target knowledge graph is stopped using. At this time, in order to avoid the data related to the target knowledge graph occupying more storage space, the storage space of the index database can be released according to the stop instruction. That is, when the real-time update service is stopped and the index information needs to be released, the Redis database can be emptied.
[0131] That is, when the stop instruction submitted by the development user is received, it indicates that the target knowledge graph needs to be stopped using, and it cannot continue to provide information query for users. At this time, in order to avoid occupying more storage space of the database, the index information in the index database (such as the Redis database) can be deleted, that is, when the index information is released, the index information about the knowledge graph in the index database is deleted, and the storage space of the index database is restored to an unused state.
[0132] In addition, although the storage space of the index database is released and the index information about the target knowledge graph is deleted, the data about the entities and relationships in the target knowledge graph stored in the database (such as Neo4j) corresponding to the target knowledge graph is not deleted. Therefore, when the target knowledge graph can continue to provide information query for users after adjustment or update, the knowledge graph will be used again. Further, at this time, if the normal use of the target knowledge graph is to be supported, the index corresponding to the adjusted or updated target knowledge graph needs to be re-established and written into the index database. In this process, a new target index needs to be created, and the creation process of the new target index can be referred to the same or similar description in the above embodiments, which will not be described in detail herein.
[0133] In summary, by releasing the index database in the manner of release processing, the problem of waste of storage resources caused by the index data occupying more storage space can be avoided.
[0134] The index creation method based on the knowledge graph provided in the application can, when facing an increase / deletion / alteration operation, first determine the database corresponding to the target knowledge graph, second extract the global data information of the database, and third create the target index of the target knowledge graph in combination with the global data information. Finally, the storage of the target index can be completed by combining the structure information of the target knowledge graph and the global data information. When facing any operation, the index information can be updated and stored in this way, which not only saves more resource consumption, but also reduces the maintenance cost, greatly reducing the risk of data loss caused by unexpected events.
[0135] The following describes the index creation method based on the knowledge graph in combination with the accompanying drawings Figure 6 The index creation method based on the knowledge graph is further described by taking the application of the index creation method based on the knowledge graph in the knowledge graph index management scene as an example. Among them, Figure 6 Fig. 1 shows a processing flowchart applied to a knowledge graph index management scene according to an embodiment of the application, which specifically includes the following steps:
[0136] Step S602, the relationship types and data constraints contained in the knowledge graph are acquired.
[0137] For example, the pre-established knowledge graph contains that A's father is B, A's mother is C, B's wife is C, B is the chairman of Company A, C is the general manager of Company B, and A is a student of School C. When an index needs to be created for the knowledge graph, the relationship types {kinship and position} and data constraints {unique constraint and check constraint} contained in the knowledge graph can be acquired by using Schema, which are used for subsequent creation of the index.
[0138] Step S604, global data information is extracted from the database corresponding to the knowledge graph.
[0139] Step S606, the target index is created according to the global data information.
[0140] Specifically, in order to create an index for the above knowledge graph and complete the rapid synchronization of the data source and the knowledge graph, the global data information can be extracted from the database (such as Neo4j) of the knowledge graph at one time. The global data information includes the relationship types corresponding to the data involved in the database, the relationship data level identifier, the relationship data memory location level identifier, and the data bit shift field, which facilitates subsequent index creation.
[0141] Based on this, the relationship type is determined to be {kinship and position relationship}, and data level identifiers {A's father is B = D_ID1; A's mother is C = D_ID2; B's wife is C = D_ID3; B is the chairman of Company A = D_ID4; C is the general manager of Company B = D_ID5; A is a student of School C = D_ID6} and data memory level identifiers {A's father is B = M_ID1; A's mother is C = M_ID2; B's wife is C = M_ID3; B is the chairman of Company A = M_ID4; C is the general manager of Company B = M_ID5; A is a student of School C = M_ID6} can be obtained according to the relationship type.
[0142] At this time, indexes of each data can be constructed according to the data level identifiers and the memory level identifiers, and the index In1 corresponding to A's father is B is D / M_ID1; the index In2 corresponding to A's mother is C is D / M_ID2; the index In3 corresponding to B's wife is C is D / M_ID3; the index In4 corresponding to B being the chairman of Company A is D / M_ID4; the index In5 corresponding to C being the general manager of Company B is D / M_ID5; and the index In6 corresponding to A being a student of School C is D / M_ID6.
[0143] Further, the uniqueness fields of each data are determined to constitute a set of unique field data, the unique field of A's father is B is UF1, the unique field of A's mother is C is UF2, the unique field of B's wife is C is UF3, the unique field of B being the chairman of Company A is UF4, the unique field of C being the general manager of Company B is UF5, and the unique field of A being a student of School C is UF6. After determining each global data information, storage is facilitated.
[0144] Step S608, the target index is stored according to the global data information.
[0145] Specifically, the relationship type is {kinship S1 and position S2}, at this time, the storage can be performed based on the relationship type, that is, the index storage format corresponding to the father of A being B is S1 / UF1 / key1-value1 / D / M_ID1; the index storage format corresponding to the mother of A being C is S2 / UF2 / key2-value2 / D / M_ID2; the index storage format corresponding to the wife of B being C is S3 / UF3 / key3-value3 / D / M_ID3; the index storage format corresponding to B being the chairman of the company is S4 / UF4 / key4-value4 / D / M_ID4; the index storage format corresponding to C being the general manager of the company is S5 / UF5 / key5-value5 / D / M_ID5; and the index storage format corresponding to A being a student of the school is S6 / UF6 / key6-value6 / D / M_ID6, thereby completing the index creation and storage of the knowledge graph.
[0146] When it is determined based on the data source that new relationship data needs to be added, such as the girlfriend of A being D, the data constraint can be queried by using the index management system, and it is determined that the data constraint of the knowledge graph is {unique constraint and check constraint}, at this time, the graph data requirement of the knowledge graph can be determined according to the data constraint, if the data meets the requirement of the graph, at this time, the data A's girlfriend is D can be inserted into the Neo4j database, and the storage information of the relationship data is returned, the information of the added data in the Neo4j is added to the index relationship system, information synchronization is realized, and the creation and storage of the index of the new relationship data can be referred to the above description, and will not be described in detail here.
[0147] In summary, the index management of the knowledge graph is realized, so that the index search efficiency is reduced from seconds to milliseconds, the query efficiency is greatly improved, the real-time performance of the update is ensured, the index information is maintained separately, the frequency of Neo4j interface calling is reduced, the calling pressure is greatly reduced, and in the process, considering the maintenance cost, a mature database such as Redis can be used for index maintenance, so that the risk of data loss caused by sudden events is greatly reduced.
[0148] Corresponding to the method embodiment, the application also provides an index creation device based on a knowledge graph, Figure 7 Fig. 1 shows a structure schematic diagram of an index creation device based on a knowledge graph according to an embodiment of the application. As shown in the figure, Figure 7 The device comprises:
[0149] A determination module 702 configured to determine a database corresponding to a target knowledge graph;
[0150] The creating module 704 is configured to extract global data information from the database, and create a target index corresponding to the target knowledge graph according to the global data information.
[0151] The storing module 706 is configured to store the target index into an index database based on structure information of the target knowledge graph and the global data information.
[0152] In an optional embodiment, the creating module 704 is further configured to:
[0153] determine graph data corresponding to graph elements contained in the target knowledge graph according to the global data information, read data identifiers and memory identifiers associated with the graph data in the database, establish a mapping relationship between the data identifiers and the memory identifiers, and create the target index corresponding to the target knowledge graph according to the mapping relationship.
[0154] In an optional embodiment, the storing module 706 is further configured to:
[0155] obtain structure information corresponding to the target knowledge graph, determine a relationship type contained in the target knowledge graph based on the structure information, and store the target index into the index database based on the relationship type and the global data information.
[0156] In an optional embodiment, the storing module 706 is further configured to:
[0157] analyze the global data information to obtain target field data, construct a target field data set based on the target field data, establish a data relationship between the target index and the target field data set, group the target index establishing the data relationship based on the relationship type to obtain a plurality of sub-target indexes, and write the plurality of sub-target indexes into the index database respectively.
[0158] In an optional embodiment, the storing module 706 is further configured to:
[0159] analyze the global data information to obtain a target field name, establish an index relationship between the target index and the relationship type, group the target index establishing the index relationship based on the target field name to obtain a plurality of sub-target indexes, and write the plurality of sub-target indexes into the index database respectively.
[0160] In an optional embodiment, the storing module 706 is further configured to:
[0161] determine a storage strategy corresponding to the index database; and store the target index into the index database according to the storage strategy based on the structure information and the global data information.
[0162] In an optional embodiment, the apparatus further includes:
[0163] The adjusting module is configured to receive an adjusting instruction, and determine a data constraint of the target knowledge graph according to the adjusting instruction; in a case where adjusting data carried in the adjusting instruction meets the data constraint, write the adjusting data into the database, and determine first storage information corresponding to the adjusting data; and update the target knowledge graph and the target index in the index database based on the first storage information.
[0164] In an optional embodiment, the apparatus further includes:
[0165] The deleting module is configured to receive a deleting instruction, and determine to-be-deleted data in the database according to the deleting instruction; determine second storage information of the to-be-deleted data in the database, and perform deleting processing on the to-be-deleted data according to the second storage information; and update the target knowledge graph and the target index in the index database according to a deleting processing result.
[0166] In an optional embodiment, the apparatus further includes:
[0167] The stopping module is configured to receive a stopping instruction submitted for the target knowledge graph; and perform releasing processing on a storage space of the index database according to the stopping instruction.
[0168] The index creation apparatus based on a knowledge graph provided in the application, when facing an increase / deletion / alteration operation, firstly determines a database corresponding to a target knowledge graph, secondly extracts global data information of the database, and creates a target index of the target knowledge graph in combination with the global data information, and finally stores the target index by jointly using structure information of the target knowledge graph and the global data information. When facing any operation, the index information can be updated and stored in this way, which not only can save more resource consumption, but also can reduce maintenance cost, and greatly reduces the risk of data loss caused by a sudden event.
[0169] The above is a schematic scheme of the index creation device based on the knowledge graph according to the embodiment. It should be noted that the technical scheme of the index creation device based on the knowledge graph is the same as the technical scheme of the index creation method based on the knowledge graph, and the details of the technical scheme of the index creation device based on the knowledge graph that are not described in detail can be seen from the description of the technical scheme of the index creation method based on the knowledge graph. In addition, each component in the device embodiment should be understood as a functional module that must be established to implement each step of the program flow or each step of the method. Each functional module is not a limitation of actual functional division or separation. The device claim defined by such a group of functional modules should be understood as a functional module architecture for realizing the solution of the computer program mainly recorded in the specification, and should not be understood as an entity device for realizing the solution mainly through hardware.
[0170] Figure 8 A structural block diagram of a computing device 800 according to an embodiment of the present application is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 through a bus 830, and a database 850 is used to save data.
[0171] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 840 can include one or more of any type of network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0172] In an embodiment of the present application, the above-mentioned components of the computing device 800 and other components not shown in the Figure 8 should be understood that the components of the computing device 800 can be connected to each other through a bus, for example. Figure 8 The structural block diagram of the computing device shown is only for the purpose of example, and is not a limitation on the scope of the present application. Those skilled in the art can add or replace other components as needed.
[0173] The computing device 800 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. The computing device 800 can also be a mobile or stationary server.
[0174] The processor 820 is configured to execute computer-executable instructions, including:
[0175] determine a database corresponding to the target knowledge graph;
[0176] extract global data information from the database, and create a target index corresponding to the target knowledge graph according to the global data information;
[0177] store the target index into an index database based on the structure information of the target knowledge graph and the global data information.
[0178] The above is a schematic scheme of the computing device of the embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the index creation method based on the knowledge graph described above belong to the same concept, and the details of the technical scheme of the computing device which are not described in detail can be referred to the description of the technical scheme of the index creation method based on the knowledge graph.
[0179] An embodiment of the present application further provides a computer readable storage medium, which stores computer instructions, and the instructions are executed by a processor to:
[0180] determine a database corresponding to the target knowledge graph;
[0181] extract global data information from the database, and create a target index corresponding to the target knowledge graph according to the global data information;
[0182] store the target index into an index database based on the structure information of the target knowledge graph and the global data information.
[0183] The above is a schematic scheme of the computer readable storage medium of the embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the index creation method based on the knowledge graph described above belong to the same concept, and the details of the technical scheme of the storage medium which are not described in detail can be referred to the description of the technical scheme of the index creation method based on the knowledge graph.
[0184] The above-described embodiments of the application have several aspects, no single one of which is solely responsible for the application's desirable attributes. Without limiting the scope of the application as expressed by the claims which follow, some further embodiments make these aspects even more useful. Other embodiments can result in less desirable attributes.
[0185] The computer readable medium can include any entity or apparatus capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium can include appropriate contents according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
[0186] It should be noted that for the foregoing method embodiments, the acts described can be performed in a different order than that described, and some acts can be performed in parallel. It should also be noted that the embodiments described in the specification are preferred embodiments, and the acts and modules involved are not necessarily essential to the application.
[0187] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0188] The preferred embodiments of the application disclosed above are only used to help explain the application. The alternative embodiments do not describe all the details and limit the application to the specific embodiments described. Obviously, according to the content of the application, many modifications and changes can be made. The application selects and describes these embodiments in order to better explain the principles and practical application of the application, so that those skilled in the art can well understand and use the application. The application is limited by the claims and their full scope and equivalents.
Claims
1. A method for creating an index based on a knowledge graph, characterized by, The method comprises: determining a database corresponding to a target knowledge graph; extracting global data information from the database, and creating a target index corresponding to the target knowledge graph according to the global data information, wherein the global data information is information related to data in the database corresponding to the target knowledge graph; storing the target index into an index database based on structure information of the target knowledge graph and the global data information, wherein the structure information is used to determine a relationship type contained in the target knowledge graph, and the relationship type is used to map a mapping relationship between data in the database and the relationship in the target knowledge graph; receiving an adjustment instruction, and determining a data constraint of the target knowledge graph according to the adjustment instruction, wherein the data constraint is used to constrain an adjustment manner of the knowledge graph; in a case where adjustment data carried in the adjustment instruction meets the data constraint, writing the adjustment data into the database, and determining first storage information corresponding to the adjustment data; updating the target knowledge graph and the target index in the index database based on the first storage information.
2. The method of claim 1, wherein, The creating of the target index corresponding to the target knowledge graph according to the global data information comprises: determining graph data corresponding to graph elements contained in the target knowledge graph according to the global data information; reading data identifiers and memory identifiers associated with the graph data in the database; establishing a mapping relationship between the data identifiers and the memory identifiers, and creating the target index corresponding to the target knowledge graph according to the mapping relationship.
3. The method of claim 1, wherein, The storing of the target index into the index database based on the structure information of the target knowledge graph and the global data information comprises: obtaining structure information corresponding to the target knowledge graph, and determining a relationship type contained in the target knowledge graph based on the structure information; storing the target index into the index database based on the relationship type and the global data information.
4. The method of claim 3, wherein, The storing of the target index into the index database based on the relationship type and the global data information comprises: parsing the global data information to obtain target field data, and constructing a target field data set based on the target field data; establishing a data relationship between the target index and the target field data set; grouping the target index establishing the data relationship based on the relationship type to obtain a plurality of sub-target indexes, and writing the plurality of sub-target indexes into the index database respectively.
5. The method of claim 3, wherein, The storing of the target index into the index database based on the relationship type and the global data information comprises: parsing the global data information to obtain a target field name; establishing an index relationship between the target index and the relationship type; grouping the target index establishing the index relationship based on the target field name to obtain a plurality of sub-target indexes, and writing the plurality of sub-target indexes into the index database respectively.
6. The method of claim 1, wherein, The storing the target index into the index database based on the structure information of the target knowledge graph and the global data information comprises: determining a storage strategy corresponding to the index database; storing the target index into the index database according to the storage strategy based on the structure information and the global data information.
7. The method according to any one of claims 1 to 6, characterized in that, After the step of storing the target index into the index database based on the structure information of the target knowledge graph and the global data information is executed, the method further comprises: receiving a deletion instruction, and determining to-be-deleted data in the database according to the deletion instruction; determining second storage information of the to-be-deleted data in the database, and performing deletion processing on the to-be-deleted data according to the second storage information; updating the target knowledge graph and the target index in the index database according to a deletion processing result.
8. The method according to any one of claims 1 to 6, characterized in that, After the step of storing the target index into the index database based on the structure information of the target knowledge graph and the global data information is executed, the method further comprises: receiving a stop instruction submitted for the target knowledge graph; performing release processing on a storage space of the index database according to the stop instruction. 9.A knowledge graph-based index creation apparatus, characterized by comprising: The method comprises: a determining module configured to determine a database corresponding to a target knowledge graph; a creating module configured to extract global data information in the database, and create a target index corresponding to the target knowledge graph according to the global data information, wherein the global data information is information related to data in the database corresponding to the target knowledge graph; a storing module configured to store the target index into an index database based on structure information of the target knowledge graph and the global data information, wherein the structure information is used to determine a relationship type contained in the target knowledge graph, and the relationship type is used to map a mapping relationship between data in the database and the relationship in the target knowledge graph; receiving an adjustment instruction, and determining a data constraint of the target knowledge graph according to the adjustment instruction, wherein the data constraint is used to constrain an adjustment manner of the knowledge graph; in a case where adjustment data carried in the adjustment instruction meets the data constraint, writing the adjustment data into the database, and determining first storage information corresponding to the adjustment data; updating the target knowledge graph and the target index in the index database based on the first storage information.
10. A computing device, comprising: The method comprises: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions to implement steps of the method in any one of claims 1 to 8.
11. A computer-readable storage medium storing computer instructions, wherein, The instructions are executed by the processor to implement steps of the method in any one of claims 1 to 8.
Citation Information
Patent Citations
Mass unstructured distribution network data integration method based on knowledge mapping technology
CN107330125A
Data processing method, device and apparatus for database and index updating method
CN111459949A
Data acquisition method and device
CN111814020A