CN112860912A - Method and device for updating knowledge graph - Google Patents
Method and device for updating knowledge graph Download PDFInfo
- Publication number
- CN112860912A CN112860912A CN202110185453.6A CN202110185453A CN112860912A CN 112860912 A CN112860912 A CN 112860912A CN 202110185453 A CN202110185453 A CN 202110185453A CN 112860912 A CN112860912 A CN 112860912A
- Authority
- CN
- China
- Prior art keywords
- intervention
- data
- attribute value
- database
- entity
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000004590 computer program Methods 0.000 claims description 17
- 230000008569 process Effects 0.000 claims description 11
- 238000010276 construction Methods 0.000 claims description 6
- 230000000694 effects Effects 0.000 claims description 6
- 238000012545 processing Methods 0.000 abstract description 3
- 229910000831 Steel Inorganic materials 0.000 description 48
- 239000010959 steel Substances 0.000 description 48
- 235000002595 Solanum tuberosum Nutrition 0.000 description 23
- 244000061456 Solanum tuberosum Species 0.000 description 23
- 239000004566 building material Substances 0.000 description 21
- -1 classification Substances 0.000 description 19
- 241001494479 Pecora Species 0.000 description 12
- 235000012015 potatoes Nutrition 0.000 description 11
- 241000283690 Bos taurus Species 0.000 description 10
- 235000013311 vegetables Nutrition 0.000 description 10
- 241000282376 Panthera tigris Species 0.000 description 9
- 229910052751 metal Inorganic materials 0.000 description 9
- 239000002184 metal Substances 0.000 description 8
- 239000004035 construction material Substances 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000008859 change Effects 0.000 description 3
- 230000001427 coherent effect Effects 0.000 description 3
- 230000007704 transition Effects 0.000 description 3
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 238000007499 fusion processing Methods 0.000 description 1
- 239000007769 metal material Substances 0.000 description 1
- 150000002739 metals Chemical class 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention provides a method and a device for updating a knowledge graph, and relates to the technical field of data processing. The method comprises the following steps: acquiring a target attribute value, wherein the target attribute value is an attribute value of a first attribute of a first entity; generating at least one intervention datum based on the target attribute value and a graph attribute value, the graph attribute value being an attribute value of the first attribute of the first entity in a knowledge graph; updating intervention data in an intervention database according to the at least one intervention data; and constructing a knowledge graph according to the intervention data in the intervention database and the source data extracted from the data source to generate an updated knowledge graph. The embodiment of the invention is used for solving the problem that the intervention data in the existing knowledge graph intervention mode does not have the capability of tracing and replaying.
Description
Technical Field
The invention relates to the technical field of data processing, in particular to a method and a device for updating a knowledge graph.
Background
The essence of the knowledge graph is a knowledge base of Semantic Network (Semantic Network), which is composed of nodes (points) and edges (edges), and is intended to describe entities and relationships between entities in objective world in the form of Semantic Network, each node represents an entity existing in real world, and each Edge is a relationship between entities.
The process of constructing the knowledge graph is a process of fusing data of a plurality of data sources, errors can exist in the knowledge graph constructed by the machine, and therefore the correction of the knowledge graph is necessary. The intervention of the knowledge graph is an action of rectifying the knowledge graph, and the error in the knowledge graph can be corrected through intervention data. At present, the commonly used method of knowledge graph intervention is to directly write intervention data into a database where the knowledge graph is located. I.e. to modify the errors present on the final generated knowledge-graph. The intervention data is used as an important link for map construction, and the data must be traceable and playable and can be used for iteration of the map. However, the intervention data does not participate in the data fusion process, and only directly acts all the adding, deleting and modifying operations on the knowledge graph, so that the intervention data in the existing knowledge graph intervention mode has no capability of tracing and replaying.
Disclosure of Invention
In view of this, the invention provides a method and a device for updating a knowledge graph, which are used for solving the problem that intervention data in the existing knowledge graph intervention mode does not have the ability of tracing back and playback.
In order to achieve the above object, the embodiments of the present invention provide the following technical solutions:
in a first aspect, an embodiment of the present invention provides a method for updating a knowledge-graph, including:
acquiring a target attribute value, wherein the target attribute value is an attribute value of a first attribute of a first entity;
generating at least one intervention datum based on the target attribute value and a graph attribute value, the graph attribute value being an attribute value of the first attribute of the first entity in a knowledge graph;
updating intervention data in an intervention database according to the at least one intervention data;
and constructing a knowledge graph according to the intervention data in the intervention database and the source data extracted from the data source to generate an updated knowledge graph.
As an optional implementation manner of the embodiment of the present invention, the generating at least one intervention data according to the target attribute value and the atlas attribute value includes:
if the target attribute value comprises a first attribute value and the atlas attribute value does not comprise the first attribute value, generating intervention data for adding the first attribute value to the knowledge atlas;
and if the target attribute value does not contain a second attribute value and the atlas attribute value contains the second attribute value, generating intervention data for deleting the second attribute value from the knowledge atlas.
As an optional implementation manner of the embodiment of the present invention, the updating the intervention data in the intervention database according to the at least one intervention data includes:
judging whether the intervention database contains conflict data of each intervention data; the conflict data of any intervention data is intervention data with the opposite semantics of the intervention data;
if the intervention database contains conflict data of first intervention data, deleting the conflict data of the first intervention data from the intervention database;
and if the intervention database does not contain the conflict data of the second intervention data, writing the second intervention data into the intervention database.
As an optional implementation manner of the embodiment of the present invention, the method further includes:
and writing the first intervention data into the intervention database under the condition that the intervention database contains conflict data of the first intervention data.
As an optional implementation manner of the embodiment of the present invention, any intervention data includes: entities, attributes, attribute values, and state information; the state information is positive or negative, when the state information is positive, the corresponding intervention data has the semantic meaning of adding the corresponding attribute value, and when the state information is negative, the corresponding intervention data has the semantic meaning of deleting the corresponding attribute value;
the judging whether the intervention database contains conflict data of each intervention data includes:
judging whether the intervention database contains intervention data which is the same as entities, attributes and attribute values of the intervention data and is opposite to state information;
if the intervention database contains intervention data which is the same as the entity, attribute and attribute value of the first intervention data and is opposite to the state information, determining conflict data containing the first intervention data in the intervention database;
and if the intervention database does not contain intervention data which is the same as the entity, the attribute and the attribute value of the second intervention data and is opposite to the state information, determining that the intervention database does not contain the conflict data of the second intervention data.
As an optional implementation manner of the embodiment of the present invention, the method further includes:
under the condition that at least two entities are fused into an entity group and the first entity is selected as a main entity of the entity group, modifying entities of intervention data to be fused and source data to be fused into the first entity, wherein the source data to be fused comprises source data of non-main entities of the entity group in the source data extracted from a data source, and the intervention data to be fused comprises intervention data of non-main entities of the entity group in an intervention database;
and constructing a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source to generate the knowledge graph fusing the at least two entities.
As an optional implementation manner of the embodiment of the present invention, after modifying the entity in which the intervention data and the source data are to be fused into the first entity, the method further includes:
judging whether the intervention database contains intervention data with opposite semantics;
if the semantics of the third intervention data and the fourth intervention data are opposite, acquiring the timestamps of the third intervention data and the fourth intervention data;
acquiring target intervention data, wherein the target intervention data is intervention data with a time stamp in the third intervention data and the fourth intervention data;
and controlling the target intervention data to take effect in the process of constructing a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source and generating the knowledge graph fused with the at least two entities.
As an optional implementation manner of the embodiment of the present invention, the intervention data has a higher effective priority than the source data extracted from the data source.
In a second aspect, an embodiment of the present invention provides an apparatus for updating a knowledge-graph, including:
an obtaining unit, configured to obtain a target attribute value, where the target attribute value is an attribute value of a first attribute of a first entity;
a generating unit configured to generate at least one intervention data according to the target attribute value and a graph attribute value, where the graph attribute value is an attribute value of the first attribute of the first entity in a knowledge graph;
the updating unit is used for updating the intervention data in the intervention database according to the at least one intervention data;
and the construction unit is used for constructing a knowledge graph according to the intervention data in the intervention database and the source data extracted from the data source to generate an updated knowledge graph.
As an optional implementation manner of the embodiment of the present invention, the updating unit is specifically configured to generate intervention data for adding a first attribute value to the knowledge graph, when the target attribute value includes the first attribute value and the graph attribute value does not include the first attribute value; and generating intervention data for deleting the second attribute value from the knowledge-graph under the condition that the target attribute value does not contain the second attribute value and the graph attribute value contains the second attribute value.
As an optional implementation manner of the embodiment of the present invention, the updating unit is further configured to determine whether the intervention database includes conflict data of each intervention data; if the intervention database contains conflict data of first intervention data, deleting the conflict data of the first intervention data from the intervention database; if the intervention database does not contain conflict data of second intervention data, writing the second intervention data into the intervention database;
and the conflict data of any intervention data is intervention data with the opposite semantics of the intervention data.
As an optional implementation manner of the embodiment of the present invention, the updating unit is further configured to, in a case that the intervention database includes conflict data of first intervention data, write the first intervention data into the intervention database.
As an optional implementation manner of the embodiment of the present invention, any intervention data includes: entities, attributes, attribute values, and state information; the state information is positive or negative, when the state information is positive, the corresponding intervention data has the semantic meaning of adding the corresponding attribute value, and when the state information is negative, the corresponding intervention data has the semantic meaning of deleting the corresponding attribute value;
the updating unit is specifically configured to determine whether the intervention database contains intervention data that is the same as entities, attributes, and attribute values of each intervention data and is opposite to state information; if the intervention database contains intervention data which is the same as the entity, attribute and attribute value of the first intervention data and is opposite to the state information, determining conflict data containing the first intervention data in the intervention database; and if the intervention database does not contain intervention data which is the same as the entity, the attribute and the attribute value of the second intervention data and is opposite to the state information, determining that the intervention database does not contain the conflict data of the second intervention data.
As an optional implementation manner of the embodiment of the present invention, the updating unit is further configured to modify, when at least two entities are fused into one entity group and the first entity is selected as a main entity of the entity group, the entities of the intervention data to be fused and the source data to be fused are modified into the first entity, the source data to be fused includes source data of the source data extracted from the data source, where the entities are non-main entities of the entity group, and the intervention data to be fused includes intervention data of the entities in the intervention database, where the entities are non-main entities of the entity group;
the construction unit is further configured to construct a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source, and generate the knowledge graph fusing the at least two entities.
As an optional implementation manner of the embodiment of the present invention, the updating unit is further configured to determine whether the intervention database contains intervention data with opposite semantics after the entity of the intervention data to be fused and the source data to be fused is modified into the first entity; if the semantics of the third intervention data and the fourth intervention data are opposite, acquiring the timestamps of the third intervention data and the fourth intervention data; acquiring target intervention data, wherein the target intervention data is intervention data with a time stamp in the third intervention data and the fourth intervention data; and controlling the target intervention data to take effect in the process of constructing a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source and generating the knowledge graph fused with the at least two entities.
As an optional implementation manner of the embodiment of the present invention, the intervention data has a higher effective priority than the source data extracted from the data source.
In a third aspect, an embodiment of the present invention provides an electronic device, including: a memory for storing a computer program and a processor; the processor is configured to perform the method of updating a knowledge graph of the first aspect or any one of the first aspects when the computer program is invoked.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for updating a knowledge graph according to the first aspect or any one of the first aspects.
In a fifth aspect, an embodiment of the present invention provides a computer program product, which includes a computer program/instruction, and when the computer program/instruction is executed by a processor, the method for updating a knowledge graph according to the first aspect or any optional implementation manner of the first aspect is implemented.
The method for updating the knowledge graph, provided by the embodiment of the invention, comprises the steps of firstly obtaining a target attribute value of a first attribute of a first entity, then generating at least one piece of intervention data according to the attribute value and the target attribute value of the first attribute of the first entity in the knowledge graph, then updating the intervention data in an intervention database according to the generated intervention data, and finally constructing the knowledge graph according to the intervention data in the intervention database and source data extracted from a data source to generate the updated knowledge graph. The intervention data in the embodiment of the invention are all stored in the intervention database, and the intervention database can be used as an independent data source to participate in the construction of the knowledge graph, so that the method for updating the knowledge graph provided by the embodiment of the invention can enable the intervention data to have the capability of tracing and replaying, and solve the problem that the intervention data in the existing knowledge graph intervention mode does not have the capability of tracing and replaying.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a flowchart illustrating steps of a method for updating a knowledge-graph, according to an embodiment of the present invention;
FIG. 2 is a second flowchart illustrating the steps of a method for updating a knowledge-graph according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating an intervention state transition provided by an embodiment of the present invention;
FIG. 4 is a third flowchart illustrating the steps of a method for updating a knowledge-graph according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an apparatus for updating a knowledge-graph according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention may be more clearly understood, a solution of the present invention will be further described below. It should be noted that the embodiments of the present invention and features of the embodiments may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways than those described herein; it is to be understood that the embodiments described in this specification are only some embodiments of the invention, and not all embodiments.
In the embodiments of the present invention, words such as "exemplary" or "for example" are used to mean serving as examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "e.g.," an embodiment of the present invention is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion. Further, in the description of the embodiments of the present invention, "a plurality" means two or more unless otherwise specified.
The embodiment of the present invention provides a method for updating a knowledge graph, and specifically, referring to fig. 1, the method for updating a knowledge graph provided by the embodiment of the present invention includes the following steps:
s101, obtaining a target attribute value.
Wherein the target attribute value is an attribute value of a first attribute of the first entity.
Illustratively, when the classification property of the steel pipe is required to be modified into: building materials and weaponry, then target attribute values (building materials, weaponry) may be entered for a first attribute value (classification) of a first entity (steel pipe).
And S102, generating at least one piece of intervention data according to the target attribute value and the map attribute value.
Wherein the graph attribute value is an attribute value of the first attribute of the first entity in a knowledge-graph.
Illustratively, the intervention data in embodiments of the present invention may be an intervention SPO. Wherein, SPO is a basic concept in a knowledge graph, and is used to identify a relationship between an entity and a triple of { subject (subject), predicate (predicate), object (object) }, for example: a's wife is B, it can be expressed by { A, wife, B } SPO. The intervention SPO can be divided into two types according to the semantics of the operation that the intervention wants to execute, one is: an intervening SPO that adds a certain SPO is referred to as a positive intervening SPO, and its corresponding intervening operation is referred to as a positive intervening. The other is as follows: an intervening SPO that wants to delete a certain SPO is called a negative intervening SPO, and its corresponding intervening operation is called a negative intervention.
As an optional implementation manner of the embodiment of the present invention: generating at least one intervention data from the target attribute value and the atlas attribute value, comprising:
if the target attribute value comprises a first attribute value and the atlas attribute value does not comprise the first attribute value, generating intervention data for adding the first attribute value to the knowledge atlas;
and if the target attribute value does not contain a second attribute value and the atlas attribute value contains the second attribute value, generating intervention data for deleting the second attribute value from the knowledge atlas.
For example: if the map attribute value comprises a classification attribute B of the entity A and the target attribute value comprises a classification attribute C of the entity A, generating two pieces of intervention data according to the target attribute value and the map attribute value, wherein one piece of intervention data is positive intervention data used for adding the classification attribute C of the entity A to the knowledge map; the other is negative intervention data for removing classification attributes B of entity a from the knowledge-graph. When the intervention data is intervention SPO, the two generated intervention SPO are respectively { entity A, category, C, positive intervention }, { entity A, category, B, negative intervention }.
For another example: the target attribute values include classification attributes "weaponry" and "construction material" of "steel", the map attribute values include classification attributes "construction material" and "mechanical parts" of "steel", intervention data for adding "weaponry" to the knowledge map is required to be generated because "weaponry" is included in the target attribute values and "weaponry" is not included in the map attribute values, and intervention data for deleting the second attribute values from the knowledge map is required to be generated because "mechanical parts" is not included in the target attribute values and "mechanical parts" is included in the map attribute values. When the intervention data is intervention SPO, the two generated intervention SPO are respectively { steel, category, weaponry, positive intervention }, { steel, category, mechanical accessory, negative intervention }.
And S103, updating the intervention data in the intervention database according to the at least one intervention data.
For example, the generated intervention data may each be added to the intervention database to update the intervention data in the intervention database.
And S104, constructing a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source, and generating an updated knowledge graph.
And the updated knowledge spectrogram is constructed according to the intervention data in the intervention database and the source data extracted from the data source, so that the attribute value of the first attribute in the updated knowledge spectrogram is the target attribute value.
Optionally, the intervention data has a higher effective priority than the source data extracted from the data source.
The method for updating the knowledge graph, provided by the embodiment of the invention, comprises the steps of firstly obtaining a target attribute value of a first attribute of a first entity, then generating at least one piece of intervention data according to the attribute value and the target attribute value of the first attribute of the first entity in the knowledge graph, then updating the intervention data in an intervention database according to the generated intervention data, and finally constructing the knowledge graph according to the intervention data in the intervention database and source data extracted from a data source to generate the updated knowledge graph. The intervention data in the embodiment of the invention are all stored in the intervention database, and the intervention database can be used as an independent data source to participate in the construction of the knowledge graph, so that the method for updating the knowledge graph provided by the embodiment of the invention can enable the intervention data to have the capability of tracing and replaying, and solve the problem that the intervention data in the existing knowledge graph intervention mode does not have the capability of tracing and replaying.
When the intervention data in the intervention database is updated according to the newly generated intervention data, if the newly generated intervention data is directly added to the intervention database, the problem that the semantics of the intervention data are unclear is very likely to occur in the knowledge graph iteration process. For example: when the intervention data in the intervention database is updated for a certain time, the intervention data with the semantic of adding the relation A is added into the intervention database, and when the intervention data in the intervention database is updated for another time, the intervention data with the semantic of deleting the relation A is added into the intervention database, at the moment, the intervention database simultaneously comprises the intervention data with the semantic of adding the relation A and the intervention data with the semantic of deleting the relation A, so that the intervention data has unclear semantic. In order to solve the above problem, another method for updating a knowledge graph is provided in an embodiment of the present invention, as shown in fig. 2, on the basis of the above steps S101 to S104, the above step S103 (updating intervention data in an intervention database according to the at least one intervention data) includes:
s201, judging whether the intervention database contains conflict data of each intervention data.
And the conflict data of any intervention data is intervention data with the opposite semantics of the intervention data.
Optionally, any intervention data comprises: entities, attributes, attribute values, and state information; the state information is positive or negative, when the state information is positive, the corresponding intervention data has the semantic meaning of adding the corresponding attribute value, and when the state information is negative, the corresponding intervention data has the semantic meaning of deleting the corresponding attribute value;
the judging whether the intervention database contains conflict data of each intervention data includes:
judging whether the intervention database contains intervention data which is the same as entities, attributes and attribute values of the intervention data and is opposite to state information;
if the intervention database contains intervention data which is the same as the entity, attribute and attribute value of the first intervention data and is opposite to the state information, determining conflict data containing the first intervention data in the intervention database;
and if the intervention database does not contain intervention data which is the same as the entity, the attribute and the attribute value of the second intervention data and is opposite to the state information, determining that the intervention database does not contain the conflict data of the second intervention data.
That is, the conflict intervention SPO of any positive intervention SPO is the same negative intervention SPO as the SPO corresponding to the positive intervention SPO; the conflict intervention SPO of any negative intervention SPO is the same positive intervention SPO as the SPO corresponding to that negative intervention SPO.
For example: the generated at least one intervention SPO includes a positive intervention SPO { a, wife, B, positive intervention }, and since the SPO corresponding to the positive intervention SPO is { a, wife, B }, a manner of determining whether the intervention database includes conflict data of each intervention data may be: and judging whether the intervention database contains negative intervention SPO { A, wife, B, negative intervention }.
For another example: the generated at least one intervention SPO includes a negative intervention SPO { C, class, D, negative intervention }, and since the SPO corresponding to the negative intervention SPO is { C, class, D }, a manner of determining whether the intervention database includes conflict data of each intervention data may be: and judging whether the intervention database contains the positive intervention SPO { C, classification, D, positive intervention }.
In the above step S201, if the intervention database includes the conflict intervention SPO of the first intervention SPO, the following step S202 is executed, and if the intervention database does not include the conflict intervention SPO of the first intervention SPO, the following step S203 is executed.
S202, deleting the conflict data of the first intervention data from the intervention database.
S203, writing the second intervention data into the intervention database.
That is, in the embodiment of the present invention, the intervention operation includes 2 semantics of positive intervention and negative intervention, the corresponding intervention SPO is a positive intervention SPO and a negative intervention SPO, respectively, and the intervention SPO itself includes 2 operations that can perform addition or deletion, so the intervention SPO includes 4 intervention states that are composed of 2 semantics (positive intervention SPO and negative intervention SPO) and 2 operations (addition intervention SPO and deletion intervention SPO), where the 4 intervention states are: when adding positive intervention, deleting positive intervention, adding negative intervention and deleting negative intervention and performing intervention state transition with SPO as granularity, the transition relationship between 4 intervention states is shown in fig. 3, and includes: adding positive intervention to the air intervention to obtain the positive intervention; if the positive intervention is deleted, the null intervention is obtained; adding negative intervention to the air intervention to obtain the negative intervention; and deleting the negative intervention to obtain the null intervention.
In the above embodiment, each intervention data generated according to the target attribute value and the map attribute value is determined, and if the intervention database includes the conflict data, the conflict intervention data in the intervention database is deleted, and if the plurality of pre-databases do not include the conflict data, the conflict intervention data is written into the intervention database. In the embodiment of the invention, under the condition that the intervention database contains the conflict data of certain intervention data, the conflict data of the intervention data is deleted instead of being written into the intervention database, so that the intervention database contains the intervention data and the conflict data thereof, and the embodiment of the invention can avoid unclear semantics of the intervention data in the intervention database.
The method for updating the knowledge graph provided by the above embodiment is exemplified below by using the intervention data and the source data both as SPOs.
Example 1, classification of entity "X", at times T1-T4, the intervening SPOs in the intervening database and extracted from the data source are as follows:
time T1:
the classification of X provided by data source 1 includes A and B, so two SPOs can be extracted from data source 1, which are: { X, Category, A } and { X, Category, B }. Intervention is not intervened, an intervention database is empty, and the map attribute values are: A. and B.
Time T2:
intervening intervention, the target attribute value is: A. and C, performing treatment. Since the map attribute values are: A. b, therefore, first generate 2 coherent pre-SPOs based on intervention operations, the two intervention SPOs being respectively: { X, Classification, B, negative intervention } and { X, Classification, C, positive intervention }. Since the current intervention database is empty, contains no intervention SPO, contains no conflicting intervention SPO for { X, Classification, B, negative intervention } and { X, Classification, C, positive intervention }, then { X, Classification, B, negative intervention } and { X, Classification, C, positive intervention } are written into the intervention database. After time T2, { X, Classification, B, negative intervention } and { X, Classification, C, positive intervention }2 intervening SPOs are included in the intervention database.
Time T3:
the class of X provided by data source 2 includes F, so 1 SPO can be extracted from data source 2, which is: { X, Category, F }, the graph attributes become A, C, F. After time T3, the intervention SPO in the intervention database remains unchanged, and still includes: { X, Classification, B, negative intervention } and { X, Classification, C, positive intervention }2 intervening SPOs.
Time T4:
intervention intervenes again, and the target attribute values are: F. since the atlas attribute becomes A, C, F, 2 coherent pre-SPOs are first generated based on the intervention operation, which are: { X, Classification, A, negative intervention } and negative intervention { X, Classification, C, negative intervention }. Secondly, for { X, Classification, A, negative intervention }, since the intervention database does not contain its collision intervention SPO, X, Classification, A, negative intervention } is written into the intervention database, and for { X, Classification, C, negative intervention }, since the intervention database contains its collision intervention SPO { X, Classification, C, positive intervention }, X, Classification, C, positive intervention } is deleted from the intervention database. After time T4, { X, Classification, A, negative intervention }, { X, Classification, B, negative intervention } 2-bar Pre-SPO is included in the intervention database.
Finally, the intervention SPO in the intervention database includes:
{ X, classification, a, negative intervention };
{ X, Classification, B, negative intervention }.
The extracted SPOs in the data source include:
{ X, Category, A }, from data Source 1;
{ X, Category, B }, from data Source 1;
{ X, Category, F }, from data Source 2;
since the intervention SPO in the intervention database has a higher priority than the SPO extracted from the data source, the classification of X in the finally constructed knowledge graph is F.
Example 2, classification of entity "Steel", at times T1-T4, the intervening SPOs in the intervening database and extracted from the data sources are as follows:
time T1:
the classification of the "steel" provided by the data source 1 includes "mechanical accessories" and "weaponry", so that two SPOs can be extracted from the data source 1, these two SPOs being: { steel, classification, mechanical fittings } and { steel, classification, weaponry }. Intervention is not intervened, an intervention database is empty, and the map attribute values are: "mechanical accessory", "weaponry".
Time T2:
intervening intervention, the target attribute value is: "weaponry", "construction materials". Since the map attribute values are: "mechanical accessories", "weaponry", therefore first generate 2-bar pre-SPO based on intervention operations, the two intervention SPO being: { steel, classification, weaponry, negative intervention } and { steel, classification, building material, positive intervention }. Since the current intervention database is empty, containing no intervention SPO, { steel, classification, weaponry, negative intervention } and { steel, classification, building material, positive intervention } are written into the intervention database. At time T2, the intervention database includes { steel, classification, weaponry, negative intervention } and { steel, classification, building material, positive intervention }2 intervening SPOs.
Time T3:
the classification of the data source 2 providing "steel" includes "metal", so 1 SPO can be extracted from the data source 2: { steel, classification, metal }, map properties become: "weaponry", "construction materials", "metals". At time T3, the intervention SPO in the intervention database remains unchanged, still including: { steel, classification, weaponry, negative intervention } and { steel, classification, building material, positive intervention }2 intervening SPOs.
Time T4:
intervention intervenes again, with the target property value being "metal". Since the current atlas attributes become: "weaponry", "construction material", "metal", so first 2 coherent pre-SPOs are generated based on intervention operations, the two intervention SPOs being respectively: { steel, classification, weaponry, negative intervention } and negative intervention { steel, classification, building material, negative intervention }. Secondly, for { steel, classification, weaponry, negative intervention }, since the intervention database does not contain its conflicting intervention SPO, { steel, classification, weaponry, negative intervention } is written into the intervention database, and for { steel, classification, building material, negative intervention }, since the intervention database contains its conflicting intervention SPO { steel, classification, building material, positive intervention }, { steel, classification, building material, positive intervention } is deleted from the intervention database. At time T4, the intervention database includes { steel, classification, machine parts, negative intervention }, { steel, classification, weapons, negative intervention }2 bar pre-SPO.
Finally, the intervention SPO in the intervention database includes:
{ steel, classification, mechanical fitting, negative intervention };
{ steel, classification, weaponry, negative intervention }.
The extracted SPOs in the data source include:
{ steel, classification, mechanical parts }, from data source 1;
{ steel, classification, weaponry }, from data source 1;
{ steel, classification, metal }, from data source 2;
since the intervention SPO in the intervention database has a higher priority than the SPO extracted from the data source, the classification attribute of the steel in the finally constructed knowledge graph is metal.
As an alternative implementation manner of the embodiment of the present invention, referring to fig. 4, on the basis of the steps S201 to S203, the method provided in the embodiment of the present invention further includes: in step S201 (determining whether the intervention database includes conflict data of each intervention data), if the intervention database does not include a conflict intervention SPO of the first intervention SPO, the step S202 is executed (the conflict data of the first intervention data is deleted from the intervention database), and after the step S202 is executed, the following step S401 is executed.
S401, writing the first intervention data into the intervention database.
Illustratively, at time T4 of example 1 above, after { X, Classification, C, positive intervention } is removed from the intervention database, { X, Classification, C, negative intervention } is also written into the intervention database, such that after time T4 { X, Classification, A, negative intervention }, { X, Classification, B, negative intervention } and { X, Classification, C, negative intervention } are included in the intervention database as well as 3 intervention SPOs.
Illustratively, at time T4 of example 2 above, after { steel, classification, building material, positive intervention } is removed from the intervention database, { steel, classification, building material, negative intervention } is also written into the intervention database, such that after time T4, the intervention database includes { steel, classification, machine part, negative intervention }, { steel, classification, weaponry, negative intervention } and { steel, classification, building material, positive intervention }3 intervening SPOs.
The above embodiment writes an intervening SPO in the intervening database after deleting a conflicting intervening SPO of the intervening SPO, even if SPOs that semantically conflict with the intervening SPO are subsequently extracted from other data sources, because the intervening SPO exists in the intervening database and has a higher priority than the SPO extracted from the data source. SPOs extracted from other data sources may also be overwritten by the intervening SPOs without being validated in the knowledge graph, thereby avoiding subsequent SPOs extracted from data sources from affecting the accuracy of the knowledge graph.
For example: on the basis of the above example 2, SPO { steel, classification, building material } is extracted from the data source 3 again at time T5, and the pre-databases do not include { steel, classification, building material, negative intervention }, so that the classification attributes of steel in the finally constructed knowledge graph are metal and building material. However, building materials are classified as being intended to be removed by intervention, and therefore the knowledge profile constructed is not accurate. The above embodiment further writes { steel, classification, building material, negative intervention } into the intervention database, and the SPO { steel, classification, building material } extracted from the data source 3 would be overwritten by the intervention SPO { steel, classification, building material, negative intervention } so that the SPO { steel, classification, building material } extracted from the data source 3 would not be validated into the final constructed graph. And in the finally constructed knowledge graph, the classification attribute of the steel is metal.
As an optional implementation manner of the embodiment of the present invention, each intervening SPO stores in the MYSQL database with SP as an index.
That is, the intervention database is a MYSQL database, and the intervention SPO is stored in the intervention database with SP as an index.
The above embodiments are exemplified below by taking the constructed knowledge graph as the Chinese zodiac with a small entity. At time T1, the data source 1 provided a small and clear birth year sheep with no intervention. Intervention at time T2 modifies the xiaoming zodiac into tiger. Intervention again at time T3 modifies the xiaoming zodiac into a cow. Intervention at time T4 again involves modifying the xiaoming zodiac signs back to the sheep, and the intervention operations at each time, the intervention SPOs generated based on the intervention operations, the intervention SPOs in the intervention database, and the SPO tables used to construct the knowledge graph are shown in table 1 below:
TABLE 1
As shown in the above table 1, above,
at time T1, the intervention is not intervened, and the intervention SPO generated, the operations on the intervention database, and the SPO in the intervention database are all empty.
At time T2, the target attribute values are: the attribute values of the graph are as follows: sheep, the intervening SPOs thus generated included: { Xiaoming, zodiac, sheep, negative intervention } and { Xiaoming, zodiac, tiger, positive intervention }. Since the intervention database does not contain the conflicting intervention SPO of the generated intervention SPO, the operation on the intervention database comprises 2 steps, step 1 being: writing intervention SPO { Xiaoming, Chinese zodiac, sheep, negative intervention }, wherein the step 2 is as follows: write intervention SPO { Xiaoming, Chinese zodiac, tiger, positive intervention }. The intervention database comprises 2 lines of pre-SPO, which are respectively: { Xiaoming, zodiac, sheep, negative intervention } and { Xiaoming, zodiac, tiger, positive intervention }.
At time T3, the target attribute values are: cattle, map attribute values are: tigers, the intervening SPOs thus generated include: { Xiaoming, zodiac, tiger, negative intervention } and { Xiaoming, zodiac, cow, positive intervention }. Since the intervention database contains the conflict intervention SPO of { xiaoming, zodiac, tiger, negative intervention } and does not contain the conflict intervention SPO of { xiaoming, zodiac, cow, positive intervention }, the operation on the intervention database comprises 3 steps, and step 1 is: deleting intervention SPO { Xiaoming, Xiaoxian, Hu, Zhen intervene }, wherein the step 2 is as follows: writing intervention SPO { Xiaoming, Chinese zodiac, tiger, negative intervention }, wherein the step 3 is as follows: write intervention SPO { Xiaoming, Chinese zodiac, ox, positive intervention }. The intervention database comprises 3 intervention SPOs which are respectively as follows: { Xiaoming, zodiac, sheep, negative intervention }, { Xiaoming, zodiac, tiger, negative intervention }, { Xiaoming, zodiac, cow, positive intervention }.
At time T4, the target attribute values are: sheep, map attribute value is: cattle, the intervening SPOs thus generated include: { Xiaoming, zodiac, cattle, negative intervention } and { Xiaoming, zodiac, sheep, positive intervention }. Since the intervention database contains the conflict intervention SPO of { xiaoming, zodiac, cow, negative intervention } and contains the conflict intervention SPO of { xiaoming, zodiac, sheep, positive intervention }, the operation on the intervention database comprises 4 steps, step 1 is: deleting intervention SPO { Xiaoming, Chinese zodiac, cattle, positive intervention }, wherein the step 2 is as follows: writing intervention SPO { Xiaoming, Chinese zodiac, cattle, negative intervention }, wherein the step 3 is as follows: deleting intervention SPO { Xiaoming, Chinese zodiac, sheep, negative intervention }, wherein the step 4 is as follows: write intervention SPO { Xiaoming, Chinese zodiac, sheep, positive intervention }.
As an optional implementation manner of the embodiment of the present invention, the method further includes:
under the condition that at least two entities are fused into an entity group and the first entity is selected as a main entity of the entity group, modifying entities of intervention data to be fused and source data to be fused into the first entity, wherein the source data to be fused comprises source data of non-main entities of the entity group in the source data extracted from a data source, and the intervention data to be fused comprises intervention data of non-main entities of the entity group in an intervention database;
and constructing a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source to generate the knowledge graph fusing the at least two entities.
Specifically, in the process of building a knowledge graph by fusing data of a plurality of data sources, entities with different names but indicating the same entity may exist in the data sources, in this case, the entities with different names but representing the same entity are fused into an entity group, and one of the entities is selected as a main entity of the entity group. For example: although the names of the potatoes, potatoes and potatoes are different, the indicated entities are the same, so the potatoes, potatoes and potatoes can be fused into an entity group, and the potatoes are selected as main entities.
Further, after modifying the entity of the intervention data to be fused and the source data to be fused into the first entity, the method further comprises:
judging whether the intervention database contains intervention data with opposite semantics;
if the semantics of the third intervention data and the fourth intervention data are opposite, acquiring the timestamps of the third intervention data and the fourth intervention data;
acquiring target intervention data, wherein the target intervention data is intervention data with a time stamp in the third intervention data and the fourth intervention data;
and controlling the target intervention data to take effect in the process of constructing a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source and generating the knowledge graph fused with the at least two entities.
As described in the above example, since it is determined whether there is any conflicting data before the intervening data is written into the intervening database, if so, the conflicting data is deleted first, and then the intervening data is written into the pre-database, so that, for the same entity, the intervening database does not necessarily have intervening data that is mutually conflicting data. However, in the process of constructing the knowledge graph, a plurality of entities may need to be fused into the same entity group, and the entity name of the intervention data corresponding to each entity in the fused entity group is modified to the main entity name of the entity group and acts on each entity in the entity group, which may cause intervention data of conflicting data of each entity group to exist in the intervention database. For example: the potatoes, the potatoes and the potatoes are fused into a same entity group, and the potatoes are selected as main entities of the entity group. At time T1, an intervention SPO { Potato, Classification, vegetable, Positive intervention } is added to the entity group. At time T2, the entity group joins the potato, and the potato is elected as the main entity of the entity group. At time T3, another intervening SPO { potato, classification, vegetable, negative intervention } is added to the entity group, and since the intervening SPO { potato, classification, vegetable, positive intervention } corresponds to SPO { potato, classification, vegetable }, the intervening SPO { potato, classification, vegetable, negative intervention } corresponds to SPO { potato, classification, vegetable } that is different, the process of deleting before writing is not performed, while the intervening SPO { potato, classification, vegetable, positive intervention } and intervening SPO { potato, classification, vegetable, negative intervention } become { potato, classification, vegetable, positive intervention }, and { potato, classification, vegetable, negative intervention } after fusion, thereby rendering the intervening data semantics unclear.
For the problem that the semantics of the intervention data are unclear, as the intervention database cannot sense the entity change and the main entity change in the entity group, the embodiment identifies the sequence of the intervention data by the timestamp of each intervention data, and when the entities are fused, the intervention data with conflicting semantics control the timestamp to take effect in the last intervention data, so that the embodiment can solve the problem that the semantics of the intervention data corresponding to the entity group are unclear without destroying the semantics of the intervention data.
Based on the same inventive concept, as an implementation of the foregoing method, an embodiment of the present invention further provides an apparatus for updating a knowledge graph, where the apparatus embodiment corresponds to the foregoing method embodiment, and for convenience of reading, details of the foregoing method embodiment are not described in detail in the following apparatus embodiment.
Fig. 5 is a schematic structural diagram of a client according to an embodiment of the present invention, and as shown in fig. 5, an apparatus 500 for updating a knowledge graph according to the embodiment includes:
an obtaining unit 51, configured to obtain a target attribute value, where the target attribute value is an attribute value of a first attribute of a first entity;
a generating unit 52, configured to generate at least one intervention data according to the target attribute value and a graph attribute value, where the graph attribute value is an attribute value of the first attribute of the first entity in a knowledge graph;
an updating unit 53, configured to update the intervention data in the intervention database according to the at least one intervention data;
and the constructing unit 54 is configured to construct a knowledge graph according to the intervention data in the intervention database and the source data extracted from the data source, and generate an updated knowledge graph.
As an optional implementation manner of the embodiment of the present invention, the updating unit 53 is specifically configured to generate intervention data for adding a first attribute value to the knowledge graph, when the target attribute value includes the first attribute value and the graph attribute value does not include the first attribute value; and generating intervention data for deleting the second attribute value from the knowledge-graph under the condition that the target attribute value does not contain the second attribute value and the graph attribute value contains the second attribute value.
As an optional implementation manner of the embodiment of the present invention, the updating unit 53 is further configured to determine whether the intervention database includes conflict data of each intervention data; if the intervention database contains conflict data of first intervention data, deleting the conflict data of the first intervention data from the intervention database; if the intervention database does not contain conflict data of second intervention data, writing the second intervention data into the intervention database;
and the conflict data of any intervention data is intervention data with the opposite semantics of the intervention data.
As an optional implementation manner of the embodiment of the present invention, the updating unit 53 is further configured to, in a case that the intervention database includes conflict data of first intervention data, write the first intervention data into the intervention database.
As an optional implementation manner of the embodiment of the present invention, any intervention data includes: entities, attributes, attribute values, and state information; the state information is positive or negative, when the state information is positive, the corresponding intervention data has the semantic meaning of adding the corresponding attribute value, and when the state information is negative, the corresponding intervention data has the semantic meaning of deleting the corresponding attribute value;
the updating unit 53 is specifically configured to determine whether the intervention database includes intervention data that is the same as the entity, attribute, and attribute value of each intervention data and is opposite to the state information; if the intervention database contains intervention data which is the same as the entity, attribute and attribute value of the first intervention data and is opposite to the state information, determining conflict data containing the first intervention data in the intervention database; and if the intervention database does not contain intervention data which is the same as the entity, the attribute and the attribute value of the second intervention data and is opposite to the state information, determining that the intervention database does not contain the conflict data of the second intervention data.
As an optional implementation manner of the embodiment of the present invention, the updating unit 53 is further configured to modify, when at least two entities are fused into one entity group and the first entity is selected as a main entity of the entity group, the entities of the intervention data to be fused and the source data to be fused are modified into the first entity, where the source data to be fused includes source data of non-main entities of the entity group in the source data extracted from the data source, and the intervention data to be fused includes intervention data of non-main entities of the entity group in the intervention database;
the constructing unit 54 is further configured to construct a knowledge graph according to the intervention data in the intervention database and the source data extracted from the data source, so as to generate a knowledge graph fusing the at least two entities.
As an optional implementation manner of the embodiment of the present invention, the updating unit 53 is further configured to, after modifying the entity of the intervention data to be fused and the source data to be fused into the first entity, determine whether the intervention database contains intervention data with opposite semantics; if the semantics of the third intervention data and the fourth intervention data are opposite, acquiring the timestamps of the third intervention data and the fourth intervention data; acquiring target intervention data, wherein the target intervention data is intervention data with a time stamp in the third intervention data and the fourth intervention data; and controlling the target intervention data to take effect in the process of constructing a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source and generating the knowledge graph fused with the at least two entities.
As an optional implementation manner of the embodiment of the present invention, the intervention data has a higher effective priority than the source data extracted from the data source.
Based on the same inventive concept, the embodiment of the invention also provides electronic equipment. Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 5, the electronic device according to the embodiment includes: a memory 51 and a processor 52, the memory 51 being for storing computer programs; the processor 52 is used to execute the steps of the method of updating a knowledge-graph provided by the above-described embodiments when the computer program is invoked.
Embodiments of the present invention further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the steps of the method for updating a knowledge graph provided in the above embodiments.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied in the medium.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer readable media include both permanent and non-permanent, removable and non-removable storage media. Storage media may implement information storage by any method or technology, and the information may be computer-readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (11)
1. A method of updating a knowledge graph, comprising:
acquiring a target attribute value, wherein the target attribute value is an attribute value of a first attribute of a first entity;
generating at least one intervention datum based on the target attribute value and a graph attribute value, the graph attribute value being an attribute value of the first attribute of the first entity in a knowledge graph;
updating intervention data in an intervention database according to the at least one intervention data;
and constructing a knowledge graph according to the intervention data in the intervention database and the source data extracted from the data source to generate an updated knowledge graph.
2. The method of claim 1, wherein generating at least one intervention data based on the target attribute value and a profile attribute value comprises:
if the target attribute value comprises a first attribute value and the atlas attribute value does not comprise the first attribute value, generating intervention data for adding the first attribute value to the knowledge atlas;
and if the target attribute value does not contain a second attribute value and the atlas attribute value contains the second attribute value, generating intervention data for deleting the second attribute value from the knowledge atlas.
3. The method of claim 1, wherein said updating intervention data in an intervention database based on said at least one intervention data comprises:
judging whether the intervention database contains conflict data of each intervention data; the conflict data of any intervention data is intervention data with the opposite semantics of the intervention data;
if the intervention database contains conflict data of first intervention data, deleting the conflict data of the first intervention data from the intervention database;
and if the intervention database does not contain the conflict data of the second intervention data, writing the second intervention data into the intervention database.
4. The method of claim 3, further comprising:
and writing the first intervention data into the intervention database under the condition that the intervention database contains conflict data of the first intervention data.
5. The method of claim 3, wherein any intervention data comprises: entities, attributes, attribute values, and state information; the state information is positive or negative, when the state information is positive, the corresponding intervention data has the semantic meaning of adding the corresponding attribute value, and when the state information is negative, the corresponding intervention data has the semantic meaning of deleting the corresponding attribute value;
the judging whether the intervention database contains conflict data of each intervention data includes:
judging whether the intervention database contains intervention data which is the same as entities, attributes and attribute values of the intervention data and is opposite to state information;
if the intervention database contains intervention data which is the same as the entity, attribute and attribute value of the first intervention data and is opposite to the state information, determining conflict data containing the first intervention data in the intervention database;
and if the intervention database does not contain intervention data which is the same as the entity, the attribute and the attribute value of the second intervention data and is opposite to the state information, determining that the intervention database does not contain the conflict data of the second intervention data.
6. The method of claim 1, further comprising:
under the condition that at least two entities are fused into an entity group and the first entity is selected as a main entity of the entity group, modifying entities of intervention data to be fused and source data to be fused into the first entity, wherein the source data to be fused comprises source data of non-main entities of the entity group in the source data extracted from a data source, and the intervention data to be fused comprises intervention data of non-main entities of the entity group in an intervention database;
and constructing a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source to generate the knowledge graph fusing the at least two entities.
7. The method of claim 6, wherein after modifying the entity into which the intervention data and the source data are to be fused to the first entity, the method further comprises:
judging whether the intervention database contains intervention data with opposite semantics;
if the semantics of the third intervention data and the fourth intervention data are opposite, acquiring the timestamps of the third intervention data and the fourth intervention data;
acquiring target intervention data, wherein the target intervention data is intervention data with a time stamp in the third intervention data and the fourth intervention data;
and controlling the target intervention data to take effect in the process of constructing a knowledge graph according to the intervention data in the intervention database and source data extracted from a data source and generating the knowledge graph fused with the at least two entities.
8. The method of any of claims 1-7, wherein the intervention data has a higher priority of effectiveness than source data extracted from the data source.
9. An apparatus for knowledge-graph updating, comprising:
an obtaining unit, configured to obtain a target attribute value, where the target attribute value is an attribute value of a first attribute of a first entity;
a generating unit configured to generate at least one intervention data according to the target attribute value and a graph attribute value, where the graph attribute value is an attribute value of the first attribute of the first entity in a knowledge graph;
the updating unit is used for updating the intervention data in the intervention database according to the at least one intervention data;
and the construction unit is used for constructing a knowledge graph according to the intervention data in the intervention database and the source data extracted from the data source to generate an updated knowledge graph.
10. An electronic device, comprising: a memory for storing a computer program and a processor; a processor is adapted to perform the method of updating a knowledge graph of any of claims 1-8 when invoking a computer program.
11. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, implements the method of updating a knowledge graph of any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110185453.6A CN112860912B (en) | 2021-02-10 | 2021-02-10 | Method and device for updating knowledge graph |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110185453.6A CN112860912B (en) | 2021-02-10 | 2021-02-10 | Method and device for updating knowledge graph |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112860912A true CN112860912A (en) | 2021-05-28 |
CN112860912B CN112860912B (en) | 2024-05-07 |
Family
ID=75989783
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110185453.6A Active CN112860912B (en) | 2021-02-10 | 2021-02-10 | Method and device for updating knowledge graph |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112860912B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113870697A (en) * | 2021-09-03 | 2021-12-31 | 厦门大学 | Exhibit system using knowledge graph |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018006469A1 (en) * | 2016-07-07 | 2018-01-11 | 深圳狗尾草智能科技有限公司 | Knowledge graph-based human-robot interaction method and system |
CN108920588A (en) * | 2018-06-26 | 2018-11-30 | 北京光年无限科技有限公司 | A kind of knowledge mapping update method and system for human-computer interaction |
CN109902130A (en) * | 2019-01-31 | 2019-06-18 | 北京明略软件系统有限公司 | A kind of date storage method, data query method and apparatus, storage medium |
CN110413695A (en) * | 2019-07-29 | 2019-11-05 | 北京百度网讯科技有限公司 | Police affair information management method, apparatus, equipment and medium based on block chain |
CN110909168A (en) * | 2019-09-23 | 2020-03-24 | 腾讯科技(深圳)有限公司 | Knowledge graph updating method and device, storage medium and electronic device |
CN111090683A (en) * | 2019-11-29 | 2020-05-01 | 上海勘察设计研究院(集团)有限公司 | Engineering field knowledge graph construction method and generation device thereof |
CN111475602A (en) * | 2020-06-23 | 2020-07-31 | 成都数联铭品科技有限公司 | Multi-version knowledge graph storage method and device, storage medium and electronic equipment |
-
2021
- 2021-02-10 CN CN202110185453.6A patent/CN112860912B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018006469A1 (en) * | 2016-07-07 | 2018-01-11 | 深圳狗尾草智能科技有限公司 | Knowledge graph-based human-robot interaction method and system |
CN108920588A (en) * | 2018-06-26 | 2018-11-30 | 北京光年无限科技有限公司 | A kind of knowledge mapping update method and system for human-computer interaction |
CN109902130A (en) * | 2019-01-31 | 2019-06-18 | 北京明略软件系统有限公司 | A kind of date storage method, data query method and apparatus, storage medium |
CN110413695A (en) * | 2019-07-29 | 2019-11-05 | 北京百度网讯科技有限公司 | Police affair information management method, apparatus, equipment and medium based on block chain |
CN110909168A (en) * | 2019-09-23 | 2020-03-24 | 腾讯科技(深圳)有限公司 | Knowledge graph updating method and device, storage medium and electronic device |
CN111090683A (en) * | 2019-11-29 | 2020-05-01 | 上海勘察设计研究院(集团)有限公司 | Engineering field knowledge graph construction method and generation device thereof |
CN111475602A (en) * | 2020-06-23 | 2020-07-31 | 成都数联铭品科技有限公司 | Multi-version knowledge graph storage method and device, storage medium and electronic equipment |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113870697A (en) * | 2021-09-03 | 2021-12-31 | 厦门大学 | Exhibit system using knowledge graph |
Also Published As
Publication number | Publication date |
---|---|
CN112860912B (en) | 2024-05-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20210256013A1 (en) | Blockchain-based methods and apparatuses for recording structured work | |
US20150261805A1 (en) | Multi-version concurrency control across row store and column store | |
CN108959510B (en) | Partition level connection method and device for distributed database | |
US9135739B2 (en) | Optimizing graph evaluation | |
CN107622080B (en) | Data processing method and equipment | |
JP2020501235A (en) | Generating, accessing, and displaying lineage metadata | |
US11775507B2 (en) | Methods and apparatuses for reading and updating data structures, and electronic devices | |
US11841836B2 (en) | Target environment data seeding | |
CN112083897A (en) | Signal declaration system, method, equipment and medium in digital logic design | |
CN112765248A (en) | SQL-based data extraction method and equipment | |
CN107609011B (en) | Database record maintenance method and device | |
CN116778124A (en) | Three-dimensional scene editing method, system, equipment and storage medium | |
CN112860912A (en) | Method and device for updating knowledge graph | |
CN112948389B (en) | MD 5-based database table data comparison method and device | |
CN111737266B (en) | Block data access method, block data storage method and device | |
CN112288586A (en) | Insurance industry data integration method based on HBase and related equipment | |
CN108228604B (en) | Model construction method based on memory object, information query method and device | |
CN110019783B (en) | Attribute word clustering method and device | |
CN115048083A (en) | Visualization method and device for assembly, storage medium and electronic equipment | |
CN110795421A (en) | Method for preventing dirty data from being generated | |
CN112685553A (en) | Method, device, equipment and medium for searching and replacing online document | |
CN109582938B (en) | Report generation method and device | |
CN109299125A (en) | Database update method and device | |
CN110704742A (en) | Feature extraction method and device | |
CN111338986B (en) | Method for acquiring data in three-dimensional model data structure |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |