Knowledge graph-based service resource recommendation method, system, device and medium

By using a knowledge graph-based service resource recommendation method, collaborative filtering and semantic mapping rules are employed to map users' frequently accessed service object sets to a pre-built knowledge graph. This solves the problems of insufficient data integration and single-dimensional recommendation algorithms in innovation and entrepreneurship service platforms, and achieves more comprehensive service resource recommendations.

CN120705419BActive Publication Date: 2025-12-26SHANDONG INSPUR INNOVATION & ENTREPRENEURSHIP TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511220715.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-12-26
Estimated Expiration
2045-08-29

AI Technical Summary

Technical Problem

Innovation and entrepreneurship service platforms suffer from insufficient data integration and limited recommendation algorithm dimensions, which restricts the comprehensiveness and accuracy of service resource matching.

Method used

The knowledge graph-based service resource recommendation method obtains the historical behavior data of target users, and uses collaborative filtering algorithms and semantic mapping rules to map the user's frequently accessed service object set and the service object set of associated user sets to a pre-constructed knowledge graph, and then recommends service resources based on the mapped data.

Benefits of technology

It effectively integrates scattered and heterogeneous innovation and entrepreneurship service resources, solves the problem of data silos, breaks through the limitations of the single dimension of traditional recommendations, improves the comprehensiveness, relevance and personalization of recommendation results, and meets the diversified and in-depth needs of users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705419B_ABST
    Figure CN120705419B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of knowledge graphs, and specifically provides a service resource recommendation method, system, device and medium based on a knowledge graph, which comprises the following steps: reading an access log, calling a user browsing history, and establishing a user operation behavior table. Then, according to the user behavior table, an entity is extracted, and a behavior entity is obtained. The knowledge graph is independently queried for each behavior entity to avoid cross-entity interference. Starting from the behavior entity, associated entities are propagated layer by layer. All nodes accessed in the propagation process are recorded, and when a node is accessed, the count is accumulated. Then, in combination with the relationship strength of the edge, the final weight is obtained, the associated entities are returned in descending order of weight, and the associated entities are matched with services in a resource library through word vector similarity calculation, and finally returned to the user. The application significantly improves the comprehensiveness, relevance and individuality of the recommendation result, and meets the diversified and deep-seated needs of the user.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of knowledge graph, and particularly relates to a service resource recommendation method, system, device and medium based on a knowledge graph. BACKGROUND

[0002] With the rapid development of innovation and entrepreneurship activities, innovation and entrepreneurship service platforms are facing increasingly complex resource integration and service matching needs. However, the existing platforms generally have the following technical bottlenecks:

[0003] Insufficient data integration: the content in the field of innovation and entrepreneurship is complex and not unified, and a scale innovation and entrepreneurship knowledge graph has not been formed, which limits the comprehensiveness and accuracy of service resource matching.

[0004] Single dimension of recommendation algorithm: traditional recommendation systems are mostly based on collaborative filtering or content similarity algorithms, and only rely on user historical behavior or static tags, resulting in single recommended content. SUMMARY

[0005] In view of the above deficiencies of the prior art, the application provides a service resource recommendation method, system, device and medium based on a knowledge graph to solve the above technical problems.

[0006] In a first aspect, the application provides a service resource recommendation method based on a knowledge graph, comprising:

[0007] Obtaining historical behavior data of a target user, and determining a first service object set frequently accessed by the target user based on the historical behavior data;

[0008] Calculating the behavior data similarity between the target user and other users, filtering out an associated user set according to the similarity, and determining a second service object set frequently accessed by the associated user set based on the historical behavior data of the associated user set by using a collaborative filtering algorithm;

[0009] Mapping the service objects in the first service object set and the second service object set to corresponding service entity nodes in a pre-constructed knowledge graph based on a pre-defined semantic mapping rule or model;

[0010] For each service entity node obtained by mapping, querying an associated entity node set having a preset type of association relationship from the knowledge graph;

[0011] Aggregating all service entity nodes and their associated entity node sets to form a candidate entity set, and outputting the service resources corresponding to the candidate entity set as recommended content to the target user.

[0012] In an optional embodiment, historical behavior data of a target user is acquired, and a first service object set frequently accessed by the target user is determined based on the historical behavior data, including:

[0013] The user access interface log generated by Nginx is read, redundant and invalid data in the log is removed, and log entries related to service mall access are screened out;

[0014] The missing fields in the log entries are filled with preset identifiers, and the log data is standardized to JSON format for storage. The JSON format log data at least includes timestamp, user IP and user request behavior fields;

[0015] The JSON format log data is read and associated with a user login table; the user login table at least includes username and login IP fields; by matching the user IP field in the JSON format log data with the login IP field of the user login table, the correspondence between the username and the user IP and the user request behavior is established; the service resource identifier in the user request behavior is parsed, and a service mall table is associated with the query, the service mall table at least includes the mapping relationship between the service resource identifier and the service resource details; based on the parsing result, the corresponding relationship between the username and the browsed service resources is generated;

[0016] According to the corresponding relationship between the username and the browsed service resources, a user-service interaction matrix is constructed, in which the user is used as the row index, the service resource is used as the column index, and the matrix element value is the cumulative number of times of browsing the service resource by the corresponding user;

[0017] The service resources whose matrix element values reach a set element threshold are screened out, and the screened service resources are saved to the first service object set.

[0018] In an optional embodiment, historical behavior data of a target user is acquired, and a first service object set frequently accessed by the target user is determined based on the historical behavior data, including:

[0019] The interactive behavior data of the target user is collected, the interactive behavior at least including clicking, collecting and consulting service resources; a user behavior sequence is generated in time sequence, each behavior record containing behavior type, service resource identifier and timestamp;

[0020] A preset weight is assigned to different behavior types, and an initial weight of a behavior record is generated based on the behavior type contained in the behavior record and the preset weight;

[0021] For each behavior record in the behavior sequence, a time decay factor is calculated based on the timestamp, and the initial weight of the behavior record is adjusted according to the time decay factor to obtain a dynamic weight of the behavior record;

[0022] According to the dynamic weight of each behavior record, the dynamic weight sum of each type of service resource identifier is calculated.

[0023] The target service resource identifier whose dynamic weight sum reaches the preset threshold is screened out, and the service resource corresponding to the target service resource identifier is saved to the first service object set.

[0024] In an optional embodiment, the behavior data similarity of the target user and other users is calculated, and an associated user set is screened out according to the similarity, including:

[0025] The similarity of the user-service interaction matrix of the target user and the user-service interaction matrix of other users is calculated.

[0026] The user and the corresponding user-service interaction matrix whose similarity reaches the preset similarity threshold are saved to the associated user set.

[0027] In an optional embodiment, the service objects in the first service object set and the second service object set are mapped to the corresponding service entity nodes in the pre-constructed knowledge graph based on a pre-defined semantic mapping rule or model, including:

[0028] An entity set in the knowledge graph and a service set in the service resource library are obtained.

[0029] A pre-trained Chinese semantic understanding model is used to batch calculate the semantic similarity scores between entities and services; the semantic similarity calculation does not depend on the existence of entity nodes completely corresponding to services in the knowledge graph.

[0030] An entity-service mapping table is created to store entity IDs, service IDs, and their semantic similarity scores; a similarity threshold is set, and entity-service pairs that satisfy the similarity reaching the similarity threshold are written into the mapping table; the mapping table content is updated periodically through a database batch writing mechanism.

[0031] The service entity nodes having a mapping relationship with the services in the first service object set and the second service object set are queried from the entity-service mapping table.

[0032] In an optional embodiment, the method further includes:

[0033] Newly added services that are not mapped in the knowledge graph are identified, and the newly added services are saved to a to-be-mapped service set Q={q1, q2,..., q n};

[0034] For each service q i in Q, a pre-trained text encoding model is used to encode the service name and description text into a feature vector v i; retrieve the Top-K knowledge graph entities with the highest similarity to v i The Top-K knowledge graph entities with the highest similarity are retained, and entities with cosine similarity greater than a preset standard threshold are retained in the Top-K knowledge graph entities to generate a candidate entity set C i ;

[0035] The service q i is mapped to the entity in C i , and a mapping relationship between the service and the entity is batch-inserted into a database mapping table, and a conflict update strategy is executed: when there is a primary key conflict, the entity ID and the similarity field are updated; entity mapping data of the corresponding service in the cache server is refreshed in real time;

[0036] The knowledge graph entity vector index is fully reconstructed at a fixed period, and new entity vectors are incrementally added to the index.

[0037] In an optional embodiment, for each service entity node obtained by mapping, a set of associated entity nodes with a preset type of association relationship is queried from the knowledge graph, including:

[0038] The service entity triggered by the user behavior is taken as a root node, and its associated relationship is independently queried in the knowledge graph to obtain a triple, the triple including a head entity, a relationship type, a relationship strength, and a tail entity;

[0039] Starting from the root node, N-layer propagation (N>=1) is performed along the knowledge graph path, and the associated entity set is expanded layer by layer; the propagation depth N is dynamically set: when the number of user historical behaviors is lower than a threshold, N>=3; when the number of user historical behaviors is higher than a threshold, N<=2; the path depth n and the path relationship strength weight are recorded during each layer of propagation;

[0040] For adjacent entity pairs in the propagation path, a pre-trained semantic encoding model is used to generate feature vectors of the entity texts; the cosine similarity of the adjacent entity vectors is calculated; if the cosine similarity reaches a set threshold, the path jump is retained, otherwise the path is removed;

[0041] For multiple propagation paths reaching the same target entity, the weight of each propagation path is calculated according to the single relationship strength in the path, and the sum of the weights of all propagation paths is set as the recommendation weight of the target entity;

[0042] The multiple target entities are arranged in descending order of the recommendation weight.

[0043] In a second aspect, the application provides a service resource recommendation system based on a knowledge graph, including:

[0044] A first acquisition module is configured to acquire historical behavior data of a target user, and determine a first service object set frequently accessed by the target user based on the historical behavior data;

[0045] a second obtaining module, configured to calculate a behavior data similarity between the target user and other users, filter out a set of associated users according to the similarity, and determine a second set of service objects frequently accessed by the set of associated users based on historical behavior data of the set of associated users by using a collaborative filtering algorithm;

[0046] a semantic mapping module, configured to map service objects in the first set of service objects and the second set of service objects to corresponding service entity nodes in a pre-constructed knowledge graph based on a predefined semantic mapping rule or model;

[0047] a graph query module, configured to query, for each service entity node obtained by mapping, a set of associated entity nodes having a preset type of association relationship with the service entity node from the knowledge graph;

[0048] a resource recommendation module, configured to aggregate all service entity nodes and their associated entity node sets to form a candidate entity set, and output service resources corresponding to the candidate entity set as recommendation content to the target user.

[0049] In a third aspect, a device is provided, comprising:

[0050] a memory, configured to store a knowledge graph-based service resource recommendation program;

[0051] a processor, configured to implement the steps of the knowledge graph-based service resource recommendation method provided in the first aspect when the knowledge graph-based service resource recommendation program is executed.

[0052] In a fourth aspect, a computer readable medium is provided, and the medium stores a knowledge graph-based service resource recommendation program. The knowledge graph-based service resource recommendation program, when executed by a processor, implements the steps of the knowledge graph-based service resource recommendation method provided in the first aspect.

[0053] The application has the beneficial effects that the method, system, device and medium for recommending service resources based on a knowledge graph provided by the application effectively integrate scattered and heterogeneous innovation and entrepreneurship service resources by mapping service objects (first and second service object sets) frequently accessed by users to pre-constructed knowledge graph nodes based on semantic rules / models, solve the data island problem, and lay a solid foundation for accurate recommendation. The method breaks through the limitation of single traditional recommendation dimension, uses the powerful semantic association capability of the knowledge graph, deeply mines a set of associated entity nodes having a preset type of association relationship (such as upstream, complementary, and similar) with the user interest node, significantly expands the range and dimension of the recommendation candidate set. The initial interest node and its associated nodes are aggregated to form a candidate entity set, and the corresponding service resources are finally recommended. The method not only inherits the advantage of discovering group commonality of collaborative filtering, but also introduces rich semantic association information through the knowledge graph, thereby significantly improving the comprehensiveness, relevance and individualization degree of the recommendation result, and meeting the diversified and deep needs of users. BRIEF DESCRIPTION OF DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative labor.

[0055] Figure 1 is a schematic flowchart of a method of an embodiment of the present application.

[0056] Figure 2 is another schematic flowchart of a method of an embodiment of the present application.

[0057] Figure 3 is a schematic block diagram of a system of an embodiment of the present application.

[0058] Figure 4 is a structural schematic diagram of a device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0059] In order to enable those skilled in the art to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.

[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the application.

[0061] The method for recommending service resources based on a knowledge graph provided by the embodiments of the application is executed by a computer device, and accordingly, the service resource recommendation system based on a knowledge graph runs in the computer device.

[0062] Figure 1 is a schematic flowchart of the method of an embodiment of the application. In the flowchart, Figure 1 The execution subject can be a service resource recommendation system based on a knowledge graph. The order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted.

[0063] As Figure 1 shown, the method comprises the following steps:

[0064] S1. Obtain historical behavior data of a target user, and determine a first service object set frequently accessed by the target user based on the historical behavior data;

[0065] S2. Calculate the behavior data similarity between the target user and other users, filter out an associated user set according to the similarity, and determine a second service object set frequently accessed by the associated user set based on the historical behavior data of the associated user set by using a collaborative filtering algorithm;

[0066] S3. Map the service objects in the first service object set and the second service object set to corresponding service entity nodes in a pre-constructed knowledge graph based on a pre-defined semantic mapping rule or model;

[0067] S4. For each service entity node obtained by mapping, query an associated entity node set having a preset type of association relationship from the knowledge graph;

[0068] S5. Aggregate all service entity nodes and their associated entity node sets to form a candidate entity set, and output the service resources corresponding to the candidate entity set as recommendation content to the target user.

[0069] Please refer to Figure 2The application firstly carries out user behavior modeling, reads the access log of nginx, calls user browsing history, and establishes a user operation behavior table. Then, according to the user behavior table, an entity is extracted, and a behavior entity is obtained. Each behavior entity is independently queried in a knowledge graph to avoid cross-entity interference. Starting from the behavior entity, the associated entities are propagated layer by layer. All nodes accessed in the propagation process are recorded, and the count is accumulated when the node is accessed. Then, the final weight is obtained by combining the relationship strength of the edge, the associated entities are returned in descending order of weight, and the associated entities are matched with the services in the resource library through word vector similarity calculation. Finally, the associated entities are returned to the user.

[0070] In an embodiment of the application, based on step S1, a possible embodiment will be given below to non-restrictively illustrate the specific implementation scheme.

[0071] By reading the log of the user access interface generated by nginx, the collection of user behavior data is realized. A large amount of redundant and invalid data in the log is removed, and the log of the user accessing the service mall is screened out. The missing fields existing in the data are filled as "null", and then the data is standardized and stored as a json file, mainly including a timestamp (timestamp), a user IP (remote_addr) and a user request behavior (request).

[0072] The above json file is read, and a user login table (mainly including a username and a login IP field) is queried. The login IP is associated to establish a username-login IP-user request behavior relationship. The user browsed service resource id is obtained by analyzing the user request behavior, and a service mall table (mainly including service resource details) is queried. Finally, the username-user browsed service corresponding relationship is obtained. Then, a user-service interaction matrix is constructed: the row represents the user, the column represents the service, and the matrix value is the user browsing times.

[0073] In order to further mine the user behavior characteristics, in an embodiment of the application, the following method is adopted:

[0074] During the data acquisition phase, a multi-source heterogeneous data fusion architecture is employed to comprehensively capture target user interaction behaviors. By embedding lightweight front-end tracking scripts (such as JavaScript-based event listeners), user click behaviors on both web and mobile devices are collected in real time, including but not limited to button clicks, link jumps, and page scrolling / staying actions. For bookmarking behaviors, backend API interfaces are called to record user marking actions on service resources, while the user account system is linked to achieve consistent tracking of behavior across devices. Behavioral data for consultation service resources is obtained by connecting to the consultation system to acquire structured data containing consultation content. All collected data is streamed via message queues (such as Kafka), and after a data cleaning module removes outliers (such as high-frequency repeated clicks within a short period), it is stored in a distributed time-series database (such as InfluxDB) to provide a high-quality data source for subsequent processing.

[0075] The construction of user behavior sequences adopts a timeline alignment strategy, using UTC timestamps as the basis to achieve unified sorting of behaviors across platforms. Each behavior record is stored in a standardized triplet data structure <b_type, r_id, t_stamp>, where b_type is the behavior type enumeration value (click=1, favorite=2, consultation=3), r_id is the unique identifier of the service resource (generated using UUIDv4 format), and t_stamp is the precise time of the behavior (accurate to the millisecond level). For scenarios with concurrent behaviors (such as multiple interactions within the same millisecond), a micro-timestamp offset is introduced to ensure the strict order of the sequence. The offset value ranges from [0, 999], supported by the sub-millisecond precision of the system clock.

[0076] The pre-defined weight allocation for behavior types was based on an assessment model constructed using the Analytic Hierarchy Process (AHP), with the importance weight of each behavior determined through expert questionnaires. After a consistency test (CR < 0.1), the final weights were: consultation behavior weight ω1 = 0.6, collection behavior weight ω2 = 0.3, and click behavior weight ω3 = 0.1. The initial weights were calculated using a direct mapping method, i.e., the initial weight of the behavior record w0 = ω i (i corresponds to the behavior type number), ensuring that the weight allocation is positively correlated with the depth of user decision-making (consultation > favorite > click).

[0077] The calculation of the time decay factor adopts an exponential decay model, and the formula is defined as: λ(t)=e^(-k・Δt), wherein Δt is the difference (in days) between the current time and the behavior record timestamp, and k is the decay coefficient (k=0.05 is determined by parameter optimization). The dynamic weight w=w0・λ(t) is used to realize the weighted reinforcement of recent behaviors and the natural weakening of long-term behaviors. For example, the dynamic weight of the consultation behavior 30 days ago is 0.6×e^(-0.05×30)≈0.6×0.223=0.134, and the weight of the same behavior 3 days ago is 0.6×e^(-0.05×3)=0.6×0.861=0.517, which effectively reflects the time decay characteristics of user interest.

[0078] The statistics of the service resource dynamic weight sum are realized by using a distributed computing framework (such as Spark) to realize efficient aggregation, the dynamic weights of the same resource are accumulated and summed by r_id grouping, and S(r_id) is obtained. The determination of the preset threshold value adopts the percentile method, the weight sum distribution based on historical data is used to set the threshold value θ as the top 20% percentile value, so that the screening result contains high attention resources and maintains moderate resource diversity.

[0079] Finally, the target service resource identifier S(r_id) satisfying S(r_id)≥θ is screened out, the corresponding service content (including resource description, provider information, service parameters, etc.) is obtained by associating the resource meta database, and the service content is stored in the first service object set after deduplication processing.

[0080] In an embodiment of the present application, based on step S2, a possible embodiment will be given below to non-restrictively describe the specific implementation scheme.

[0081] The collaborative filtering algorithm is used to calculate the user similarity based on the user-service interaction matrix, to score and predict the unvisited service resources and generate N services, and then to take the original service and the collaborative filtering extended service as the starting point of user behavior, to respectively perform behavior propagation, to mine the entities related to the user historical behavior, and to obtain the recommendation path.

[0082] The user portrait and the collaborative filtering module support incremental updating to adapt to the change of user interest.

[0083] In an embodiment of the present application, based on step S3, a possible embodiment will be given below to non-restrictively describe the specific implementation scheme.

[0084] S301. Obtain an entity set in a knowledge graph and a service set in a service resource library;

[0085] S302. Using a pre-trained Chinese semantic understanding model, batch calculating the semantic similarity score between entities and services; the semantic similarity calculation does not depend on the existence of entity nodes corresponding to services in the knowledge graph;

[0086] S303. Create an entity-service mapping table to store entity ID, service ID and their semantic similarity scores; set a similarity threshold, filter entity-service pairs that meet the similarity threshold to write into the mapping table; periodically update the mapping table content through the database batch writing mechanism;

[0087] S304. Query the service entity nodes that have mapping relationships with the first service object set and the second service object set from the entity-service mapping table.

[0088] In one example, to solve the problem that service resources do not completely correspond to knowledge graph nodes, a Chinese semantic understanding model is used to calculate the semantic similarity between entities and service resources. It does not depend on the existence of complete entities in the graph, and supports cross-semantic recommendation (even if there is no corresponding service resource, it can find similar entities)

[0089] To avoid the problem of excessive calculation between service resources and entities, a cache mechanism is designed to realize an intermediate "mapping table" to connect graph entities and actual available service resources.

[0090] By batch calculating the semantic similarity between entities and service names, and combining the database batch writing mechanism, a technology for efficiently and automatically constructing entity-service mapping relationships is realized.

[0091] In addition, the mapping table is dynamically updated, and the update method includes:

[0092] The new service identification module realizes the accurate capture of unmapped services in the knowledge graph by constructing a bidirectional incremental comparison mechanism. Based on the change log of the service registry center, the metadata of the newly added services in the period (including service unique identifier, name, function description, interface parameter, etc.) is extracted, and primary key comparison is performed with the existing entity mapping table of the knowledge graph (initial screening is performed using a Bloom filter, and then accurate matching verification is performed), to identify the service set Q={q1, q2,..., q n} that has not established a mapping relationship. To avoid repeated calculation, Redis cache is used to process service identifiers with a 24-hour expiration time, which improves the identification efficiency by 37%.

[0093] The service feature vector generation stage uses a hybrid coding strategy to optimize semantic representation ability. For each service q i, first pre-process its name and description text: remove special symbols through regular expressions, use the NLTK toolkit for Lemmatization, and filter StopWords. Then use the pre-trained model BERT-base (Chinese / English adaptively selected according to the service text type) for encoding, and take the [CLS] position vector as the basic feature v i base; while introducing TF-IDF feature v i tfidf as a supplement, and get the final feature vector v i =α・v i base+β・v i tfidf.

[0094] The vector retrieval link is based on the Milvus vector database to build a two-level index architecture. The bottom layer uses IVF_FLAT index (inverted file + flat storage) to improve retrieval speed, and the number of cluster centers is set to 2048, and the nprobe parameter is dynamically adjusted (adaptive according to the size of the data set between 8-32); The upper layer constructs HNSW (HierarchicalNavigableSmallWorld) index to optimize the Top-K query efficiency, and sets M = 16 (number of adjacent nodes), efConstruction = 200 (exploration depth in the construction stage). In the retrieval process, first locate the candidate set through the HNSW index, and then calculate the cosine similarity accurately through the IVF_FLAT, and return the Top-K (K = 20) similar entities. The preset standard threshold is determined through a dynamic calibration mechanism: based on the similarity distribution of the historical mapping data, the initial threshold is set by the 3σ criterion, and the mapping accuracy is fed back (the target accuracy is ≥90%) every period to fine-tune, to ensure the accuracy of the candidate entity set C i .

[0095] The mapping relationship storage and update adopts a distributed transaction mechanism to guarantee data consistency. The database mapping table adopts a MySQL split table design, taking the service identifier hash value as the split table key. The table structure includes (service_id, entity_id, similarity, update_time) fields, wherein service_id is the primary key. Batch insertion is implemented through MyBatis-Plus BatchExecutor, and the single batch processing capacity is set to 500 to balance performance and transaction overhead. The conflict update strategy adopts an optimistic lock mechanism: when a primary key conflict is detected, the version number (version) field is used to control concurrency, and only when the new similarity is more than 10% higher than the old value, the update (entity_id, similarity, update_time) is performed to avoid invalid writing. The cache flushing adopts an "update and delete" strategy: the corresponding service cache keys (key format: "service:entity:{service_id}") are deleted in batches through RedisPipeline, triggering automatic loading during subsequent queries to ensure the eventual consistency of the cache and database data.

[0096] The vector index maintenance mechanism adopts a combination of incremental updating and full-reconstruction. Incremental updating is implemented through the Milvus Insert interface, and new entity vectors (dimension 768) are added to the index in batches every hour, while triggering asynchronous merge operations (merge_factor=10) to optimize query performance. Full-reconstruction is performed at a fixed period (T=7 days), and the process includes: extracting full-quantity entity text from the knowledge graph; generating a vector set through re-encoding; creating a temporary index and performing performance verification (query delay≤100ms); completing the update through atomic switching of the index alias. To avoid service interruption during reconstruction, a double-index redundancy mechanism is adopted, and the old index is automatically cleaned up after 24 hours to ensure business continuity.

[0097] In an embodiment of the present application, based on step S4, a possible embodiment will be given below to non-restrictively illustrate the specific implementation thereof.

[0098] Each behavior entity is independently queried in the knowledge graph (head entity, relationship and relationship strength, tail entity) to avoid cross-entity interference; starting from the behavior entity as the root node, the associated entities are propagated layer by layer, and through the propagation mechanism, the user behavior is diffused to the potential resources, and the propagation generally includes horizontal propagation and vertical propagation.

[0099] Horizontal propagation refers to propagating the behavior of a specified node at the same level. In the propagation process, the nodes with a relationship strength greater than a preset threshold are selected, and the nodes with a relationship strength less than the preset threshold are ignored, so as to optimize the propagation speed and control the breadth of propagation.

[0100] Longitudinal propagation refers to the behavior of deep propagation along a certain path of the knowledge graph. Generally speaking, the deeper the propagation layer, the shallower the relationship between the root node and the propagation node, and the less close. When the propagation layer is 1-2 layers, the calculation is fast, and the noise is less. However, long path associations may be missed; when the propagation layer is more than 3 layers, more entities can be mined, but the calculation cost is higher, and irrelevant entities may be introduced. Therefore, for users with less behavior, the layer number can be increased; for users with more behavior, a lower layer number is appropriately set. In this paper, longitudinal propagation is used for path recommendation.

[0101] Semantic rationality judgment:

[0102] When recommending services, it is necessary to ensure that each hop of the path is reasonable in the context of service resources, not just connected in the graph structure, so the semantic similarity between the starting entity and the target entity is calculated to determine whether it is reasonable.

[0103] Each entity node uses the SentenceTransformer framework model to perform semantic encoding on the service resources to construct its semantic feature vector.

[0104] For two adjacent entity nodes in the path, the semantic similarity between them is calculated by cosine similarity.

[0105] If the similarity is higher than the set threshold (such as 0.75), it is considered that there is semantic rationality between the two services, allowing effective path jumps to be formed; otherwise, it is considered to be an unreasonable jump and should be filtered.

[0106] Recommendation weight calculation: For each propagated node, the relationship strength relative to the root node is calculated. Since there may be multiple paths from the root node to the target propagation node, the weighted sum of the path strengths is calculated, and the weighted formula is: W = Σ(weight ×(1 / n)), where weight represents the weight of the relationship, and n represents the propagation layer number, and the final recommendation weight is calculated.

[0107] In an embodiment of the present application, based on step S5, a possible embodiment will be given below to non-restrictively describe the specific implementation scheme.

[0108] According to the entities obtained from the knowledge graph propagation, the model queries the service resource library, maps to the related services, and sorts the recommendation results by weight, and finally returns to the user.

[0109] In some embodiments, the knowledge graph-based service resource recommendation system can include a plurality of functional modules composed of computer program segments. The computer programs of each program segment in the knowledge graph-based service resource recommendation system can be stored in the memory of the computer device and executed by at least one processor to perform the functions of the knowledge graph-based service resource recommendation (see Figure 1 description).

[0110] In this embodiment, the knowledge graph-based service resource recommendation system can be divided into a plurality of functional modules according to the functions it performs, as shown in Figure 3 The module referred to in the present application refers to a series of computer program segments that can be executed by at least one processor and can complete a fixed function, which are stored in the memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0111] The first acquisition module is configured to acquire historical behavior data of a target user, and determine a first service object set frequently accessed by the target user based on the historical behavior data;

[0112] The second acquisition module is configured to calculate the behavior data similarity between the target user and other users, filter out an associated user set according to the similarity, and determine a second service object set frequently accessed by the associated user set based on the historical behavior data of the associated user set using a collaborative filtering algorithm;

[0113] The semantic mapping module is configured to map the service objects in the first service object set and the second service object set to corresponding service entity nodes in a pre-constructed knowledge graph based on a pre-defined semantic mapping rule or model;

[0114] The graph query module is configured to query, for each service entity node obtained by mapping, an associated entity node set having a preset type of association relationship from the knowledge graph;

[0115] The resource recommendation module is configured to aggregate all service entity nodes and their associated entity node sets to form a candidate entity set, and output the service resources corresponding to the candidate entity set as recommendation content to the target user.

[0116] Figure 4The method for recommending service resources based on a knowledge graph provided in the embodiments of the present application can be applied to a device. Those skilled in the art can understand that the device structure involved in the embodiments of the present application does not constitute a limitation on the device, and the device can include more or fewer components than the diagram, or combine certain components, or different component arrangements. In the embodiments of the present application, the device includes but is not limited to a laptop computer, a desktop computer, a workstation, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The device can also represent various forms of mobile devices, such as a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the embodiments of the present application described herein and / or claimed.

[0117] The device 400 can include a processor 410, a memory 420, and a communication unit 430. These components communicate through one or more buses, and those skilled in the art can understand that the structure of the server shown in the diagram does not constitute a limitation on the present application, and it can be a bus structure or a star structure, and can include more or fewer components than the diagram, or combine certain components, or different component arrangements.

[0118] The memory 420 can be used to store the execution instructions of the processor 410, and the memory 420 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. When the execution instructions in the memory 420 are executed by the processor 410, the device 400 is enabled to perform some or all of the steps in the following method embodiments.

[0119] The processor 410 is the control center of the storage device, connects various parts of the entire electronic device by using various interfaces and lines, and performs various functions of the electronic device and / or processes data by running or executing software programs and / or modules stored in the memory 420 and calling data stored in the memory. The processor can be composed of an integrated circuit (IC), for example, can be composed of a single packaged IC, or can be composed of a plurality of packaged ICs connected together. For example, the processor 410 can only include a central processing unit (CPU). In the embodiments of the present application, the CPU can be a single operation core or can include multiple operation cores.

[0120] The communication unit 430 is configured to establish a communication channel, so that the storage device can communicate with other devices. The communication unit 430 receives user data sent by other devices or sends user data to other devices.

[0121] The present application also provides a computer medium, wherein the computer medium can store a program, and the program can include some or all steps in the embodiments provided by the present application when executed. The medium can be a magnetic disc, an optical disc, a read-only memory (ROM) or a random access memory (RAM), etc.

[0122] Those skilled in the art can clearly understand that the technology in the embodiments of the present application can be realized by means of software and necessary general hardware platforms. Based on such understanding, the technical solutions in the embodiments of the present application can be embodied in the form of a software product, which is stored in a medium such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disc or an optical disc, etc. The medium can store program codes, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a second device, a network device, etc.) to execute all or part of the steps of the method described in the embodiments of the present application.

[0123] In the present specification, the same or similar parts among various embodiments can be referred to each other. In particular, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.

[0124] In several embodiments provided by the present application, it should be understood that the disclosed system and method can be implemented in other manners. For example, the system embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There can be another division manner for the actual implementation. For example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different modules can be indirect couplings or communication connections through some interfaces, and electrical, mechanical or other forms.

[0125] The modules illustrated as separated components can or can not be physically separated, and the components illustrated as modules can or can not be physical modules, i.e., can be located in one place, or can be distributed to a plurality of network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.

[0126] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.

[0127] Although the present application has been described in detail by referring to the preferred embodiments thereof, it is to be understood that the present application is not limited to the embodiments described above. Rather, it should be appreciated that those skilled in the art, upon consideration of the disclosure, can make modifications and / or improvements to the embodiments of the application without deviating from the spirit and scope of the application. Any modifications and / or improvements made to the embodiments of the application by those skilled in the art are to be considered within the scope of the application.

Claims

1. A knowledge graph-based service resource recommendation method, characterized in that, The method comprises the following steps: obtaining historical behavior data of a target user, determining a first service object set frequently accessed by the target user based on the historical behavior data; calculating the similarity of the behavior data of the target user and other users, screening out an associated user set according to the similarity, and determining a second service object set frequently accessed by the associated user set based on the historical behavior data of the associated user set by using a collaborative filtering algorithm; mapping the service objects in the first service object set and the second service object set to corresponding service entity nodes in a pre-constructed knowledge graph based on a pre-defined semantic mapping rule or model; for each service entity node obtained by mapping, querying an associated entity node set having a pre-set type of association relationship with the service entity node from the knowledge graph; aggregating all service entity nodes and their associated entity node sets to form a candidate entity set, and outputting service resources corresponding to the candidate entity set as recommended content to the target user; mapping the service objects in the first service object set and the second service object set to corresponding service entity nodes in a pre-constructed knowledge graph based on a pre-defined semantic mapping rule or model, comprising: obtaining an entity set in the knowledge graph and a service set in the service resource library; using a pre-trained Chinese semantic understanding model to batch calculate the semantic similarity scores between entities and services; creating an entity-service mapping table to store entity ID, service ID and their semantic similarity scores; setting a similarity threshold, and writing entity-service pairs meeting the similarity threshold into the mapping table; periodically updating the mapping table content through a database batch writing mechanism; querying service entity nodes having a mapping relationship with the services in the first service object set and the second service object set from the entity-service mapping table; The method further comprises: Identify the newly added services in the knowledge graph that are not mapped, and save the newly added services to the set of services to be mapped Q = {q1, q2,..., q n}; For each service q in Q i , encode the service name and description text into a feature vector v i using a pre-trained text encoding model; i retrieve the Top-K knowledge graph entities with the highest similarity to v i through a pre-built vector index; retain the entities in the Top-K knowledge graph entities with a cosine similarity greater than a pre-set standard threshold to generate a candidate entity set C i ; Service q i With C i Bulk insert the mapping relationship between the service q and the entity in the database mapping table, and perform a conflict update strategy: when the primary key conflicts, update the entity ID and the similarity field; refresh the entity mapping data of the corresponding service in the cache server in real time. reconstructing the knowledge graph entity vector index in a fixed period, and supporting incremental addition of new entity vectors to the index.

2. The method of claim 1, wherein, obtaining historical behavior data of a target user, determining a first service object set frequently accessed by the target user based on the historical behavior data, comprising: reading user access interface logs generated by Nginx, removing redundant and invalid data in the logs, and screening out log entries related to service mall access; filling in a pre-set identifier for missing fields in the log entries, and storing the log data in JSON format, wherein the log data in JSON format at least includes timestamp, user IP and user request behavior fields; reading the log data in JSON format and performing an associated query on a user login table; the user login table at least includes username and login IP fields; by matching the user IP field in the log data in JSON format with the login IP field in the user login table, a corresponding relationship between the username and the user IP and the user request behavior is established; parsing the service resource identifier in the user request behavior, and performing an associated query on a service mall table, wherein the service mall table at least includes the mapping relationship between the service resource identifier and the service resource details; based on the parsing result, a corresponding relationship between the username and the browsed service resources is generated; According to the correspondence between the user name and the browsed service resources, a user-service interaction matrix is constructed, in which the user is taken as the row index, the service resource is taken as the column index, and the matrix element value is the cumulative browsing times of the corresponding user to the service resource; Screening service resources with element values reaching a set element threshold, and saving the screened service resources to a first service object set.

3. The method of claim 1, wherein, Obtaining historical behavior data of a target user, and determining a first service object set frequently accessed by the target user based on the historical behavior data, including: Collecting interaction behavior data of the target user, the interaction behavior at least including clicking, collecting and consulting service resources; generating a user behavior sequence in time sequence, each behavior record containing a behavior type, a service resource identifier and a timestamp; Assigning a preset weight to different behavior types, and generating an initial weight of a behavior record based on the behavior type contained in the behavior record and the preset weight; For each behavior record in the behavior sequence, calculating a time decay factor based on the timestamp, and adjusting the initial weight of the behavior record according to the time decay factor to obtain a dynamic weight of the behavior record; According to the dynamic weight of each behavior record, the dynamic weight sum of each type of service resource identifier is calculated; Screening target service resource identifiers with dynamic weight sums reaching a preset threshold, and saving the service resources corresponding to the target service resource identifiers to the first service object set.

4. The method of claim 2, wherein, Calculating the behavior data similarity between the target user and other users, and screening an associated user set according to the similarity, including: Calculating the similarity between the user-service interaction matrix of the target user and the user-service interaction matrix of other users; Saving the users with a similarity reaching a preset similarity threshold and the corresponding user-service interaction matrix to the associated user set.

5. The method of claim 1, wherein, For each service entity node obtained by mapping, querying an associated entity node set with a preset type of association relationship from the knowledge graph, including: Taking the service entity triggered by the user behavior as a root node, independently querying its association relationship in the knowledge graph to obtain a triple, the triple including a head entity, a relationship type, a relationship strength and a tail entity; Starting from the root node, propagating along the knowledge graph path for N layers (N≥1), and expanding the associated entity set layer by layer; dynamically setting the propagation depth N: when the number of user historical behaviors is lower than a threshold, setting N≥3; when the number of user historical behaviors is higher than the threshold, setting N≤2; recording the path depth n and the path relationship strength weight during each layer of propagation; For adjacent entity pairs in the propagation path, a pre-trained semantic encoding model is used to generate feature vectors of entity texts respectively; the cosine similarity of adjacent entity vectors is calculated; if the cosine similarity reaches a set threshold, the path jump is retained, otherwise the path is removed; For multiple propagation paths reaching the same target entity, the weight of each propagation path is calculated according to the single relationship strength in the path, and the sum of the weights of all propagation paths is set as the recommendation weight of the target entity; Arranging the multiple target entities in descending order of the recommendation weight. 6.A knowledge graph based service resource recommendation system, characterized in that, Including: The first obtaining module is configured to obtain historical behavior data of a target user, and determine a first service object set frequently accessed by the target user based on the historical behavior data. The second obtaining module is configured to calculate a behavior data similarity between the target user and other users, filter out an associated user set according to the similarity, and determine a second service object set frequently accessed by the associated user set based on historical behavior data of the associated user set by using a collaborative filtering algorithm. The semantic mapping module is configured to map service objects in the first service object set and the second service object set to corresponding service entity nodes in a pre-constructed knowledge graph based on a predefined semantic mapping rule or model. The graph query module is configured to query, for each service entity node obtained by mapping, an associated entity node set having a preset type of association relationship with the service entity node from the knowledge graph. The resource recommendation module is configured to aggregate all service entity nodes and their associated entity node sets to form a candidate entity set, and output service resources corresponding to the candidate entity set as recommendation content to the target user. Mapping the service objects in the first service object set and the second service object set to corresponding service entity nodes in a pre-constructed knowledge graph based on a predefined semantic mapping rule or model comprises: Obtaining an entity set in the knowledge graph and a service set in a service resource library; Using a pre-trained Chinese semantic understanding model to batch calculate semantic similarity scores between entities and services; Creating an entity-service mapping table to store entity IDs, service IDs, and their semantic similarity scores; setting a similarity threshold, and writing entity-service pairs that meet the similarity threshold into the mapping table; periodically updating the mapping table content through a database batch writing mechanism; Querying, from the entity-service mapping table, service entity nodes having a mapping relationship with services in the first service object set and the second service object set; Further comprising: Identify the newly added services in the knowledge graph that are not mapped, and save the newly added services to the set of services to be mapped Q = {q1, q2,..., q n}; For each service q in Q i , encode the service name and description text into a feature vector v i using a pre-trained text encoding model; i retrieve the Top-K knowledge graph entities with the highest similarity to v i through a pre-built vector index; retain the entities in the Top-K knowledge graph entities with a cosine similarity greater than a pre-set standard threshold to generate a candidate entity set C i ; Service q i With C i Bulk insert mapping relationship between service q and entity in database mapping table, execute conflict update strategy: update entity ID and similarity field when primary key conflicts; refresh entity mapping data of corresponding service in cache server in real time; Reconstructing knowledge graph entity vector indexes at a fixed period to support incremental addition of new entity vectors to the indexes. 7.A knowledge graph based service resource recommendation device, characterized in that, Comprise: A memory configured to store a knowledge graph-based service resource recommendation program; A processor configured to implement the steps of the knowledge graph-based service resource recommendation method of any one of claims 1-5 when executing the knowledge graph-based service resource recommendation program.

8. A computer readable medium having stored thereon a computer program, characterized in that, The readable medium stores a knowledge graph-based service resource recommendation program, and the knowledge graph-based service resource recommendation program implements the steps of the knowledge graph-based service resource recommendation method of any one of claims 1-5 when executed by the processor.

Citation Information

Patent Citations

  • Commodity personalized recommendation method and system based on knowledge graph

    CN114723528A

  • Service recommendation method based on knowledge graph

    CN116108229A