Product Derivation Method Based on Feature Model and Feature Formal Specification
By using feature models and formal specification descriptions in the software product line, combining SOFL language to describe feature behavior and generate feature fusion sequences, the problems of low efficiency and inaccurate description of software products in the prior art are solved, and high Quality and detailed product derivation.
Patent Information
- Application Number
- CN202210689401.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-17
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-06-17
AI Technical Summary
Existing software product derivation methods are inefficient and error-prone, unable to meet customer specific unforeseen needs, and inaccurate product descriptions, resulting in the unguaranteed benefits of software reuse.
Using a method based on feature models and formal specification description, use structured object-oriented formal language (SOFL) to describe feature behaviors, generate feature fusion sequences, and maintain fusion through feature formal specification description behaviors to ensure a detailed description of derived products. and high quality.
It improves the quality and accuracy of product derivatives, can better meet customer needs, and ensures functional consistency and detailed description of derived products.
Smart Images

Figure CN115080032B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of computer technology and proposes a product derivation method for a software product line. Background Art
[0002] As the size and complexity of software systems increase, the cost of developing new products, the number of products required, and the specific needs of customers are also increasing, which has put pressure on many software-intensive companies. In the past decade, many studies have found that software product lines can achieve software reuse, enabling them to significantly increase research and development focused on highly differentiated functions, shorten software development cycles and costs. Product derivation is a key process in product line engineering. It meets different needs by changing the functional structure of the product to add new functions, or removing unnecessary functions from the product line, or modifying the core assets used in the product, etc., and building software products from a basic set of core assets consisting of architecture, design, and reusable code.
[0003] At present, product derivation research has achieved a lot of results, but there are still some problems. On the one hand, the software derivation process from software product families to mass customized products is quite time-consuming. Most of the product derivation is done manually, which is prone to errors in some cases, and if the derivation process is not efficient enough, the benefits of software reuse will not be guaranteed. In addition, automated product derivation methods are not flexible. They do not allow products to meet unforeseen, customer-specific requirements. On the other hand, the product derivation process lacks a precise description of the specific software behavior and cannot help developers better understand the requirements. Although some researchers have applied formal methods to formalize product line feature models [18-20] However, they focus on describing the organization of the features involved, rather than the internal structure of these features, which leads to unclear requirements for subsequent derived specific products, and the specific products obtained are relatively abstract models. Therefore, it is still a challenge to systematically and efficiently derive products for software product families. Summary of the invention
[0004] The technical problem to be solved by the present invention is: the present invention combines the ideas of formal specification language and product series modeling technology, and proposes a product derivation method based on feature model and formal specification to address the above problems. By combining structured object-oriented formal language (SOFL) to describe the specific behavior of each feature, and combining the feature model to generate a feature fusion sequence, the behavior of feature-to-feature formal specification is kept fused, so that the derived product has a detailed description, thereby further improving the quality of the derived product.
[0005] To achieve the above objectives, the concept of the present invention is: considering the structural specificity and relationship complexity of small molecule drugs and biopharmaceuticals, multimodal representation learning is first used to extract drug features. On the one hand, one-dimensional sequence features are learned using recoding and dual-channel CNN. On the other hand, the association information of all drug nodes in the heterogeneous network is encoded into a one-dimensional feature vector to learn the network topology features. Then, the sample noise is reduced by PU-sampling to obtain high-confidence negative samples. Finally, the reduced-dimensional drug pair features are input into the DNN to predict new small molecule drug and biopharmaceutical interactions.
[0006] The idea of the present invention is: first, according to user needs, the features of a specific product are selected from the feature model and the feature fusion order is determined. Then, the declaration part of the feature formal specification is fused, and the behavior of each feature is represented by the functional scenario to generate the functional scenario path. Finally, according to the feature fusion order, the functional scenario paths of the features are matched in a way of fusion of two features, and each pair of feature formal specifications is fused until the formal specification of the complete product is obtained.
[0007] The technical solution of the present invention:
[0008] A product derivation method based on a feature model and a feature formal specification, characterized by comprising the following steps:
[0009] A. Generate feature fusion sequence: According to the hierarchical structure of the feature model and the constraint relationship of the features, the feature fusion sorting algorithm is used to determine the feature fusion order;
[0010] B. Behavior-preserving feature fusion: According to the fusion order obtained in step A, two features are combined into a pair, and the behavior-preserving fusion of feature formal specifications is performed in combination with a structured object-oriented formal language.
[0011] In step B: first, the declaration part of the feature formal specification is integrated, and the functional scenario is used to represent the behavior of each feature to generate a functional scenario path; then, according to the feature fusion order, the functional scenario paths of the features are matched in a pairwise fusion manner, and each pair of feature formal specifications is fused until the formal specification of the complete product is obtained.
[0012] The specific steps of determining the feature fusion order described in step A above are as follows:
[0013] A1. Select product features based on the systematically built software product line, and extract the feature model from the software product line to be derived;
[0014] A2. Parse the XML format document of the obtained feature model, and determine the feature fusion order by using a feature fusion sorting algorithm according to the feature constraint relationship and the feature model hierarchy of the feature model.
[0015] The specific steps of the feature fusion sorting algorithm described in step A2 above are as follows:
[0016] A21. Perform a deep traversal of the feature model to find all non-leaf nodes, merge the leaf nodes under the same parent node in pairs, obtain a merged leaf node, and replace the parent node;
[0017] A22, based on the leaf nodes merged in step A21, use the nearest neighbor search algorithm to find the nearest related leaf nodes, merge the nearest related leaf nodes in sequence, and repeat the previous step until there is only one merged leaf node;
[0018] A23. The resulting sequence represents the order of operations for fusing the results of each two features with the next feature.
[0019] The behavior of formalizing the feature specification described in step B remains integrated, and the specific steps are as follows:
[0020] B1. Declaration fusion of feature formal specifications: Define the conversion rules from a single type variable to a fused type variable, and provide a conversion path from a single feature declaration to a fused feature declaration;
[0021] B2. Generate feature function scenario path: Analyze the internal behavior of each feature and connect the scenarios of each feature behavior to form a scenario path;
[0022] B3. Match the relevant scenarios of the functional path scenario feature pairs, and finally fuse the product formal specifications based on the results of path matching and fusion statement.
[0023] The specific steps of declarative fusion of the feature formal specification described in step B1 are as follows:
[0024] B11. Basic data types (nat (natural number type), nat0 (natural number type including 0), int (integer type), real (real number type), char (character type), bool (Boolean type), enumeration (enumeration type)) are retained in the fused product formal specification because there is no redundancy or overlap in types and variables.
[0025] B12. For declaration fusion rules of composite data types (set, sequence, composite, map, product, union), composite type variables with the same semantics as the original ones are generated from the relevant conditions involving the above operations. The rules are as follows:
[0026] 1. The map type represents a finite pair of sets. If the domain / range of map s1 is satisfied by map s2, then dom(s1) = s2 or rng(s1) = s2. If map s1 and map s2 intersect, a new s is generated, which is the union of s1 and s2. If set s1 and set / com s2 intersect, then set s is the union (s1, s2).
[0027] 2. The set type represents an unordered and unique set of objects. If sets s1 and s2 partially overlap, the fused sets are conc(s1,s2);
[0028] 3. Sequence represents an ordered and unique set of objects. If sequences s1 and s2 partially overlap, the fused sequence s is the union (s1, s2);
[0029] 4. Composite and product are both collections of different data elements and have customized functions. If composite / product s1 and s2 partially overlap or s2, then composite / product s is the union of s1 and s2, with only one copy of the duplicated part retained.
[0030] The specific steps of generating the feature function scenario path described in step B2 are as follows:
[0031] B21. Extract functional scenarios fs from the feature formal specification (SOFL) module m i Module m is composed of multiple processes p, each of which contains an input port Iport p and output port Oport p , preP p and postcondition postP p , where the functional scenario is a conjunction preP p ∧C i ∧D i , where each C i (i∈1,…,n) does not contain output variables and Di Contains at least one output variable. Convert the postcondition to an equivalent disjunctive normal form and extract the functional scenario from the disjunctive clause in the disjunctive normal form.
[0032] B22, connect the functional scenarios to form a functional scenario path. A functional scenario path is an operation sequence [fs1, ..., fs n ], if and only if Connect the functional scenarios obtained in B21. When executing, the sequence {IV(p ij )}[p ij ]{OV(p ij )}→{IV(p lk )}[p lk ]{OV(p lk )}→…→{IV(p nm )}[p nm ]{OV(p nm )} for scene paths. Each {IV(p ij )}[p ij ]{OV(p ij )} is a functional scenario. ij Input IV(p ij ) objects from outside module m, the set OV(p ij ) is p ij The output of the scene path. ij Receive input data item IV(p ij ) and generates the data item OV(p ij ), where IV(p ij ) is included in the guard condition, OV(fs i ) are included in the definition conditions. f The functional scenario path of each process p will be generated according to the functional scenario.
[0033] The functional path scene matching of the feature pair described in step B3 is specifically performed as follows:
[0034] B31. Check the validity of the generated path. For two adjacent functional scenario paths, if a post-condition cannot be mapped to another pre-condition, it is an invalid path.
[0035] B32. Feature fusion based on input and output port matching. Features will interact through database information exchange and process scenario path information. Database information exchange means reading the data stream of one operation into the database and writing the data stream of another operation into the same database. This information exchange is usually retained in the fusion feature, and the feature form remains unchanged after fusion. In simple cases, path matching needs to satisfy whether the connections between different port variables of the process can be matched. That is:
[0036]
[0037]
[0038] Functional scenario paths of different features f1 and f2 are matchable if a set of inputs and outputs are the same; if the set of input variables of the functional scenario path of feature f1 is a subset of the output variables of another f2, and vice versa, the paths are related and can be matched.
[0039] B33, Feature fusion based on pre / post scene matching. It is not enough to consider the matching based on input and output ports. It is also necessary to perform pre / postcondition matching checks based on port matching. Considering that there are many ways to connect scenes, the matching connection of complex scene paths can be divided into three cases:
[0040] 1) The sequential path of scenario connection, because conditional process B is only available in processes A1, A2, ..., A n It will be triggered only after all the scenarios are met. Whether it is satisfied to match the fusion. Each post Ai v i (i=1,…,n) is the postcondition Ai A sub-logical expression of , representing one of the scenarios of a component process Ai.
[0041] 2) The process of selecting the structure is matched and integrated, and its inspection judgment is and Where pre is the precondition of the previous conditional process; post is a sub-logical expression containing the postcondition of the variable v; pre B It is a prerequisite for conditional process B.
[0042] 3) The process matching fusion of the case structure is checked and judged as follows: and Where i = 1, ..., n. If the variable v satisfies the condition C i (v), then the scenario associated with v is connected to the conditional process B iThe premise needs to be through the conjunction pre∧post(v))∧C i (v) so that the scene paths are connected correctly.
[0043] The beneficial effects of the present invention are:
[0044] 1. The granularity of existing product derivation methods remains at the feature level, and it is impossible to manage the accurate description of feature requirements, and the result is an abstract product. The product derivation method based on feature model and formal specification proposed in the present invention describes the specific behavior of each feature through structured object-oriented formal language (SOFL), and generates feature fusion sequence in combination with feature model, so that the behavior of feature formal specification is kept fused with feature pair, so that the derived product has a detailed description, solves the above-mentioned problem of inaccurate product description, and further improves the quality of derived products.
[0045] 2. This method introduces a structured object-oriented formal language (SOFL). Compared with other methods that only have partial logical algebra to describe the relationship between product features, this method can provide rich data types to define data structures and describe feature behaviors.
[0046] 3. This method uses behavior-preserving feature fusion to ensure the consistency of the formal specification of features before and after fusion. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is an example of a product family.
[0048] Figure 2 The basic structure of the SOFL specification and the relationship between the module, CDFD and process are shown.
[0049] Figure 3 It is the basic structure of SOFL process and the corresponding text specification document.
[0050] Figure 4 This is a schematic diagram of the characteristic model of a travel management system (TMS). The main function of TMS is to customize personalized travel plans according to user needs and complete necessary travel transactions.
[0051] Figure 5 This is a schematic diagram of the feature model after feature selection. It includes the necessary registration and login functions, as well as the option to update user information. According to the constraint relationship between the features, the corresponding transportation information cannot be updated because the travel mode is selected.
[0052] Figure 6 It is the overall process of the present invention.
[0053] Figure 7It is a flow chart of the algorithm for generating feature fusion sequence.
[0054] Figure 8 It is a behavior-preserving feature fusion process.
[0055] Fig. 9 Schematic diagram of feature pair declaration fusion. (a) is the declaration fusion rule based on basic type expression, (b) is the declaration fusion rule based on compound type expression.
[0056] Fig.10 This is a diagram of the declaration fusion of the features ReserveforBus and Login.
[0057] Fig.11 It is a diagram of the specific formal specifications of Reserve for Bus and Reserve for Flight.
[0058] Fig.12 It is a functional scenario path diagram of the Reserve for Bus and Reserve for Flight feature pairs.
[0059] Fig.13 It is the CDFD corresponding to Reserve for Bus and Reserve for Flight.
[0060] Fig.14 It is a functional scenario path that integrates Reserve for Bus and Reserve for Flight.
[0061] Fig.15 It is the CDFD that is the integration of Reserve for Bus and Reserve for Flight.
[0062] Fig.16 It is a formal specification of the feature pairs after the fusion of Reserve for Bus and Reserve for Flight. DETAILED DESCRIPTION
[0063] Embodiment 1: The preferred embodiment of the present invention is further described in detail below with reference to the accompanying drawings.
[0064] Product family can be used to express all possible products in an entire software product line, usually described by a feature model (FM). The construction of feature model refers to the following two documents: Wang, X. Combining Product Line Approach and Formal Specification for Product Family Modeling. In Proceedings of the 2019 IEEE 5th International Conference on Computer and Communications (ICCC), Chengdu, China, 6–10 December 2019; pp. 515–519.
[0065] Wang,
[0066] FM is usually represented by a tree hierarchy, see Figure 1 As shown in Figure 1. Users select the required features from the product line. Each feature represents the function of the product. The internal behavior of the feature is described by SOFL. The basic structure of the SOFL specification is as follows: Figure 2 As shown in Figure 1. The process in SOFL is the most basic unit that constitutes a module. A module is composed of a group of processes. Figure 3 In order to study the effectiveness of this method, a supporting tool was designed to introduce the implementation example. The tool was developed using C# in the VisualStudio 2019 environment.
[0067] The main method process of the present invention is as follows Figure 6 , Figure 8 As shown, the following steps are included:
[0068] A. Generate feature fusion sequence: Based on the hierarchical structure of the feature model and the constraint relationship of the features, use the feature fusion sorting algorithm to determine the feature fusion order. The specific steps include:
[0069] A1. According to user needs, select product features in the systematically built software product line, extract the feature model from the software product line to be derived, and refer to Figure 5 ;
[0070] A2. Parse the XML format document of the obtained feature model. According to the feature constraint relationship and the hierarchical structure of the feature model, the selected features can be regarded as scattered independent leaf nodes in the feature model. The closeness of the leaf node relationship is determined by the hierarchical structure of the model after selection. Then perform a deep traversal of the feature model to find all non-leaf nodes, merge the leaf nodes in pairs under the same parent node, obtain a merged leaf node, and replace the parent node. Then use the nearest neighbor search algorithm to find the nearest related leaf node, merge the nearest related leaf nodes, until there is only one merged leaf node. The resulting sequence represents the order of operations for fusing the results of each two features with the next feature. Refer to the flowchart of the algorithm for generating feature fusion sequence Figure 7 For example, for Figure 5 The sequence fusion result of the TMS underlying features is [ReserveforFlight,ReserveforBus,Login,Register,UpdateProfile].
[0071] B. Behavior-preserving feature fusion: As the most basic fusion operation of feature pairs, behavior-preserving fusion will be repeatedly applied to the selected features to be fused. The functional scenario path is used as the representation of the feature behavior, and then behavior-preserving fusion is performed on this basis. Behavior-preserving fusion includes each statement and process behavior in the formal specification of the fused feature.
[0072] The specific steps include:
[0073] B1. Declaration fusion: The method has defined the conversion rules from a single type variable to a fused type variable, providing a conversion path from a single feature declaration to a fused feature declaration, see Fig. 9The basic data types (nat, nat0, int, real, char, bool, enumeration) are retained in the fused product formal specification because there is no redundancy or overlap in types and variables. The declaration fusion rules for composite data types (set, sequence, composite, map, product, union) are retained. For map type, it represents a finite set pair. If the domain / range of map s1 is satisfied by map s2, then dom(s1) = s2 or rng(s1) = s2. If map s1 and map s2 have an intersection, a new s is generated, which is the union of s1 and s2. If set s1 and set / com s2 have an intersection, then set s is the union (s1, s2). For set type, it represents an unordered and unique set of objects. If sets s1 and s2 partially overlap, then the fused set s is conc(s1, s2). For sequence, it represents an ordered and unique set of objects. If sequences s1 and s2 partially overlap, then the fused sequence s is the union (s1, s2). Composite and product both represent sets of different data elements and have customized functions. If composite / product s1 and s2 partially overlap or Then composite / product s is the union of s1 and s2, with only one copy of the duplicated part retained.
[0074] Because some feature declarations have great similarities, that is, they do not involve the intersection of data information, the fusion result is not particularly obvious. Fig.10 Here, we list the declaration fusion of two features, ReserveforBus and Login, in the order of the fusion sequence. The type variables contained in the feature Login include the basic information of the user (id, pass_no, status, phone_no, name, etc.), and the feature ReserveforBus has type variables (id, pass_no, card_name, etc.). The variable Customer is a composite type in the two modules, including the public variables user_id and pass_no. The declaration fusion needs to satisfy Fig. 9 The composite type fusion rule in (b), namely, comp(Customer Login·ReserveforBus )=CustomerLogin union Customer ReserveforBus After the fusion of the same variables in the two modules of feature Reserve for Bus and Login, only one is retained. The variables in the two modules of feature Reserve for Bus and Login are user-defined variables, and there is no information interaction, so the two variables are directly retained in the fused features.
[0075] B2. Generate feature function scenario path: Analyze the internal behavior of each feature and connect the scenarios of each feature behavior to form a scenario path. The specific steps include:
[0076] B21. Extract functional scenarios fs from the feature formal specification (SOFL) module m i . Convert the postcondition into an equivalent disjunctive normal form and extract the functional scenario from the disjunctive clause in the disjunctive normal form.
[0077] For example, for Figure 3 The extracted scenes are:
[0078]
[0079]
[0080]
[0081] B22, connect the functional scenarios to form a functional scenario path. A functional scenario path is an operation sequence [fs1, ..., fs n ], if and only if When executing, the sequence {IV(p ij )}[p ij ]{OV(p ij )}→{IV(p lk )}[p lk ]{OV(p lk )}→…→{IV(p nm )}[p nm ]{OV(p nm )} for scene paths. Each {IV(p ij )}[p ij ]{OV(p ij )} is a functional scenario. ij Input IV(p ij ) objects from outside module m, the set OV(p ij ) is p ij The output of the scene path. ij Receive input data item IV(p ij) and generates the data item OV(p ij ), where IV(p ij ) is included in the guard condition, OV(fs i ) are included in the definition conditions. f The functional scenario path of each process p will be generated according to the functional scenario.
[0082] For example, the process is described by combining the two features Reserve for Bus and Reserve for Flight. Fig.11 For the feature ReserveforBus, there are 4 functional scenario paths, refer to Fig.12 The first functional scenario path based on the Check_Bus process is [reserve_for_bus_request,user_id]Check_Bus11[wrong_id], where 11 represents the port number, indicating that reserve_for_bus_request and user_id enter the Check_Bus process from the first port on the input side, and after postcondition, are output from the first port on the output side. The following three scenario paths are similar.
[0083] B3, matching the relevant scenarios of the functional path scenario feature pair, and finally fusion of the product formal specification description based on the results of path matching and fusion statement. The specific steps are as follows:
[0084] B31. Check the validity of the generated path. For two adjacent functional scenario paths, if a post-condition cannot be mapped to another pre-condition, it is an invalid path.
[0085] B32. Feature fusion based on input and output port matching. Features interact through database information, and the features remain unchanged in form after fusion; features interact through functional scenario path information. Determine whether the input and output of two feature paths are the same. If so, the scenario paths are matchable; if the input variable set of the functional scenario path of feature f1 is a subset of the output variable of another f2, and vice versa, the paths are related and can be matched.
[0086] Reference Fig.13, a process P with m inputs and n outputs can be separated into m×n operations. In particular, when P is a single-port process, only one operation can be obtained, such as Confirm_invoice. In Figure (a) and Figure (b), there are 4 processes respectively. It can be intuitively found that they have similar operation flows, especially Check_Pass and Confirm_invoice. Due to the characteristics of Reserve for Bus and Reserve for Flight, they have the same functional scenario at the process level, and the input and output port variables are the same, the scenario path matching process Check_Pass, Confirm_invoice can be performed according to the rules.
[0087] B33, Feature fusion based on pre / post scene matching. Considering the matching based on input and output ports is not enough, it is also necessary to perform pre / postcondition matching checks based on port matching. For the case where the matching structure based on input and output ports is a sequential path, judge Whether it is satisfied to match the fusion. Each post Ai v i (i=1,…,n) is the postcondition Ai The sub-logical expression represents one of the scenarios of a component process Ai. For the case where the structure path is selected based on the input and output port matching structure, check and judge and Where pre is the precondition of the previous conditional process; post is a sub-logical expression containing the postcondition of the variable v; pre B It is the prerequisite of conditional process B. For the case structure path based on the input and output port matching structure, check and judge and Where i = 1, ..., n. If the variable v satisfies the condition C i (v), then the scenario associated with v is connected to the conditional process B i The premise needs to be through the conjunction pre∧post(v))∧C i (v) so that the scene paths are connected correctly.
[0088] Reference Fig.14According to the rule, the scene path results of the Reserve for Bus and Reserve for Flight features are fused. There are 8 fused scene paths. The suffixes of the processes Check_Pass and Confirm_invoice marked in bold black have changed compared to before the fusion. By judging that the results of the input and output port path matching of the processes Check_Pass and Confirm_invoice meet the pre / post scene matching rules. The process Check_Pass originally had one input and two outputs, but now has two inputs and three outputs. The process Confirm_invoice originally had one input, but now has two inputs. Corresponding to the fused CDFD reference Fig.15 The fused features refer to the formal specification Fig.16 As shown in the figure, the feature pairs Reserve for Bus and Reserve for Flight have been fused. The behavior-preserving fusion will be repeatedly applied to the selected features to be fused in the order of feature fusion until all features are fused, and the formal specification of the specific product is obtained, completing the product derivation.
[0089] In summary, the present invention provides a product derivation method based on feature models and feature formal specifications. The method combines structured object-oriented formal language (SOFL) to describe the specific behavior of each feature, and combines the feature model to generate a feature fusion sequence, so that the behavior of formal specification of features is kept fused in the form of features. The method can improve the quality of derived products, can describe the specific functions of the product in more detail, and ensure the consistency of product functions before and after derivation. Compared with the prior art, the method of the present invention can solve the problem that the specific product requirements obtained in the product derivation process are unclear and the specific product model is relatively abstract.
[0090] This article combines the specification sheets, figures and specific embodiments only to help explain and understand the methods and ideas of this aspect. For those skilled in the art, it is obvious that the present invention is not limited to the embodiments described in the above specific embodiments. In addition, it should be understood that although this specification is described in accordance with the SOFL language, the principle of the method is language-independent, so it can be supported by other formal specification languages. This description of the specification is because I am more familiar with SOFL. Those skilled in the art can take the methods and ideas of the present invention as a whole, use other embodiments to make appropriate adjustments and combinations, and form other understandable implementation methods. The content of this specification should not be understood as a limitation of the present invention.
Claims
1. A product derivation method based on feature model and feature formal specification, characterized in that: The following steps are included: A. Generate feature fusion sequence: According to the hierarchical structure of the feature model and the constraint relationship of the features, the feature fusion sorting algorithm is used to determine the feature fusion order; the specific steps are as follows: A1. Select product features based on the systematically built software product line, and extract the feature model from the software product line to be derived; A2. Parse the XML format document of the obtained feature model, and determine the feature fusion order using the feature fusion sorting algorithm according to the feature constraint relationship and the feature model hierarchy of the feature model. The specific steps of the feature fusion sorting algorithm are as follows: A21. Perform a deep traversal of the feature model to find all non-leaf nodes, merge the leaf nodes under the same parent node in pairs, obtain a merged leaf node, and replace the parent node; A22, based on the leaf nodes merged in step A21, use the nearest neighbor search algorithm to find the nearest related leaf nodes, merge the nearest related leaf nodes in sequence, and repeat the previous step until there is only one merged leaf node; A23, the resulting sequence represents the order of operations for fusing the results of each two features with the next feature; B. Behavior-preserving feature fusion: According to the fusion order obtained in step A, two features are combined into a pair, and the behavior-preserving fusion of feature formal specifications is performed in combination with structured object-oriented formal language; first, the declaration part of the feature formal specifications is fused, and the behavior of each feature is represented by the functional scenario to generate the functional scenario path; then, according to the feature fusion order, the functional scenario paths of the features are matched in a pairwise fusion mode, and each pair of feature formal specifications is fused until the formal specification of the complete product is obtained. The specific steps are as follows: B1. Declaration fusion of feature formal specifications: Define the conversion rules from a single type variable to a fused type variable, and provide a conversion path from a single feature declaration to a fused feature declaration; B2. Generate feature function scenario path: Analyze the internal behavior of each feature and connect the scenarios of each feature behavior to form a scenario path; B3. Match the relevant scenarios of the functional path scenario feature pairs, and finally fuse the product formal specifications based on the results of path matching and fusion statement.
2. The product derivation method based on feature model and feature formal specification according to claim 1, characterized in that: The specific steps of declarative fusion of the feature formal specification described in step B1 are as follows: B11. Basic data types are reserved in the formal specifications of the fused product, including natural number types, natural number types including 0, integer types, real number types, character types, Boolean types, or enumeration types; B12. Declaration fusion rules for composite data types: generate composite type variables with the same semantics as the original ones from the relevant conditions involved in the operation; including set type set, sequence type sequence, composite type composite, mapping type map, product type product, and union type union; the rules are as follows: 1) The map type represents a finite pair of sets. If the domain / range of map s1 is satisfied by map s2, then dom(s1) = s2 or rng(s1) = s2; if map s1 and map s2 intersect, a new s is generated, which is the union of s1 and s2; if set s1 and set / com s2 intersect, then set s is the union (s1, s2); 2) The set type represents an unordered and unique set of objects. If sets s1 and s2 partially overlap, the fused set s is conc(s1, s2); 3) Sequence represents an ordered and unique set of objects. If sequences s1 and s2 partially overlap, the fused sequence s is the union (s1, s2); 4) Composite and product are both collections of different data elements and have customized functions. If composite / product s1 and s2 partially overlap or composite / product composite / product s2, then composite / product s is the union of s1 and s2, with only one copy of the repeated part retained.
3. The product derivation method based on feature model and feature formal specification according to claim 1, characterized in that: The specific steps of generating the feature function scenario path described in step B2 are as follows: B21. Extracting functional scenarios fs from feature formal specification module m i ; Module m is composed of multiple processes p, each of which contains an input port Iport p and output port Oport p , preP p and postcondition postP p , where the functional scenario is a conjunction preP p ∧C i ∧D i , where each c i (i∈1,…,n) does not contain output variables and D i Contain at least one output variable; transform the postcondition into an equivalent disjunctive normal form, and extract the functional scenario from the disjunctive clause in the disjunctive normal form; B22, connect functional scenarios to form a functional scenario path; a functional scenario path is an operation sequence [fs1, ..., fs n ], if and only if Connect the functional scenarios obtained in B21. When executing, the sequence {IV(p ij )}[p ij ]{OV(p ij )}→{IV(p lk )}[ pl k]{OV(p lk )}→…→{IV(p nn )}[p nn ]{OV(p nm )} for scene paths; each {IV(p ij )}[p ij ]{OV(p ij )} is a functional scenario, p ij Input IV(p ij ) objects from outside module m, the set OV(p ij ) is p ij Output of; p in the scene path ij Receive input data item IV(p ij ) and generates the data item OV(p ij ), where IV(p ij ) is included in the guard condition, OV(fs i ) are included in the definition conditions; f The functional scenario path of each process p will be generated according to the functional scenario.
4. The product derivation method based on feature model and feature formal specification according to claim 1, characterized in that: The functional path scene matching of the feature pair described in step B3 is specifically performed as follows: B31. Check the validity of the generated path. For two adjacent functional scenario paths, if a post-condition cannot be mapped to another pre-condition, it is an invalid path. B32. Feature fusion based on input and output port matching; features will interact through database information exchange and process scenario path information. Database information exchange means reading the data stream of one operation into the database and writing the data stream of another operation into the same database. Path matching needs to satisfy whether the connections between different port variables of the process can be matched, that is: Functional scenario paths of different features f1 and f2 are matchable if a set of inputs and outputs are the same; if the set of input variables of the functional scenario path of feature f1 is a subset of the output variables of another f2, and vice versa, the paths are related and can be matched.
5. The product derivation method based on feature model and feature formal specification according to claim 4, characterized in that: After step B32, execute step B33: B33. Feature fusion based on pre / post scene matching. Considering the matching based on input and output ports is not enough. It is also necessary to perform pre / postcondition matching check based on port matching. The scene path matching connection can be divided into three cases: 1) The sequential path of scenario connection, because conditional process B is only available in processes A1, A2, ..., A n It will be triggered only after all the scenarios are met, by checking Whether to meet the matching fusion; each post Ai v i (i=1,…,n) is the postcondition Ai A sub-logical expression of represents one of the scenarios of a component process Ai; 2) The process of selecting the structure is matched and integrated, and its inspection judgment is and Where pre is the precondition of the previous conditional process; post is a sub-logical expression containing the postcondition of the variable v; pre B It is the precondition of conditional process B; 3) The process matching fusion of the case structure is checked and judged as follows: and Where i = 1, ..., n; If the variable v satisfies condition C i (v), then the scenario associated with v is connected to the conditional process B i The premise needs to be through the conjunction pre∧post(v))∧C i (v) so that the scene paths are connected correctly.
