# US 2025/0156704 A1 · Secondary recommendation method based on service complementary relation learning model for restful service

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0156704 A1
- Document ID: US20250156704A1
- Status: Published application
- Kind: A1
- Application number: 18/635,011
- Filed: 2024-04-15
- Published: 2025-05-15
- Earliest claimed: 2023-11-13
- Assignees: China Jiliang University; Zhejiang Zhejiang Tourism Investment Digital Technology Co., Ltd; Zhejiang Tourism Investment Group Co., Ltd
- Applicants: China Jiliang University; Zhejiang Zhejiang Tourism Investment Digital Technology Co., Ltd; Zhejiang Tourism Investment Group Co., Ltd
- Inventors: Jiawei Lu; Gang Xiao; Yun CAI; Xiaoye ZHANG; Liangzhong XU; Jiahong Zheng; Qibing Wang; Ge SHI; Duanni Li
- Web page: https://patentgrep.com/patent/US20250156704A1

## CPC

- G06N 3/08: Learning methods
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

Disclosed is a secondary recommendation method based on a service complementary relation learning model for a RESTful service. The method includes: firstly, establishing a service complementary relation learning model, and setting a service complementary relation rule; on the basis, extracting an initial service complementary relation, expanding the initial service complementary relation with service function similarity information, and creating a complementary relation graph structure; secondly, conducting representation learning on the complementary relation graph structure in combination with a mask graph attention mechanism, and obtaining embedded vectors of a RESTful service and a service function; then, computing a distance between the embedded vectors, and reducing the distance between the embedded vectors having a complementary relation with a hinge loss function; and finally, finding the RESTful service having the complementary relation according to user input, and conducting secondary service recommendation.

## Claims

### Claim 1

A secondary recommendation method based on a service complementary relation learning model for a RESTful service, comprising the following steps:
step 1: creating a service complementary relation learning model, establishing a RESTful service invocation data set, setting a service complementary relation rule, and extracting an initial service complementary relation as follows:
1.1. enabling the service complementary relation learning model to be a deep learning model capable of learning a service complementary relation between data samples of the RESTful service and conducting secondary recommendation on the basis of the service complementary relation, which is represented by a symbol SCRM;
1.2. enabling the RESTful service invocation data set to be a collection of data samples related to a service, a service invocation sequence and a service combination, which is represented by a symbol C;
1.3. configuring the service complementary relation rule to describe related information of strength of a complementary relation between two RESTful services in SCRM; and
1.4. extracting the initial service complementary relation as follows: extracting the initial service complementary relation in C according to the service complementary relation rule formulated in step 1.3;
step 2: expanding the initial service complementary relation extracted in step 1.4 with service function similarity information, and obtaining a function service complementary relation as follows:
2.1. using the service function similarity information as follows: determining that any two RESTful services are functionally similar if subordinate service functions of the services have the same item, wherein a degree of similarity is evaluated with service function similarity; and
2.2. expanding the initial service complementary relation as follows: finding functionally similar RESTful services in the RESTful service invocation data set so as to expand the initial service complementary relation, and obtaining the function service complementary relation;
step 3: creating a complementary relation graph structure on the basis of the initial service complementary relation and the function service complementary relation as follows:
3.1. configuring the complementary relation graph structure to describe a directed weighted graph of the initial service complementary relation and the function service complementary relation in SCRM, which is defined as ACWG=<V, E, W>, wherein ACWG represents the complementary relation graph structure, V represents a node set, E represents a directed edge set, and W represents a weight matrix; and
3.2. creating the complementary relation graph structure as follows: transforming the initial service complementary relation and the function service complementary relation into nodes, directed edges and edge weights in the complementary relation graph structure;
step 4: transforming the RESTful service into an embedded vector through representation learning, learning an attention coefficient from the complementary relation graph structure AWCG created in step 3 with a mask graph attention mechanism, and optimizing the embedded vector in combination with the attention coefficient as follows:
4.1. transforming a data sample into a low-dimensional vector representation through representation learning, and firstly transforming any RESTful service α into an embedded vector εα having a dimension d through representation learning in SCRM, wherein d is a hyper-parameter representing a dimension;
4.2. learning the complementary relation graph structure in combination with the mask graph attention mechanism, and obtaining the attention coefficient; and
4.3. optimizing the embedded vector with the attention coefficient as follows: conducting weighted average processing on the embedded vector with an attention coefficient between a node and a neighbor node;
step 5: computing vector distances of different RESTful services in SCRM, transforming service functions into embedded vectors, and computing vector distances of different service functions as follows:
5.1. obtaining the vector distance of the RESTful service as follows: mapping the RESTful service to a vector space through step 4, and determining a distance between different RESTful services in the vector space to be the vector distance of the RESTful service;
5.2. transforming the service function as follows: transforming the service function into the embedded vector through representation learning; and
5.3. computing the vector distance of the service function as follows: mapping the service function to the vector space through step 5.2, and determining a distance between different service functions in the vector space to be the vector distance of the service function;
step 6: optimizing SCRM with a gradient descent algorithm and a hinge loss function, and reducing a vector distance between a RESTful service and a service function having a complementary relation, wherein the gradient descent algorithm is an optimization algorithm in deep learning and is configured to find a local minimum of a function, and the hinge loss function is a loss function commonly used in semi-supervised learning; and
step 7: finding closest RESTful service and service function that are complementary to user input with SCRM, and implementing secondary recommendation.

### Claim 2 (depends on 1)

The secondary recommendation method based on the service complementary relation learning model for the RESTful service according to claim 1, wherein in step 1.2, the service invocation data set comprises the following information:
1.2.1. a RESTful service: a RESTful application programming interface (API) service, which is represented by a symbol α;
1.2.2. a service invocation frequency: a total invocation frequency of a RESTful service, which is represented by a symbol Contain(α);
1.2.3. the service invocation sequence: a sequence consisting of invoked RESTful services, which is represented by a symbol c;
1.2.4. the service combination: a combination mode of RESTful services, which is represented by a symbol MA; and
1.2.5. a total service combination number: a total number of service combinations in the RESTful service invocation data set, which is represented by a symbol |MA|.

### Claim 3 (depends on 1)

The secondary recommendation method based on the service complementary relation learning model for the RESTful service according to claim 1, wherein in step 1.3, the service complementary relation rule comprises the following information:
1.3.1. a support threshold: a lowest probability of simultaneous appearance of any two RESTful services α1 and α2 in c, which is represented by a symbol ω;
1.3.2. a confidence threshold: a lowest conditional probability of appearance of a RESTful service α2 on the premise of appearance of a RESTful service α1 in c, which is represented by a symbol δ;
1.3.3. co-occurrence: a condition that RESTful services α1 and α2 simultaneously appear in c, which is referred to as one time of co-occurrence, wherein a co-occurrence frequency is represented by a symbol Co(α1, α2); and
1.3.4, the initial service complementary relation that exists between two RESTful services if a result computed on the basis of the service invocation frequency, the co-occurrence frequency and the total service combination number satisfies a given support threshold and a given confidence threshold.

### Claim 4 (depends on 1)

The secondary recommendation method based on the service complementary relation learning model for the RESTful service according to claim 1, wherein in step 1.4, the initial service complementary relation is extracted as follows:
1.4.1. taking any two RESTful services from C, which are recorded as α1 and α2 respectively;
1.4.2. setting an invocation frequency Contain(α1) of αi to be 0;
1.4.3. setting a co-occurrence frequency Co(α1, α2) of α1 and α2 to be 0;
1.4.4. traversing the service invocation sequence in C in sequence, and recording the service invocation sequence taken at the it time as ci;
1.4.5. adding 1 to Contain(α1) if α1 appears in ci;
1.4.6. adding 1 to Co(α1, α2) if α1 and α2 simultaneously appear in ci;
1.4.7. ending traversal when ci is a last service invocation sequence in C;
1.4.8. comparing a result of dividing Co(α1, α2) by |MA| with ω, and skipping to step 1.4.1 if the result is smaller than ω;
1.4.9. comparing a result of dividing Co(α1, α2) by Contain(α1) with δ, and skipping to step 1.4.1 if the result is smaller than S; and
1.4.10. outputting the initial service complementary relation between αi and α2, which is recorded as (α1, α2)com.

### Claim 5 (depends on 1)

The secondary recommendation method based on the service complementary relation learning model for the RESTful service according to claim 1, wherein in step 2.1, the service function similarity information comprises the following contents:
2.1.1. a service function: a subordinate function type of the RESTful service, which is represented by a symbol Category, wherein a service α having a function of a type i is represented by α→Categoryi, and a symbol→represents a subordinate relation between the RESTful service and the service function;
2.1.2. a service function set: a collection of all subordinate service functions of the RESTful service α, which is recorded as CAT(α);
2.1.3. the service function similarity: a result of dividing a module of an intersection of a collection CAT(α1) and a collection CAT(α2) for the functionally similar RESTful services α1 and α2 by a result of a module of CAT(α1), which is recorded as sim(α1, α2);
2.1.4. service complementary relation confidence configured to evaluate credibility of the service complementary relation, wherein for the initial service complementary relation, the confidence is 1; and for the function service complementary relation, a confidence value is sim(α1, αformer), and αformer is an expanded service; and
2.1.5. a service complementary relation set: a collection of all initial service complementary relations and function service complementary relations, which is represented by a symbol COM; and
in step 2.2, the initial service complementary relation is expanded as follows:
2.2.1. giving and adding any initial service complementary relation (α1, α2)com to the service complementary relation set COM;
2.2.2. finding the service function set CAT(α2) corresponding to α2;
2.2.3. traversing the RESTful services in C in sequence, and recording the service taken at the ith time as αj;
2.2.4. computing function similarity sim(αi, α2) between αi and α2, and skipping to 2.2.6 if sim(αi, α2) is 0;
2.2.5. expanding the initial service complementary relation (α1, α2)com to (α1, αi)com, and determining (α1, αi)com to be the function service complementary relation;
2.2.6, assigning a value to the service complementary relation confidence of (α1, αi)com, which is sim(αi, α2);
2.2.7. adding (α1, αi)com to COM; and
2.2.8. ending traversal when αi is a last RESTful service in C.

### Claim 6 (depends on 1)

The secondary recommendation method based on the service complementary relation learning model for the RESTful service according to claim 1, wherein in step 3.1, the complementary relation graph structure comprises the following information:
3.1.1. a graph node transformed from the RESTful service defined in step 1.2.1, which is represented by a symbol ν;
3.1.2. a directed edge transformed from the initial service complementary relation and the function service complementary relation, which is represented by a symbol e; and
3.1.3. an edge weight transformed from the service complementary relation confidence defined in step 2.1.4, which is represented by a symbol w; and
in step 3.2, the complementary relation graph structure is created as follows:
3.2.1. traversing COM in sequence, and recording the taken initial or function service complementary relation as (αj, αk)com;
3.2.2. creating two nodes νj and νk to represent RESTful services αj and αk, and adding the nodes to the node set V;
3.2.3. creating a directed edge ejk from νj to νk, and adding the directed edge to the directed edge set E;
3.2.4. evaluating an edge weight corresponding to the directed edge ejk as sim(αj, αk), and updating a matrix value wjk in the weight matrix W; and
3.2.5. ending traversal when (αj, αk)com is a last initial or function service complementary relation in COM.

### Claim 7 (depends on 1)

The secondary recommendation method based on the service complementary relation learning model for the RESTful service according to claim 1, wherein in step 4.2, a learning process of the mask graph attention mechanism is as follows:
4.2.1. traversing a node set of AWCG, and recording a node taken at the ith time as νi;
4.2.2. taking any neighbor node νj of νi, and skipping to step 4.2.11 if νi has no neighbor node;
4.2.3. finding RESTful services corresponding to νi and νj, which are recorded as αi and αj;
4.2.4. conducting representation learning on αi and αj, which are transformed into d-dimensional vectors and recorded as εαi and εαj respectively;
4.2.5. defining a shared weight matrix W1 having a size d×d′, wherein d′ is a hyper-parameter representing a dimension;
4.2.6. multiplying εαi, εαj and W1, then conducting vector splicing, and recording a vector splicing result as ti,j;
4.2.7. defining a scalar transformation matrix W2 having a size d′×1;
4.2.8. multiplying W2 and ti,j, and transforming the vector splicing result into a scalar ki,j;
4.2.9. weighting ki,j, multiplying the service complementary relation confidence sim(αi, αj) and ki,j, and recording a result as mi,j;
4.2.10. conducting normalization on mi,j with a LeakyReLU activation function, and determining a normalization result to be an attention coefficient between nodes νi and νj, which is represented by a symbol αi,j, wherein the LeakyReLU activation function is a common neural network activation function and has advantages of preventing neuron jitter, avoiding gradient disappearance and good fitting; and normalization is a commonly used mathematical method, and transforms original data and limits the data to a range of 0 to 1; and
4.2.11. ending traversal when νi is a last node in AWCG; and
in step 4.3, the embedded vector is optimized with the attention coefficient as follows:
4.3.1. giving an embedded vector εα of any RESTful service α, and defining and initializing an optimized vector ε′α as an empty vector;
4.3.2. finding a node να corresponding to the RESTful service α in AWCG, wherein a collection of all neighbor nodes of να is represented by a symbol Nα;
4.3.3. stopping an optimization process if Nα is an empty set, and outputting εα as a result;
4.3.4. traversing Nα in sequence, and recording a neighbor node taken at the jth time as νj;
4.3.5. computing an attention coefficient between the nodes να and νj according to step 4.2, wherein a computation result is represented by a symbol αα,j;
4.3.6. multiplying embedded vectors εα and αα,j, and adding the result to ε′α;
4.3.7. ending traversal when νj is a last neighbor node in Nα; and
4.3.8. outputting ε′α.

### Claim 8 (depends on 1)

The secondary recommendation method based on the service complementary relation learning model for the RESTful service according to claim 1, wherein in step 5.1, the vector distance of the RESTful service is computed as follows:
5.1.1. giving any two RESTful services αi and αj, and obtaining the optimized embedded vectors through step 4, which are represented by symbols ε′αi and ε′αj respectively;
5.1.2. defining lαi,j to represent a vector distance between αi and αj, and initializing the vector distance to 0;
5.1.3. defining a boundary distance of a RESTful service vector, which is represented by a symbol Δα;
5.1.4. finding nodes corresponding to αi and αj in AWCG, which are recorded as νi and νj;
5.1.5. subtracting the embedded vector ε′αi from the embedded vector ε′αj, and conducting modulo operation on a computation result;
5.1.6. assigning a square of a module length to lαi,j when νj is a neighbor node of νi, and skipping to step 5.1.8;
5.1.7. subtracting the square of the module length from Δα when νj is not a neighbor node of νi, recording a computation result as Rα, assigning Rα to lαi,j when Rα is greater than 0, and skipping to step 5.1.8; and
5.1.8. outputting lαi,j;
in step 5.2, the service function is transformed as follows:
5.2.1. traversing a service function set CAT(α) of a RESTful service α in sequence, and recording a service function taken at the ith time as Categoryi;
5.2.2. transforming the service function Categoryi into a d-dimensional embedded vector through representation learning, wherein Categoryi is recorded as qiα when serving as an inherent function of the service α; and Categoryi is recorded as pa when serving as a complementary function of the service α; and
5.2.3. ending traversal when Categoryi is a last service function in CAT(α); and
in step 5.3, the vector distance of the service function is computed as follows:
5.3.1. giving any two RESTful services αi and αj, and taking two service functions from service function sets CAT(αj) and CAT(αj) respectively, which are recorded as Categorym and Categoryn;
5.3.2. transforming Categorym into a vector qmi and Categoryn into pnj according to step 5.2;
5.3.3. defining lci,j to represent a vector distance between Categorym and Categoryn, and initializing the vector distance to 0;
5.3.4. defining a boundary distance of a vector, which is represented by a symbol Δc;
5.3.5. finding nodes corresponding to αi and αj in AWCG, which are recorded as νi and νj;
5.3.6. subtracting the embedded vector qmi from the embedded vector pnj, and conducting modulo operation on a computation result;
5.3.7. assigning a square of a module length to lci,j when νj is a neighbor node of νi, and skipping to step 5.3.9;
5.3.8. subtracting the square of the module length from Δc when νj is not a neighbor node of νi, recording a computation result as Rc, assigning Rc to lci,j when Rc is greater than 0, and skipping to step 5.3.9; and
5.3.9. outputting lci,j.

### Claim 9 (depends on 1)

The secondary recommendation method based on the service complementary relation learning model for the RESTful service according to claim 1, wherein in step 6, the vector distance in SCRM is reduced with a hinge function as follows:
6.1. computing vector distances between all different RESTful services through step 5.1, and adding the vector distances between all the RESTful services, wherein the sum of the distances is represented by a symbol Lα;
6.2. computing vector distances between all different service functions through step 5.3, and adding the vector distances between all the service functions, wherein the sum of the distances is represented by a symbol Lc;
6.3. defining a learning intensity control parameter λ of the hinge loss function;
6.4. defining the hinge loss function with an expression of L=λLα+(1−λ)Lc, wherein a symbol L represents the hinge loss function; and
6.5. setting as an optimization target, repeating 6.1 to 6.5 on a RESTful service invocation data set C, and finding a minimum value of L with the gradient descent algorithm.

### Claim 10 (depends on 1)

The secondary recommendation method based on the service complementary relation learning model for the RESTful service according to claim 1, wherein step 7 comprises:
7.1. obtaining an embedded vector of α through step 4.3 for a RESTful service α input by a user, which is represented by a symbol εαc′;
7.2. transforming a service function of the RESTful service α through step 5.2, and taking any transformed vector, which is represented by a symbol qiα;
7.3. defining a vector distance collection Dis_A of a service;
7.4. defining a vector distance collection Dis_C of a service function;
7.5. traversing C in sequence, and recording a RESTful service taken at a jth time as αj;
7.6. computing a vector distance between service α and service αj according to step 5.1, and adding a computation result to Dis_A;
7.7. computing a vector distance between service functions of the service α and the service αj according to step 5.3, and adding a computation result to Dis_C;
7.8. ending traversal when αj is a last service in C;
7.9. obtaining top K1 services having a smallest distance in Dis_A, wherein K1 represents a number of recommended services, and obtained results are represented by a collection S(α, αj);
7.10. obtaining top K2 service functions having a smallest distance in Dis_C, wherein K2 represents a number of recommended service functions, and obtained results are represented by a collection T(α, αj); and
7.11. conducting secondary recommendation, wherein S(α, αj) is regarded as a second recommendation result of a complementary service; and T(α, αj) is regarded as a secondary recommendation result of a complementary service function.
