Skip to content

UVL Download is broken in some cases #41

Description

@derf

Hi,

When going along the Tutorial given at MODEVAR/Re:Volution just now, I encountered an error when using "Export To" → "Download UVL" in ide.flamapy.org.

Feature model:

features
	Pizza {Allergens {Cereals, Milk, Sulphites}, Units {Price 'Eur'},
			constraint Price == sum(Pizza, Price)}
		mandatory
			Integer OrderNum
			String CustomerName
			Base {abstract}
				mandatory
					Mozzarella
					Oregano
				optional
					Tomato
		optional
			Ingredients cardinality [1..6] {abstract, Price 1.00}
				alternative
					"York Ham"
					Mushroom
					Peppers
			Vegan
			Calzone
			Size {abstract}
				alternative
					Normal {Price 6.00}
					Big {Price 8.50}
constraints
	Calzone => !Size & !Calzone => Size
	Big => Ingredients.Price == Ingredients.Price + 0.50
	OrderNum > 0
	len(CustomerName) > 0

Error:

Traceback (most recent call last): File "/lib/python312.zip/_pyodide/_base.py", line 596, in eval_code_async await CodeRunner( File "/lib/python312.zip/_pyodide/_base.py", line 410, in run_async coroutine = eval(self.code, globals, locals) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<exec>", line 2, in <module> File "<exec>", line 125, in execute_export_transformation File "/lib/python3.12/site-packages/flamapy/core/discover.py", line 163, in use_transformation_m2t return plugin.use_transformation_m2t(src, dst) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.12/site-packages/flamapy/core/plugins.py", line 105, in use_transformation_m2t return result.transform() ^^^^^^^^^^^^^^^^^^ File "/lib/python3.12/site-packages/flamapy/metamodels/fm_metamodel/transformations/uvl_writer.py", line 56, in transform self.read_features(root, "features", 0) + "\n" + self.read_constraints() ^^^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.12/site-packages/flamapy/metamodels/fm_metamodel/transformations/uvl_writer.py", line 137, in read_constraints constraint_text = self.serialize_constraint(constraint) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.12/site-packages/flamapy/metamodels/fm_metamodel/transformations/uvl_writer.py", line 149, in serialize_constraint str_constraint = ctc.ast.pretty_str() ^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.12/site-packages/flamapy/core/models/ast.py", line 194, in pretty_str return self.root.pretty_str() ^^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.12/site-packages/flamapy/core/models/ast.py", line 115, in pretty_str left = Node._get_pretty_str_node(self.left) if self.left is not None else '' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lib/python3.12/site-packages/flamapy/core/models/ast.py", line 106, in _get_pretty_str_node res = f'{node.pretty_str()}' ^^^^^^^^^^^^^^^^^ File "/lib/python3.12/site-packages/flamapy/core/models/ast.py", line 127, in pretty_str return res ^^^ UnboundLocalError: cannot access local variable 'res' where it is not associated with a value 

Thanks for giving the tutorial by the way, I didn't know that UVL had come this far over the past years :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions