ravel-net / pyotr

Apache License 2.0
0 stars 0 forks source link

Condition concatenation not working when there are no conditions #17

Closed mudbri closed 2 years ago

mudbri commented 2 years ago

Test 4 of unit_tests fails with the following error:

Traceback (most recent call last):
  File "unit_tests.py", line 55, in <module>
    program1.minimize()
  File "./program.py", line 151, in minimize
    contained = self.contains_rule(rule_with_deleted_atom)
  File "./program.py", line 112, in contains_rule
    changed = self.execute(conn)
  File "./program.py", line 74, in execute
    DB_changes = rule.execute(conn)
  File "./rule.py", line 326, in execute
    return self.run_with_faure(conn, self.sql)
  File "./rule.py", line 577, in run_with_faure
    FaureEvaluation(conn, program_sql, additional_condition=",".join(self._additional_constraints), output_table="output", domains=self._domains, reasoning_engine=self._reasoning_engine, reasoning_sort=self._reasoning_type, simplication_on=self._simplication_on, information_on=False)
  File "../faure_translator/faure_evaluation.py", line 109, in __init__
    self._integration()
  File "../faure_translator/faure_evaluation.py", line 244, in _integration
    cursor.execute(data_sql)
psycopg2.errors.UndefinedColumn: column "none" does not exist
LINE 1: ...t t0.c0 as c0, t0.c1 as c1, t0.condition || Array[None] as c...

Fix would be to check if a condition is empty or not before concatenating

mudbri commented 2 years ago

Fixed in commit: 1362bcdb772569016b3de2ad8b714b17ddd83722