@@ -39,13 +39,21 @@ def transform(self) -> FeatureModel:
3939 # Copy the feature's attributes and relations from the referenced feature
4040 feature .relations = feature .reference .relations
4141 feature .attributes .extend (feature .reference .attributes )
42+ # Process attribute constraints
43+ feature .constraints_attributes .extend (feature .reference .constraints_attributes )
44+ process_attribute_constraints (feature .reference ,
45+ new_feature_model .alias_namespace ,
46+ self ._maintain_namespaces )
4247 if not self ._maintain_namespaces :
4348 feature .name = feature .reference .name
4449 else :
4550 namespace = '.' .join (feature .name .split ('.' )[:- 1 ])
4651 put_namespace_to_features (feature .reference , namespace )
4752 feature .reference = None # Clear reference after copying
4853 features .extend (feature .get_children ())
54+ # Add contraints from imported models
55+ for imported_fm in self .feature_model .imports .values ():
56+ new_feature_model .ctcs .extend (imported_fm .ctcs )
4957 if not self ._maintain_namespaces :
5058 for ctcs in new_feature_model .ctcs :
5159 process_namespace_constraint (ctcs .ast , new_feature_model .alias_namespace )
@@ -63,6 +71,20 @@ def put_namespace_to_features(root: Feature, namespace: str) -> None:
6371 features .extend (feature .get_children ())
6472
6573
74+ def process_attribute_constraints (root : Feature ,
75+ alias_namespace : dict [str , str ],
76+ maintain_namespaces : bool ) -> None :
77+ """Put the namespace to the constraints of the attributes constraints and return them to
78+ incorporate in the new feature model."""
79+ features = [root ]
80+ while features :
81+ feature = features .pop ()
82+ for ctc in feature .constraints_attributes :
83+ if not maintain_namespaces :
84+ process_namespace_constraint (ctc .ast , alias_namespace )
85+ features .extend (feature .get_children ())
86+
87+
6688def process_namespace_constraint (ast : AST , alias_namespace : dict [str , str ]) -> None :
6789 """Replace the namespace of the features in the constraints."""
6890 stack = [ast .root ]
0 commit comments