Web service characterization method based on multi-view multi-level comparative learning

Through the multi-view and multi-level comparison learning method, combined with the Sentence-BERT and LightGCN models, the text and structural features of the Web service are extracted, and the problem of insufficient utilization of text semantics and structural semantics in the existing technology is solved, and more accurate Web service representation and recommendation are achieved.

CN120386948AActive Publication Date: 2025-07-29HUNAN UNIV OF SCI & TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510476595.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-07-29
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

Existing Web service representation methods are difficult to make full use of text semantics and structural semantics, making it difficult to quickly find the most suitable service among massive services, especially the poor representation of tail services.

Method used

Using a multi-view multi-level contrast learning method, text representation is extracted through the Sentence-BERT model, and structural representation is extracted in combination with the LightGCN model, local comparison learning and global contrast learning are added, text and structural information are integrated, and the popularity distribution of the Web API is considered for weight allocation, and finally the representation vector of the Web service is weighted.

Benefits of technology

It improves the accuracy and richness of Web service representation, improves the performance of service classification, retrieval and recommendation, and enhances the generalization ability and adaptability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120386948A_ABST
    Figure CN120386948A_ABST
Patent Text Reader

Abstract

The invention discloses a Web service characterization method based on multi-view and multi-level comparative learning. The method comprises the following steps: acquiring a programmable Web data set; the method comprises the following steps: acquiring Mashup text description and Web API text description on the basis of a programmable Web data set; the Mashup text description and the Web API text description are input into a Sension-BERT model, and a Mashup text representation and a Web API text representation are obtained; the programmable Web data set is input into the Web service interaction network model, and Mashup structural representation and WebAPI structural representation are obtained; respectively carrying out global comparative learning on the corresponding text characterization and the structure characterization to obtain corresponding global feature information; and adding the corresponding global feature information to obtain a Web representation vector. According to the method, feature information of Web services under multiple views is considered at the same time, and feature extraction is carried out in combination with multi-level comparative learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Web service representation, and in particular relates to a Web service representation method based on multi-view and multi-level contrast learning. Background Art

[0002] Web services (Web APIs) are a service model that enables data exchange and function calls over the internet. They are designed to provide developers with a flexible and efficient development path, enabling the rapid construction of mashup applications. However, with the rapid increase in the number of web services, users face difficulties in quickly finding the most suitable service among the vast number of options, leading to the problem of "difficulty in selection." Furthermore, traditional web service classification methods face challenges when processing large amounts of data, making efficient web service discovery and classification a research hotspot. Service representation is fundamental to tasks such as service discovery and classification, as the quality of service representation directly impacts the performance of these tasks.

[0003] In recent years, service representation methods have continued to develop and can generally be categorized into three types: content-based, graph-based, and hybrid approaches. Content-based service representation methods rely on textual descriptions of service quality and focus on extracting semantic features from the text, including the service name, description, input and output parameters, and category labels. Content-based representation methods parse documents into structured information and transform services into feature vectors using feature extraction and representation learning techniques such as BERT and DNN. Graph-based service representation methods treat services as nodes in a graph and represent them using graph neural network models, emphasizing the interactive relationships between services. The idea is that the semantics of service functionality is implicit in the service network structure. Network representation methods, such as Node2Vec, LightGCN, GAN, and GAT, are commonly used in this type of work. Although network representations can be learned from service networks to embed users and services, many existing works focus solely on structural semantics while ignoring textual semantics. To fully leverage both textual and structural semantics, hybrid approaches extract textual and structural semantics from both functional description documents and service networks to achieve service representation. This type of approach has significantly improved service representation performance.

[0004] While hybrid approaches have made significant progress in service representation, the information limitations of service description documents and service networks make it difficult to effectively extract rich semantics from them. Furthermore, web services are characterized by their popularity, a problem that has been largely ignored in existing work, making it difficult for models to fully represent tail services. Summary of the Invention

[0005] In view of the above technical problems, the present invention proposes a Web service representation method based on multi-view multi-level contrastive learning to solve the problems existing in the above prior art.

[0006] The present invention proposes a Web service representation method based on multi-view multi-level contrastive learning, including:

[0007] Obtain a programmable Web dataset;

[0008] Based on the programmable Web dataset, obtain Mashup text descriptions and Web API text descriptions;

[0009] Input the Mashup text descriptions and Web API text descriptions into a Sentence-BERT model to obtain Mashup text representations and Web API text representations;

[0010] Input the programmable Web dataset into a Web service interaction network model to obtain Mashup structure representations and Web API structure representations;

[0011] Perform global contrastive learning on the corresponding text representations and structure representations respectively to obtain corresponding global feature information;

[0012] Sum up the corresponding global feature information to obtain a Web representation vector.

[0013] Optionally, obtaining the Mashup text representations and Web API text representations includes:

[0014] Perform dimensionality reduction processing on the output results of the Sentence-BERT model through a multi-dimensional perceptron to obtain the Mashup text representations and Web API text representations.

[0015] Optionally, the Web service interaction network model includes: a Mashup-API interaction network sub-model, a Mashup-Tag interaction network sub-model, and an API-Tag interaction network sub-model;

[0016] The Mashup-API interaction network sub-model includes: a Mashup-API network and a LightGCN model;

[0017] The Mashup-Tag interaction network sub-model includes: a Mashup-Tag network and a LightGCN model;

[0018] The API-Tag interaction network sub-model includes: an API-Tag network and a LightGCN model;

[0019] Among them, the LightGCN model is used to perform graph convolution processing on the Mashup-API network, Mashup-Tag network, and API-Tag network respectively to obtain structural representation vectors.

[0020] Optionally, inputting the programmable Web dataset into the Web service interaction network model to obtain the Mashup structure representation and the WebAPI structure representation includes:

[0021] Inputting the programmable Web dataset into the Mashup-API interaction network sub-model to obtain the first Mashup embedding vector and the first WebAPI embedding vector;

[0022] Inputting the programmable Web dataset into the Mashup-Tag interaction network sub-model to obtain the first Tag embedding vector and the second Mashup embedding vector;

[0023] Inputting the programmable Web dataset into the API-Tag interaction network sub-model to obtain the second Tag embedding vector and the second WebAPI embedding vector;

[0024] Dividing the corresponding embedding vectors and assigning different weights for local contrast learning to obtain the Mashup structure representation and the WebAPI structure representation.

[0025] Optionally, performing local contrast learning includes:

[0026] Using the first local contrast loss function to perform local contrast learning on the first Mashup embedding vector and the second Mashup embedding vector to obtain the Mashup structure representation;

[0027] Using the second local contrast loss function to perform local contrast learning on the first WebAPI embedding vector and the second WebAPI embedding vector to obtain the WebAPI structure representation;

[0028] Using the third local contrast loss function to perform local contrast learning on the Mashup Tag embedding vector and the Web API Tag embedding vector, aiming to promote the learning of service features during the interaction network convolution process.

[0029] Optionally, the first local contrast loss function is:

[0030]

[0031] The second local contrast loss function is:

[0032]

[0033] The second partial contrast loss function is as follows:

[0034]

[0035] Among them, represents the local contrast learning loss value corresponding to the Mashup, represents the local contrast learning loss value corresponding to the API, represents the local contrast learning loss value corresponding to the Tag, represents the Mashup collection, m i represents the i-th Mashup, represents the Web API collection, a i represents the i-th API, represents the Tag collection, t i represents the i-th tag, represents the structural feature vector corresponding to the i-th Mashup in the G MA view, represents the structural feature vector corresponding to the i-th Mashup in the G MT view, represents the structural feature vector corresponding to the i-th Web API in the G MA view, represents the structural feature vector corresponding to the i-th Web API in the G AT view, represents the structural feature vector corresponding to the i-th tag in the G MT view, represents the structural feature vector corresponding to the i-th tag in the G AT view, s(·,·) is used to calculate the similarity between two vectors, τ1 is the temperature parameter, and α is the hyperparameter that controls the attention weight of the model to different samples. is the same Web API collection, is the WebAPI collection of different categories.

[0036] Optionally, perform global contrast learning on the corresponding text representation and structural representation respectively to obtain the corresponding global feature information, including:

[0037] Perform global contrast learning on the Mashup text representation and the Mashup structural representation using the first global contrast loss function to obtain the Mashup global feature information;

[0038] Perform global contrast learning on the WebAPI text representation and the WebAPI structural representation using the second global contrast loss function to obtain the WebAPI global feature information.

[0039] Optionally, the first global contrast loss function is:

[0040]

[0041] The second global contrast loss function is:

[0042]

[0043] Wherein, represents the global contrast learning loss value corresponding to the Mashup, represents the global contrast learning loss value corresponding to the Web API, represents the text representation vector corresponding to the i-th Mashup, represents the text representation vector corresponding to the i-th API, represents the structural representation vector corresponding to the i-th Mashup, is the structural representation vector corresponding to the i-th API, s(·,·) is used to calculate the similarity between two vectors, τ2 is the temperature coefficient in the contrast learning function, α is a hyperparameter for controlling the attention weight of the model to different samples, is the same Web API set, is the Web API set of different categories.

[0044] Compared with the prior art, the present invention has the following technical solutions and technical effects:

[0045] The present invention simultaneously considers the feature information of Web services under multiple views. First, the service text description is preprocessed, and the Sentence-BERT model is used to extract the text representation. Then, the Web interaction network is decomposed into three subgraphs, and the LightGCN model is used to extract the structural representation. On this basis, the text representation and the structural representation are semantically aligned through a multi-layer neural network. In the convolution process of the three subviews, local contrast learning is added to extract the fine-grained features of Web services. At the same time, according to the data popularity distribution, Web APIs are divided into head APIs and long-tail APIs, and different weights are assigned to optimize the learning effect of the model. Finally, through global contrast learning, the text semantic representation and the structural semantic representation are associated to complement each other's semantic information, thereby improving the accuracy of both. Finally, the text representation and the structural representation are weighted to obtain the final representation of the service.

[0046] The technical effects of the present invention are mainly reflected in the following aspects:

[0047] 1. Comprehensive and accurate feature extraction: Integrate text and structural information, extract features from multiple views, and avoid the limitations of a single view. Use the Sentence-BERT and LightGCN models to extract text representations and structural representations respectively, accurately depict the features of Web services, and provide rich feature information for subsequent model learning.

[0048] 2. Enhanced fine-grained feature extraction: Add local contrast learning to sub-view convolution to strengthen the model's attention to local details, extract more discriminative fine-grained features, and help improve the accuracy and efficiency of Web service tasks.

[0049] 3. Optimization of model learning effect: According to the popularity distribution of Web API data, divide the APIs into head and long-tail APIs and assign different weights to balance the contributions of different categories of data, optimize the model learning effect, and enhance the generalization ability and adaptability.

[0050] 4. Enhancement of semantic association and accuracy: Associate text and structural semantic representations through global contrast learning to achieve semantic complementarity, improve the accuracy and richness of semantic representations, understand the semantic connotations of Web services more comprehensively, and provide more accurate matching and recommendation results.

[0051] 5. Enhancement of the effectiveness of the final representation: Weightedly fuse the optimized text and structural representations to obtain a more representative and discriminative final service representation, significantly improving the performance and effect of Web service classification, retrieval, recommendation and other tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The accompanying drawings, which form a part of this application, are used to provide a further understanding of this application. The schematic embodiments and descriptions thereof of this application are used to explain this application and do not constitute an improper limitation of this application. In the drawings:

[0053] Figure 1 is a flowchart of a Web service representation method based on multi-view multi-level contrast learning according to an embodiment of the present invention;

[0054] Figure 2 is a schematic diagram of the architecture of the Sentence-BERT model according to an embodiment of the present invention;

[0055] Figure 3 is a framework diagram of the LightGCN according to an embodiment of the present invention;

[0056] Figure 4 is a schematic diagram of contrast learning according to an embodiment of the present invention;

[0057] Figure 5 is a comparative experimental diagram of a service recommendation task according to an embodiment of the present invention;

[0058] Figure 6Experimental comparison graph of service classification tasks in the Mashup dataset of the embodiments of the present invention;

[0059] Figure 7 Experimental comparison graph of service classification tasks in the WebAPI dataset of the embodiments of the present invention;

[0060] Figure 8 Influence curve graph of hyperparameters in the model of the embodiments of the present invention. Detailed implementation manners

[0061] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0062] It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0063] Regarding the problem of how to combine the text view and structure view features of Web services to complete service representation, in order to improve the service representation performance of existing methods, in this embodiment, the Sentence-BERT is first used to obtain the representation vectors of service description documents, and the LightGCN model is used to perform graph convolution on the Mashup-API, Mashup-Tag, and API-Tag interaction graphs respectively to obtain the structure representations of Web services in different views, and local contrast learning is added during the convolution process, and the popularity distribution problem of Web services is also considered. Then, global contrast learning is further performed on the text and structure representations, and finally, the representations in these two different semantics are weighted to obtain the final representation of the Web service.

[0064] As Figure 1 shown, this embodiment proposes a Web service representation method based on multi-view and multi-level contrast learning, which specifically includes the following steps:

[0065] Obtain a programmable Web dataset;

[0066] Based on the programmable Web dataset, obtain Mashup text descriptions and WebAPI text descriptions;

[0067] Input the Mashup text descriptions and Web API text descriptions into the Sentence-BERT model to obtain Mashup text representations and WebAPI text representations;

[0068] Input the programmable Web dataset into the Web service interaction network model to obtain the Mashup structure representation and the WebAPI structure representation;

[0069] Perform global contrastive learning on the corresponding text representation and structure representation respectively to obtain the corresponding global feature information;

[0070] Sum up the corresponding global feature information to obtain the Web representation vector.

[0071] Specifically, this embodiment aims to improve the representation effect of Web services by fusing text semantics and structure semantics. First, use the Sentence-BERT model to extract the text semantic representations of Mashup and Web API, and at the same time use the LightGCN model to extract their structure semantic representations. Perform dimensionality reduction on the text representation output by the Sentence-BERT model to ensure that its embedding dimension is consistent with the structure semantic embedding dimension output by the LightGCN model. On this basis, through local contrastive learning, the model can capture the fine-grained feature information of Web services; further through global contrastive learning, align the text representation and the structure representation semantically to achieve the complementarity of semantic information, thereby improving the accuracy of text semantic representation and structure semantic representation. This embodiment applies the representation results to service recommendation and service classification tasks, and uses the real data of the ProgrammableWeb platform for experimental verification. The experimental results show that compared with the baseline method, the multi-view multi-level contrastive learning method proposed in this embodiment shows better performance in various evaluation indicators, proving the effectiveness of this method.

[0072] More specifically, the framework of the Web service representation method of multi-view multi-level contrastive learning proposed in this embodiment is as Figure 1 shown, which is mainly divided into four steps:

[0073] First, this embodiment is mainly divided into four steps: based on the text descriptions of Mashup and Web API, use the Sentence-BERT model to obtain the text representation of Mashup and the text representation of WebAPI respectively;

[0074] Secondly, divide the Web service interaction network structure into three sub-views: Mashup-API, Mashup-Tag, and API-Tag. Use the LightGCN model to perform convolution on these three sub-views respectively to obtain the corresponding representation vectors, and sum up the representations under the three views to obtain the structure representations of Mashup and WebAPI;

[0075] Then, use local contrastive learning to extract the fine-grained feature information of Web services, and assign different contrastive learning weights according to the characteristics of the popularity distribution of Web API;

[0076] Finally, global contrastive learning is performed on the semantic and structural representations of Mashup and Web API, and the text representation and structural representation of the Web service are weighted to obtain the final representation vector.

[0077] The Web service is represented by the above method based on multi-view and multi-level contrastive learning.

[0078] The data preprocessing, model construction and joint training of this embodiment will be described in detail below:

[0079] Data preprocessing:

[0080] The crawled Mashup and Web API text information is processed to make it suitable for model input. Specifically, natural language preprocessing methods are used to preprocess the function description documents of Mashup and Web API, including normalization, stemming, tokenization and stop word removal. The interaction network of the Web service is deconstructed to generate three sub-views: Mashup-API, Mashup-Tag, and API-Tag. The preprocessing process includes the following steps:

[0081] 1. Extract the Mashup name column, the called WebAPI column, the Mashup text description column, the Mashup Tag column, the WebAPI name column, the WebAPI text description column, and the WebAPI Tag column of the ProgrammableWeb dataset;

[0082] 2. Delete the Mashups that use externally imported Web APIs;

[0083] 3. Delete the Web APIs that have not been called;

[0084] 4. Number them, and construct three sub-views: Mashup-API, Mashup-Tag, and API-Tag according to the interaction records of Mashup, Web API, and Tag.

[0085] Model construction and joint training:

[0086] The overall process of the M2CL4SRL method consists of four main parts:

[0087] (1) Obtaining the text representations of Mashup and Web API: Use the Sentence-BERT model to obtain the text representations of Mashup and WebAPI respectively;

[0088] (2) Input the Mashup-API, Mashup-Tag, and API-Tag interaction network into the LightGCN model to obtain the structural representation of the Mashup and the structural representation of the Web API;

[0089] (3) Use local contrast learning to align the structural representations from LightGCN and assign different learning weights according to the popularity distribution attributes of the Web API to learn the fine-grained features of the Web service;

[0090] (4) Use global contrast learning to align the semantic and structural representation information of the Mashup and the Web API, and weight the text representation and the structural representation of the Web service to obtain the final representation vector.

[0091] Furthermore, obtaining the Mashup text representation and the WebAPI text representation includes:

[0092] Perform dimensionality reduction on the output result of the Sentence-BERT model through a multi-dimensional perceptron to obtain the Mashup text representation and the WebAPI text representation.

[0093] Specifically, the text encoder of the service representation:

[0094] The content-based service representation extracts features from the description texts of Mashups and Web APIs. To achieve this goal, this embodiment uses the Sentence-BERT model as the text encoder to complete the feature extraction task in the text description. This model is based on a siamese network and uses the BERT framework to generate sentence embedding vectors. Compared with the standard BERT, Sentence-BERT significantly improves the inference speed while maintaining excellent performance, making it one of the leading methods for sentence encoding in natural language processing. Therefore, Sentence-BERT is used to encode the service description text. Specifically, the all-mpnet-base-v2 version of Sentence-BERT is used in this embodiment. This version is based on the pre-trained model of microsoft / mpnet-base and is fine-tuned on a dataset containing 1 billion sentences to optimize the performance. Figure 2 Shows the overall framework of Sentence-BERT. The model first uses BERT to generate sentence embedding vectors, and then applies a pooling strategy to extract sentence representations from the context-rich word embedding vectors. The pooling methods include three strategies: using the output of the [CLS] token (CLS pooling), calculating the mean of all output vectors (MEAN pooling), and calculating the maximum of the output vectors (MAX pooling). The default strategy is MEAN pooling, which calculates the average of all vectors.

[0095] Before text representation, general preprocessing techniques are applied to the functional description documents, such as normalization, stemming, tokenization, and stop word removal. These operations are crucial for improving the performance of subsequent models. The preprocessed functional description documents of Mashup and Web API are then input into the Sentence-BERT model to generate initial text embedding vectors. Next, a multi-layer perceptron (MLP) model is used to further transform the text representation to ensure that the text embedding dimension is consistent with the embedding dimension of the structural representation. The MLP model consists of three layers: an input layer, a hidden layer, and an output layer, as defined in Equation (1). The following is the specific formula for the multi-layer perceptron:

[0096] f(x) = σ2(W2(σ1(W1x + b1) + b2)) #(1)

[0097] where W, b, and σ represent weight, bias, and activation function respectively. Through the multi-layer perceptron (MLP), the text embedding vectors of Mashupm and Web APIa are respectively represented as and The embedding dimension of the text representation obtained from Sentence-BERT is 384. To ensure the operation of the model, the dimension of the text embedding vector must be consistent with the embedding vector dimension of the graph structure. Therefore, in this embodiment, an MLP is designed to adjust the dimension of the text embedding vector.

[0098] Furthermore, the web service interaction network model includes: a Mashup-API interaction network sub-model, a Mashup-Tag interaction network sub-model, and an API-Tag interaction network sub-model;

[0099] The Mashup-API interaction network sub-model includes: a Mashup-API network and a LightGCN model;

[0100] The Mashup-Tag interaction network sub-model includes: a Mashup-Tag network and a LightGCN model;

[0101] The API-Tag interaction network sub-model includes: an API-Tag network and a LightGCN model;

[0102] where the LightGCN model is used to perform graph convolution processing on the Mashup-API network, Mashup-Tag network, and API-Tag network respectively to obtain structural representation vectors.

[0103] Specifically, the structural encoder of the service representation:

[0104] The Web service network is regarded as a heterogeneous graph composed of Mashups, Web APIs, and Tags, denoted as G = (G MA , G MT , G AT ). The Mashup-API network is represented as G MA = {V m , V a , E ma}, where: is the set of Mashups; is the set of Web APIs; E ma represents the call relationship between Mashups and Web APIs, that is, if Mashup m i interacts with Web API a i , then E ma (i, j) = 1, otherwise E ma (i, j) = 0. G MT = {V m , V t , E mt} represents the Mashup-Tag network, where: V m is the set of Mashups; V t is the set of Tags; E mt represents the tagging relationship between Mashups and Tags. G AT = {V a , V t , E at} represents the API-Tag network, where: V a is the set of WebAPIs; V t is the set of Tags; E at represents the tagging relationship between WebAPIs and Tags.

[0105] To capture the interaction preferences and feature information of Mashups and Web APIs, this embodiment deconstructs the Web service network into subgraphs G MA , G MT and G AT , and applies convolutional operations. Based on its lightweight and efficient characteristics, LightGCN is selected as the graph encoder to extract the structural information of the Web service, and its framework is as Figure 3 shown.

[0106] 2.1 Embedding layer:

[0107] In the embedding layer, first, node initialization is performed based on the adjacency matrix of the graph. In G MA , the embedding representation of each Mashup (WebAPI) node is The structure embedding of Mashup and Web API in G MA is defined by formulas (2) and (3).

[0108]

[0109] 2.2 Embedding Propagation Layer:

[0110] The propagation layer updates the features of the current node by aggregating the information of its neighbor nodes. Specifically, by introducing to control the importance of each neighbor node's feature, where and represent the neighbor nodes of Mashupm and Web APIa respectively, as defined in formulas (4) and (5). Here, represent the k-th layer embeddings of Mashup nodes and Web API nodes in G MA respectively. Using matrix operations, the propagation process of all nodes can be efficiently processed. Different from the traditional Graph Convolutional Network (GCN), LightGCN abandons feature transformation and non-linear activation, and this method has been proven to maintain the model performance while significantly reducing the time complexity.

[0111]

[0112] 2.3 Weighted Combination Layer:

[0113] After passing through k layers of GCN, in order to obtain the final representation of each node, a weighted sum of the embeddings of all k layers is performed, where the weight of the k-th layer is set as defined as formulas (6 - 7).

[0114]

[0115] Finally, the embedding vectors of Mashup and API in the subgraph can be represented as Similarly, for the subgraph G MT , G AT , the same operation as above is also performed. Finally, in the subgraph G MT , Mashup and Mashup Tag can be represented by respectively. In the subgraph G AT , API and API Tag can be represented by respectively.

[0116] Let and represent the paired training datasets defined as follows:

[0117] where Including the observed Mashup and WebAPI interactions, Including the unobserved Mashup and WebAPI interactions.

[0118] Among them Including the observed Mashup and Tag interactions, Including the unobserved Mashup and Tag interactions.

[0119] Among them Including the observed Web API and Tag interactions, Including the unobserved WebAPI and Tag interactions.

[0120] In G MA 、G MT and G AT During the graph convolution process, the loss function adopts BPR (Bayesian Personalized Ranking), as shown in formulas (8), (9) and (10).

[0121]

[0122] Among them, The goal of the BPR loss function is to minimize the logarithmic probability of valid triples, ensuring that the score of the positive sample is higher than that of the negative sample. By weighted fusion of the representations, the final structural representations of Mashup and Web API are expressed as As defined in formulas (11) and (12).

[0123]

[0124] Here ω m and ω a are hyperparameters, ω m controls the weight between views G MA and G MT controls the weight between views G a and G MA and G AT In the experimental examples, both of these hyperparameters are set to 0.5, aiming to retain the feature information within different views, thereby improving the model's comprehensive understanding ability of different view features.

[0125] Furthermore, inputting the programmable Web dataset into the Web service interaction network model, obtaining the Mashup structure representation and the WebAPI structure representation includes:

[0126] Input the programmable Web dataset into the Mashup-API interaction network sub-model to obtain the first Mashup embedding vector and the first WebAPI embedding vector;

[0127] Input the programmable Web dataset into the Mashup-Tag interaction network sub-model to obtain the first Tag embedding vector and the second Mashup embedding vector;

[0128] Input the programmable Web dataset into the API-Tag interaction network sub-model to obtain the second Tag embedding vector and the second WebAPI embedding vector;

[0129] Partition the corresponding embedding vectors and assign different weights for local contrast learning to obtain the Mashup structure representation and the WebAPI structure representation.

[0130] Further, the local contrast learning includes:

[0131] Use the first local contrast loss function to perform local contrast learning on the first Mashup embedding vector and the second Mashup embedding vector to obtain the Mashup structure representation;

[0132] Use the second local contrast loss function to perform local contrast learning on the first WebAPI embedding vector and the second WebAPI embedding vector to obtain the WebAPI structure representation;

[0133] Use the third local contrast loss function to perform local contrast learning on the Mashup Tag embedding vector and the Web API Tag embedding vector, aiming to promote the learning of service features during the interaction network convolution process.

[0134] Further, perform global contrast learning on the corresponding text representation and structure representation respectively to obtain the corresponding global feature information, including:

[0135] Use the first global contrast loss function to perform global contrast learning on the Mashup text representation and the Mashup structure representation to obtain the Mashup global feature information;

[0136] Use the second global contrast loss function to perform global contrast learning on the WebAPI text representation and the WebAPI structure representation to obtain the WebAPI global feature information.

[0137] Specifically, the contrast learning of service representation:

[0138] Contrast learning is a self-supervised learning method that learns meaningful feature representations by comparing the similarities and differences between samples. For example Figure 4As shown, its core idea is to map "similar" samples to a close representation space while pushing "different" samples away, thereby capturing the true structure of the data. In this study, M2CL4SRL effectively integrates the text semantic features and relationship structure features of services by combining local contrast learning and global contrast learning. Local contrast learning alleviates the data sparsity problem through fine-grained feature extraction, while global contrast learning enhances the overall performance of the model representation. In addition, the model improves the learning ability of rare samples by introducing a popularity-based weight assignment mechanism, thereby alleviating the sub-optimal representation problem caused by uneven popularity distribution. Research shows that ignoring the popularity distribution problem will reduce the accuracy of the model's representation learning. Although contrast learning methods can improve the effect of representation learning, during the positive and negative sample contrast process, the popularity distribution may lead to unbalanced feature learning. For example, when negative samples are mainly composed of popular items, the feature learning of unpopular items will be restricted, thus exacerbating the feature gap between unpopular items and popular items. On the contrary, when negative samples are evenly distributed, the optimization of popular items may further widen the feature gap between popular items and unpopular items, resulting in insufficient feature learning of minority samples. This imbalance will directly affect the overall performance of the model. Therefore, it is necessary to adjust the weights of contrast learning according to the popularity of samples to promote balanced learning of different sample types.

[0139] To solve this problem, this embodiment proposes a weighted contrast module based on popularity distribution. According to the call frequency of Web APIs, they can be divided into and and different contrast weights are assigned to them to enable the model to perform more fine-grained feature learning. Specifically, given a set of Web APIs they are divided into two types according to their interaction frequencies: head APIs and tail APIs. Web APIs are defined as the top 30% of the call frequencies as popular items. The popularity category of each WebAPI is represented by c i where c i = H represents the head Web API, and c i = L represents the tail Web API. Among them The division strategy is shown in formulas (13) and (14).

[0140]

[0141] In local contrast learning, by utilizing the feature information in the three subgraphs, cross-view mutual supervision and cooperation are realized, so as to more effectively extract structural information. In addition, contrast learning is also carried out on the same labels in Mashup and WebAPI to capture potential functional information, thereby improving the quality of Web service representation. The local contrast learning process is shown in formulas (15 - 17).

[0142]

[0143] Among them, the cosine similarity is used to evaluate vector similarity, denoted as s(·). The hyperparameter τ affects the model's ability to distinguish positive and negative samples, and α controls the attention weights of the model for different samples. The impact of their settings on the model performance will be explored in subsequent experiments.

[0144] Global contrast learning emphasizes learning the feature information of Web services from a global perspective, aiming to integrate text semantic and structural features to enrich the representation information. Global contrast learning is defined as formulas (18 - 19)

[0145]

[0146] Through local and global contrast learning, Mashup and WebAPI can finally be represented as As defined in formulas (20 - 21).

[0147]

[0148] More specifically, the representation optimization of multi - task learning:

[0149] By aggregating the objective functions of each module, the final objective function of the model is defined as formula (22). Among them, L adopts a multi - task joint training strategy, aiming to balance the relationships between the tasks of each module. At the same time, a regularization term is introduced to avoid model overfitting and maintain reasonable parameter adjustment during training, thereby enhancing the robustness and generalization ability of the model.

[0150]

[0151] Among them, λ1 and λ2 control the weights of the local and global contrast learning losses respectively. If the model focuses too much on local contrast, it may ignore global information. On the contrary, over - emphasizing global contrast may lead to insufficient capture of local details. Therefore, by appropriately setting these two parameters, the model can achieve a balance between learning local and global features, thereby improving the representation performance of the model.

[0152] The following elaborates on this embodiment in detail in combination with experiments and drawings:

[0153] The experimental example outlines the experimental settings, including the dataset, evaluation metrics, and baseline methods. Then, the performance of the model in Web service recommendation and Web service classification tasks is shown. Finally, ablation studies and hyperparameter analysis are discussed.

[0154] Dataset and experimental settings:

[0155] The dataset used in the experiment was collected from the ProgrammableWeb website in February 2022, containing 6,454 Mashups and 22,576 Web APIs. To ensure the quality of the training data, during the data preprocessing stage, Mashups and Web APIs lacking descriptive text or call records were removed. Therefore, 5,750 Mashups and 1,188 Web APIs were included in the service recommendation task; and the effective Mashups and Web APIs were filtered by screening out the top 30 tags with the highest frequencies. Finally, the classification dataset contains 4,089 Mashups and 847 Web APIs, as shown in Table 1.

[0156] Table 1 Experimental Dataset

[0157]

[0158] Evaluation Metrics:

[0159] Evaluation Metrics for Service Recommendation Task: Precision, Recall, F1-Score, NDCG.

[0160] Evaluation Metrics for Service Classification Task: Top-k Accuracy, Precision, Recall, F1-Score.

[0161] (1) Precision refers to the ratio of the number of truly hit Web APIs in the recommended Web API list to the total number of recommended Web APIs, as shown in Equation (23). Among them, TopKAPIs represents the actual list of Web APIs with call relationships, and RealAPIs represents the recommended list of Web APIs.

[0162]

[0163] (2) Recall is used to evaluate the ability of the model to hit real Web APIs, and is measured by calculating the ratio of the number of truly hit Web APIs to the total number of actual Web APIs, as shown in Equation (24).

[0164]

[0165] (3) F1-score is the harmonic mean of Precision and Recall, as shown in Equation (25). The F1-score is a comprehensive statistical metric.

[0166]

[0167] (4) NDCG (Normalized Discounted Cumulative Gain) is a metric used to evaluate the ranking quality of a recommendation system. NDCG measures the quality of a recommendation by comparing the actual recommendation list with the ideal one. The specific calculation formula is shown in Formula (28). NDCG is calculated by dividing DCG by IDCG, where DCG and IDCG are defined in Formulas (26) and (27), respectively.

[0168]

[0169] Top-K Accuracy is a commonly used evaluation metric in classification tasks. Top-K Accuracy evaluates the proportion of instances with true labels among the top K predicted labels generated by the model, as shown in formula (29).

[0170]

[0171] Where N is the total number of samples, is an indicator function, when the true label y i The first K predicted labels generated by the model If the result is correct, it returns 1; otherwise, it returns 0. Similar to the previous definition, in web service recommendation and classification tasks, precision, recall, and F1-Score all play similar roles.

[0172] Comparison method:

[0173] This example verifies the effectiveness of the proposed representation method in service recommendation and classification tasks by comparing it with existing baseline methods. Specifically, for the recommendation task, we selected content-based recommendation methods (NAFM, SANFM), graph-based recommendation methods (RWR, LightGCN, BPRMF), and hybrid recommendation methods (FSFM, SRCLML).

[0174] NAFM: Neural Attention Factorization Machine (NAFM) uses deep neural networks to model nonlinear interactions between features and introduces an attention mechanism to evaluate the relative importance of these interactions.

[0175] SANFM: SANFM is a factorization machine model that introduces a self-attention mechanism to model feature weights in Web API recommendations, thereby capturing interactive features.

[0176] RWR: The RWR method uses knowledge graphs to model the interaction relationship between services and completes the representation by traversing the graph through restarted random walks.

[0177] LightGCN: LightGCN is a simplified version of GCN. It removes the non - linear activation and feature transformation in the forward propagation process, thus reducing the computational complexity of graph convolution.

[0178] BPRMF: BPRMF is a Bayesian matrix factorization model widely used in collaborative filtering tasks in recommendation systems. It decomposes the user - item interaction matrix into low - dimensional feature matrices to capture user preferences and item features.

[0179] FSFM: FSFM is a hybrid model that combines text semantic information and graph structure information, effectively fusing output vectors to complete service recommendation tasks.

[0180] SRCLML: SRCLML simultaneously uses Transformer and LightGCN to extract text and structural features, and evaluates the model performance through service recommendation tasks.

[0181] In the classification task, this embodiment selects classification methods based on LSTM (LSTM, Bi - LSTM, CLSTM), classification methods based on CNN (CNN, RCNN), and some other deep - learning - based classification methods (ANFM4WSC, Serve - Net).

[0182] LSTM: LSTM is a special variant of recurrent neural networks, which is very suitable for processing time - series or text data. It can effectively solve the problems of gradient vanishing and explosion in traditional RNNs, and controls the propagation of information through a gating mechanism, thus better capturing dependencies.

[0183] Bi - LSTM: Bi - LSTM is an extension of LSTM. It processes sequence data in two directions, can capture context information and dependencies in both forward and backward directions simultaneously, and thus can more comprehensively understand the structure and semantics of sequence data.

[0184] CLSTM: The CLSTM model combines a convolutional layer with LSTM units. It uses the convolutional layer for local feature extraction while retaining the ability of LSTM to process sequence information, thus achieving a balance between feature extraction and sequence modeling.

[0185] CNN: CNN processes service embeddings through convolutional operations to extract local features, thus providing effective representations for service classification tasks. The convolutional layer can automatically learn local feature patterns in data and is suitable for processing data with local correlations.

[0186] RCNN: RCNN combines convolutional layers and recurrent layers to effectively extract local features from service embeddings while considering the extraction of global features. It captures the long-term dependencies of sequential data through recurrent layers, while convolutional layers are responsible for extracting local features, thus achieving a more comprehensive representation.

[0187] ANFM4WSC: This method integrates the content and structural semantic information of services and uses an attention mechanism to deeply fuse features. It can automatically focus on features that are more important for the classification task, thus achieving effective service classification.

[0188] Serve-Net: Serve-Net is a new type of deep neural network that abandons traditional feature engineering and length limitations. This network can automatically abstract the low-level representations of service names and descriptions into high-level combined features, thus better capturing the semantic information of services and providing a more effective representation for the classification task.

[0189] Performance Evaluation:

[0190] Table 2 lists the default parameter settings of this model. Subsequent experiments will analyze the impact of the main hyperparameters on the model performance. In the Web service recommendation and classification tasks, this part verifies the performance differences between M2CL4SRL and baseline methods through comparative experiments. In the recommendation task, since the average number of interactions between Mashups and Web APIs in the dataset is 1.84, the Top-K range for recommending Web APIs is set to {2, 4, 6}. In the classification task, the Top-K accuracy is evaluated at K = 1 and K = 5 respectively. Among them, the accuracy at K = 1 directly reflects the recommendation quality, while the accuracy at K = 5 reflects the ability of the model to recommend relevant services among multiple candidate services. The default hyperparameter values of M2CL4SRL are shown in Table 2.

[0191] Table 2 Model Default Parameters

[0192]

[0193] (1) Comparison with service recommendation baseline methods. In the Web service recommendation task, this embodiment uses the dot product calculation method to measure the similarity between Mashup and WebAPI embeddings obtained based on the proposed service representation method. Table 3 shows the Precision, Recall, F1-Score, and Normalized Discounted Cumulative Gain (NDCG) metrics of various methods in the Web service recommendation task. The results show that as the value of K increases, the Recall of all methods increases, while the Precision shows a negative correlation. This is because as the value of K increases, the hit rate improves, but at the same time, more noise is introduced. The F1-Score is the weighted average of Recall and Precision.

[0194] Among all methods, NAFM, RWR, and BPRMF perform relatively poorly. Although NAFM uses a neural factorization machine to extract features from service texts, a large amount of noise in the text description has a negative impact on its performance. RWR extracts features from the knowledge graph through the random walk algorithm, but due to the sparsity of service call records, feature extraction is limited, resulting in poor recommendation performance. As a matrix factorization-based method, BPRMF performs poorly when dealing with large-scale data and complex relationships and is difficult to capture high-order and implicit relationships between services. In contrast, SANFM introduces a self-attention neural network layer, effectively reducing the impact of noise information in the text description, thus improving performance. LightGCN improves on the traditional GCN, learning better user and item representations and being able to more effectively capture complex relationships between services. FSFM integrates text and structural information and uses convolutional layers for recommendation, performing well. SRCLML combines multi-task learning and contrastive learning, fusing service text and structural views, and achieving better performance. However, M2CL4SRL shows significant advantages. It introduces a multi-level contrastive learning mechanism and more comprehensively considers the impact of different interaction frequencies on service representation, thus more effectively integrating text and structural information and improving model performance. Under the condition of K = 4, M2CL4SRL outperforms the baseline method SRCLML, with its Precision, Recall, F1-Score, and NDCG metrics increasing by 13.4%, 6.9%, 11.9%, and 5.3% respectively.

[0195] Table 3 Web service recommendation performance

[0196]

[0197]

[0198] (2) Comparison with the service classification baseline method. In the classification task, this embodiment uses the Mashup and WebAPI embeddings obtained by the proposed service representation method as inputs, and adopts a multi-layer perceptron (MLP) classifier to complete the service classification task. Tables 4 and 5 respectively show the classification performances of various methods on the Mashup dataset and the Web API dataset. It is observed that the classification method performs better on the Mashup dataset than on the Web API dataset. This may be because the Mashup dataset is larger in scale, and the model can obtain more training samples, thus obtaining better generalization ability.

[0199] Table 4 Service Classification Performance on Mashup Dataset

[0200]

[0201] Table 5 Service Classification Performance on WebAPI Dataset

[0202]

[0203]

[0204] Among all the methods, CNN performs the worst because it can only extract local features of the service and cannot capture global features. In contrast, the performance of RCNN has been significantly improved after introducing the sequence model. Similarly, Bi-LSTM and CLSTM have also made great improvements compared with LSTM. Serve-Net performs well in terms of Top-1 Acc and precision in the Web API classification task by integrating service descriptions and names into high-order features and using a neural network for further feature extraction. ANFM4WSC simultaneously considers the text description and structural information of the service and classifies the service through ANFM, performing relatively well among the baseline methods. M2CL4SRL introduces a multi-level contrast learning mechanism and more deeply considers the influence of different interaction frequencies on service representation, thus more effectively integrating text and structural information. On the Mashup dataset, compared with the baseline method, M2CL4SRL has increased by 18.6% in Top-1 Acc, 3.9% in Top-5 Acc, 2.7% in precision, 2.2% in recall, and 29.3% in F1 score. On the Web API dataset, M2CL4SRL is better than the baseline method, with a 0.7% increase in Top-5 Acc, a 31.7% increase in recall, and a 21.1% increase in F1 score.

[0205] On the Mashup dataset, compared with the baseline method, M2CL4SRL improved by 18.6% in Top-1 Acc, 3.9% in Top-5 Acc, 2.7% in precision, 2.2% in recall, and 29.3% in F1 score. On the Web API dataset, M2CL4SRL outperformed the baseline method, with a 0.7% improvement in Top-5 Acc, 31.7% in recall, and 21.1% in F1 score.

[0206] Ablation experiments:

[0207] To evaluate the contributions of the various modular parts of the proposed model, the present invention conducted ablation experiments. The M2CL4SRL model mainly includes a text view, a structure view, contrast learning, local contrast learning, global contrast learning, and an improved contrast learning loss. Therefore, there are a total of six variants, as follows:

[0208] w / o Text removed the text encoding module and the global contrast learning module. The service representation only depends on the features extracted from the service interaction network view.

[0209] w / o Graph removed the structure encoding module and the global and local contrast learning modules. The service representation is completely based on the text view features of the service.

[0210] w / o CL removed all contrast learning modules and only used the text description encoding module and the structure relationship encoding module to represent web services.

[0211] w / o Local removed the local contrast module in multi-level contrast learning and retained global contrast learning.

[0212] w / o Global removed the global contrast module in multi-level contrast learning and retained local contrast learning.

[0213] w / o CLpro removed the popularity-based contrast learning and switched to a traditional contrast learning function.

[0214] Among these variants, this embodiment analyzed in detail the impact of each component to evaluate its contribution to the overall model performance. Through these ablation experiments, the role and importance of each part can be deeply understood. Figure 5Shows the ablation study results for the Web service recommendation task. From the results, it can be seen that the "w / o Graph" variant always performs the worst, indicating that the service structure encoding module has a significant impact on the overall recommendation performance. Specifically, the "w / o CL" variant performs worse than the "w / o Text" variant, indicating that contrastive learning plays a key role in promoting the fusion of service text and structural views. In addition, the performance of "w / o Global" is better than that of "w / o Local", indicating that fine-grained feature learning may be more important in service representation. Finally, M2CL4SRL achieves the best performance, verifying the effectiveness of multi-level contrastive learning and the improved contrastive learning loss function.

[0215] This embodiment also conducts ablation experiments on the Mashup and WebAPI datasets for the classification task, and the results are as follows Figure 6 and Figure 7 shown. In the service classification task, the observed conclusions are similar to those of the Web service recommendation task. In particular, in the recommendation task, the "w / o Graph" variant performs the worst, while in the classification task, the "w / o Text" variant performs the worst. This result indicates that the service relationship structure is more critical for the service recommendation task, while the encoding of text descriptions is more important for the service classification task.

[0216] Hyperparameter analysis:

[0217] This embodiment analyzes the effects of various hyperparameters in M2CL4SRL, including the weights (λ1, λ2) of the local and global contrast loss functions, the local and global temperature coefficients (τ1, τ2), the weight factor (α) in the contrast loss function in the WebAPI representation, and the embedding dimension (d) of the service representation. The purpose is to study the effects of different hyperparameters. All experiments are conducted in the Web service recommendation task, and the Top-K is set to 4. Analysis of the effects of hyperparameters

[0218] (1) Effects of λ1 and λ2. λ1 controls the weight of the local contrast loss function. To study its impact on the model performance, experiments are conducted in the range of {0.001, 0.005, 0.01, 0.05, 0.1}, and the results are as follows Figure 8 (a) shown. It is observed that as λ1 increases, the model performance first rises and reaches a peak when λ1 is approximately 0.05. However, when λ1 continues to increase, the performance gradually decreases. Similarly, λ2 controls the weight of the global contrast loss function. To explore its impact on the model performance, experiments are conducted in the range of {0.001, 0.005, 0.01, 0.05, 0.1}, and the results are as follows Figure 8(as shown in (b). As λ2 increases, the model performance first rises and reaches a peak when λ2 is approximately 0.01. After that, as λ2 further increases, the model performance starts to decline. Based on these observations, it can be concluded that appropriate contrastive loss helps service representation, thus improving the performance of the recommendation task. However, too strong alignment may cause the model to overly focus on the contrastive loss, resulting in representation bias and reducing performance.)

[0219] (2) Effects of τ1 and τ2. τ1 and τ2 are hyperparameters in local and global contrastive learning respectively. The temperature parameter plays a key role in contrastive learning, enhancing the model's ability to recognize similarities by affecting the sample feature distribution. A lower temperature can reduce the distance between similar samples and increase the distance between dissimilar samples. However, extreme values may disrupt the uniformity of the distribution, thus negatively affecting the learning effect. Experiments explored different values of τ1 and τ2. τ1 was set to {0.001, 0.005, 0.1, 0.2, 0.5}. As Figure 8 (shown in (c), when τ1 = 0.2, the model performs best, and further increasing τ1 does not bring significant improvement. τ2 was set to {0.001, 0.005, 0.01, 0.05, 0.1}. As Figure 8 (shown in (d), when τ2 is approximately 0.05, the model performs best. Beyond this value, the performance decreases, indicating that a larger τ2 in global contrastive learning hinders the model's ability to distinguish positive and negative samples, thus affecting the overall representation effect.)

[0220] (3) Effect of α. α controls the contrastive learning weight between two types of paired samples ( and ). The setting of α is crucial for balancing the feature learning of paired samples. Experiments were conducted in the range of {0, 0.2, 0.4, 0.6, 0.8, 1}, and the results are as Figure 8 (shown in (e). It was observed that when α = 0.8, the model performs best. This indicates that when α = 0.8, the model achieves a balance in the WebAPI sample representations between and , highlighting the importance of ensuring that the model effectively captures the differences between different types of paired samples while learning the features of the same type of paired samples.)

[0221] (4) Effect of d. d is the dimension of service embedding in LightGCN, which determines the dimension of service feature mapping. The effects of different embedding dimensions were studied by setting d in the range of {16, 32, 64, 128, 256}, and the results are as Figure 8(f). When d = 128, the model achieves the best performance. As d increases, the model performance initially improves but then decreases. Therefore, a larger d value can better capture the complex interactions between neighboring nodes, but an overly large d value may introduce more noise and lead to overfitting.

[0222] This embodiment mainly deeply explores the problem of high-quality representation of Web services. At present, although the mainstream methods of Web service representation have their own advantages, they also have deficiencies. The methods that rely only on text information or structural information for service recommendation cannot fully capture the information available for recommendation, and it is difficult to effectively solve the problems of inconsistency in service text descriptions and sparsity of interaction data. Therefore, how to fuse multi-view feature information to complete high-quality representation is a difficult point that needs to be solved urgently. For this reason, this embodiment proposes a Web service representation method based on multi-view multi-level contrast learning (M2CL4SRL). The relevant work is summarized as follows:

[0223] M2CL4SRL aims to extract local fine-grained features and global features by integrating multi-view features and multi-level contrast learning to achieve more accurate representation. In addition, aiming at the problem of uneven epidemic distribution in service data, this embodiment designs a novel contrast learning strategy to assign learning weights to different types of Web APIs, so as to better capture their functional information. Extensive experiments show that the proposed method is superior to the baseline method in terms of performance. The ablation study further explores the contribution degree of each module in multi-view representation learning and multi-level contrast learning.

[0224] The above is only a preferred specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A Web service representation method based on multi-view multi-level contrastive learning, characterized in that Including: Obtain a programmable Web dataset; Based on the programmable Web dataset, obtain a Mashup text description and a WebAPI text description; Input the Mashup text description and the Web API text description into a Sentence-BERT model to obtain a Mashup text representation and a WebAPI text representation; Input the programmable Web dataset into a Web service interaction network model to obtain a Mashup structure representation and a WebAPI structure representation; Perform global contrastive learning on the corresponding text representations and structure representations respectively to obtain corresponding global feature information; Sum the corresponding global feature information to obtain a Web representation vector.

2. The Web service characterization method based on multi-view multi-level contrastive learning according to claim 1, wherein Obtaining the Mashup text representation and the WebAPI text representation includes: Perform dimensionality reduction processing on the output result of the Sentence-BERT model through a multi-dimensional perceptron to obtain the Mashup text representation and the WebAPI text representation.

3. A Web service representation method based on multi-view multi-level contrastive learning according to claim 1, characterized in that, The Web service interaction network model includes: a Mashup-API interaction network sub-model, a Mashup-Tag interaction network sub-model, and an API-Tag interaction network sub-model; The Mashup-API interaction network sub-model includes: a Mashup-API network and a LightGCN model; The Mashup-Tag interaction network sub-model includes: a Mashup-Tag network and a LightGCN model; The API-Tag interaction network sub-model includes: an API-Tag network and a LightGCN model; Among them, the LightGCN model is used to perform graph convolution processing on the Mashup-API network, the Mashup-Tag network, and the API-Tag network respectively to obtain structure representation vectors.

4. A Web service representation method based on multi-view multi-level contrastive learning according to claim 3, characterized in that Inputting the programmable Web dataset into the Web service interaction network model to obtain a Mashup structure representation and a WebAPI structure representation includes: Input the programmable Web dataset into the Mashup-API interaction network sub-model to obtain a first Mashup embedding vector and a first WebAPI embedding vector; Input the programmable Web dataset into the Mashup-Tag interaction network sub-model to obtain a Mashup Tag embedding vector and a second Mashup embedding vector; Input the programmable Web dataset into the API-Tag interaction network sub-model to obtain a WebAPI Tag embedding vector and a second WebAPI embedding vector; Divide the corresponding embedding vectors and assign different weights for local contrastive learning to obtain the Mashup structure representation and the WebAPI structure representation.

5. A Web service representation method based on multi-view multi-level contrastive learning according to claim 4, characterized in that, Performing local contrastive learning includes: Perform local contrastive learning on the first Mashup embedding vector and the second Mashup embedding vector using a first local contrastive loss function to obtain a Mashup structure representation; Perform local contrastive learning on the first WebAPI embedding vector and the second WebAPI embedding vector using the second local contrastive loss function to obtain the WebAPI structure representation; Perform local contrastive learning on the Mashup Tag embedding vector and the Web API Tag embedding vector using the third local contrastive loss function to promote the learning of service features during the interaction network convolution process.

6. A method for Web service representation based on multi-view multi-level contrastive learning according to claim 5, characterized in that, The first local contrastive loss function is: The second local contrastive loss function is: The third local contrastive loss function is: Among them, represents the local contrastive learning loss value corresponding to the Mashup, represents the local contrastive learning loss value corresponding to the API, represents the local contrastive learning loss value corresponding to the Tag, represents the Mashup collection, m i represents the i-th Mashup, represents the Web API collection, a i represents the i-th API, represents the Tag collection, t i represents the i-th tag, represents the structural feature vector corresponding to the i-th Mashup in G MA view, represents the structural feature vector corresponding to the i-th Mashup in G MT view, represents the structural feature vector corresponding to the i-th Web API in G MA view, represents the structural feature vector corresponding to the i-th Web API in G AT view, represents the structural feature vector corresponding to the i-th tag in G MT view, represents the structural feature vector corresponding to the i-th tag in G AT view, s(·,·) is used to calculate the similarity between two vectors, τ1 is the temperature parameter, and α is the hyperparameter that controls the attention weight of the model to different samples. is the same Web API collection, is the Web API collection of different categories.

7. A Web service representation method based on multi-view multi-level contrastive learning according to claim 6, characterized in that Perform global contrastive learning on the corresponding text representation and structure representation respectively to obtain the corresponding global feature information including: Perform global contrastive learning on the Mashup text representation and the Mashup structure representation using the first global contrastive loss function to obtain the Mashup global feature information; Perform global contrastive learning on the WebAPI text representation and the WebAPI structure representation using the second global contrastive loss function to obtain the WebAPI global feature information.

8. A Web service representation method based on multi-view multi-level contrastive learning according to claim 7, characterized in that, The first global contrastive loss function is: The second global contrastive loss function is: Among them, represents the global contrastive learning loss value corresponding to the Mashup, represents the global contrastive learning loss value corresponding to the Web API, represents the text representation vector corresponding to the i-th Mashup, represents the text representation vector corresponding to the i-th API, represents the structural representation vector corresponding to the i-th Mashup, is the structural representation vector corresponding to the i-th API, s(·,·) is used to calculate the similarity between two vectors, τ2 is the temperature coefficient in the contrastive learning function, and α is a hyperparameter that controls the attention weight of the model to different samples, is the same Web API collection, is a collection of Web APIs of different categories.

Citation Information

Patent Citations

  • Cloud native API (Application Program Interface) recommendation method integrating data enhancement and comparative learning

    CN117009674A

  • Web API recommendation method based on multi-task deep neural network

    CN119760231A

  • Cloud-native application programming interface (API) recommendation method fusing data augmentation and contrastive learning

    US20250013514A1