Cross-library linkage method, device and electronic equipment
By using a cross-repository linkage method, we can listen to repository events, determine the reference relationships and categories of the target repository, and select an appropriate processing method for linkage. This solves the timeliness and accuracy problems of cross-repository linkage in existing technologies and achieves efficient and accurate linkage between repository resources.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 特赞(上海)信息科技有限公司
- Filing Date
- 2026-02-26
- Publication Date
- 2026-06-12
Smart Images

Figure CN122195997A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data synchronization technology, and more specifically, to a cross-database linkage method, apparatus, and electronic device. Background Technology
[0002] In enterprise operations, much data is used across multiple business scenarios. For example, a company's product information is used not only in the sales department's sales database but also in the marketing department's market research report database and the customer service department's knowledge base. Furthermore, the product database references the resource database (products in the product database use images, videos, and other resources from the resource database), the marketing content database references the celebrity database (marketing content references artist information from the celebrity database), the product database references the recipe database (seasoning products in the product database reference recipes from the recipe database), and the social media content database references the product database (social media content references product information). If each business database stores a complete set of product information separately, it will result in significant data redundancy, occupy a large amount of storage space, and increase data maintenance costs. Therefore, enterprise-level content management systems typically establish content referencing relationships between different business databases, allowing different databases to share the same product information and avoid duplicate storage. However, when content referencing relationships exist between resource databases, when the content of the source database (the referenced database) changes, all target databases referencing that content need to be updated synchronously.
[0003] Existing technologies typically employ several linkage methods, including manual linkage, scheduled batch linkage, database triggers, and message queues. Manual and scheduled batch linkage suffer from latency issues. Database triggers are difficult to use across databases, and require trigger modification when linkage rules change. Message queues struggle to determine the actual changes and require maintaining reference relationships in each database, resulting in high maintenance costs. Therefore, further optimization of linkage methods is crucial to improving the timeliness and accuracy of linkage between resource repositories.
[0004] There is currently no effective solution to the aforementioned problems with existing linkage methods. Summary of the Invention
[0005] The main objective of this application is to provide a cross-database linkage method, apparatus, and electronic device to improve the timeliness and accuracy of linkage between resource databases and further optimize the linkage method.
[0006] To achieve the above objectives, one aspect of this application proposes a cross-library linkage method, comprising: receiving a cross-library linkage request; obtaining reference identifiers of multiple reference resource libraries based on the cross-library linkage request; performing event listening on multiple reference resource libraries based on the multiple reference identifiers, and, upon detecting a submission event corresponding to a target resource library, obtaining a linkage reference configuration file corresponding to the target resource library, wherein the target resource library is any reference resource library; determining the linkage reference relationship corresponding to the target resource library based on the linkage reference configuration file, and determining the target reference category corresponding to the target resource library based on the linkage reference relationship; determining a target linkage processing method based on the target reference category, and performing cross-library linkage based on the target linkage processing method.
[0007] According to another aspect of the embodiments of this application, a cross-library linkage device is also provided, comprising: a receiving unit, configured to receive a cross-library linkage request and obtain reference identifiers of multiple reference resource libraries based on the cross-library linkage request; a listening unit, configured to listen for events of multiple reference resource libraries based on the multiple reference identifiers, and, upon listening for a submission event corresponding to a target resource library, obtain a linkage reference configuration file corresponding to the target resource library, wherein the target resource library is any reference resource library; a determining unit, configured to determine the linkage reference relationship corresponding to the target resource library based on the linkage reference configuration file, and determine the target reference category corresponding to the target resource library based on the linkage reference relationship; and a linkage unit, configured to determine a target linkage processing method based on the target reference category, and perform cross-library linkage based on the target linkage processing method.
[0008] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, which stores computer instructions for causing a computer to perform the cross-library linkage method as described above.
[0009] According to another aspect of the embodiments of this application, an electronic device is also provided, the electronic device including: at least one processor, and a memory communicatively connected to the at least one processor; wherein, the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the at least one processor to perform the cross-library linkage method as described above.
[0010] In this application, the cross-database linkage method, device and electronic equipment described above are used to further optimize the linkage method and improve the timeliness and accuracy of linkage between resource databases. Attached Figure Description
[0011] The accompanying drawings, which form part of this application, are used to provide a further understanding of the application and to make other features, objects, and advantages of the application more apparent. The illustrative embodiments and descriptions of this application are used to explain the application and do not constitute an undue limitation of the application. In the drawings:
[0012] Figure 1 A schematic diagram of the hardware environment for an optional cross-library linkage method provided in this application; Figure 2 A flowchart of an optional cross-database linkage method provided for this application; Figure 3 A schematic diagram of an optional cross-library linkage reference relationship provided for this application; Figure 4 A schematic diagram of an optional resource library corresponding to this application. Figure 5 A flowchart of another optional cross-library linkage method provided for this application; Figure 6 A schematic diagram of an optional cross-warehouse linkage device provided for this application; Figure 7 A schematic diagram of an optional electronic device provided in this application. Detailed Implementation
[0013] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0014] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in any order other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus. Without conflict, the embodiments and features in the embodiments of this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0015] When content references exist between different business libraries, existing technologies typically employ the following solutions: 1. Manual synchronization: For example, if a product library references a material library, and the tags on materials stored in the material library are updated, operations staff need to manually search all product libraries that reference the material library, and then update the tags of the products referencing the corresponding materials in each product library. However, this method is inefficient (requires manual intervention, time-consuming and labor-intensive), prone to omissions (difficult to find all reference points), and untimely (delayed for several days or even no update); 2. Scheduled batch synchronization: For example, querying data from the material library whose update time is later than the last synchronization time every day at midnight, and updating the product tags, setting the product tags to XXX, provided that the material ID equals XXX; however, this method has poor real-time performance (maximum delay of 24 hours). 1) Waste of resources (full scan even if there are no changes), risk of conflict (may overwrite data manually modified by users); 2) Database triggers (automatic database updates), but this method has difficulties in cross-database operations (database triggers are difficult to operate across databases), performance issues (triggers are executed within transactions, affecting the performance of the main process), and poor flexibility (triggers need to be modified when rules change); 3) Message queues: for example, when the material is updated, an MQ message is sent, the product service consumes the message, and then finds all products that reference the material and updates them one by one, but this method is feasible for some resource libraries (but each resource library needs to implement the consumption logic separately), reference relationships are difficult to track (reference relationships need to be maintained in each resource library), and incremental updates are difficult (it is difficult to determine which fields have actually changed).
[0016] To address the issues of low timeliness and accuracy in traditional cross-database linkage methods, this application provides a cross-database linkage method, apparatus, and electronic device. As an optional embodiment, the aforementioned cross-database linkage method can be applied, but is not limited to, to applications such as... Figure 1 In the cross-database linkage system shown, consisting of terminal device 102 and server 104, as follows: Figure 1 As shown, terminal device 102 is connected to server 104 via network 110. Terminal device 102 also includes a display 106, a processor 108, and a memory 112. The display 106 can be used to display cross-database linkage processes, etc., the processor 108 can be used to process the collected data, and the memory 112 can be used to store relevant data. Server 104 includes a database 114 and a processing engine 116. The database 114 can be used to store data, models, etc., and the processing engine 116 is used to process the data.
[0017] In one aspect of this invention, the cross-database linkage system described above can further perform the following steps: First, the terminal device 102 executes as follows Figure 1 As shown in S102; then, server 104 executes as follows Figure 1As shown in S104 to S110, cross-database linkage is achieved. The cross-database linkage system (also known as the cross-database content linkage system) in this application can achieve the following: reference relationship management (unified recording and tracking of cross-database reference relationships), change detection (intelligent detection of actual changes (incremental) of tags and tag values on resources in the referenced resource library and the referenced resource library), automatic synchronization (automatic synchronization of all referenced resource libraries when the content of the referenced resource library changes), configurable rules (support for configuring which tags and tag values on resources need to be linked), multi-language support (support for linkage synchronization of multi-language content), and high performance (does not affect the performance of the main process and supports asynchronous processing).
[0018] In the above embodiments of the present invention, the cross-database linkage method described above can uniformly manage cross-database content reference relationships, intelligently detect actual changes in content fields, realize automatic synchronous updates of referenced content, support configurable linkage rules, and handle the linkage synchronization of multilingual content, thereby optimizing the linkage method and improving the timeliness and accuracy of linkage between resource databases.
[0019] As an alternative implementation method, please refer to Figure 2 The diagram illustrates a flowchart of a cross-library linkage method provided in an embodiment of this application. The method includes at least one of the following steps (S202 to S208): S202, receiving a cross-library linkage request and obtaining reference identifiers of multiple reference resource libraries based on the request; S204, performing event listening on multiple reference resource libraries based on the multiple reference identifiers, and obtaining a linkage reference configuration file corresponding to the target resource library when a commit event corresponding to the target resource library is detected, where the target resource library is any reference resource library; S206, determining the linkage reference relationship corresponding to the target resource library based on the linkage reference configuration file, and determining the target reference category corresponding to the target resource library based on the linkage reference relationship; S208, determining the target linkage processing method according to the target reference category, and performing cross-library linkage based on the target linkage processing method.
[0020] In S202 above, the reference resource library can be understood, but is not limited to, as the resource library to be monitored, which is the initial resource library that triggers the subsequent cross-library linkage process. The reference identifier refers to the identifier that uniquely identifies and locates a reference resource library within the system, such as the code or ID of the reference resource library. It should be noted that the resource library (reference resource library, target resource library, etc.) in this application is a library used to store, manage, and access unstructured data (such as images, videos, PDFs, etc.) after uploading resources such as images or videos in the system or webpage. The functions of the resource library include: file storage (saving uploaded files to server disks, object storage (such as AWS S3, Alibaba Cloud OSS), or distributed file systems (such as HDFS)), metadata management (recording structured information such as the name, size, type, upload time, path, thumbnail URL, etc. of the resource), access control (restricting user access permissions to files), version management (supporting historical version tracking of files), and search and classification (quickly locating files through tags, keywords, or directory structure).
[0021] In S204 above, event listeners are used to listen for events based on the listener event type corresponding to the reference identifier. It should be noted that when a resource repository is created, the system configures listener events based on the resource repository's reference relationships. By pre-configuring listener events, the system can decouple the listening logic from the resource repository's reference relationships, achieving proactive and precise capture of commit events. A commit event refers to a specific operation that triggers a cross-repository linkage process, specifically including commit events from the referenced repository and confirmation operation events (such as confirmation of deletion events, confirmation of modification events, etc.) for resources within the referencing repository. The linkage reference configuration file contains the relevant linkage reference relationships of the target resource repository. In S206 above, the target reference category refers to the category to which the target resource repository belongs in the linkage reference relationship, including: the target resource repository belongs to the referencing repository (referencing other resource repositories), the target resource repository belongs to the referenced repository (referencing by other resource repositories), and the target resource repository belongs to both the referencing and referenced repositories (referencing and being referenced by other resource repositories). In S208 above, the target linkage processing method refers to the processing method corresponding to the target linkage reference category.
[0022] It should be noted that the above-mentioned linked reference configuration file can consist of a multi-layered architecture. Each layer can be understood as, but is not limited to, a configuration sub-file. The configuration sub-file can be a database table file, or a Word or Excel file; this application does not impose any limitations. For example, the linked reference configuration file includes: Configuration Layer: nebula_library_process_config; processType: tag_linkage_update / delete (defining the processing type as "tag linked update / delete") positionCodes (linkage field list) extraInfo.targetLibraryList (target library list); Reference Layer: nebula_content_refer_record; content_id (target content ID) refer_content_id (source content ID (referenced)); refer_library_type (source library type); position_code (reference position); Change Detection Layer (ChangeDe... `ContentLabelLinkageWrapper.buildNeedUpdateAttrs()` (compares oldContentJSON and newContentJSON to detect field-level changes; supports multi-language comparison); `EventHandlerLayer`: `TagLinkageUpdateProcessHandler` (listens for content update events; queries reference relationships; synchronously updates target content); `TagLinkageDeleteProcessHandler` (listens for content deletion events; clears reference fields in target content); `SyncExecutionLayer`: `ContentUpdateAttrService.updateMetadataInfo()` (batch updates target content; synchronously indexes to ES).
[0023] The resource repositories with reference relationships include those requiring linkage and those not requiring linkage. The configuration layer can define whether linkage is needed based on business requirements. Linkage relationships include linkage between multiple repositories and linkage between specific resources (such as linkage between tags or tag values). Linkage reference relationships include, but are not limited to, one-to-one, one-to-many, many-to-one, and many-to-many reference relationships. The reference relationship layer can accurately locate resource repositories and their content. When a resource repository or content is created, the relevant reference relationships are saved to obtain a linkage reference configuration file, which includes, but is not limited to, database tables and database views. The change detection layer can detect specific changes, and detection methods include, but are not limited to, comparing JSON data (such as differences in ingredients for the same recipe in different regions, or price differences for the same product in different regions). This application's change detection layer supports comparison in multi-language environments. The event handling layer can listen to and query reference relationships in the reference resource repository, while the synchronous execution layer can achieve the final cross-repository linkage and synchronously index it to ES (Elasticsearch, an open-source distributed search and analysis engine), ensuring real-time and accurate cross-repository linkage.
[0024] In addition, with Figure 3 Taking the linked referencing relationships of product-related resource libraries as an example, if resources in the product library are referenced by the social media content library, e-commerce platform library, and customer service knowledge library, and resources in the e-commerce platform library are referenced by the inventory planning library and user profile library, then the target referencing category for the product library is the referenced library; the target referencing categories for the social media content library, customer service knowledge library, inventory planning library, and user profile library are the referencing libraries; and the target referencing categories for the e-commerce platform library are both the referenced library and the referencing library.
[0025] Through the above-described embodiments of this application, the cross-database linkage method described above can optimize the linkage method and improve the timeliness and accuracy of linkage between resource databases.
[0026] As an optional implementation, the target linkage processing method is determined according to the target reference category, including: S1, when the target reference category indicates that the target resource library is a referenced library, a referenced library, and a reference library, the target linkage processing method is determined to be a first linkage processing method; S2, when the target reference category indicates that the target resource library is a reference library, the target linkage processing method is determined to be a second linkage processing method.
[0027] In S1 above, the referenced library (source library) is the provider of the resource, and the referencing library is the referencer of the resource. The referencing library can reference resources (such as images, standard text, configuration parameters, etc.) in the referenced library without needing to save them repeatedly. The first linkage processing method is used to instruct that when the target resource library changes, the target resource library and its corresponding referencing library should be updated. In S2 above, the second linkage processing method is to retrieve the latest resources from the referenced library referenced by the target resource library to update the target resource library when the target resource library changes.
[0028] S1 above enables changes to the target resource repository to be automatically and accurately propagated to the corresponding referencing libraries, achieving batch synchronization, improving change efficiency, and preventing omissions. S2 above allows the target resource repository to proactively retrieve the latest resources from the referenced libraries when changes occur, ensuring resource timeliness and consistency. Through the operations of S1-S2 above, a mechanism is constructed that automatically selects different linkage strategies based on the category of the target resource repository in the reference relationship, achieving precise and efficient targeted synchronization and improving the efficiency of linkage between resource repositories.
[0029] As an optional implementation method, the above-mentioned cross-library linkage based on the target linkage processing method includes: S1-1, when the target linkage processing method is the first linkage processing method, performing resource change detection on the target resource library to obtain the first resource change information; S1-2, determining the reference library and reference resource information corresponding to the target resource library according to the linkage reference configuration file; S1-3, performing resource linkage update on the reference resources in the reference library according to the first resource change information and the reference resource information.
[0030] In S1-1 above, the first linkage processing method indicates the change situation when the target resource library is the referenced library, the referenced library, and the referencing library. This includes both cases where resource changes have actually occurred and cases where resource changes have not actually occurred. If resource changes have actually occurred, subsequent operations are required.
[0031] In S1-2 above, the referenced resource information is used to accurately indicate all referenced libraries corresponding to the target resource library, and there can be one or more referenced libraries. In S1-3 above, the referenced resources are precisely updated in a targeted manner through the first resource change information and the referenced resource information.
[0032] Through S1-1 to S1-3 above, the system combines the first resource change information with the referenced resource information for cases where the target resource library is a referenced library, a referenced library, and a referencing library. This avoids inefficient full updates and significantly improves the efficiency and accuracy of cross-library linkage. The following example of deletion linkage will further illustrate this: Scenario description: An image (ID=201) is deleted from the material library. This image is referenced by 10 products. The system automatically removes the references to this image from the products.
[0033] Step 1: Delete the image Java (Logical Deletion); NebulaContentPO material = contentService.getById(201) material.setStatus(1) (marks it as deleted) contentService.updateById(material) (saves it back to the database).
[0034] Step 2: Trigger deletion linkage Java (delete linkage); TagLinkageDeleteProcessHandlerhandler = handlerMap.get("tag_linkage_delete"); (find the tag linkage delete handler and assign it to handler) handler.submitProcess(201, (image ID "DELETE") bindProcessInfo, (guide linkage process) oldContentJSON, (before the change); params); Step 3: Remove references from the product Java (querying reference relationships); List <long>productIds = [101, 102, ..., 110]; (Batch clear) for (NebulaContentPO product : products) {JSONObject contentInfo =JSON.parseObject(product.getContentInfo()) (Iterate through all languages) for (String lang :product.getContentLanguages()){JSONObject langData =contentInfo.getJSONObject(lang); (Remove referenced fields) langData.remove("cover_image"); (Clear the cover image field)}product.setContentInfo(contentInfo.toJSONString());} contentService.updateBatchById(products); Through the above steps, the system automatically cleared image references in 10 products, and the data consistency was 100%, ultimately avoiding dangling references and ensuring the accuracy and efficiency of cross-database linkage.
[0035] As an optional implementation, the above-mentioned resource linkage update of referenced resources in the reference library based on the first resource change information and referenced resource information includes: S1-3-1, Obtain the first language set corresponding to the target resource library and the second language set corresponding to the reference library. The first language set includes at least the target main language corresponding to the target resource library, and the second language set includes at least the reference main language corresponding to the reference library. S1-3-2, Determine the change tag and / or change tag value corresponding to each supported language of the target resource library based on the first resource change information. S1-3-3, Perform language matching on the first language set and the second language set, and perform resource linkage update on the reference resources in the reference library based on the language matching results, change tags and / or change tag values.
[0036] In the above S1-3-1, the first language set refers to the set of all languages supported by the target resource library; the second language set refers to the set of all languages supported by the reference library; the target main language refers to a specific language in the first language set, such as the default language of the target resource library; the reference main language refers to a specific language in the second language set, such as the default language of the reference library. In the above S1-3-2, the change tag refers to the tag that has changed (such as added, deleted, or modified) in the submission event, that is, the change of the resource identifier; the change tag value refers to the specific content that has changed, that is, the change of the resource content. In the above S1-3-2, language matching refers to the operation of comparing the first language set and the second language set to find the common languages in the two sets.
[0037] Take Figure 4 For example, for multiple tags of the resources corresponding to a certain product shown below, the resource tags are divided into three categories: product version, release region, and release language. Each category corresponds to multiple sub-tags (such as version A, version B, etc.). The tag values include but are not limited to: product copywriting, visual materials, analysis reports, etc. Taking the change of tag values in different language environments as an example: A company developed an office software mainly for the Chinese and North American markets. The interface text quotes the content of the company's global standard copywriting library. Among them, the company's global standard copywriting library is the referenced library, which is used to store the standard text descriptions of all the company's software, and the reference library is the resource library of this office software project. The referenced library (the company's global standard copywriting library) supports three languages, that is, the first language set is: {Chinese, English, Japanese}, among which, Chinese is the target main language; the reference library (the resource library of this office software project) supports two languages, that is, the second language set is {Chinese, English}, among which, English is the reference main language. When the resource welcome_message (welcome information) is updated in the company's global standard copywriting library: Before the change: The Chinese (tag value) of welcome_message (tag) is: "Welcome to use our product"; the English (tag value) of welcome_message is: "Welcome to our product"; the Japanese (tag value) of welcome_message is: "当社の製品へようこそ".
[0038] After the change: The Chinese is changed to: "Welcome to use our excellent product"; the English is changed to: "Welcome to our excellent product"; the Japanese is changed to: "当社の優れた製品へようこそ".
[0039] The system determines the change of the above tag value according to the first resource change information, and then performs language matching on the first language set and the second language set, and the language matching result is {Chinese, English}. Therefore, the new tag values in Chinese and English are synchronized to the office software project resource library (reference library) to achieve linkage update. In addition, the system can also implement the differences of corresponding contents in different languages according to the changes of tags or tag values in specific languages. For example, for the same recipe originally, peppers are added to the recipe corresponding to Chinese (change of tag value), while the recipes corresponding to other languages remain unchanged. Therefore, the system realizes the precision and intelligence of cross-library linkage in a multi-language scenario through the above S1-3-1 to S1-3-3, avoids ineffective linkage (such as the linkage change of Japanese in the "office software" example), avoids waste of resources, and improves the efficiency of cross-library linkage. It should be noted that in addition to the cross-library linkage for different language environments, this application can also be used for cross-library linkage with differences (such as different tags and tag values) for different regions and different versions of products.
[0040] The following further illustrates the process of the system realizing cross-library linkage under multi-language conditions with the linkage of the marketing content library: Scenario description: The artist information (ID=301) in the star library supports Chinese, English and Japanese; there are 5 marketing activities in the marketing content library that reference this artist. When the operator updates the artist tags, the system needs to automatically synchronize and handle language matching.
[0041] Step 1: Update of artist information: JSON / / Content in the star library (ID=301) {"primaryLanguage":"zh_CN","contentLanguages":["zh_CN","en_US","ja_JP"],"contentInfo":{"zh_CN":{"name":["Jay Chou"],"tags":["Singer","Actor","Director"] / / Newly added "Director"},"en_US":{"name":["JayChou"],"tags":["Singer","Actor","Director"]},"ja_JP":{"name":["ジェイ チョウ"],"tags":["歌手","俳優","監督"]}}} Step 2: Query the referenced marketing content: Marketing content IDs: [401,402,403,404,405]; 401,402: Support [zh_CN,en_US]; 403,404: Only support [zh_CN]; 405: Support [en_US,es_ES] / / Spanish.
[0042] Step 3: Language matching and synchronization Java / / Marketing Content 401 (Supports Chinese and English) {"zh_CN":{"tags":["singer","actor","director"] / / Matching, using zh_CN data },"en_US":{"tags":["Singer","Actor","Director"] / / Matching, using en_US data}} / / Marketing content 403 (Chinese only) {"zh_CN":{"tags":["Singer","Actor","Director"] / / Matching, using zh_CN data}} / / Marketing content 405 (Supports English + Spanish) {"en_US":{"tags":["Singer","Actor","Director"] / / Matching, using en_US data}, "es_ES":{"tags":["singer","actor","director"] / / mismatch, use the main language zh_CN data}} In this scenario, the system uses the corresponding language data when the languages match, and uses the main language data when the languages do not match, thus ensuring that all languages have corresponding data and preventing omissions.
[0043] As an optional implementation method, the above-mentioned cross-library linkage based on the target linkage processing method includes: S2-1, when the target linkage processing method is the second linkage processing method, performing resource change detection on the target resource library to obtain second resource change information; S2-2, determining the referenced library and referenced resource information corresponding to the target resource library based on the second resource change information and the linkage reference configuration file; S2-3, obtaining the referenced resource from the referenced library based on the referenced resource information, so as to perform resource linkage update on the referenced resources in the target resource library based on the referenced resource.
[0044] In S2-1 above, the second linkage processing method indicates the change situation when the target resource library is a reference library. In S2-2 above, the changed resources that need to be re-acquired are determined based on the changed resources in the target resource library and the linkage reference configuration file. The referenced resource information is used to indicate the referenced library and referenced resource information (including tag reference relationships and tag value reference relationships) corresponding to the target resource library. Through S2-3 above, the system can retrieve the latest changed resources from the referenced library and display them when the referenced library changes. Through S2-1 to S2-3, the system solves the problem of how to ensure that the external resources it references are the latest version when the referenced library itself changes, thereby realizing self-updating when the referenced library changes and ensuring resource timeliness, thus improving the efficiency and accuracy of cross-library linkage.
[0045] As an optional implementation, the above-described resource change detection of the target resource library to obtain resource change information includes: S1, obtaining first JSON data and second JSON data of the target resource library, wherein the first JSON data is the JSON data before the submission event is detected, and the second JSON data is the JSON data after the submission event is detected; S2, performing data matching on the first JSON data and the second JSON data to obtain a data matching result; S3, if the data matching result indicates that the first JSON data and the second JSON data do not match, obtaining data mismatch information and adding the data mismatch information to a pre-created resource change list to obtain resource change information.
[0046] In S1 above, JSON data is used to save all resources (such as tags, tag values, configurations, etc.) in the target resource library in a structured manner. In S2 above, by matching the first JSON data and the second JSON data, all differences between the first JSON data and the second JSON data can be found. In S3 above, the data mismatch information between the first JSON data and the second JSON data indicates the changed resources. Taking the tag linkage of the product library as an example, the above data matching and cross-library linkage process is further explained: Scenario description: There is a product image (ID=201) in the material library, which is referenced by 10 products. The operations staff updates the image's tags: ["Electronic Products", "Smartphones"] → ["Electronic Products", "Smartphones", "5G"]. The system needs to automatically synchronize the new tags to all products that reference the image. Step 1: Configure linkage rules: The administrator configures in the backend: JSON{"libraryType":"material_library","contentType":"image","processType":"tag_linkage_update","positionCodes":["tags","category"],"extraInfo":{"targetLibraryList":["product_cloud"]}} / / Monitors all resource libraries of type material_library. When any image resource's tags or category field changes and is submitted, the 'tag-linkage update' process is automatically started, accurately synchronizing the change to the target resource library product_cloud.
[0047] Step 2: Operations staff edit the image (ID=201): Old tags: ["Electronic Products", "Smartphones"] New tags: ["Electronic Products", "Smartphones", "5G"] Step 3: System automatically triggers linkage: Java / / 1. Save image update NebulaContentPOmaterial = contentService.getById(201); String oldContentInfo = material.getContentInfo(); / / Save old value material.setContentInfo(newContentInfo);contentService.updateById(material); / / Trigger linkage event JSONObjectoldContentJSON=JSON.parseObject(oldContentInfo);JSONObjectnewContentJSON=JSON.parseObject(newContentInfo); / / Parse JSON TagLinkageUpdateProcessHandlerhandler=handlerMap.get("tag_linkage_update");handler.submitProcess(201, / / Picture ID "UPDATE", bindProcessInfo, (configuration operation) oldContentJSON, (before update) params (other control parameters)); Step 4: Detect field changes: Java / / Compare tags field / / Old: ["Electronic Products", "Smartphones"] / / New: ["Electronic Products", "Smartphones", "5G"] / / Result: Changes have occurred List <string>needUpdateAttrs=["tags"]; / / Only tags change Step 5: Query reference relationships SQLSELECT content_id / / Select the content_id field FROM nebula_content_refer_record / / Query from the data table named nebula_content_refer_record WHERErefer_content_id=201 (the referenced library ID is 201) AND status=0; Result: [101, 102, 103, ..., 110] / / 10 products Step 6: Batch update products for(LongproductId:[101,102,...,110]){NebulaContentPOproduct=contentService.getById(productId);JSONObjectcontentInfo=JSON.parseObject(product.getContentInfo()); / / Update tags for all languages for(String lang:product.getContentLanguages()){JSONObject langData=contentInfo.getJSONObject(lang);langData.put("tags",["electronic products","smartphones","5G"]); }product.setContentInfo(contentInfo.toJSONString());contentService.updateById(product);} / / Modify the multilingual resource content of a specific product (product). Step 7: Synchronize the index Java (synchronizing to ES) contentIndexService.updateIndexSync([101,102,...,110]); / / After the database update is complete, immediately and synchronously update the index of the corresponding record in the search engine (such as Elasticsearch).
[0048] Combination Figure 5 The system analyzes the tag linkage of the product library. After configuring the linkage rules in the system (step 1), when the operator updates the tags (step 2), the system listens for the submission event (step 3) and determines the linkage reference relationship through the linkage reference configuration file. It clarifies that the target reference category of the target resource library is "referenced library". The system identifies the field changes through resource change detection and obtains the first resource change information (step 4). Then, it determines the reference library and reference resource information (step 5) and finally realizes the linkage update of resources (steps 6 and 7). Through the above operations, the system can automatically update 10 products with only 1 operation, with a time of less than 2 seconds and 100% data consistency.
[0049] As can be seen from the example of tag linkage in the product library above, by using S1-S3, the entire system can not only listen to the submission event, but also accurately know the specific location and content of the change, thereby obtaining accurate resource change information, providing a foundation for cross-database linkage operations, and ensuring that the entire cross-database linkage solution can run efficiently and accurately.
[0050] It should also be noted that the system can set different comparison strategies for different types of fields, as shown in Table 1 below:
[0051] Table 1 As an optional implementation, the above cross-database linkage method further includes the following steps before receiving the cross-database linkage request: S1, obtaining the database creation information of multiple reference resource databases; S2, parsing the reference relationships of the database creation information to obtain reference relationship information; and S3, mapping the reference relationship information to a pre-created linkage reference configuration file.
[0052] In S1-S2 above, the database creation information includes the basic resources of the resource database (such as unique identifiers and names) and the reference relationships between each resource database and external resource databases. In S3, the system obtains a linked reference configuration file containing the reference relationships between all resource databases through the mapping of reference relationship information. The model establishment of the reference relationships and the records of the reference relationships include: SQL content reference relationship table CREATETABLE `nebula_content_refer_record`(id `bigintPRIMARYKEYAUTO_INCREMENT, content_id`bigintNOTNULLCOMMENT'Target content ID (referring to)', position_code`varchar(50)NOTNULLCOMMENT'Reference position (field code)', refer_content_id`bigintNOTNULLCOMMENT'Source content ID (the one being referenced)', refer_library_type`varchar(20)NOTNULLCOMMENT'Source library type', status`tinyintNOTNULLDEFAULT0COMMENT'Status: 0 - Normal; 1 - Deleted', create_user`bigintNOTNULL,create_time`datetimeNOTNULL,update_user`bigintNOTNULL,update_time`datetimeNOTNULL,KEY`idx_content_id`( `content_id`),KEY`idx_refer_content_id`(`refer_content_id`),KEY`idx_refer_library_type`(`refer_library_type`))COMMENT='Content reference relationship table'; / / Modeling of reference relationships Java / Record reference relationships when saving content / @TransactionalpublicLongcreateContent(ContentCreateReqreq){ / / 1. Save the content NebulaContentPOcontent=buildContent(req);contentService.save(content); / / 2. Resolve reference relationships (extract from content_info) List <contentreference>references=parseReferences(req.getContentInfo()); / / 3. Batch save reference relationships for(ContentReferenceref:references){ NebulaContentReferRecordPOrecord=new;NebulaContentReferRecordPO();;record.setContentId(content.getId()); / / Target content record.setPositionCode(ref.getPositionCode()); / / Reference field record.setReferContentId(ref.getReferContentId()); / / Source content record.setReferLibraryType(ref.getReferLibraryType()); record.setStatus(0);referRecordService.save(record);}returncontent.getId();} / References in the parsed content / privateList <contentreference>parseReferences(JSONObjectcontentInfo){List <contentreference>references = new ArrayList<>(); / / Iterate through all languages for(String language: contentInfo.keySet()){JSONObject langData = contentInfo.getJSONObject(language); / / Iterate through all fields for(String attrCode:langData.keySet()){ Objectvalue = langData.get(attrCode); / / Check if it is a reference type field (inputType = 34, content selector) if(isReferenceField(attrCode) && value != null) { / / Extract the referenced content ID and library type.
[0053] List <contentreference>refs=extractReferences(attrCode,value);references.addAll(refs);}}}returnreferences;} As an optional implementation, the above-mentioned determination of the linkage reference relationship corresponding to the target resource library based on the linkage reference configuration file, and determination of the target reference category corresponding to the target resource library based on the linkage reference relationship, includes: S1, reading multiple configuration fields from the linkage reference configuration file; S2, determining the linkage reference relationship between each reference resource library corresponding to the target resource library based on the configuration field values corresponding to the multiple configuration fields; S3, determining the target reference category of the target resource library based on the multiple linkage reference relationships, wherein the target reference category is used to indicate whether the target resource library is a referencing library or a referenced library.
[0054] In S1-S3 above, the configuration field refers to the data item or attribute name (Key) in the linked reference configuration file used to define the reference relationship. It can indicate the structure of the configuration file, and the configuration field value refers to the specific data (Value) corresponding to the configuration field. Through S1-S3, the system can automatically extract information from the configuration file to determine the target reference category of the target resource library without manual judgment, thus improving the efficiency and accuracy of cross-library linkage. Through the above-described implementation method of this application, the cross-database linkage method is optimized, improving the timeliness and accuracy of linkage between resource databases. Specifically, this includes: real-time automatic synchronization (second-level), extremely low omission rate, good real-time performance, and low operation and maintenance costs; incremental synchronization: only updated fields that have changed, saving 80% of update operations; batch processing: updating multiple target contents at once, improving efficiency by 10 times; asynchronous execution: not affecting the main process performance, response time <100ms; precise tracking: accurate positioning through reference relationship tables, improving query efficiency by 20 times; configurable rules: supporting backend configuration of linkage fields and target databases; multi-language support: automatically handling the synchronization of multi-language content; bidirectional operation: supporting update linkage and deletion linkage; cross-database support: unlimited number of cross-database linkages; strong consistency: transaction guarantee, either all succeed or all fail; idempotency: repeated execution does not produce side effects; traceability: all linkage operations are logged.
[0055] According to another aspect of the present invention, a cross-database linkage apparatus for implementing the above-described cross-database linkage method is also provided, such as... Figure 6 As shown, the device includes: a receiving unit 602, configured to receive cross-database linkage requests and obtain reference identifiers of multiple reference resource libraries based on the cross-database linkage requests; a listening unit 604, configured to listen for events of multiple reference resource libraries based on the multiple reference identifiers, and, upon detecting a submission event corresponding to a target resource library, obtain a linkage reference configuration file corresponding to the target resource library, wherein the target resource library is any reference resource library; a determining unit 606, configured to determine the linkage reference relationship corresponding to the target resource library based on the linkage reference configuration file, and determine the target reference category corresponding to the target resource library based on the linkage reference relationship; and a linkage unit 608, configured to determine the target linkage processing method according to the target reference category, and perform cross-database linkage based on the target linkage processing method. The specific methods by which each unit performs its operations in this embodiment have been described in detail in the embodiments related to the method, and will not be elaborated further here.
[0056] According to another aspect of the present invention, an electronic device for implementing a cross-library linkage method is also provided, the electronic device being as follows: Figure 7 The terminal device or server shown. This embodiment uses this electronic device as an example for illustration. Figure 7 As shown, the electronic device includes: at least one processor 704; and a memory 702 communicatively connected to the at least one processor 704; wherein the memory 702 stores a computer program executable by the at least one processor 704, the computer program being executed by the at least one processor 704 to cause the at least one processor 704 to perform the steps in any of the above method embodiments. The electronic device may be located in at least one of a plurality of network devices in a computer network. The processor may be configured to execute a cross-library linkage method via a computer program.
[0057] Alternatively, as those skilled in the art will understand, Figure 7 The structure shown is for illustrative purposes only. Figure 7 This does not limit the structure of the aforementioned electronic devices. For example, electronic devices may also include components that are more... Figure 7 The more or fewer components shown (such as network interfaces, etc.) or having the same Figure 7 The different configurations shown.
[0058] The memory 702 can be used to store software programs and modules, such as the program instructions / modules corresponding to the cross-library linkage method and apparatus in this embodiment of the invention. The processor 704 executes various functional applications and data processing by running the software programs and modules stored in the memory 702, thereby realizing the aforementioned cross-library linkage method. The memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 702 may further include memory remotely located relative to the processor 704, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. As an example, such as... Figure 7 As shown, the memory 702 may include, but is not limited to, all the units in the cross-library linkage device. Furthermore, it may include, but is not limited to, other module units in the cross-library linkage device, which will not be elaborated upon in this example.
[0059] Optionally, the transmission device 706 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 706 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. Furthermore, the electronic device described above also includes a display 704 and a connection bus 710 for connecting the various module components within the electronic device.
[0060] Obviously, those skilled in the art should understand that the various units or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps into a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0061] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.< / contentreference> < / contentreference> < / contentreference> < / contentreference> < / string> < / long>
Claims
1. A cross-database collaboration method, characterized in that, include: Receive cross-database linkage requests and obtain reference identifiers for multiple reference resource libraries based on the cross-database linkage requests; Based on multiple reference identifiers, event listening is performed on multiple reference resource libraries, and when a submission event corresponding to a target resource library is detected, the linkage reference configuration file corresponding to the target resource library is obtained, wherein the target resource library is any of the reference resource libraries; The linkage reference relationship corresponding to the target resource library is determined based on the linkage reference configuration file, and the target reference category corresponding to the target resource library is determined based on the linkage reference relationship; The target linkage processing method is determined based on the target reference category, and cross-database linkage is performed based on the target linkage processing method.
2. The method according to claim 1, characterized in that, The target linkage processing method is determined based on the target reference category, including: When the target reference category indicates that the target resource library is a referenced library, a referenced library, and a referenced library, the target linkage processing method is determined to be the first linkage processing method; If the target reference category indicates that the target resource library is a reference library, the target linkage processing method is determined to be the second linkage processing method.
3. The method according to claim 2, characterized in that, Cross-database collaboration based on the aforementioned target collaboration processing method includes: When the target linkage processing method is the first linkage processing method, resource change detection is performed on the target resource library to obtain the first resource change information; The reference library and reference resource information corresponding to the target resource library are determined based on the linked reference configuration file. Based on the first resource change information and the referenced resource information, the referenced resources in the reference library are updated in a linked manner.
4. The method according to claim 2, characterized in that, Cross-database collaboration based on the aforementioned target collaboration processing method includes: When the target linkage processing method is the second linkage processing method, resource change detection is performed on the target resource library to obtain the second resource change information; Based on the second resource change information and the linked reference configuration file, determine the referenced library and referenced resource information corresponding to the target resource library; Based on the referenced resource information, the referenced resource is obtained from the referenced library, so as to perform resource linkage update on the referenced resources in the target resource library based on the referenced resource.
5. The method according to claim 4, characterized in that, The target resource library is subjected to resource change detection to obtain resource change information, including: Obtain the first JSON data and the second JSON data of the target resource library. The first JSON data is the JSON data before the submission event is detected, and the second JSON data is the JSON data after the submission event is detected. The first JSON data and the second JSON data are matched to obtain the matching result; If the data matching result indicates that the first JSON data and the second JSON data do not match, obtain the data mismatch information and add the data mismatch information to a pre-created resource change list to obtain the resource change information.
6. The method according to claim 3, characterized in that, Based on the first resource change information and the referenced resource information, the referenced resources in the reference library are updated in a linked manner, including: Obtain a first language set corresponding to the target resource library and a second language set corresponding to the reference library. The first language set includes at least the target main language corresponding to the target resource library, and the second language set includes at least the reference main language corresponding to the reference library. Based on the first resource change information, determine the change tag and / or change tag value corresponding to each supported language of the target resource library; The first language set and the second language set are matched, and the referenced resources in the reference library are updated in a linked manner according to the language matching results, the change tag and / or the change tag value.
7. The method according to claim 1, characterized in that, Before receiving cross-database linkage requests, it also includes: Obtain the database creation information of multiple reference resource libraries; The database creation information is parsed to obtain the reference relationship information; The reference relationship information is mapped to a pre-created linked reference configuration file.
8. The method according to claim 7, characterized in that, Based on the linked reference configuration file, the linked reference relationship corresponding to the target resource library is determined, and based on the linked reference relationship, the target reference category corresponding to the target resource library is determined, including: Read multiple configuration fields from the linked reference configuration file; The linkage and reference relationship between each reference resource library corresponding to the target resource library is determined based on the configuration field values corresponding to multiple configuration fields. The target reference category of the target resource library is determined based on multiple linked reference relationships, and the target reference category is used to indicate whether the target resource library is a referencing library or a referenced library.
9. A cross-warehouse linkage device, characterized in that, include: The receiving unit is used to receive cross-database linkage requests and obtain reference identifiers of multiple reference resource libraries based on the cross-database linkage requests. The listening unit is used to listen for events to multiple reference resource libraries based on multiple reference identifiers, and when a submission event corresponding to a target resource library is detected, obtain the linkage reference configuration file corresponding to the target resource library, wherein the target resource library is any of the reference resource libraries; The determining unit is used to determine the linkage reference relationship corresponding to the target resource library based on the linkage reference configuration file, and to determine the target reference category corresponding to the target resource library based on the linkage reference relationship; The linkage unit is used to determine the target linkage processing method according to the target reference category, and to perform cross-library linkage based on the target linkage processing method.
10. An electronic device, characterized in that, The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the at least one processor to perform the cross-library linkage method according to any one of claims 1-8.