Methods, devices, equipment, and media for managing configuration files
By setting a reference inheritance tag in the configuration file and replacing it with the property of the base class configuration file, the inefficiency and error-proneness of configuration file management in large-scale search systems are solved, achieving flexible and convenient configuration file management and reducing maintenance difficulty and resource consumption.
Patent Information
- Application Number
- CN202411945343.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2044-12-26
AI Technical Summary
In large-scale search and recommendation systems, configuration files are large and complex, which means that maintenance personnel have to repeatedly compare and repeat configuration operations when iterating configurations and updating functions, making them prone to errors and difficult to maintain.
By setting a reference inheritance tag in the configuration file and replacing the reference inheritance tag with the reference inheritance attribute in the base class configuration file it indicates after reading the configuration file, flexible and convenient management of the configuration file can be achieved.
It saves storage resources required for configuration files, improves the efficiency of system configuration updates, and reduces the difficulty of understanding, learning, and maintaining the system.
Smart Images

Figure CN119759449B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer software technology, particularly to the fields of software engineering, data modeling, and configuration management, and can be used in application scenarios such as generative search, intelligent document editing, intelligent assistants, virtual assistants, and intelligent e-commerce. Specifically, it relates to a configuration file management method, a configuration file management device, an electronic device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] In large-scale search and recommendation systems, configuration files are enormous and complex, often containing thousands or even tens of thousands of items. Traditionally, different application cases use configuration files independently, with many similarities and minor differences. This forces operations personnel to repeatedly compare and reconfigure files during configuration iterations and feature updates, which is not only inefficient but also prone to errors. Furthermore, when common characteristics change, the relationship between base classes and subclasses needs to be manually refactored, further increasing maintenance difficulty and costs.
[0003] The methods described in this section are not necessarily methods that had been previously conceived or adopted. Unless otherwise specified, no method described in this section should be assumed to be prior art simply because it is included in this section. Similarly, unless otherwise specified, the issues mentioned in this section should not be considered to be accepted in any prior art. Summary of the Invention
[0004] This disclosure provides a method for managing configuration files, a device for managing configuration files, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] According to one aspect of this disclosure, a method for managing configuration files is provided, comprising: reading a first configuration file, wherein the first configuration file includes a first reference inheritance tag, the value of the first reference inheritance tag indicating a first reference inheritance attribute in a first base class configuration file; obtaining the first reference inheritance attribute from the first base class configuration file based on the value of the first reference inheritance tag; and replacing the reference configuration tag in the first configuration file with the first reference inheritance attribute to obtain an expanded first configuration file.
[0006] According to another aspect of this disclosure, a configuration file management apparatus is provided, comprising: a reading unit configured to read a first configuration file, wherein the first configuration file includes a first reference inheritance tag, the value of which indicates a first reference inheritance attribute in a first base class configuration file; an obtaining unit configured to obtain the first reference inheritance attribute from the first base class configuration file based on the value of the first reference inheritance tag; and a first replacement unit configured to replace the reference configuration tag in the first configuration file with the first reference inheritance attribute to obtain an expanded first configuration file.
[0007] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods described above.
[0008] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform the above-described method.
[0009] According to another aspect of this disclosure, a computer program product is provided, including a computer program, wherein the computer program implements the above-described method when executed by a processor.
[0010] According to one or more embodiments of this disclosure, this disclosure saves the storage resources required for the configuration file and achieves flexible and convenient management of the configuration file by setting a reference inheritance tag in the configuration file and replacing the reference inheritance tag with the reference inheritance attribute in the base class configuration file it indicates after reading the configuration file.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0012] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0013] Figure 1 A schematic diagram of an exemplary system in which the various methods described herein may be implemented according to embodiments of the present disclosure is shown;
[0014] Figure 2 A flowchart illustrating a method for managing configuration files according to an embodiment of the present disclosure is shown;
[0015] Figure 3 A flowchart illustrating a method for managing configuration files according to an embodiment of the present disclosure is shown;
[0016] Figure 4 A schematic diagram of a reference inheritance tree according to an embodiment of the present disclosure is shown;
[0017] Figure 5A flowchart is shown illustrating the replacement of one or more attributes in a modified first configuration file with a second reference inheritance tag according to an embodiment of the present disclosure;
[0018] Figure 6 A flowchart illustrating a method for managing configuration files according to an embodiment of the present disclosure is shown;
[0019] Figure 7 A flowchart illustrating a method for managing configuration files according to an embodiment of the present disclosure is shown;
[0020] Figure 8 A flowchart illustrating the updating of reference inheritance properties in multiple base class configuration files according to embodiments of the present disclosure is shown;
[0021] Figure 9 A schematic diagram of the derivation relationship diagram according to embodiments of the present disclosure is shown;
[0022] Figures 10A-10C A schematic diagram of a reference inheritance tree and a derivation graph according to embodiments of the present disclosure is shown;
[0023] Figure 11 A structural block diagram of a configuration file management device according to an embodiment of the present disclosure is shown; and
[0024] Figure 12 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation
[0025] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0026] In this disclosure, unless otherwise stated, the use of terms such as "first," "second," etc., to describe various elements is not intended to limit the positional, temporal, or importance relationships of these elements; such terms are merely used to distinguish one element from another. In some examples, the first element and the second element may refer to the same instance of that element, while in other cases, based on the context, they may refer to different instances.
[0027] The terminology used in the description of the various examples described in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context explicitly indicates otherwise, an element may be one or more unless the number of elements is specifically limited. Furthermore, the term "and / or" as used in this disclosure covers any one of the listed items and all possible combinations thereof.
[0028] In related technologies, configuration files usually rely on manual processing, which is time-consuming and labor-intensive.
[0029] To solve the above problems, this disclosure sets a reference inheritance tag in the configuration file and replaces the reference inheritance tag with the reference inheritance attribute in the base class configuration file it indicates after reading the configuration file. This saves the storage resources required for the configuration file and realizes flexible and convenient management of the configuration file.
[0030] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0031] Figure 1 A schematic diagram of an exemplary system 100 in which the various methods and apparatus described herein can be implemented according to embodiments of this disclosure is shown. Reference Figure 1 The system 100 includes one or more client devices 101, 102, 103, 104, 105 and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105 and 106 can be configured to execute one or more applications.
[0032] In embodiments of this disclosure, server 120 may run one or more services or software applications that enable the execution of the methods of this disclosure.
[0033] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtual and virtual environments. In some embodiments, these services may be provided as web-based services or cloud services, such as to users of client devices 101, 102, 103, 104, 105, and / or 106 under a Software as a Service (SaaS) model.
[0034] exist Figure 1In the configuration shown, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or combinations thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 can sequentially interact with server 120 using one or more client applications to utilize the services provided by these components. It should be understood that various different system configurations are possible and may differ from system 100. Therefore, Figure 1 This is an example of a system used to implement the various methods described herein, and is not intended to be limiting.
[0035] Users can use client devices 101, 102, 103, 104, 105, and / or 106 for human-computer interaction. The client devices provide interfaces that enable users to interact with them. The client devices can also output information to the user through these interfaces. Although... Figure 1 Only six client devices are described, but those skilled in the art will understand that this disclosure can support any number of client devices.
[0036] Client devices 101, 102, 103, 104, 105, and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptops), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors, or other sensing devices. These computer devices can run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as Google Chrome OS); or include various mobile operating systems, such as Microsoft Windows Mobile OS, iOS, Windows Phone, and Android. Portable handheld devices may include cellular phones, smartphones, tablets, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Gaming systems may include various handheld gaming devices, internet-enabled gaming devices, etc. Client devices are capable of executing various applications, such as various internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and can use various communication protocols.
[0037] Network 110 can be any type of network well known to those skilled in the art, and can use any of a variety of available protocols (including but not limited to TCP / IP, SNA, IPX, etc.) to support data communication. By way of example only, one or more networks 110 can be a local area network (LAN), an Ethernet-based network, a token ring network, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.
[0038] Server 120 may include one or more general-purpose computers, special-purpose server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running a virtual operating system, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that can be virtualized to maintain virtual storage devices for servers). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0039] The computing unit in server 120 can run one or more operating systems, including any of the aforementioned operating systems and any commercially available server operating system. Server 120 can also run any of a variety of additional server applications and / or middleware applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0040] In some implementations, server 120 may include one or more applications to analyze and merge data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105 and / or 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105 and / or 106.
[0041] In some implementations, server 120 can be a server for a distributed system or a server integrated with blockchain. Server 120 can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Server (VPS) services, such as high management difficulty and weak business scalability.
[0042] System 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. Databases 130 may reside in various locations. For example, a database used by server 120 may be local to server 120, or it may be located away from server 120 and may communicate with server 120 via a network-based or dedicated connection. Databases 130 may be of different types. In some embodiments, the database used by server 120 may be, for example, a relational database. One or more of these databases may store, update, and retrieve data from and from the databases in response to commands.
[0043] In some embodiments, one or more of the databases 130 may also be used by an application to store application data. The databases used by the application may be of different types, such as key-value stores, object stores, or regular stores supported by a file system.
[0044] Figure 1 The system 100 can be configured and operated in various ways to enable the application of the various methods and apparatus described in this disclosure.
[0045] According to one aspect of this disclosure, a method for managing configuration files is provided. For example... Figure 2 As shown, the method includes: step S201, reading a first configuration file, wherein the first configuration file includes a first reference inheritance tag, and the value of the first reference inheritance tag indicates a first reference inheritance attribute in the first base class configuration file; step S202, obtaining the first reference inheritance attribute from the first base class configuration file based on the value of the first reference inheritance tag; and step S203, replacing the reference configuration tag in the first configuration file with the first reference inheritance attribute to obtain the expanded first configuration file.
[0046] Therefore, by setting a reference inheritance tag in the configuration file and replacing the reference inheritance tag with the reference inheritance attribute in the base class configuration file it indicates after reading the configuration file, the storage resources required for the configuration file are saved, and flexible and convenient management of the configuration file is achieved.
[0047] In an exemplary embodiment, in offline search database building operations, there is a scenario involving the construction and maintenance of multiple database types. A database type refers to a category of configuration files included in an index; these databases generally calculate the same features and use the same index building methods. In large-scale search applications, there are often hundreds of database types, with similarities and differences between them. Generally, different database types differ in at least one configuration, such as differences in feature calculation or local differences in index building methods. Maintaining hundreds of database types often requires careful comparison of all configuration items for two or more database types, making the characterization of differences between them a significant challenge. Furthermore, when performing feature upgrades, if a change is desired to take effect simultaneously on several database types, it is often necessary to repeatedly configure these database types, resulting in high complexity.
[0048] The configuration file management method proposed in this disclosure can better describe the similarities and differences between these libraries. When updating similarities, only one modification needs to be made, and all libraries will be affected simultaneously. Differences are readily apparent, allowing for a quick understanding of the differences between the various libraries. This improves the efficiency of search system operation, maintenance, and iteration.
[0049] In some embodiments, the configuration file management method proposed in this disclosure can be used for system configuration files, and can also be used for configuration files based on standard file protocols, such as JSON, protobuf, XML, YAML, etc. These standard file protocols generally have specifications describing basic data structures such as boolean values, numbers, strings, arrays, and objects. Various applications define specific protocols for system configuration based on these basic data structure specifications.
[0050] This disclosure will primarily use JSON as an example to illustrate the proposed configuration file management method, but it is not intended to limit the scope of protection of this disclosure. It is understood that implementations based on other protocols or custom protocols are all within the scope of protection of this disclosure. Furthermore, "configuration file" is intended to refer to a complete configuration description section, and not a specific computer file.
[0051] This disclosure will use $lref to refer to the inheritance tag and use terms such as base class and base to refer to the base class configuration file.
[0052] In some embodiments, most existing methods cannot directly characterize the differences between different configuration files. For example, if there are two services with different IPs but identical configurations, they would typically be described using JSON as follows:
[0053]
[0054] Service A and Service B have different IPs, but the ports and other information are the same, but they need to be described repeatedly.
[0055] Using the method proposed in this disclosure, the above example can be modified as follows:
[0056]
[0057]
[0058] In the example above, the reference inheritance tag `$lref` expresses the reference and inheritance relationship. Both A and B define their own base class configuration file `basic_service.json` that they will reference and inherit from. A and B only need to define the parts that differ from the base class configuration file. The common parts between A and B can be described in `basic_service.json`. In real-world business scenarios, these common configuration items can be numerous and complex. In some embodiments, a single library can have tens of thousands of configuration items. This reference inheritance method demonstrates significant value, improving the efficiency of system configuration updates and reducing the difficulty of understanding and maintaining the system.
[0059] In some embodiments, the reference inheritance tag $lref represents the concept of reference inheritance, and its format is defined as follows:
[0060] {"$lref":"dir / some_json_file.json#json-pointer"}
[0061] The value of the inherited reference tag $lref is taken from the content at the json-pointer position in the file dir / some_json_file.json, where:
[0062] ·dir is a directory prefix, and there can actually be multiple levels of directories;
[0063] • some_json_file.json is a valid JSON text file;
[0064] The json-pointer points to a specific location in the JSON file. The definition of json-pointer can be found in RFC 6901.
[0065] JSON has six basic data types: boolean, number, string, null, array, and object. Among them, boolean, number, string, and null are single-value types; object and array are composite types, and their internal basic elements are still the six basic data types of JSON.
[0066] When the json-pointer in the $lref tag points to a single-value type or array type, it means "reference", that is, its value cannot be modified.
[0067] When the `json-pointer` attribute of the `$lref` tag points to an object type, it signifies "inheritance," meaning a JSON merge patch. In other words, it not only allows referencing the value pointed to by the `json-pointer` but also enables further modification.
[0068] In one exemplary embodiment, the contents of the base class configuration file base.json are as follows:
[0069]
[0070]
[0071] Depending on the JSON type, the reference inheritance relationship can be expressed using "$lref" as follows:
[0072] 1) Reference semantics
[0073] An example configuration file named boolean.json has the following content:
[0074] {
[0075] "$lref":"base.json#n"
[0076] }
[0077] After being expanded, the file contains the following: 3.14
[0079] An example configuration file, array.json, has the following content:
[0080] {
[0081] "$lref":"base.json#a"
[0082] }
[0083] After being expanded, the file contains the following:
[0084] [1,2{"s":"hello"}]
[0085] 2) Inheritance semantics
[0086] An example configuration file, object.json, has the following content:
[0087]
[0088] After being expanded, the actual content of the file is as follows:
[0089]
[0090]
[0091] The value of the p1 property is inherited from the base class base.json, the p2 property is deleted (because it is set to null), and p3 is a newly added property.
[0092] Back Figure 2 The first configuration file read in step S201 can be similar to the exemplary configuration file described above. The first configuration file may include a first reference inheritance tag $lref, whose value indicates a first reference inheritance attribute in the first base class configuration file.
[0093] In some embodiments, the first reference inheritance tag can reference the entire first base class configuration file. That is, the entire first configuration file inherits from the first base class configuration file, and the first reference inheritance property is actually all the properties in the first base class configuration file.
[0094] In some embodiments, the first reference inheritance tag may reference certain properties in the first base class configuration file.
[0095] In some embodiments, in steps S202 and S203, the content referenced by the $lref tag can be used as the original content, the value of the current $lref tag definition position can be used as a patch, the patch can be applied to the original content, and the generated result can be used as the expanded content to obtain the expanded first configuration file.
[0096] In some embodiments, the $lref tags may be nested due to the presence of arrays and objects. In this case, local expansion can be performed first and treated as factual content (definite values), and then the upper-level $lref tags can be expanded layer by layer to cover a larger scope.
[0097] Steps S201-S203 above can be referred to as a loading operation (load, or load_json), the purpose of which is to expand the $lref tag. Specifically, it reads content containing the $lref tag from the file, expands the $lref tag, and finally returns a configuration file (e.g., a JSON object, which may have different implementations in different programming languages) that does not contain the $lref tag. The final expanded first configuration file can be used directly by the program.
[0098] In some embodiments, the first configuration file may be expanded using the following steps:
[0099] Step SA01: In response to determining that the current value is a single-value type, return the value of the element;
[0100] Step SA02: In response to determining that the current value is an array type,
[0101] Iterate through each element of the array, including:
[0102] Step SA021: Perform a loading operation for each element (call load_json).
[0103] Get the result after expanding the $lref tag, and replace the result with the corresponding position in the array;
[0104] Step SA03: Return the contents of the entire array;
[0105] Step SA04: In response to determining that the current value is an object type,
[0106] Iterate through each property of the object, including:
[0107] Step SA041: For the value of each attribute, perform a loading operation (call load_json) and use the returned expanded result as the value of the current object's attribute;
[0108] Step SA05: In response to the determination that there is a property named $lref under the current value, read the content pointed to by the JSON pointer in $lref (becoming the original content), treat the content of the current object as a patch, apply the patch to the original content using the merge patch method to obtain the result, and swap the result with the current value;
[0109] Step SA06: Return the current value.
[0110] According to some embodiments, such as Figure 3 As shown, the configuration file management method may further include: step S304, after reading the first configuration file, adding the reference inheritance relationship between the reference configuration tag in the first configuration file and the first reference inheritance property in the first base class configuration file to the reference inheritance relationship tree; step S305, in response to receiving the instruction to store the modified first configuration file, replacing one or more properties in the modified first configuration file with the second reference inheritance tag based on the reference inheritance relationship tree to obtain the collapsed first configuration file; and step S306, storing the collapsed first configuration file.
[0111] Understandable, Figure 3 The operations and effects of steps S301-S303 can be referred to the above text. Figure 2The descriptions of steps S201-S203 are not repeated here.
[0112] Step S304 achieves the synchronous construction of the reference inheritance tree of the $lref tag (hereinafter referred to as RefTree). With RefTree, it is easy to understand the dependency relationships between various configuration files in the system. When the content of the configuration files is adjusted later, it also depends on RefTree, putting as many as possible into the base class, and putting those that cannot be put into the base class into the subclass (i.e., each configuration file).
[0113] Figure 4 A schematic diagram of the RefTree, a tree representing the reference inheritance relationship, is shown. Figure 4 As can be seen, the configuration file son.json inherits from the configuration file father.json. The property hobby in the configuration file son.json references the property hobby in the configuration file father.json. The properties address in both the configuration files son.json and father.json reference the property address in the configuration file common.json.
[0114] Step S305 above can be referred to as a save operation (save, or save_json). A save operation can be considered the inverse of a load operation. Given a configuration document that does not contain the $lref tag, but knowing its RefTree and the contents of all files pointed to by the $lref tags, this configuration file can be converted into a form containing the $lref tag and then saved.
[0115] According to some embodiments, such as Figure 5 As shown, step S305, replacing one or more attributes in the modified first configuration file with a second reference inheritance tag based on the reference inheritance relationship tree, may include: step S501, determining the current attribute in the modified first configuration file; step S502, in response to determining that the reference inheritance relationship tree indicates that the current attribute has a reference inheritance relationship with the second reference inheritance attribute in the second base class configuration file, determining whether the value of the current attribute is consistent with the value of the second reference inheritance attribute; and step S503, in response to determining that the value of the current attribute is consistent with the value of the second reference inheritance attribute, replacing the current attribute with a second reference inheritance tag, the value of the second reference inheritance tag indicating the second reference inheritance attribute in the second base class configuration file.
[0116] In some embodiments, in step S501, all attributes in the modified first configuration file can be traversed, and these attributes can be used as the current attributes to perform subsequent steps.
[0117] In some embodiments, the modified first configuration file may be collapsed using the following steps:
[0118] Step SB01: In response to determining that the current value is of type number, boolean, string, or null, check whether there is a $lref tag in RefTree at the position of the current value;
[0119] Step SB02: In response to determining that there is no $lref tag, return the value of the current position;
[0120] Step SB03: In response to confirming the existence of the $lref tag,
[0121] In response to the determination that the content pointed to by $lref is the same as the current value, a reference inheritance tag $lref is constructed, whose value points to the content pointed to by $lref in RefTree, and is used as the returned content (i.e.
[0122] {"$lref":"json_file.json#json-pointer"});
[0123] In response to the determination that the content pointed to by $lref is different from the current value, the inheritance structure is lost, and the current value is returned;
[0124] Step SB04: In response to determining that the current value is an array type, check if there is an array inheritance in the RefTree at the current value's position.
[0125] Step SB05: In response to the determination that there is no overall inheritance of the array, recursively perform a storage operation (call save_json) on each element of the array, replace each element of the array with the return value, and return array a;
[0126] Step SB06: In response to determining that there is overall inheritance of the array,
[0127] In response to the determination that the content pointed to by $lref is the same as the value, a reference inheritance tag $lref is constructed, whose value points to the content pointed to by $lref in RefTree, and is returned as the content (i.e., {"$lref":").
[0128] json_file.json#json-pointer”});
[0129] In response to the determination that the content pointed to by $lref is different from the current value, the inheritance structure is lost, and the current value is returned;
[0130] Step SB07: In response to determining that the current value is of object type,
[0131] Iterate through each property of the object, including:
[0132] Step SB071: Perform a storage operation (call save_json) and obtain the return value of the sub-merged patch;
[0133] Step SB072: Determine whether the sub-merged-patch can be contributed by a content referenced by $lref on the json-pointer (i.e., inherit the default value);
[0134] Step SB073: In response to the determination that it is possible, the current sub-merged-patch is ignored;
[0135] Step SB074: In response to the determination that it is not possible, replace the current traversal property of the object with a sub-merged-patch;
[0136] Step SB08: In response to determining that the current value has a $lref tag (obtained through RefTree), read the content of the $lref tag as the base class configuration file, perform a depth-first traversal of the base class configuration file, and in response to determining that a certain position in the base class configuration file does not exist in the current value, set the null flag, indicating that the current value needs to be set to null in the base class.
[0137] According to some embodiments, such as Figure 6 As shown, the configuration file management method may further include: step S607, in response to receiving a base class generation instruction for multiple second configuration files, recording the leaf paths of multiple candidate values in the multiple second configuration files, wherein the leaf path describes the attributes that the corresponding candidate value traverses from the root path of the second configuration file to the leaf node; step S608, traversing the recorded leaf paths in reverse order and clustering the values of different second configuration files under the same leaf path; and step S609, determining the second reference inheritance attribute for the multiple second configuration files based on the clustering results.
[0138] Understandable, Figure 6 The operations and effects of steps S601-S606 can be referred to the above text. Figure 3 The descriptions of steps S301-S306 are not repeated here.
[0139] Steps S607-S609 above can be referred to as the base class creation operation (create_base). create_base derives the optimal base class result for N values. There is no single best answer for the base class; the derived result is merely one possible implementation.
[0140] In some embodiments, some parameters can be preset:
[0141]
[0142] The three parameters mentioned above can be set simultaneously, or one or two can be set selectively. This approach enables more flexible base class creation operations.
[0143] In some embodiments, during the base class creation operation, each subclass participating in the derivation is called a voter, and a group of voters elects the content of the base class; the content under different voting paths (relative to the JSON pointer of the base class) of different voters is provided, along with the corresponding vote values. Specifically, this can be achieved through the following steps:
[0144] Step SC01: Initialize the base class configuration file to null.
[0145] Step SC02: Iterate through the votes submitted by each voter, including:
[0146] Step SC021: Record the leaf paths of each project (all attributes traversed from the root directory ' / ' to a leaf node of a non-object type or empty object type) into an ordered set of leaf paths;
[0147] Step SC022: Record the values corresponding to the leaf paths to the cluster_map. <leaf_path,
[0148] In value-cluster-size>;
[0149] Step SC03: Traverse each leaf path in reverse order under the leaf path set, and cluster the values under cluster_map[leaf_path] of the current leaf path. The values with the same value belong to the same cluster, and the value of the largest cluster is used as the value determined by voting.
[0150] Step SC04: Obtain the base class configuration file.
[0151] In some embodiments, the following filtering conditions can be set:
[0152] a) If set null is not allowed, i.e. allow_null = false, if a voter's voting path is a prefix of the current leaf path and the voter does not have a current leaf path, then the voter can veto the vote.
[0153] b) The target is met when the voter turnout exceeds a preset percentage. The voter path is the number of voters whose prefixes are leaf paths. These voters are affected by the outcome, and the vote is only passed when the size of the largest cluster is greater than the proportion of affected voters.
[0154] The two conditions mentioned above can be used individually or together, and there is no limitation here.
[0155] According to some embodiments, the configuration file management method may further include: adding a second reference inheritance attribute to a third base class configuration file that is jointly referenced and inherited by multiple second configuration files.
[0156] Therefore, this method avoids unnecessary addition of more base class configuration files, saving storage resources.
[0157] According to some embodiments, the configuration file management method may further include: creating a new fourth base class configuration file, the fourth base class configuration file including a second reference inheritance property; and adding the reference inheritance relationship between multiple second configuration files and the second reference inheritance property to the reference inheritance relationship tree.
[0158] Therefore, this method allows for the creation of new base class configuration files when no existing base class configuration file exists, and the corresponding reference inheritance relationships are added to the reference inheritance tree, thereby saving storage resources and facilitating subsequent operations.
[0159] According to some embodiments, such as Figure 7 As shown, the configuration file management method may further include: step S707, determining multiple objective fact attribute values in multiple third configuration files; step S708, determining multiple base class configuration files that have reference inheritance relationships with the multiple objective fact attribute values based on the reference inheritance relationship tree; step S709, constructing a derivation relationship graph of multiple objective fact attribute values and multiple base class configuration files, the derivation relationship graph including multiple nodes and at least one directed edge, the node indicating the reference inheritance relationship between an objective fact attribute value and a base class configuration file, the directed edge describing the derivation order between the reference inheritance relationships of two nodes; and step S710, updating the reference inheritance attributes in the multiple base class configuration files using the derivation relationship graph and the multiple objective fact attribute values.
[0160] Understandable, Figure 7 The operations and effects of steps S701-S706 can be referred to the above text. Figure 3 The descriptions of steps S301-S306 are not repeated here.
[0161] Steps S707-S710 above can be referred to as a refactoring operation (reconstruct_lref). In some embodiments, there are a batch of values (hereinafter also referred to as fact doc, representing objective facts) in multiple configuration files. Knowing their respective RefTrees, the goal is to automatically deduce the content of the associated base class in the RefTree based on the content of the objective facts, and then write the objective facts (and the deduced base class file) to a file carrying the $lref tag. The purpose of refactoring is to place values that can be placed in the parent class into the parent class; values that are not suitable for the parent class are no longer reflected in the parent class. Because the parent class may be referenced and inherited by multiple configuration files, multiple values are generally input and refactored together.
[0162] According to some embodiments, such as Figure 8 As shown, step S710, updating the reference inheritance attributes in multiple base class configuration files using the derivation relationship graph and multiple objective fact attribute values, may include: step S801, determining the current node indicating the same base class configuration file among the nodes with an out-degree of zero in the derivation relationship graph; step S802, clustering the objective fact attribute values indicated by the current node to update the reference inheritance attributes of the base class configuration file indicated by the current node; and step S803, removing multiple current nodes from the derivation relationship graph.
[0163] The derivation graph can be a directed acyclic graph (DAG). The content of the nodes is defined as follows:
[0164] derived_file#derived_json_pointer->base_file#base_json_pointer
[0165] This represents a reference in a subclass file that inherits content from a location in a base class file. By analyzing the RefTree of all objective facts in the input, a structure like... Figure 9 The derivation relationship diagram DAG is shown below.
[0166] The directed edges between nodes in a Directed Acyclic Graph (DAG) represent the order in which nodes are popped during derivation. Each time a node with an "out-degree" of 0 is popped, it is then removed from the DAG. Popped nodes must point to the same base class configuration file, and there must be no other nodes in the entire DAG—their in-degree must be non-zero, and their base class configuration file must match the one being popped.
[0167] Each time a batch of nodes is popped from the DAG, these nodes share the same base class configuration file, which is the base class file to be derived at the current stage. At this point, the derived content is known, i.e., objective fact. This derived content acts as voters, voting on the content at the `base_json_pointer` of the base class configuration file, and using the base class creation operation mentioned earlier to derive the base class configuration file.
[0168] Once the base class configuration file is determined, it is considered an objective fact. Then, a batch of nodes are popped from the DAG until there are no nodes left in the DAG. At this point, all relevant base class configuration files have been derived.
[0169] In some embodiments, when the DAG is empty, the contents of all involved base class files are already determined. Each objective fact is traversed, and based on its RefTree, a depth-first traversal is performed, calling the storage operation on each base class from the bottom up to store it.
[0170] In summary, this disclosure provides a reference inheritance tag `$lref`, which represents a "reference". This allows a large configuration file to be simplified into multiple smaller configuration files. Even with complex systems and numerous configurations, it still enables global modeling and decomposition of system functions, reducing the costs of understanding, learning, and maintaining the system.
[0171] The `$lref` tag can function as an "inheritance" feature. For large-scale configurations of the same type, common features can be extracted from the base class description, allowing changes in one place to affect many others.
[0172] As the system iterates and changes, its configuration also iterates accordingly. Configuration descriptions based on inheritance structures also need to iterate (ensuring consistency in depicting commonalities and differences). The refactoring operation proposed in this patent is one way to refactor the base class content. This method can significantly reduce the workload of system configuration iteration and overcome the obstacles to system configuration optimization applications.
[0173] The following exemplary embodiment will illustrate the effect and function of the refactoring operation. Assume there are four third-party configuration files, which use the $lref tag syntax proposed in this disclosure as follows.
[0174] "brief_base.json":{"a":{},"b":{}},
[0175] "k_base.json":{"type":"ann"},
[0176] "k1.json":{"$lref":"k_base.json","brief":{"$lref":"brief_base.json","b":null,"aa":{}}},
[0177] "k2.json":{"$lref":"k_base.json","brief":{"$lref":"brief_base.json","a":null,"bb":{}}}
[0178] k1.json and k2.json each correspond to a library, which inherits from the base class configuration file k_base.json. At the same time, the content of the "brief" attribute of these two libraries inherits from another base class configuration file brief_base.json, with some adjustments made. Specifically, k1 removes the 'b' feature and adds the 'aa' feature; k2 removes the 'a' feature and adds the 'bb' feature.
[0179] After being expanded using $lref (for example, after a loading operation), the actual content of k1.json and k2.json is as follows:
[0180] "k1.json":{"type":"ann","brief":{"a":{},"aa":{}}},
[0181] "k2.json":{"type":"ann","brief":{"b":{},"bb":{}}}
[0182] Now, we expect to re-derive the contents of k_base.json and brief_base.json based on the contents of k1.json and k2.json.
[0183] The derivation parameters are defined as follows:
[0184] "allow_null":true, / / / <Allows subclasses to delete a base class property by setting it to null.>
[0185] "allow_lose_inherit":false, / / / < Do not allow loss of inheritance relationship.>
[0186] "vote_ratio": 0.3, / / / <The threshold for passing the vote. The value at a certain JSON pointer position in the base class is taken from the value with the most votes, and the total number of votes must exceed a certain threshold. It is understood that 0.3 is only an exemplary threshold. When implementing the scheme disclosed herein, it can be set according to requirements.>
[0187] "input_set":["k1.json","k2.json"], / / / <Which objective facts participate in the refactoring? Generally, they have a common base class.
[0188] Figure 10A and Figure 10B The RefTree of k1.json and k2.json are shown respectively. Based on the RefTree structures of k1.json and k2.json, a DAG is constructed, as follows. Figure 10C As shown. Due to Figure 10C There are no dependencies between the nodes in the dataset, so it doesn't matter whether you derive the base class configuration file k_base.json first or brief_base.json first.
[0189] After the final derivation is completed, the contents of each configuration file are changed as follows:
[0190]
[0191] Because the derivation options allow `set-null` and the voting adoption threshold is 0.3, the content of the base class configuration file `brief_base.json` becomes the complete set. The two third configuration files, `k1` and `k2`, internally mask unwanted features by setting them to `set-null`. The derivation parameters can be adjusted to change the result. Meanwhile, `k1.json` and `k2.json`, as objective facts, are described using the form `$lref`. After `$lref` expansion, their content remains essentially unchanged; however, the content of the base class configuration file `brief_base.json` has changed. It can generally be understood that the base class configuration file `brief_base.json` is the complete set of all attribute `brief` values. The `brief` attribute content in the third configuration files `k1` and `k2`, by setting it to `set-null`, reflects the difference from the base class configuration file `brief_base.json`. All attributes not set to `set-null` use the attributes defined in the base class configuration file `brief_base.json`.
[0192] The derivation option parameters are adjusted as follows:
[0193]
[0194]
[0195] Because set-null is not allowed in the derivation parameters, the value of the base class configuration file brief_base.json will ultimately be null. At this point, the content of k1.json and k2.json remains essentially unchanged, but the description format using $lref has changed, highlighting the difference between the third configuration files k1 and k2 and the base class configuration file brief_base.json.
[0196] In summary, if all configuration information is written into a single configuration file, this file will become extremely large, and different types of changes and iterations will affect this single file. The learning, understanding, and maintenance costs will be very high. The advantages of using the `$lref` tag for inheritance are:
[0197] 1. Splitting the configuration file (using reference semantics) allows the configuration file to put different content into different small files according to business semantics.
[0198] 2. Allowing multiple libraries to inherit the same base class configuration file (using inheritance semantics) means that changes to the base class configuration file will take effect simultaneously across multiple libraries.
[0199] Furthermore, system configuration also needs to be iterated synchronously during system iteration. If the system configuration uses $lref references, the corresponding inherited base class content will also require adjustment. In this case, the reconstruct_lref operation proposed in this patent is used to reconstruct the base class, thus sustainably maintaining this inheritance relationship.
[0200] According to another aspect of this disclosure, a configuration file management device is provided. For example... Figure 11 As shown, the device 1100 includes: a reading unit 1110 configured to read a first configuration file, wherein the first configuration file includes a first reference inheritance tag, the value of which indicates a first reference inheritance attribute in a first base class configuration file; an obtaining unit 1120 configured to obtain the first reference inheritance attribute from the first base class configuration file based on the value of the first reference inheritance tag; and a first replacement unit 1130 configured to replace the reference configuration tag in the first configuration file with the first reference inheritance attribute to obtain an expanded first configuration file.
[0201] It is understandable that the operation and effects of units 1110-1130 in device 1100 can be referred to respectively. Figure 2 Steps S201-S203 are not described in detail here.
[0202] According to some embodiments, the configuration file management device may further include: a first addition unit configured to, after reading the first configuration file, add the reference inheritance relationship between the reference configuration tag in the first configuration file and the first reference inheritance property in the first base class configuration file to the reference inheritance relationship tree; a second replacement unit configured to, in response to receiving a storage instruction for the modified first configuration file, replace one or more properties in the modified first configuration file with second reference inheritance tags based on the reference inheritance relationship tree to obtain a collapsed first configuration file; and a storage unit configured to store the collapsed first configuration file.
[0203] According to some embodiments, the second replacement unit may include: a first determining subunit configured to determine the current attribute in the modified first configuration file; a judging subunit configured to, in response to determining that the reference inheritance tree indicates that the current attribute has a reference inheritance relationship with a second reference inheritance attribute in the second base class configuration file, judge whether the value of the current attribute is consistent with the value of the second reference inheritance attribute; and a replacement subunit configured to, in response to determining that the value of the current attribute is consistent with the value of the second reference inheritance attribute, replace the current attribute with a second reference inheritance tag, the value of the second reference inheritance tag indicating the second reference inheritance attribute in the second base class configuration file.
[0204] According to some embodiments, the configuration file management device may further include: a recording unit configured to, in response to receiving a base class generation instruction for a plurality of second configuration files, record leaf paths of a plurality of candidate values in the plurality of second configuration files, wherein the leaf paths describe the attributes traversed by the corresponding candidate value from the root path of the second configuration file to the leaf node; a clustering unit configured to traverse the recorded leaf paths in reverse order and cluster the values of different second configuration files under the same leaf path; and a first determining unit configured to, based on the clustering results, determine a second reference inheritance attribute for the plurality of second configuration files.
[0205] According to some embodiments, the configuration file management device may further include: a second joining unit configured to join a second reference inheritance attribute to a third base class configuration file that is jointly referenced and inherited by multiple second configuration files.
[0206] According to some embodiments, the configuration file management device may further include: a creation unit configured to create a fourth base class configuration file, the fourth base class configuration file including a second reference inheritance attribute; and a third addition unit configured to add the reference inheritance relationships between multiple second configuration files and the second reference inheritance attribute to the reference inheritance relationship tree.
[0207] According to some embodiments, the configuration file management device may further include: a second determining unit configured to determine multiple objective fact attribute values in multiple third configuration files; a third determining unit configured to determine multiple base class configuration files that have reference inheritance relationships with the multiple objective fact attribute values based on a reference inheritance relationship tree; a construction unit configured to construct a derivation relationship graph of the multiple objective fact attribute values and the multiple base class configuration files, the derivation relationship graph including multiple nodes and at least one directed edge, a node indicating a reference inheritance relationship between an objective fact attribute value and a base class configuration file, and a directed edge describing the derivation order between the reference inheritance relationships of two nodes; and an updating unit configured to update the reference inheritance attributes in the multiple base class configuration files using the derivation relationship graph and the multiple objective fact attribute values.
[0208] According to some embodiments, the update unit includes: a second determining subunit configured to determine a current node indicating the same base class configuration file among nodes with an out-degree of zero in the derivation graph; a clustering subunit configured to cluster the objective fact attribute values indicated by the current node to update the reference inheritance attribute of the base class configuration file indicated by the current node; and a removal subunit configured to remove multiple current nodes from the derivation graph.
[0209] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0210] According to embodiments of this disclosure, an electronic device, a readable storage medium, and a computer program product are also provided.
[0211] refer to Figure 12 The present invention describes a structural block diagram of an electronic device 1200 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0212] like Figure 12As shown, the electronic device 1200 includes a computing unit 1201, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1202 or a computer program loaded from a storage unit 1208 into a random access memory (RAM) 1203. The RAM 1203 may also store various programs and data required for the operation of the electronic device 1200. The computing unit 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0213] Multiple components in electronic device 1200 are connected to I / O interface 1205, including: input unit 1206, output unit 1207, storage unit 1208, and communication unit 1209. Input unit 1206 can be any type of device capable of inputting information to electronic device 1200. Input unit 1206 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of the electronic device, and may include, but is not limited to, a mouse, keyboard, touchscreen, trackpad, trackball, joystick, microphone, and / or remote control. Output unit 1207 can be any type of device capable of presenting information, and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 1208 may include, but is not limited to, a hard disk and an optical disk. The communication unit 1209 allows the electronic device 1200 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and / or chipsets, such as Bluetooth devices, 802.11 devices, WiFi devices, WiMax devices, cellular communication devices and / or the like.
[0214] The computing unit 1201 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1201 performs the various methods, processes, and / or processes described above. For example, in some embodiments, these methods, processes, and / or processes may be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 1208. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1200 via ROM 1202 and / or communication unit 1209. When the computer program is loaded into RAM 1203 and executed by the computing unit 1201, one or more steps of the methods, processes, and / or processes described above may be performed. Alternatively, in other embodiments, the computing unit 1201 may be configured to perform these methods, processes, and / or handling by any other suitable means (e.g., by means of firmware).
[0215] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0216] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0217] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0218] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0219] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.
[0220] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0221] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0222] While embodiments or examples of this disclosure have been described with reference to the accompanying drawings, it should be understood that the methods, systems, and devices described above are merely exemplary embodiments or examples, and the scope of the invention is not limited by these embodiments or examples, but only by the granted claims and their equivalents. Various elements in the embodiments or examples may be omitted or replaced by their equivalents. Furthermore, the steps may be performed in a different order than that described in this disclosure. Further, various elements in the embodiments or examples may be combined in various ways. Importantly, as the technology evolves, many elements described herein can be replaced by equivalents that appear after this disclosure.
Claims
1. A method for managing configuration files, comprising: Read the first configuration file, wherein the first configuration file includes a first reference inheritance tag, and the value of the first reference inheritance tag indicates a first reference inheritance attribute in the first base class configuration file; Add the reference inheritance relationship between the reference configuration tag in the first configuration file and the first reference inheritance property in the first base class configuration file to the reference inheritance tree; In response to receiving a storage instruction for the modified first configuration file, one or more attributes in the modified first configuration file are replaced with second reference inheritance tags based on the reference inheritance tree to obtain a collapsed first configuration file, including: Determine the current attributes in the modified first configuration file; In response to determining that the reference inheritance tree indicates that the current attribute has a reference inheritance relationship with a second reference inheritance attribute in the second base class configuration file, it is determined whether the value of the current attribute is consistent with the value of the second reference inheritance attribute; and In response to determining that the value of the current property is consistent with the value of the second reference inheritance property, the current property is replaced with the second reference inheritance tag, the value of the second reference inheritance tag indicating the second reference inheritance property in the second base class configuration file; Store the folded first configuration file; Based on the value of the first reference inheritance tag, the first reference inheritance attribute is obtained from the first base class configuration file; and Replace the reference configuration tag in the first configuration file with the first reference inheritance attribute to obtain the expanded first configuration file.
2. The method according to claim 1, further comprising: In response to receiving a base class generation instruction for multiple second configuration files, the leaf paths of multiple candidate values in the multiple second configuration files are recorded, wherein the leaf paths describe the attributes that the corresponding candidate values traverse from the root path of the second configuration file to the leaf nodes; Traverse the recorded leaf paths in reverse order and cluster the values of different second configuration files under the same leaf path; as well as Based on the clustering results, a second reference inheritance attribute for the multiple second configuration files is determined.
3. The method according to claim 2, further comprising: The second reference inheritance attribute is added to the third base class configuration file that is jointly referenced and inherited by the multiple second configuration files.
4. The method according to claim 2, further comprising: Create a new fourth base class configuration file, which includes the second reference inheritance attribute; as well as The reference inheritance relationship between the multiple second configuration files and the second reference inheritance property is added to the reference inheritance relationship tree.
5. The method according to claim 1, further comprising: Determine the values of multiple objective fact attributes in multiple third-party configuration files; Based on the reference inheritance tree, determine multiple base class configuration files that have reference inheritance relationships with the multiple objective fact attribute values; Construct a derivation relationship graph of the multiple objective fact attribute values and multiple base class configuration files. The derivation relationship graph includes multiple nodes and at least one directed edge. The node indicates the reference inheritance relationship between an objective fact attribute value and a base class configuration file, and the directed edge describes the derivation order between the reference inheritance relationships of two nodes. as well as Using the derivation relationship diagram and the multiple objective fact attribute values, update the reference inheritance attributes in the multiple base class configuration files.
6. The method according to claim 5, wherein, Updating the reference inheritance attributes in the multiple base class configuration files using the derivation relationship diagram and the multiple objective fact attribute values includes: In the derivation graph, identify the current node that points to the same base class configuration file among the nodes with an out-degree of zero; Cluster the objective fact attribute values indicated by the current node to update the reference inheritance attribute of the base class configuration file indicated by the current node; and Remove the plurality of current nodes from the derivation graph.
7. A configuration file management device, comprising: The reading unit is configured to read a first configuration file, wherein the first configuration file includes a first reference inheritance tag, and the value of the first reference inheritance tag indicates a first reference inheritance attribute in a first base class configuration file; The first addition unit is configured to add the reference inheritance relationship between the reference configuration tag in the first configuration file and the first reference inheritance property in the first base class configuration file to the reference inheritance relationship tree after reading the first configuration file; The second replacement unit is configured to, in response to receiving a storage instruction for the modified first configuration file, replace one or more attributes in the modified first configuration file with a second reference inheritance tag based on the reference inheritance relationship tree, to obtain the collapsed first configuration file; The storage unit is configured to store the folded first configuration file; The acquisition unit is configured to retrieve the first reference inheritance attribute from the first base class configuration file based on the value of the first reference inheritance tag; and The first replacement unit is configured to replace the reference configuration tag in the first configuration file with the first reference inheritance attribute to obtain the expanded first configuration file. The second replacement unit includes: The first determining subunit is configured to determine the current attributes in the modified first configuration file; The determination subunit is configured to, in response to determining that the reference inheritance tree indicates that the current attribute has a reference inheritance relationship with a second reference inheritance attribute in the second base class configuration file, determine whether the value of the current attribute is consistent with the value of the second reference inheritance attribute; and The replacement subunit is configured to replace the current property with the second reference inheritance tag in response to determining that the value of the current property is consistent with the value of the second reference inheritance property, the value of the second reference inheritance tag indicating the second reference inheritance property in the second base class configuration file.
8. The apparatus according to claim 7, further comprising: The recording unit is configured to, in response to receiving a base class generation instruction for a plurality of second configuration files, record the leaf paths of a plurality of candidate values in the plurality of second configuration files, wherein the leaf paths describe the attributes that the corresponding candidate value traverses from the root path of the second configuration file to the leaf node; Clustering units are configured to traverse the recorded leaf paths in reverse order and cluster the values of different second profiles under the same leaf path; as well as The first determining unit is configured to determine the second reference inheritance attribute for the plurality of second configuration files based on the clustering results.
9. The apparatus according to claim 8, further comprising: The second addition unit is configured to add the second reference inheritance attribute to the third base class configuration file that is jointly referenced and inherited by the plurality of second configuration files.
10. The apparatus of claim 8, further comprising: A new unit is configured to create a new fourth base class configuration file, the fourth base class configuration file including the second reference inheritance attribute; as well as The third addition unit is configured to add the reference inheritance relationship between the plurality of second configuration files and the second reference inheritance property to the reference inheritance relationship tree.
11. The apparatus according to claim 7, further comprising: The second determining unit is configured to determine multiple objective fact attribute values in multiple third configuration files; The third determining unit is configured to determine multiple base class configuration files that have reference inheritance relationships with the multiple objective fact attribute values based on the reference inheritance relationship tree; The building unit is configured to build a derivation graph of the plurality of objective fact attribute values and the plurality of base class configuration files. The derivation graph includes a plurality of nodes and at least one directed edge. The nodes indicate the reference inheritance relationship between an objective fact attribute value and a base class configuration file, and the directed edge describes the derivation order between the reference inheritance relationships of two nodes. as well as The update unit is configured to update the reference inheritance attributes in the multiple base class configuration files using the derivation relationship graph and the multiple objective fact attribute values.
12. The apparatus according to claim 11, wherein, The update unit includes: The second determining subunit is configured to determine the current node indicating the same base class configuration file among the nodes with zero out-degree in the derivation graph; A clustering subunit is configured to cluster the objective fact attribute values indicated by the current node to update the reference inheritance attribute of the base class configuration file indicated by the current node; and The removal sub-unit is configured to remove the plurality of current nodes from the derivation graph.
13. 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 instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.
15. A computer program product comprising a computer program, wherein, The computer program, when executed by a processor, implements the method of any one of claims 1-6.
Citation Information
Patent Citations
Inheritable bureau data dynamic page configuration method and inheritable bureau data dynamic page configuration device
CN111309319A