Universal-Variability-Language / uvl-parser

GNU Lesser General Public License v3.0
10 stars 8 forks source link

Missing Attribute when converting from Type to Arithmetic Level #48

Open coemgen1992 opened 1 month ago

coemgen1992 commented 1 month ago

When converting Type level UVL models to Arithmetic Level UVL models, an attribute for the typed features gets lost.

Example: This UVL Model:

features
    ASEJ1
        mandatory
            Real Strands
            Modes
                or
                    top
                    horizontal
                    bottom
                    vertical
            UI
            TopFeeding3D   
            Thermal3D

constraints
    (Strands == 1.0 | Strands > 1.0) & (Strands == 100.0 | Strands < 100.0)
    (Strands == 4.0 | Strands > 4.0) => !top

Results in the following converted UVL Model:

features
        ASEJ1
                mandatory
                        Strands {feature_type 'Real'}
                        Modes
                                or
                                        top
                                        horizontal
                                        bottom
                                        vertical
                        UI
                        TopFeeding3D
                        Thermal3D

constraints
        (Strands.type_level_value == 1 | Strands.type_level_value > 1) & (Strands.type_level_value == 100 | Strands.type_level_value < 100)
        (Strands.type_level_value == 4 | Strands.type_level_value > 4) => !top

The missing attribute type_level_value in feature Strands causes a parsing error:

Exception in thread "main" Attribute Strands.type_level_value is referenced in a constraint in ASEJ1 but does not exist as feature in the tree! (at 16:0)
    at de.vill.main.UVLModelFactory.referenceAttributesInConstraints(UVLModelFactory.java:486)
    at de.vill.main.UVLModelFactory.parse(UVLModelFactory.java:148)
    at de.vill.main.UVLModelFactory.parse(UVLModelFactory.java:133)
    at de.kit.kastel.sdq.uvl.parser.test.ParserTest.main(ParserTest.java:54)