CN114297334A - Index creating method and device based on knowledge graph - Google Patents

Index creating method and device based on knowledge graph Download PDF

Info

Publication number
CN114297334A
CN114297334A CN202111630367.8A CN202111630367A CN114297334A CN 114297334 A CN114297334 A CN 114297334A CN 202111630367 A CN202111630367 A CN 202111630367A CN 114297334 A CN114297334 A CN 114297334A
Authority
CN
China
Prior art keywords
target
index
data
database
information
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
CN202111630367.8A
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 Kingsoft Digital Entertainment Co Ltd
Original Assignee
Beijing Kingsoft Digital Entertainment 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 Kingsoft Digital Entertainment Co Ltd filed Critical Beijing Kingsoft Digital Entertainment Co Ltd
Priority to CN202111630367.8A priority Critical patent/CN114297334A/en
Publication of CN114297334A publication Critical patent/CN114297334A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

The application provides a method and a device for creating an index based on a knowledge graph, wherein the method for creating the index based on the knowledge graph comprises the following steps: determining a database corresponding to the 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; storing the target index to an index database based on the structural information of the target knowledge-graph and the global data information.

Description

Index creating method and device based on knowledge graph
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to a method and an apparatus for creating an index based on a knowledge graph.
Background
With the development of internet technology, knowledge maps become important constituent elements of most search engines. By providing knowledge maps in different fields, the knowledge in the fields can be searched, and the searching efficiency and the searching accuracy can be guaranteed. However, in the prior art, most knowledge maps are constructed in advance, and are generally implemented in a reconstruction manner when facing the increase of knowledge, which results in a great waste of manpower and material resources, and the maintenance cost is also increased, so an effective solution is urgently needed to solve the above problems.
Disclosure of Invention
In view of this, the embodiments of the present application provide an index creating method based on a knowledge graph, so as to solve the technical defects existing in the prior art. The embodiment of the application also provides an index creating device based on the knowledge graph, a computing device and a computer readable storage medium.
According to a first aspect of the embodiments of the present application, there is provided a method for creating an index based on a knowledge graph, including:
determining a database corresponding to the 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;
storing the target index to an index database based on the structural information of the target knowledge-graph and the global data information.
Optionally, the creating a target index corresponding to the target knowledge graph according to the global data information includes:
determining atlas data corresponding to atlas elements contained in the target knowledge atlas according to the global data information;
reading a data identifier and a memory identifier associated with the map data from the database;
and establishing a mapping relation between the data identifier and the memory identifier, and creating the target index corresponding to the target knowledge graph according to the mapping relation.
Optionally, the storing the target index to an index database based on the structural information of the target knowledge-graph and the global data information includes:
acquiring structural information corresponding to the target knowledge graph, and determining a relation type contained in the target knowledge graph based on the structural information;
storing the target index to the index database based on the relationship type and the global data information.
Optionally, the storing the target index to the index database based on the relationship type and the global data information includes:
analyzing 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;
and grouping the target indexes 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.
Optionally, the storing the target index to the index database based on the relationship type and the global data information includes:
analyzing the global data information to obtain a target field name;
establishing an index relationship between the target index and the relationship type;
and grouping the target indexes establishing the index relationship based on the target field names to obtain a plurality of sub-target indexes, and writing the sub-target indexes into the index database respectively.
Optionally, the storing the target index to an index database based on the structural information of the target knowledge-graph and the global data information includes:
determining a storage strategy corresponding to the index database;
and storing the target index to the index database according to the storage strategy based on the structural information and the global data information.
Optionally, after the step of storing the target index into an index database based on the structural information of the target knowledge-graph and the global data information is executed, the method further includes:
receiving an adjustment instruction, and determining the data constraint of the target knowledge graph according to the adjustment instruction;
under the condition that the adjustment data carried in the adjustment instruction is detected to meet 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 stored information.
Optionally, after the step of storing the target index into an index database based on the structural information of the target knowledge-graph and the global data information is executed, the method further includes:
receiving a deleting instruction, and determining data to be deleted in the database according to the deleting instruction;
determining second storage information of the data to be deleted in the database, and deleting the data to be deleted according to the second storage information;
and updating the target knowledge graph and the target index in the index database according to the deletion processing result.
Optionally, after the step of storing the target index into an index database based on the structural information of the target knowledge-graph and the global data information is executed, the method further includes:
receiving a stop instruction submitted for the target knowledge-graph;
and releasing the storage space of the index database according to the stop instruction.
According to a second aspect of embodiments of the present application, there is provided a knowledge-graph-based index creation apparatus, including:
the determining module is configured to determine a database corresponding to the target knowledge graph;
the creating module 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;
a storage module configured to store the target index to an index database based on structural information of the target knowledge-graph and the global data information.
According to a third aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is for storing computer-executable instructions that when executed by the processor implement the steps of the knowledge-graph based index creation method.
According to a fourth aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the method for creating a knowledge-graph based index.
According to the index creating method based on the knowledge graph, when the operation of adding, deleting and changing is faced, the database corresponding to the target knowledge graph is determined, the global data information of the database is extracted, the target index of the target knowledge graph is created by combining the global data information, and finally the storage of the target index can be completed by combining the structural information and the global data information of the target knowledge graph.
Drawings
FIG. 1 is a schematic structural diagram of a knowledge-graph-based index creation method according to an embodiment of the present application;
FIG. 2 is a flow chart of a first method for creating a knowledge-graph based index according to an embodiment of the present application;
FIG. 3 is a flow chart of a second method for creating a knowledge-graph based index according to an embodiment of the present application;
FIG. 4 is a flowchart of a third method for creating a knowledge-graph based index according to an embodiment of the present application;
FIG. 5 is a flowchart of a fourth method for creating a knowledge-graph based index according to an embodiment of the present application;
FIG. 6 is a flowchart of a process applied to a knowledge-graph index management scenario according to an embodiment of the present application;
FIG. 7 is a schematic structural diagram of an index creating apparatus based on knowledge-graph according to an embodiment of the present application;
fig. 8 is a block diagram of a computing device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The terminology used in the one or more embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present application. As used in one or more embodiments of the present application 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 should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments of the present application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first aspect may be termed a second aspect, and, similarly, a second aspect may be termed a first aspect, without departing from the scope of one or more embodiments of the present application.
First, the noun terms to which one or more embodiments of the present invention relate are explained.
Knowledge graph: the (Knowledge Graph/value) is a series of different graphs for displaying the relation between the Knowledge development process and the structure, describes Knowledge resources and carriers thereof by using a visualization technology, and mines, analyzes, constructs, draws and displays Knowledge and the mutual relation between the Knowledge resources and the carriers. The modern theory is that the theory and method of applying mathematics, graphics, information visualization technology, information science and other disciplines are combined with the method of metrology citation analysis, co-occurrence analysis and the like, and the core structure, development history, frontier field and overall knowledge framework of the disciplines are vividly displayed by utilizing a visual map to achieve the aim of multi-discipline fusion.
Neo4 j: is a high-performance NOSQL graph database that stores structured data on a network rather than in tables. It is an embedded, disk-based Java persistence engine with full transactional features.
Schema: defining a knowledge graph data model and a vocabulary system for describing a physical world, and standardizing the expression of structured data; the schema object is an organization and structure of a database, and may be a table (table), a column (column), a data type (data type), a view (view), a stored procedure (stored procedure), a relationship (relationships), a primary key (primary key), a foreign key (foreign key), and the like. The database schema may be represented by a visual graph showing the database objects and their relationships to each other.
Redis: the Remote Dictionary Server is an open source log-type and Key-Value database written in ANSI C language, supporting network, based on memory and endurable, and provides API of multiple languages.
In the application, a knowledge-graph-based index creation method is provided. The present application also relates to a knowledge-graph-based index creation apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
In practical application, in consideration of dynamic characteristics of knowledge, after a knowledge graph is constructed, dynamic synchronization of the knowledge graph and a data source needs to be supported, namely after the data source is modified (data is added or deleted), the knowledge graph needs to automatically acquire modification information and complete data synchronization in the knowledge graph in real time, and in the synchronization process, a data interface provided by Neo4j is used for reducing speed by using sentences, so that corresponding modification can be completed.
In the synchronization process, the atlas data needing to be modified needs to be located in the knowledge atlas, and in the data with more than one million levels, the problem of query inefficiency is faced, and the inefficiency problem is continuously worsened along with the increase of the data volume. This will seriously affect the real-time synchronization effect of the knowledge graph and the data source, and Neo4j provides the function of creating an index for the node attribute at present, but still affects the efficiency of real-time update for the synchronization problem of the relationship and the relationship index. Furthermore, because Neo4j is used as a map storage tool, interface calls of an application layer and a data layer need to be faced at the same time, and a large number of queries are modified and called in the real-time updating process, which results in an overlarge interface load and influences the use effect of the application layer, while index data is dynamically maintained in a system by using methods such as a memory, and the like, which risks that the system is lost in an emergency such as a breakpoint.
Referring to the schematic diagram shown in fig. 1, when an add/delete/change operation is encountered, a database corresponding to a target knowledge graph is determined, global data information of the database is extracted, a target index of the target knowledge graph is created by combining the global data information, and finally the storage of the target index can be completed by combining the structural information of the target knowledge graph and the global data information.
Fig. 2 is a flowchart illustrating a method for creating an index based on a knowledge-graph according to an embodiment of the present application, which specifically includes the following steps:
and step S202, determining a database corresponding to the target knowledge graph.
Specifically, the target knowledge graph specifically refers to a knowledge graph associated with any field or any search engine, and the knowledge graph has a requirement for updating, where the updating refers to adding new entities and relationships to the knowledge graph, or deleting entities and relationships, or modifying entities and relationships, and the like. Correspondingly, the database corresponding to the target knowledge graph is specifically a storage space for providing storage data for the target knowledge graph, and the knowledge graph is a graph structure which embodies a large number of entities and relations, so in order to support the entities and relations in the knowledge graph to be used, the database needs to store the data corresponding to the entities and relations, and support the service function of the knowledge graph, and the database can be a Neo4j database.
It should be noted that the knowledge maps constructed in different fields correspond to different databases, such as the knowledge map corresponding to the sports field, and the corresponding database stores a large amount of content related to sports knowledge, including but not limited to sports star name, sports type, mission team, etc.; such as a knowledge graph corresponding to a geographic domain, and a database corresponding to the knowledge graph will store a large amount of contents related to geographic knowledge, including but not limited to geographic coordinates, country names, terrain names, etc.; for example, a knowledge map corresponding to a person domain, a database corresponding to the knowledge map will store a large amount of information about the person's knowledge, including but not limited to the name of the person, the relationship of the person, and the like. The index creation process of the knowledge graph corresponding to different fields can refer to the corresponding description content of the embodiment, and is not limited herein.
Step S204, extracting global data information from the database, and creating a target index corresponding to the target knowledge graph according to the global data information.
Specifically, after the database corresponding to the target knowledge graph is determined, further, in order to quickly create index information for the target knowledge graph, global data information may be extracted from the database, and a target index corresponding to the target knowledge graph is created based on the global data information, so that subsequent storage is facilitated, and the target knowledge graph can be used.
The global data information specifically refers to information related to all data related to a database corresponding to the target knowledge graph, and includes, but is not limited to, a relationship type corresponding to the data related to the database, a data level identifier, a data memory location level identifier, a data displacement field and the like, so that the target index can be created on the basis of the relationship type, the data level identifier, the data memory location level identifier, the data displacement field and the like; the relationship type is used for representing the relationship type among all the entities; the data level identification specifically refers to a unique identification corresponding to each entity in the data level; the data memory location level identification specifically refers to a unique identification of each entity on a storage location level; correspondingly, the target index specifically refers to creating index information that can be queried for each entity in the database.
Based on the method, after the database corresponding to the target knowledge graph is determined, the global data information related to the target knowledge graph can be extracted from the database, the target index of the target knowledge graph is created on the basis of the global data information, the created global information of the target knowledge graph corresponding to the target index can be ensured, and operations such as modification of the target knowledge graph can be supported.
Further, when creating a 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 target index may be implemented by combining a data identifier and a memory identifier, and in this embodiment, the specific implementation manner is as follows:
determining atlas data corresponding to atlas elements contained in the target knowledge atlas according to the global data information;
reading a data identifier and a memory identifier associated with map data in a database;
and establishing a mapping relation between the data identifier and the memory identifier, and establishing a target index corresponding to the target knowledge graph according to the mapping relation.
Specifically, the map elements specifically refer to basic elements forming the target knowledge map, namely entities and relations in the target knowledge map; correspondingly, the map data specifically refers to entity-related data and relationship-related data; the corresponding data identifier specifically refers to a unique identifier corresponding to each relationship and the adjacent entity in the data plane, and the memory identifier specifically refers to a unique identifier corresponding to each relationship and the adjacent entity in the storage plane.
Based on the above, after determining the global data information corresponding to the database, at this time, map data corresponding to map elements included in the target knowledge map can be determined according to the global data information, and at this time, data corresponding to entities and relations included in the target knowledge map can be determined according to the map data; and then, reading the data identifier and the memory identifier associated with the map data in the database, and establishing a mapping relation between the data identifier and the memory identifier on the basis of the data identifier and the memory identifier, so as to determine the mapping relation of each relation, namely, the corresponding relation of each relation between a data layer and a storage layer, and finally, creating an index aiming at each relation and each entity according to the mapping relation, wherein the index is used as a target index of the target knowledge map.
For example, a pre-established knowledge graph corresponding to the sports field contains coach A who is class B, partner A who is class C, age B who is 32, class B who is an S club legal person, age A who is 18, and age C who is 19; when an index needs to be created for a knowledge graph corresponding to the sports field, in order to improve index creation efficiency and reduce maintenance cost of the knowledge graph, a Schema can be used to obtain a relationship type { dependency relationship and age relationship } and a data constraint { unique constraint and inspection constraint } included in the knowledge graph, where the data constraint is a condition for adjusting the knowledge graph and is used to constrain how to adjust the knowledge graph so as to create the index subsequently.
Further, acquiring a unique identifier (namely a data identifier) of the relationship at the data level according to the relationship type, and determining that the unique identifier corresponding to the data level is D _ ID1 when the coach of the first coach is the coach of the second coach; the unique identifier corresponding to the data plane is D _ ID2, wherein the partner of the A is the C; "age of B is 32" the corresponding unique identifier at data level is D _ ID 3; the unique identifier corresponding to the S club legal person at the data level is D _ ID 4; "the age of the nail is 18" and the corresponding unique identifier at the data level is D _ ID 5; the age of "C is 19" and the corresponding unique identifier at the data level is D _ ID 6.
Meanwhile, determining the unique identifier (namely the storage identifier) of the relationship at the storage level, and determining that the coach at the first is the coach at the second and the corresponding unique identifier at the storage level is M _ ID 1; the unique identifier corresponding to the storage layer surface is M _ ID2, wherein the partner of the A is C; "age of B is 32" the corresponding unique identifier at storage level is M _ ID 3; the unique identifier corresponding to the S club legal person at the storage level is M _ ID 4; "age of nail is 18" the corresponding unique identifier at the storage level is M _ ID 5; "age of third is 19" the corresponding unique identifier at the storage level is M _ ID 6.
Furthermore, at this time, the index of each relationship data can be constructed according to the unique identifier of the data level and the unique identifier of the storage level, that is, the index In1 corresponding to "the coach A is B" is D/M _ ID 1; the index In2 corresponding to "partner of A is C" is D/M _ ID 2; "the age of B is 32" corresponds to an index In3 of D/M _ ID 3; the index In4 corresponding to "B is S club legal person" is D/M _ ID 4; "the age of the nail is 18" corresponds to the index In5 being D/M _ ID 5; "the age of C is 19" corresponds to an index In6 of D/M _ ID 6; so as to facilitate the storage of the index information subsequently.
In summary, the target index is created by combining the data identifier and the memory identifier, so that the comprehensiveness and accuracy of the created index can be ensured, the storage relationship of the entity and the relationship related to the target knowledge graph can be fully reflected, and the target knowledge graph can be directly reused and adjusted when needing to be updated.
Step S206, storing the target index to an index database based on the structural information of the target knowledge graph and the global data information.
Specifically, after the index creation for the target knowledge graph is completed, the target index can be further stored in the index database corresponding to the target knowledge graph; in the process, in order to fully reflect the relationship between the target index and each relationship and entity, realize direct multiplexing and adjustment when the target index is used, the storage of the target index can be completed by combining the structural information of the target knowledge graph and the global data information, so that the maintenance cost and the loss risk can be reduced when the graph adjustment is needed.
Based on the structure information, the structure information specifically refers to information corresponding to the map structure of the target knowledge map, and the relationship type related in the target knowledge map can be determined through the structure information so as to conveniently map the mapping relationship between the data in the database and the relationship in the map; correspondingly, the index database is specifically a database for storing all index information (i.e., target indexes) corresponding to the target knowledge graph, and the index database can be changed according to the adjustment of the target knowledge graph, that is, after the target knowledge graph is changed, the corresponding index is changed accordingly, and at this time, the index database dynamically updates the changed index, so as to ensure that the target knowledge graph is supported to be used. In practical applications, Redis may be used for the index database.
Further, when the target index is stored, in order to ensure that the target index stored in the index database can be dynamically updated, the target index may be implemented by combining the structure information and the global data information, and the specific implementation manner in this embodiment is as follows:
step S2062, obtaining the structural information corresponding to the target knowledge graph, and determining the relationship type included in the target knowledge graph based on the structural information.
Specifically, the relationship type specifically refers to all types related to the relationship contained in the target knowledge graph, such as a relationship of relativity, an arbitrary relationship, an age relationship, and the like, in the figure knowledge graph; in the physical knowledge map, any relationship, age relationship, sex relationship, affiliation relationship and the like can be involved; the geographical knowledge map may relate to a location relationship, an attribute relationship, a historical relationship, and the like.
Based on the method, after the structural information corresponding to the target knowledge graph is obtained, the relationship contained in the graph can be determined by analyzing the structural information, and then all the relationships involved in the knowledge graph are integrated, so that the relationship type contained in the knowledge graph can be determined. The mapping relation between the relation and the index can be established when the target index is stored subsequently, so that the relation between the database and the target knowledge graph is reflected, and the target knowledge graph can be supported to be used.
Step S2064, the target index is stored in the index database based on the relationship type and the global data information.
Specifically, after the relationship type included in the target knowledge graph is determined, the target index may be stored in the index database by combining the relationship type and the global data information. In this process, since the global data information includes not only information for constructing the target index but also other information for storing the target index, considering the storage efficiency of storing the target index and facilitating subsequent use, the target field data or the target field name may be selected to group the target indexes, and then the grouped target indexes are stored, in this embodiment, the specific implementation manner is as follows:
(1) analyzing 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 relation between a target index and a target field data set; and grouping the target indexes 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 an index database respectively.
Specifically, the target field data specifically refers to fields corresponding to all relations in the target knowledge graph in the database; correspondingly, the target field data set specifically refers to a set formed by combining corresponding fields in the database with all relations; the data relation is specifically the incidence relation between the target index and the target data field set, and the target data field can be written into the target index through the data relation, so that the mapping relation between the relation type and the target field data can be established when the sub-target index is generated subsequently, and the grouped sub-target indexes can be successfully written into the index database; the sub-target indexes are all target indexes obtained after grouping according to the relationship type.
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 (such as Neo4j) can be analyzed to obtain target field data corresponding to the relationship in the target knowledge graph, wherein the global data information is analyzed, specifically, all data information included in the global data information is traversed to determine the target field data corresponding to the relationship according to the traversal result; that is, when all the data information included in the global data information is traversed, after each data information is traversed, it is determined that the traversed data information belongs to the field data corresponding to the relationship or the entity stored in the database, and then the field data corresponding to the traversed relationship is selected as the target field data. And then constructing a target field data set based on all the related target field data, and establishing a data relationship between all the target indexes and the target field data set, namely establishing a mapping relationship between each target index and each target field data, so that the target indexes with the data relationship established can be grouped based on the relationship type to obtain a plurality of sub-target indexes, and finally writing the plurality of sub-target indexes into an index database respectively.
In conclusion, by establishing the data relationship, the relationship type and the target field data can be associated, so that a plurality of sub-target indexes are divided on the basis, the index information is conveniently stored in the index database, and the storage efficiency is effectively improved.
(2) Analyzing the global data information to obtain a target field name; establishing an index relationship between a target index and a relationship type; and grouping the target indexes establishing the index relationship based on the target field names to obtain a plurality of sub-target indexes, and writing the plurality of sub-target indexes into the index database respectively.
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 relation specifically refers to the incidence relation between the target index and each target field name, the target field name and the corresponding target index can be associated through the index relation, and when the sub-target indexes are subsequently written into the index database, the mapping relation between the relation type and the target field name can be established, so that the grouped sub-target indexes can be successfully written into the index database; the sub-target indexes are all target indexes obtained after grouping according to the relationship type; the target field names represent fields corresponding to the relationships in the database, and each relationship corresponds to one data type, so that grouping based on the target field names is completed according to the relationship types to which the fields of the relationship corresponding to the target field names belong when grouping is performed.
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 names corresponding to each relation in the target knowledge graph; and then establishing an index relationship between all the target indexes and all the target field names, so that the target indexes establishing the index relationship can be grouped based on the relationship type of each relationship to obtain a plurality of sub-target indexes, and finally writing the plurality of sub-target indexes into an index database respectively.
In conclusion, by establishing the index relationship, the relationship type and the target field name can be associated, so that a plurality of sub-target indexes are divided on the basis, the index information is conveniently stored in the index database, and the storage efficiency is effectively improved.
In addition, when writing the target index into the index database, the target index may be written according to a preset storage policy, and in this embodiment, the specific implementation manner is as follows:
determining a storage strategy corresponding to the index database;
and storing the target index into an index database according to a storage strategy based on the structural information and the global data information.
Specifically, the storage strategy is to store the target index according to the characteristics of the index database by combining a set algorithm and a set mode; if the index database is Redis, the target index can be written into Redis in a hash and set mode according to the structural information and the global data information, and meanwhile, the data storage characteristic of Redis is combined, and the storage success rate and efficiency are guaranteed. Correspondingly, the storage strategy can also be to carry out covering storage 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 structural information and the global data information. In practical applications, the manner of writing the index database may be selected according to practical application scenarios, and the embodiment is not limited herein.
Along the above example, after the index is determined, the unique field corresponding to each data in the database can be determined according to the global data information, and the unique field for determining that the coach A is the coach B is UF 1; the unique field for "partner of a is c" is UF 2; the unique field for "age of B is 32" is UF 3; the unique field of "b is S club legal" is UF 4; the unique field for "the age of nail is 18" is UF 5; the only field for "age of propane is 19" is UF 6.
Further, at this time, the data can be stored in a hash and set manner in groups according to the relationship type, the name of the target field and the data storage characteristic of Redis. Based on this, the relationship type is { membership S1 and age relationship S2}, and since Redis is a key-value storage system, the index of each data can be stored at this time in combination with the above information, that is, the index storage format corresponding to "the coach first is b" is S1/UF1/key1-value1/D/M _ ID 1; the index storage format corresponding to the fact that the partner of the first is third is S2/UF2/key2-value2/D/M _ ID 2; the index storage format corresponding to the age of B being 32 is S3/UF3/key3-value3/D/M _ ID 3; the index storage format corresponding to the 'second is S club legal person' is S4/UF4/key4-value4/D/M _ ID 4; the index storage format corresponding to the age of the nail being 18 is S5/UF5/key5-value5/D/M _ ID 5; and the index storage format corresponding to the age of 19 is S6/UF6/key6-value6/D/M _ ID6, and the index creation and storage aiming at the knowledge graph are completed.
In practical application, as the usage time of the knowledge graph becomes longer, modification, deletion or addition of related content may be involved; if the director of a certain enterprise changes, the knowledge graph relating to the occupational relationship of the enterprise needs to be adjusted, and the adjustment involves deleting the original occupational relationship, adding new occupational relationship, adjusting other relationships of the original director, and the like. If the knowledge graph is reconstructed based on the change, a large amount of manpower and material resources are consumed, and resources are wasted, so that when different adjustment requirements are met, in order to save maintenance cost and avoid resource waste, different processing strategies can be adopted to complete the updating of the knowledge graph, the updating of the database corresponding to the knowledge graph and the updating of the index database according to different requirements.
Referring to FIG. 3, a flow chart of a second knowledge-graph based index creation method according to an embodiment of the application is shown; when there is an adjustment requirement for the knowledge-graph, it can be realized through step S302 to step S306:
step S302, receiving an adjusting instruction, and determining data constraint of the target knowledge graph according to the adjusting instruction.
Step S304, under the condition that the adjustment data carried in the adjustment instruction is detected to meet the data constraint, writing the adjustment data into a database, and determining first storage information corresponding to the adjustment data.
Step S306, updating the target knowledge graph and the target index in the index database based on the first storage information.
Specifically, the adjustment instruction is an instruction that needs to add or modify a target knowledge graph, and based on the instruction, the content that needs to be added or modified can be determined, such as adding a new entity or modifying an original relationship, and the adjustment instruction is submitted by a development user who needs to update an index of the target knowledge graph; correspondingly, the data constraint specifically refers to a condition for constraining the adjustment of the target knowledge graph, and after the adjustment instruction is received, it is indicated that the index of the knowledge graph needs to be adjusted, and in order to ensure that the adjusted index can be multiplexed on the knowledge graph, the data constraint of the target knowledge graph needs to be preferentially inquired based on the adjustment instruction so as to complete the subsequent processing operation. It should be noted that, in a scene of updating a target index, an adjustment instruction carries data information of an update index, a data constraint to be queried can be determined according to the data information carried by the adjustment instruction, and after receiving the adjustment instruction, according to a pre-established mechanism, the adjustment instruction is determined to trigger an update processing operation of the index; the adjustment data specifically refers to data corresponding to a relationship or an entity to be added to the target knowledge graph, and correspondingly, the first storage information specifically refers to corresponding storage location information after the adjustment data is written into the database.
It should be noted that, when a new relationship or entity is added to the knowledge graph, new data will also be written into the corresponding database, at this time, in order to support that the new relationship or entity can be queried, a new target index will be created for the new data, and the new target index is written into the index database to complete updating of the target index already stored in the index database, and the process of creating the new target index may refer to the same or similar descriptions in the foregoing embodiments, which is not described in detail herein.
Based on this, after receiving the adjustment instruction, the data constraint of the target knowledge graph can be determined according to the adjustment instruction, and when it is detected that the adjustment data carried in the adjustment instruction meets the data constraint, it is described that the relationship or the 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, the first storage information corresponding to the adjustment data is determined, the index corresponding to the adjustment data is determined at the same time, and finally, the target knowledge graph and the target index in the index database are updated based on the first storage information, so that the writing of new data and the updating of the target knowledge graph are realized.
Along with the above example, when determining that new relationship data needs to be added based on a data source, the sex of the male is increased, in order to meet the requirement that the sex of the male can be inquired through a knowledge graph subsequently, at the moment, an index management system can be used for inquiring data constraint, and the data constraint of the knowledge graph is determined to be { unique constraint and check constraint }, wherein the unique constraint is used for limiting the uniqueness of the relationship between an entity and an entity in the knowledge graph, namely the knowledge graph entity and the relationship are unique; accordingly, the checking constraints are used to limit the criteria of the query to be performed according to the set logic when the knowledge-graph is used. That is, if new relationship data is added to the knowledge graph, preprocessing is required according to data constraints, so as to ensure that the relationship data can be reused in the use stage. At this time, the atlas data requirement of the knowledge atlas may be determined according to data constraint, if the data meets the data requirement of the atlas, the sex difference of the data a may be written into the database and the storage information of the relational data is returned, the information of the added data in Neo4j is added to the index relational system, information synchronization is achieved, and the creation and storage of the index of the newly added relational data may refer to the above description, which is not described in detail herein.
In conclusion, the target knowledge graph is updated by adopting an adjustment mode, so that the maintenance cost of the target knowledge graph can be reduced, and the consumption of resources can be reduced.
Referring to FIG. 4, a flow chart of a third knowledge-graph based index creation method according to an embodiment of the present application is shown; when there is a need to delete a knowledge-graph, it can be realized by steps S402 to S406:
step S402, receiving a deleting instruction, and determining data to be deleted in the database according to the deleting instruction.
Step S404, determining second storage information of the data to be deleted in the database, and deleting the data to be deleted according to the second storage information.
And step S406, updating the target knowledge graph and the target index in the index database according to the deletion processing result.
Specifically, the deleting instruction specifically refers to an instruction for deleting an entity or a relationship to be deleted from the knowledge graph, and the entity or the relationship to be deleted can be determined based on the instruction, wherein the deleting 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 data corresponding to an entity or a relation which cannot be used in the target knowledge graph and is in a database, when a deletion instruction is received, it is indicated that the index of the knowledge graph needs to be adjusted, in order to ensure that the adjusted index does not contain the index corresponding to the data to be deleted any more, the data to be deleted in the database needs to be preferentially determined based on the deletion instruction, that is, after the deletion instruction is received, the data to be deleted is traversed in the database according to a preset establishment mechanism and serves as the data to be deleted, so as to be used for subsequent processing; correspondingly, the second storage information specifically refers to the storage location information corresponding to the data to be deleted in the database.
Based on the above, after the deleting instruction is received, firstly, the data to be deleted in the data, which needs to be deleted, is determined according to the deleting instruction, then, second storage information of the data to be deleted in the database is determined, and secondly, the data to be deleted is deleted according to the second storage information; and finally, updating the target knowledge graph and the target index in the index database according to the deletion processing result.
That is, when it is determined that relational data needs to be deleted based on a data source, the index system may be queried for storage location information of the data in the Neo4j database by updating an ID of the deletion relational data, and the data deletion operation in Neo4j may be completed by using the location information, and at the same time, the index information of the data is deleted from the index system, so as to ensure synchronization of the data.
Along with the above example, when the coach of the first in the knowledge base needs to be deleted, the coach of the first in the knowledge base corresponding to the knowledge base can be determined to be the data to be deleted corresponding to the third, the storage information of the data to be deleted in Neo4j is determined, the data to be deleted can be deleted according to the storage information, and meanwhile, in order to avoid influencing other searches after deletion, the indexes in the knowledge base and the index database are updated according to the deletion processing result.
In conclusion, when data needs to be deleted, the target knowledge graph, the database and the index database are updated synchronously, so that the problem that the mapping relation among the target knowledge graph, the database and the index database is influenced after the data is deleted can be avoided, and the consistency of the target knowledge graph, the database and the index database can be ensured.
Referring to FIG. 5, a flow chart of a fourth knowledge-graph based index creation method according to an embodiment of the present application is shown; when there is a stopping requirement for the knowledge-graph, it can be realized by steps S502 to S504:
step S502, receiving a stop instruction submitted by aiming at the target knowledge graph.
Step S504, the storage space of the index database is released according to the stop instruction.
Specifically, the stop instruction specifically refers to a stop use instruction submitted for the target knowledge graph, where the stop instruction is submitted by a development user who needs to close the index of the target knowledge graph. Based on this, when a stop instruction submitted for the target knowledge graph is received, the target knowledge graph is described to stop using, and at this time, in order to avoid that data related to the target knowledge graph occupies more storage space, the storage space of the index database may 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 is emptied.
That is, after receiving a stop instruction submitted by a development user, it is described that the target knowledge graph needs to be stopped from being used, and thus the user cannot continue to query information, so that in order to avoid occupying more storage space of the database, all the index information in the index database (e.g., the Redis database) may be deleted, that is, when releasing the index information, all the index information about the knowledge graph in the index database is deleted, and the storage space of the index database is recovered to an unused state.
In addition, although the storage space of the index database is released, the index information about the target knowledge graph is deleted, but the data about the entities and the relations 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 is adjusted or updated to be available for the user to perform information query, the knowledge graph is enabled 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 process of creating the new target index may refer to the same or similar descriptions in the above embodiments, which is not described herein in detail.
In summary, the index database is released by adopting a release processing mode, so that the problem that the index data occupies more storage space and causes storage resource waste can be avoided.
According to the index creating method based on the knowledge graph, when the operation of adding, deleting and changing is faced, the database corresponding to the target knowledge graph is determined, the global data information of the database is extracted, the target index of the target knowledge graph is created by combining the global data information, and finally the storage of the target index can be completed by combining the structural information and the global data information of the target knowledge graph.
The index creating method based on the knowledge graph is further described below with reference to fig. 6 by taking an example that the index creating method based on the knowledge graph provided by the present application is applied to a knowledge graph index management scene. Fig. 6 shows a processing flow chart applied to a knowledge graph index management scenario according to an embodiment of the present application, which specifically includes the following steps:
step S602, acquiring the relation type and data constraint contained in the knowledge graph.
If the father containing A in the pre-established knowledge graph is B, the mother of A is C, the wife of B is C, B is the director of the company A, C is the manager of the company B, and A is the student of school C, when the index needs to be created for the knowledge graph, the relation type { relationship and occupational relation } and data constraint { unique constraint and check constraint } contained in the knowledge graph can be obtained by using Schema at the moment so as to be used for creating the index subsequently.
And step S604, extracting global data information from the database corresponding to the knowledge graph.
Step S606, a target index is created according to the global data information.
Specifically, in order to create an index for the above-mentioned knowledge graph and complete the rapid synchronization of the data source and the knowledge graph, global data information may be extracted from a database (e.g., Neo4j) of the knowledge graph at one time, where the global data information includes a relationship type corresponding to data related in the database, a relationship data level identifier, a relationship data memory location level identifier, and a data displacement field, so as to facilitate subsequent creation of the index.
Based on this, the relationship type is determined as { relationship and relationship }, and meanwhile, the data plane identifier { a father is D _ ID 1; mother of a is C ═ D _ ID 2; wife of B is C ═ D _ ID 3; b is a first company president D _ ID 4; c is company b total manager D _ ID 5; a is third school student D _ ID6, and data occupancy memory level identifier { a parent is B M _ ID 1; mother of a is C — M _ ID 2; wife of B is C ═ M _ ID 3; b is board of company a-M _ ID 4; c is company b total manager — M _ ID 5; a is school student M _ ID6 }.
At this time, indexes of each data can be constructed according to the data level identification and the memory level identification, and the index In1 corresponding to the parent of A, B, is determined to be D/M _ ID 1; the index In2 corresponding to the mother of A being C is D/M _ ID 2; wife of B is C the corresponding index In3 is D/M _ ID 3; b is an index In4 corresponding to the president of the A company is D/M _ ID 4; c is the index In5 corresponding to the general manager of company B is D/M _ ID 5; a is the index In6 corresponding to school student C is D/M _ ID 6.
Further, the unique field of each data is determined to form a unique field data set, the unique field of the father of A, which is B, is UF1, the unique field of the mother of A, which is C, is UF2, the unique field of the wife of B, which is C, is UF3, the unique field of the B, which is the president of the A company, is UF4, the unique field of the C, which is the general manager of the B company, is UF5, and the unique field of the A, which is the student of the C school, is UF6, so that the data can be stored conveniently after the information of each global data is determined.
Step S608, storing the target index according to the global data information.
Specifically, the relationship type is { relationship S1 and relationship S2}, and at this time, storage can be performed based on the relationship type, that is, the father of a is the index storage format corresponding to B is S1/UF1/key1-value1/D/M _ ID 1; the mother of A is C corresponding to the index storage format S2/UF2/key2-value2/D/M _ ID 2; the wife of B is the index storage format corresponding to C is S3/UF3/key3-value3/D/M _ ID 3; b is the index storage format corresponding to the president of the company A, S4/UF4/key4-value4/D/M _ ID 4; c is the index storage format corresponding to the general manager of company B, S5/UF5/key5-value5/D/M _ ID 5; a is the index storage format S6/UF6/key6-value6/D/M _ ID6 corresponding to third school students, and index creation and storage aiming at the knowledge graph are completed.
When it is determined that new relationship data needs to be added based on a data source, if a girl friend who adds a is D, the index management system can be used for inquiring data constraint, and determining 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 graph requirement, at this time, the girl friend who uses the data a is D, and the data is inserted into the Neo4j database, and the storage information of the relationship data is returned, and the information of the added data in the Neo4j is added to the index relationship system, so that information synchronization is realized, and the creation and storage of the index of the newly added relationship data can refer to the description contents, which is not described in an excessive way.
In conclusion, the knowledge graph index management is realized, so that the index searching efficiency is reduced from the second level to the millisecond level, the query efficiency is greatly improved, the updating real-time performance is ensured, the index information is maintained independently, the Neo4j interface calling frequency is reduced, the calling pressure is greatly reduced, in the process, in consideration of the maintenance cost, index maintenance can be performed by adopting mature databases such as Redis, and the risk of data loss caused by emergency is greatly reduced.
Corresponding to the above method embodiment, the present application further provides an embodiment of an index creating apparatus based on a knowledge graph, and fig. 7 shows a schematic structural diagram of an index creating apparatus based on a knowledge graph provided by an embodiment of the present application. As shown in fig. 7, the apparatus includes:
a determining module 702 configured to determine a database corresponding to the target knowledge-graph;
a creating module 704 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;
a storage module 706 configured to store the target index to an index database based on the structural information of the target knowledge-graph and the global data information.
In an optional embodiment, the creating module 704 is further configured to:
determining atlas data corresponding to atlas elements contained in the target knowledge atlas according to the global data information; reading a data identifier and a memory identifier associated with the map data from the database; and establishing a mapping relation between the data identifier and the memory identifier, and creating the target index corresponding to the target knowledge graph according to the mapping relation.
In an optional embodiment, the storage module 706 is further configured to:
acquiring structural information corresponding to the target knowledge graph, and determining a relation type contained in the target knowledge graph based on the structural information; storing the target index to the index database based on the relationship type and the global data information.
In an optional embodiment, the storage module 706 is further configured to:
analyzing 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; and grouping the target indexes 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.
In an optional embodiment, the storage module 706 is further configured to:
analyzing the global data information to obtain a target field name; establishing an index relationship between the target index and the relationship type; and grouping the target indexes establishing the index relationship based on the target field names to obtain a plurality of sub-target indexes, and writing the sub-target indexes into the index database respectively.
In an optional embodiment, the storage module 706 is further configured to:
determining a storage strategy corresponding to the index database; and storing the target index to the index database according to the storage strategy based on the structural information and the global data information.
In an optional embodiment, the apparatus further comprises:
an adjustment module configured to receive an adjustment instruction and determine a data constraint of the target knowledge-graph according to the adjustment instruction; under the condition that the adjustment data carried in the adjustment instruction is detected to meet 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 stored information.
In an optional embodiment, the apparatus further comprises:
the deleting module is configured to receive a deleting instruction and determine data to be deleted in the database according to the deleting instruction; determining second storage information of the data to be deleted in the database, and deleting the data to be deleted according to the second storage information; and updating the target knowledge graph and the target index in the index database according to the deletion processing result.
In an optional embodiment, the apparatus further comprises:
a stopping module configured to receive a stopping instruction submitted for the target knowledge-graph; and releasing the storage space of the index database according to the stop instruction.
The application provides a knowledge graph-based index creating device, when facing to add/delete/change operation, firstly, a database corresponding to a target knowledge graph is determined, secondly, global data information of the database is extracted, a target index of the target knowledge graph is created by combining the global data information, and finally, storage of the target index can be completed by combining structural information and the global data information of the target knowledge graph.
The above is an illustrative scheme of the index creating apparatus based on knowledge-graph according to the embodiment. It should be noted that the technical solution of the index creating apparatus based on the knowledge graph belongs to the same concept as the technical solution of the index creating method based on the knowledge graph, and details of the technical solution of the index creating apparatus based on the knowledge graph, which are not described in detail, can be referred to the description of the technical solution of the index creating method based on the knowledge graph. Further, the components in the device embodiment should be understood as functional blocks that must be created to implement the steps of the program flow or the steps of the method, and each functional block is not actually divided or separately defined. The device claims defined by such a set of functional modules are to be understood as a functional module framework for implementing the solution mainly by means of a computer program as described in the specification, and not as a physical device for implementing the solution mainly by means of hardware.
Fig. 8 illustrates a block diagram of a computing device 800 provided according to an embodiment of the present application. The components of the computing device 800 include, but are not limited to, memory 810 and a processor 820. The processor 820 is coupled to the memory 810 via a bus 830, and the database 850 is used to store data.
Computing device 800 also includes access device 840, access device 840 enabling computing device 800 to communicate via one or more networks 860. Examples of such networks include the 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. Access device 840 may include one or more of any type of network interface (e.g., a Network Interface Card (NIC)) whether wired or wireless, such as an IEEE802.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 so forth.
In one embodiment of the application, the above-described components of the computing device 800 and other components not shown in fig. 8 may also be connected to each other, for example, by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 8 is for purposes of example only and is not limiting as to the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 800 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), a mobile phone (e.g., smartphone), a wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 800 may also be a mobile or stationary server.
Wherein, the processor 820 is configured to execute the following computer-executable instructions:
determining a database corresponding to the 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;
storing the target index to an index database based on the structural information of the target knowledge-graph and the global data information.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the index creation method based on the knowledge graph belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the index creation method based on the knowledge graph.
An embodiment of the present application further provides a computer-readable storage medium storing computer instructions that, when executed by a processor, are configured to:
determining a database corresponding to the 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;
storing the target index to an index database based on the structural information of the target knowledge-graph and the global data information.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as that of the above-mentioned index creation method based on the knowledge graph, and for details that are not described in detail in the technical solution of the storage medium, reference may be made to the description of the technical solution of the above-mentioned index creation method based on the knowledge graph.
The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and its practical applications, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.

Claims (12)

1. A method for creating an index based on a knowledge graph is characterized by comprising the following steps:
determining a database corresponding to the 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;
storing the target index to an index database based on the structural information of the target knowledge-graph and the global data information.
2. The method of claim 1, wherein the creating a target index corresponding to the target knowledge-graph according to the global data information comprises:
determining atlas data corresponding to atlas elements contained in the target knowledge atlas according to the global data information;
reading a data identifier and a memory identifier associated with the map data from the database;
and establishing a mapping relation between the data identifier and the memory identifier, and creating the target index corresponding to the target knowledge graph according to the mapping relation.
3. The method of claim 1, wherein storing the target index to an index database based on the structural information of the target knowledge-graph and the global data information comprises:
acquiring structural information corresponding to the target knowledge graph, and determining a relation type contained in the target knowledge graph based on the structural information;
storing the target index to the index database based on the relationship type and the global data information.
4. The method of claim 3, wherein storing the target index to the index database based on the relationship type and the global data information comprises:
analyzing 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;
and grouping the target indexes 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 storing the target index to the index database based on the relationship type and the global data information comprises:
analyzing the global data information to obtain a target field name;
establishing an index relationship between the target index and the relationship type;
and grouping the target indexes establishing the index relationship based on the target field names to obtain a plurality of sub-target indexes, and writing the sub-target indexes into the index database respectively.
6. The method of claim 1, wherein storing the target index to an index database based on the structural information of the target knowledge-graph and the global data information comprises:
determining a storage strategy corresponding to the index database;
and storing the target index to the index database according to the storage strategy based on the structural information and the global data information.
7. The method according to any one of claims 1 to 6, wherein after the step of storing the target index into an index database based on the structural information of the target knowledge-graph and the global data information is performed, the method further comprises:
receiving an adjustment instruction, and determining the data constraint of the target knowledge graph according to the adjustment instruction;
under the condition that the adjustment data carried in the adjustment instruction is detected to meet 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 stored information.
8. The method according to any one of claims 1 to 6, wherein after the step of storing the target index into an index database based on the structural information of the target knowledge-graph and the global data information is performed, the method further comprises:
receiving a deleting instruction, and determining data to be deleted in the database according to the deleting instruction;
determining second storage information of the data to be deleted in the database, and deleting the data to be deleted according to the second storage information;
and updating the target knowledge graph and the target index in the index database according to the deletion processing result.
9. The method according to any one of claims 1 to 6, wherein after the step of storing the target index into an index database based on the structural information of the target knowledge-graph and the global data information is performed, the method further comprises:
receiving a stop instruction submitted for the target knowledge-graph;
and releasing the storage space of the index database according to the stop instruction.
10. An apparatus for creating an index based on a knowledge-graph, comprising:
the determining module is configured to determine a database corresponding to the target knowledge graph;
the creating module 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;
a storage module configured to store the target index to an index database based on structural information of the target knowledge-graph and the global data information.
11. A computing device, comprising:
a memory and a processor;
the memory is configured to store computer-executable instructions, and the processor is configured to execute the computer-executable instructions to implement the steps of the method of any one of claims 1 to 9.
12. A computer-readable storage medium storing computer instructions, which when executed by a processor, perform the steps of the method of any one of claims 1 to 9.
CN202111630367.8A 2021-12-28 2021-12-28 Index creating method and device based on knowledge graph Pending CN114297334A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111630367.8A CN114297334A (en) 2021-12-28 2021-12-28 Index creating method and device based on knowledge graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111630367.8A CN114297334A (en) 2021-12-28 2021-12-28 Index creating method and device based on knowledge graph

Publications (1)

Publication Number Publication Date
CN114297334A true CN114297334A (en) 2022-04-08

Family

ID=80972452

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111630367.8A Pending CN114297334A (en) 2021-12-28 2021-12-28 Index creating method and device based on knowledge graph

Country Status (1)

Country Link
CN (1) CN114297334A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113283772A (en) * 2021-06-04 2021-08-20 云南电网有限责任公司信息中心 Electric power marketing inspection business rule analysis and application method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113283772A (en) * 2021-06-04 2021-08-20 云南电网有限责任公司信息中心 Electric power marketing inspection business rule analysis and application method

Similar Documents

Publication Publication Date Title
CN110147437B (en) Knowledge graph-based searching method and device
CN105095195B (en) Nan-machine interrogation's method and system of knowledge based collection of illustrative plates
CN109582799B (en) Method and device for determining knowledge sample data set and electronic equipment
US20190005025A1 (en) Performing semantic graph search
CN110119473B (en) Method and device for constructing target file knowledge graph
CN107798387B (en) Knowledge service system and method suitable for full life cycle of high-end equipment
US20130218837A1 (en) Cloud data synchronization with local data
US20090138430A1 (en) Method for assembly of personalized enterprise information integrators over conjunctive queries
US20120023109A1 (en) Contextual processing of data objects in a multi-dimensional information space
CN105956123A (en) Local updating software-based data processing method and apparatus
CN106202207A (en) A kind of index based on HBase ORM and searching system
US20210018332A1 (en) Poi name matching method, apparatus, device and storage medium
CN109086434B (en) Knowledge aggregation method and system based on theme map
CN108255972A (en) A kind of text searching method and system
CN103631604B (en) A kind of standardized digital education resource management method based on CELTS-41 specification
US11675769B2 (en) On-demand, dynamic and optimized indexing in natural language processing
US20180357330A1 (en) Compound indexes for graph databases
US20120078905A1 (en) Manipulating non-schema attributes for objects in a schema based directory
CN113535977A (en) Knowledge graph fusion method, device and equipment
CN114297334A (en) Index creating method and device based on knowledge graph
CN114328799A (en) Data processing method, device and computer readable storage medium
EP3499379B1 (en) Computer implemented and computer controlled method, computer program product and platform for manipulating data arranged for processing and storage at a data storage engine
CN114911893A (en) Method and system for automatically constructing knowledge base based on knowledge graph
US10146813B2 (en) Single table index relational database
CN110413793A (en) A kind of knowledge mapping substance feature method for digging based on translation model

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