Heterogeneous ontology matching method and system based on BERT and graph contrast learning
By extracting the semantic features of isomeric ontology using the BERT model, and learning the fusion structure features in combination with the graph to generate comprehensive vector representations, the problem of inaccurate matching results in the existing technology is solved, and a more accurate and robust matching effect of isomeric ontology is achieved.
Patent Information
- Application Number
- CN202411877818.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-19
AI Technical Summary
The existing heterogeneous ontology matching technology has limitations, including only considering local structural information and failing to fully integrate textual features and structural features, resulting in inaccurate matching results.
The context semantic features of entities are extracted using the BERT model, and the ontology is converted into graph structure. Through graph comparison learning, combined with graph encoder, semantic features and structural features are fused to generate comprehensive vector representations for matching.
More accurate matching of heterogeneous ontology is achieved. By extracting rich global structural features and semantic features, the accuracy and robustness of the matching are enhanced, and the dependence on external training sets is broken.
Smart Images

Figure CN119719802A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of the combination of semantic web and deep learning, and relates to a heterogeneous ontology matching method and system based on BERT and graph contrast learning. Background Art
[0002] The semantic web is a vision for the next generation of the web. Its goal is to add metadata that can be understood by computers to documents on the Internet so that computers can automatically understand the information on web pages and exchange this information between different applications to achieve more efficient data sharing and interaction. As a conceptual description of knowledge and a formal representation method, ontology can give clear meaning to data by defining concepts, attributes and relationships in a field. At the same time, it uses standardized language to describe concepts and relationships so that machines can read and process data and achieve data integration and communication.
[0003] However, when constructing ontologies, due to the lack of unified standards and the influence of developers' subjectivity, the same concepts may have different descriptions, resulting in the generation of a large number of heterogeneous ontologies, which brings difficulties to the interaction between different systems and applications and seriously hinders the implementation of the language web.
[0004] Ontology matching is the key to solving the above problems. It eliminates the heterogeneity problem between concepts by identifying and establishing the similarity or equivalence relationship between concepts in heterogeneous ontologies. Early ontology matching technology was mainly based on a single dimension. For example, string-based methods consider the similarity of concept names; vocabulary-based methods use dictionaries or vocabulary resources to evaluate the similarity of concepts; structure-based methods consider the position and hierarchy of concepts in the ontology. They are usually simple and fast, but because they only consider the features of a single dimension, some important information may be ignored, resulting in inaccurate matching results. Therefore, some methods that integrate multi-dimensional features have been proposed, which comprehensively consider the text and structural similarity of concepts. With the development of machine learning, some methods train models and comprehensively consider the similarity of concepts from multiple perspectives. Although these methods have made some progress, they all have some limitations:
[0005] (I) Existing structural features often only consider local structural information of the ontology, such as the degree of a node, the number of neighboring nodes a node has, etc. These local structural information cannot fully express the complex structural relationship between concepts.
[0006] (ii) When considering multi-dimensional features, only some simple weighted aggregation is used, and the text features and structural features are not truly integrated. At the same time, machine learning-based methods rely on high-quality training data, which is a huge challenge for the lack of a unified and standardized ontology. Summary of the invention
[0007] In view of this, the purpose of the present invention is to provide a heterogeneous ontology matching method and system based on BERT and graph contrast learning. The present invention effectively achieves the matching of heterogeneous ontologies by extracting complex structural features between entities and realizing the complete fusion of semantic features and structural features. The present invention first uses the BERT model to extract entity semantic features with contextual semantics, and at the same time converts the ontology into a graph structure, converts the entity into a node, converts the relationship into an edge, and uses the semantic feature vector as the node feature. Through the graph encoder combined with graph contrast learning, a vector representation with both semantic features and structural features is obtained, thereby performing ontology matching.
[0008] In order to achieve the above object, the present invention provides the following technical solutions:
[0009] A heterogeneous ontology matching method based on BERT and graph contrastive learning, the method comprising the following steps:
[0010] S1, read the ontology file, convert the resource description framework RDF in the ontology file into a directed acyclic graph, and traverse each node to build the ontology corpus;
[0011] S2. Fine-tune and optimize the BERT model according to the ontology corpus, and output the entity semantic feature vector through the fine-tuned and optimized BERT model;
[0012] S3, taking the semantic feature vector as the node feature vector, and obtaining the final structure embedding through graph sampling strategy and graph encoding method;
[0013] S4. Construct two views, select positive and negative samples to calculate the loss function for the two views, optimize the encoder parameters through the minimum loss function, and finally output the comprehensive vector representation of each node;
[0014] S5. Use the cosine similarity distance formula to calculate the similarity of the entity pair and obtain the final similarity score.
[0015] Further, in step S1, the process of constructing the ontology corpus includes:
[0016] S11, establish an empty graph, traverse each entity in the resource description framework RDF in the ontology file, and store the entity as a node in the graph;
[0017] S12, then detect the domain and value of each entity attribute, and use them as the edge attribute of the entity to obtain a directed acyclic graph structure;
[0018] S13, traversing all nodes in the directed acyclic graph structure, in the traversal stage, retrieving the relationship edges between each node and all neighboring nodes, and constructing a sentence sequence according to the relationship edges;
[0019] S14. All sentence sequences after traversal are used as the ontology corpus.
[0020] Further, in step S2, the fine-tuned and optimized BERT model is used as an encoder, and the entity name is input to obtain a vector of a fixed length, which is the entity semantic feature; wherein the process of fine-tuning and optimizing the BERT model includes the following steps:
[0021] S21, preprocessing the sentence sequences in the corpus, including removing irrelevant characters and text segmentation;
[0022] S22. Sequence each sentence, represented as Q{q1,q2,...q N}, and add labels to each sentence sequence, including [CLS], [SEP], [MASK];
[0023] S23, the labeled sentence sequence is embedded into a vector of preset length, and then transformed by several Transformer encoders in the BERT model to obtain the final output Among them, L represents the total number of BERT layers, and N represents the total number of elements;
[0024] S24. Through the masking training MLM and next sentence prediction NSP training methods, the parameters are adjusted to obtain the fine-tuned and optimized BERT model.
[0025] Further, in step S23, the updating process for each element in the final output K is expressed as:
[0026]
[0027] Among them, M e ,M b Represent the weight matrix and bias matrix respectively, q i represents the i-th element, represents the state of the lth hidden layer of the ith element, and transformer(·) represents the encoding operation of the Transformer encoder, which includes a multi-head attention layer, a fully connected layer, and an output layer.
[0028] Further, in step S3, the following steps are included:
[0029] S31, taking the constructed directed acyclic graph structure as input, and taking the semantic feature vector as the feature vector of the entity node;
[0030] S32, generating a comparison object by randomly destroying the topological structure or node features of the graph to perform graph sampling, wherein the graph sampling strategy includes a random edge deletion strategy and an attribute masking strategy;
[0031] S33. Highway-GCN is used as the graph encoder to update the node representation by continuously aggregating neighbor node information to obtain the final structure embedding.
[0032] Further, in step S32, a random edge deletion strategy is first adopted by using a random mask matrix Randomly remove edges in the original ontology graph, Bernoulli distribution p r is the probability of the edge being removed; let A be the original adjacency matrix of the graph, then:
[0033]
[0034] In the formula, represents the Hadamard product, represents the adjacency matrix after randomly deleting edges;
[0035] Secondly, an attribute masking strategy is adopted to restore the masked vertex attributes using context information by using a random vector Randomly mask the node features, where f represents the dimension of the feature vector, and each dimension of the random vector conforms to the Bernoulli distribution.
[0036]
[0037] Where s1, s2, …, s N represents the feature vector of the node, N represents the number of nodes, Represents the feature matrix after random attribute masking.
[0038] Further, in step S33, the lth layer of the HGCN graph encoder embeds the semantics into a feature matrix As input, its update rule is as follows:
[0039]
[0040] in, A is the adjacency matrix, which consists of the relationships between nodes, and I is the unit matrix. yes The degree matrix of is the weight matrix shared between the lth layer, σ{·} is the ReLU activation function;
[0041] Add a highway network after each layer of GCN network to avoid gradient explosion and perform structural embedding calculation:
[0042]
[0043] Among them, T(·) is the transform gate, C(·) is the carry gate, and the final structure embedding is expressed as V = HGCN(S).
[0044] Further, in step S4, the two obtained views are expressed as:
[0045]
[0046] In the formula, represents the original ontology graph, They represent random edge deletion function and random attribute masking function respectively. for all nodes in the first view and all nodes in the second view, respectively. are the sets of relationships between nodes in the first view and the second view, respectively. are the feature matrices of the first view and the second view respectively;
[0047] Then, a comparison object is established, including positive samples and negative samples, where the positive samples include: Each node in i with The corresponding anchor node u in i , View in i The neighbor nodes of Anchor node u in the view i Neighbor nodes of ; negative samples include: ν in the same view i The non-neighbor nodes of u and u in another view i Non-neighbor nodes;
[0048] Define contrastive loss:
[0049]
[0050] in Indicates v i The number of neighbor nodes of Indicates u i The number of neighbor nodes, θ(·) represents the vector inner product, τ represents the temperature coefficient; i, j represent different node subscripts respectively;
[0051] The goal is to minimize the overall contrast loss, where the overall contrast loss is defined as the average of all positive sample pairs, as follows:
[0052]
[0053] The encoder parameters are updated by minimizing the loss objective of Eq.
[0054] Further, in step S5, the cosine distance formula is used to calculate the similarity of entities from different ontologies:
[0055]
[0056] In the formula, e1 and e2 represent the vector representations of c1 and c2 entities respectively, and c1 and c2 are different entities; the final matching result is obtained based on the similarity.
[0057] The present invention also proposes a matching system for executing the aforementioned heterogeneous ontology matching method based on BERT and graph contrast learning, the system comprising a semantic feature extraction module, a graph contrast learning module and a similarity calculation module; wherein,
[0058] The semantic feature extraction module is used to read the ontology file, build the corpus and fine-tune the BERT model to obtain the semantic feature vector of the entity;
[0059] The graph contrastive learning module is used to train an encoder that can obtain unique structural features using contrastive learning and output a comprehensive representation of entities;
[0060] The similarity calculation module uses the cosine similarity distance formula to calculate the similarity between the comprehensive representations of entities from different ontologies to obtain the final matching result.
[0061] The beneficial effects of the present invention are:
[0062] (I) The structural features referenced by the existing matching methods rely on the local structural information of the ontology, but these local information cannot fully characterize the structure of the entity in the ontology. The present invention uses the topological structure of the graph to extract richer global structural features through graph contrast learning. At the same time, the semantic feature vector of the entity is used as the feature vector of the corresponding node in the contrast learning to achieve complete feature fusion.
[0063] (ii) Some existing machine learning matching methods rely on training sets to achieve matching results. The present invention only uses internal ontology information in the corpus extraction stage, and generates comparison objects for training through the original ontology graph in the comparative learning stage, without requiring any external resources or training sets. This eliminates the problem that matching accuracy is affected by the training set.
[0064] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0066] Figure 1 Schematic diagram of the overall architecture of a heterogeneous matching method based on BERT and graph contrast learning according to an embodiment of the present invention;
[0067] Figure 2 It is a flowchart of executing the graph comparison learning module of an embodiment of the present invention;
[0068] Figure 3 BERT model structure diagram of an embodiment of the present invention;
[0069] Figure 4 Schematic diagram of positive and negative samples in comparative learning according to an embodiment of the present invention. DETAILED DESCRIPTION
[0070] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0071] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0072] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0073] See also Figure 1 to Figure 4, which is a heterogeneous ontology matching method and system based on BERT and graph contrastive learning.
[0074] Example
[0075] This embodiment first gives a detailed structural introduction of a heterogeneous ontology matching method based on BERT and graph contrast learning. Figure 1 The overall architecture diagram shown in the figure, the method includes the following steps:
[0076] S1, read the ontology file, convert the RDF into a directed acyclic graph, and traverse the nodes to build the ontology corpus;
[0077] S2. Input the corpus into BERT for fine-tuning to obtain a fine-tuned BERT model, and output the entity semantic feature vector through the fine-tuned BERT model;
[0078] S3, taking the semantic feature vector as the node feature vector, and obtaining the subgraph through two graph sampling strategies;
[0079] S4, select positive and negative sample pairs and calculate the loss function after H-GCN encoding, optimize the encoder parameters through the minimum loss function and finally output the comprehensive vector representation of each node;
[0080] S5. Use the cosine similarity distance formula to calculate the similarity of the entity pair and obtain the final similarity score.
[0081] In step S1 of this embodiment, the main corpus is constructed: the structure of the ontology can be regarded as a directed acyclic graph, each entity represents a node in the graph structure, and there are many different types of relationships between the nodes. Therefore, we construct the corpus through the following process: First, establish an empty graph, traverse each entity in the Resource Description Framework RDF (RDF) in the ontology file, store the entity as a node in the graph, then retrieve the domain and value range of the entity attribute, and add edge attributes. After obtaining the ontology graph structure, perform corresponding traversal on these nodes. In the traversal stage, retrieve all neighbor nodes and the relationship edges of each node to construct a sentence sequence, and regard all sentence sequences as a corpus.
[0082] In step S2 of this embodiment, BERT is fine-tuned and optimized in combination with the constructed corpus: first, the sentence sequences in the corpus are preprocessed, including removing irrelevant characters and text segmentation. Then, each sentence is sequence-tagged, represented as Q{q1,q2,...q N}, and add [CLS], [SEP], [MASK] tags. Each element in the input sequence will be embedded into a vector of length 768, which will pass through each Transformer encoder in turn and be transformed accordingly to obtain the final output representation as L represents the total number of BERT layers, such as Figure 3 As shown. Then the element state of the lth layer of the i-th element is expressed as:
[0083]
[0084] Among them, M e ,M b Represent the weight matrix and bias matrix respectively, q i represents the i-th element, represents the state of the i-th element and the l-th hidden layer, and transformer(·) represents the encoding operation of the Transformer encoder, which includes a multi-head attention layer, a fully connected layer, and an output layer. In addition, M e 、M b And adjust the parameters in the transformer.
[0085] At the same time, the fine-tuned BERT model is used as an encoder to input the name of the entity to obtain a vector of fixed length, which represents the semantic features of the entity.
[0086] In step S3 of this embodiment, the structural information of the entity is mainly extracted and the comprehensive representation is output. The purpose is to obtain different views by adopting different sampling strategies. In these views, the contrast learning framework maximizes the consistency of the perspective generated by the same instance and minimizes the consistency of the perspective generated by different instances to train the model. The vector output by the model has strong robustness and can resist changes in the graph structure, thereby obtaining rich entity structure features. The process is shown in the attached figure. Figure 2 As shown, the specific execution process is:
[0087] S31, inputting the ontology graph structure and semantic feature vector. In order to achieve complete integration of semantic features and structural features, the present invention uses the ontology graph structure obtained in the corpus construction phase as input, and uses the semantic features as feature vectors of entity nodes.
[0088] S32. Graph sampling: Graph sampling generates comparison objects by randomly destroying the topological structure or node features of the graph. The method is as follows:
[0089] Randomly remove edges by using a random mask matrix Randomly remove edges in the original ontology graph, Bernoulli distribution p r is the probability of the edge being removed. Let A be the original adjacency matrix of the graph. If A ij =1, then R ij Set to 0. Then the adjacency matrix can be calculated as follows
[0090]
[0091] Attribute masking. Attribute masking prompts the model to restore the masked vertex attributes using their context information (i.e., the remaining attributes). The basic assumption is that the lack of some vertex attributes will not have a big impact on the model prediction. By using a random vector The node features are randomly masked, where f represents the dimension of the feature vector, and each dimension of the random vector conforms to the Bernoulli distribution.
[0092]
[0093] Where s1, s2, …, s N represents the feature vector of the node, Represents the feature matrix after random attribute masking.
[0094] S33, Graph Encoding: Highway-GCN is used as the graph encoder. GCN updates the node representation by continuously aggregating neighbor node information. The input of the first layer of GCN is the feature matrix composed of semantic embedding The update rules are as follows.
[0095]
[0096] in, A is the adjacency matrix, which consists of the relationships between nodes, and I is the unit matrix. yes The degree matrix of is the weight matrix shared between the lth layer, and σ{·} is the ReLU activation function. The gradient explosion problem caused by the increase in the number of neural network layers is solved by adding a highway network. A network is added after each GCN layer for structural embedding. The calculation is as follows.
[0097]
[0098] T is the transform gate, C is the carry gate, C = 1-T. The final structure embedding is V = HGCN(S).
[0099] In step S4 of this embodiment, positive and negative sample training is performed: the two views obtained are represented as:
[0100]
[0101] In the formula, represents the original ontology graph, They represent random edge deletion function and random attribute masking function respectively. Respectively Figure 1 All nodes and views in Figure 2 All nodes in Respectively Figure 1 And Vision Figure 2 The set of relationships between the nodes in Respectively Figure 1 The feature matrix and view Figure 2 The feature matrix of .
[0102] Then, we establish the comparison objects, including positive samples and negative samples, as shown in the following figure. Figure 4 Specifically, the positive sample is mainly composed of three parts. The first is Each node v in i with The corresponding anchor node u in i ,Secondly, considering the association relationship contained in the neighbor nodes in the ontology, In the view, change v i The neighbor nodes of u are regarded as positive samples. i The neighbor nodes of v are regarded as positive samples. Negative samples are mainly composed of two parts. The first part is the i non-neighboring nodes.
[0103] Second, in another view, u i The contrast loss is defined as follows:
[0104]
[0105] in Indicates v i The number of neighbor nodes of Indicates u i The number of neighbor nodes, σ(·) represents the vector inner product, and τ represents the temperature coefficient.
[0106] The two generated views are represented as and Since the two views are symmetric, the loss for the other view is defined in the same way. The overall contrastive objective to be minimized is defined as the average of all positive pairs as follows:
[0107]
[0108] In summary, in each training epoch, we first generate two views of the graph G and Using the graph encoder H-GCN to get and The nodes of represent V and U. Finally, the parameters of the encoder are updated by minimizing the loss objective of Eq.
[0109] In step S5 of this embodiment, the cosine distance formula is used to calculate the similarity of entities from different ontologies. The calculation formula is:
[0110]
[0111] In the formula, e1 and e2 represent the vector representation of c1 and c2 entities respectively, and c1 and c2 are different entities. The similarity obtained here is between 0 and 1. The closer the value is to 1, the more similar the two entities are. The final matching result is obtained based on the similarity.
[0112] This embodiment provides a matching method based on the above matching system, which includes a semantic feature extraction module, a graph comparison learning module and a similarity calculation module; wherein,
[0113] The semantic feature extraction module is used to read the ontology file, build the corpus and fine-tune the BERT model to obtain the semantic feature vector of the entity;
[0114] The graph contrastive learning module is used to train an encoder that can obtain unique structural features using contrastive learning and output a comprehensive representation of entities;
[0115] The similarity calculation module uses the cosine similarity distance formula to calculate the similarity between the comprehensive representations of entities from different ontologies to obtain the final matching result.
[0116] In summary, through the detailed implementation instructions, those skilled in the art can clearly understand the implementation steps, so as to implement the present invention by themselves with the help of the required software and hardware platforms. The present invention designs a heterogeneous ontology matching system and method based on BERT and graph contrast learning. The system first converts the ontology file into a graph structure by parsing it, and at the same time parses and obtains triple sentences as a corpus to fine-tune BERT, and obtains the semantic representation of the entity in the ontology through the fine-tuned BERT. Then, it is used as the feature vector of the node in the graph structure, and the sampling operation of randomly deleting the edge information and masking the node features is performed on the ontology graph with the help of the topological structure of the graph. Two views are obtained, and they are trained by selecting positive and negative samples and defining the loss function. In this way, the model can learn an encoder so that the output embedding has strong robustness, can resist the change of the graph structure, and obtain a unique encoding representation. Finally, the obtained representation is used as a comprehensive representation of the entity that combines semantic and structural features, and the final similarity score is obtained by calculating the similarity between two entities to complete the ontology matching task.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. A heterogeneous ontology matching method based on BERT and graph contrastive learning, characterized by: The method comprises the following steps: S1, read the ontology file, convert the resource description framework RDF in the ontology file into a directed acyclic graph, and traverse each node to build the ontology corpus; S2. Fine-tune and optimize the BERT model according to the ontology corpus, and output the entity semantic feature vector through the fine-tuned and optimized BERT model; S3, taking the semantic feature vector as the node feature vector, and obtaining the final structure embedding through graph sampling strategy and graph encoding method; S4. Construct two views, select positive and negative samples to calculate the loss function for the two views, optimize the encoder parameters through the minimum loss function, and finally output the comprehensive vector representation of each node; S5. Use the cosine similarity distance formula to calculate the similarity of the entity pair and obtain the final similarity score.
2. According to claim 1, a heterogeneous ontology matching method based on BERT and graph contrastive learning is characterized by: In step S1, the process of constructing the ontology corpus includes: S11, establish an empty graph, traverse each entity in the resource description framework RDF in the ontology file, and store the entity as a node in the graph; S12, then detect the domain and value of each entity attribute, and use them as the edge attribute of the entity to obtain a directed acyclic graph structure; S13, traversing all nodes in the directed acyclic graph structure, in the traversal stage, retrieving the relationship edges between each node and all neighboring nodes, and constructing a sentence sequence according to the relationship edges; S14. All sentence sequences after traversal are used as the ontology corpus.
3. The heterogeneous ontology matching method based on BERT and graph contrastive learning according to claim 1, characterized in that: In step S2, the fine-tuned and optimized BERT model is used as an encoder, and the entity name is input to obtain a vector of fixed length, which is the entity semantic feature; wherein, the process of fine-tuning and optimizing the BERT model includes the following steps: S21, preprocessing the sentence sequences in the corpus, including removing irrelevant characters and text segmentation; S22. Sequence each sentence, represented as Q{q1,q2,...q N }, and add labels to each sentence sequence, including [CLS], [SEP], [MASK]; S23, the labeled sentence sequence is embedded into a vector of preset length, and then transformed by several Transformer encoders in the BERT model to obtain the final output Among them, L represents the total number of BERT layers, and N represents the total number of elements; S24. Through the masking training MLM and next sentence prediction NSP training methods, the parameters are adjusted to obtain the fine-tuned and optimized BERT model.
4. The heterogeneous ontology matching method based on BERT and graph contrastive learning according to claim 3, characterized in that: In step S23, the updating process for each element in the final output K is expressed as: Among them, M e ,M b Represent the weight matrix and bias matrix respectively, q i represents the i-th element, represents the state of the lth hidden layer of the ith element, and transformer(·) represents the encoding operation of the Transformer encoder, which includes a multi-head attention layer, a fully connected layer, and an output layer.
5. The heterogeneous ontology matching method based on BERT and graph contrastive learning according to claim 1, characterized in that: In step S3, the following steps are included: S31, taking the constructed directed acyclic graph structure as input, and taking the semantic feature vector as the feature vector of the entity node; S32, generating a comparison object by randomly destroying the topological structure or node features of the graph to perform graph sampling, wherein the graph sampling strategy includes a random edge deletion strategy and an attribute masking strategy; S33. Highway-GCN is used as the graph encoder to update the node representation by continuously aggregating neighbor node information to obtain the final structure embedding.
6. The heterogeneous ontology matching method based on BERT and graph contrastive learning according to claim 5, characterized in that: In step S32, a random edge deletion strategy is first adopted by using a random mask matrix Randomly remove edges in the original ontology graph, Bernoulli distribution p r is the probability of the edge being removed; let A be the original adjacency matrix of the graph, then: In the formula, represents the Hadamard product, represents the adjacency matrix after random deletion; Secondly, an attribute masking strategy is adopted to restore the masked vertex attributes using context information by using a random vector Randomly mask the node features, where f represents the dimension of the feature vector, and each dimension of the random vector conforms to the Bernoulli distribution. Where s1, s2, …, s N represents the node feature vector, Represents the feature matrix after attribute masking.
7. The heterogeneous ontology matching method based on BERT and graph contrastive learning according to claim 6, characterized in that: In step S33, the lth layer of the HGCN graph encoder embeds the semantics into a feature matrix As input, its update rule is as follows: in, A is the adjacency matrix, which consists of the relationships between nodes, and I is the unit matrix. yes The degree matrix of is the weight matrix shared between the lth layer, σ{·} is the ReLU activation function; Add a highway network after each layer of GCN network to avoid gradient explosion and perform structural embedding calculation: S e (l+1) =T(S e (l) )·S e (l+1) +C(S e (l) )·S e (l) Among them, T(·) is the transform gate, C(·) is the carry gate, and the final structure embedding is expressed as V = HGCN(S).
8. The heterogeneous ontology matching method based on BERT and graph contrastive learning according to claim 7, characterized in that: In step S4, the two obtained views are represented as: In the formula, represents the original ontology graph, They represent random edge deletion function and random attribute masking function respectively. for all nodes in the first view and all nodes in the second view, respectively. are the sets of relationships between nodes in the first view and the second view, respectively. are the feature matrices of the first view and the second view respectively; Then, a comparison object is established, including positive samples and negative samples, where the positive samples include: Each node in i with The corresponding anchor node u in i , View in i The neighbor nodes of Anchor node u in the view i Neighbor nodes of ν; negative samples include: i The non-neighbor nodes of u and u in another view i Non-neighbor nodes; Define contrastive loss: in Indicates v i The number of neighbor nodes of Indicates u i The number of neighbor nodes, θ(·) represents the vector inner product, τ represents the temperature coefficient, and i and j represent different node subscripts respectively; The goal is to minimize the overall contrast loss, where the overall contrast loss is defined as the average of all positive sample pairs, as follows: The encoder parameters are updated by minimizing the loss objective of Eq.
9. The heterogeneous ontology matching method based on BERT and graph contrastive learning according to claim 8, characterized in that: In step S5, the similarity of entities from different ontologies is calculated using the cosine distance formula: In the formula, e1 and e2 represent the vector representations of c1 and c2 entities respectively, and c1 and c2 are different entities; the final matching result is obtained based on the similarity.
10. A matching system for executing the heterogeneous ontology matching method based on BERT and graph contrastive learning as described in any one of claims 1 to 9, characterized in that: The system includes a semantic feature extraction module, a graph comparison learning module and a similarity calculation module; in, The semantic feature extraction module is used to read the ontology file, build the corpus and fine-tune the BERT model to obtain the semantic feature vector of the entity; The graph contrastive learning module is used to train an encoder that can obtain unique structural features using contrastive learning and output a comprehensive representation of entities; The similarity calculation module uses the cosine similarity distance formula to calculate the similarity between the comprehensive representations of entities from different ontologies to obtain the final matching result.
Citation Information
Patent Citations
Ontology concept matching method based on paired connected graphs and graph neural network
CN114818700A
Knowledge graph embedding method based on graph convolution contrast learning and XLNet
CN115936115A
Electronic medical record representation learning method based on multi-view comparative learning
CN117409911A
Ontology matching method and device based on deep transfer learning
CN118094243A
Functional exercise shorts
KR1020240023968A
Cited By
Heterogeneous ontology matching method and system based on BERT and graph contrastive learning
WO2026129624A1