thahmann / macleod

Ontology development environment for Common Logic (CL)
Other
23 stars 9 forks source link

analyze_logicals in Axiom.py crashes the parser when dealing w/ functions #26

Open evanmrsampson opened 6 years ago

evanmrsampson commented 6 years ago

@Fxhnd I pulled the DL changes into the master branch so that I could take advantage of the constants distinction. However, I found that the analyze_logicals method will crash when the axiom has a function in it.

At the moment, I commented out the call to analyze_logicals and left a TODO note above it. At the moment, the editor doesn't know the difference between constants and variables until this works

carmenchui commented 5 years ago

Just wondering if functions will be supported soon, there are some theories I'm working with that have functions so it'd be preferable if the translation for functions is operational.

Traceback of the current error when trying to do consistency check and translation:

Traceback (most recent call last): File "macleod/gui/gui_beta/gui_main.py", line 260, in check_consistency_command (return_value, fastest_reasoner) = ontology.check_consistency(resolve=True) File "/Users/cchui/Documents/GitHub/macleod/macleod/Ontology.py", line 217, in check_consistency reasoners.constructAllCommands(self) File "/Users/cchui/Documents/GitHub/macleod/macleod/ReasonerSet.py", line 38, in constructAllCommands r.constructCommand(ontology) File "/Users/cchui/Documents/GitHub/macleod/macleod/Reasoner.py", line 65, in constructCommand self.args = commands.get_system_command(self.name, ontology) File "/Users/cchui/Documents/GitHub/macleod/macleod/Commands.py", line 26, in get_system_command return handlers.get(system_name, get_empty_cmd)(ontology) File "/Users/cchui/Documents/GitHub/macleod/macleod/Commands.py", line 39, in get_p9_cmd args.append(clif_converter.convert_single_clif_file(ontology,clif_converter.ladr_output,True)) File "/Users/cchui/Documents/GitHub/macleod/bin/clif_converter.py", line 32, in convert_single_clif_file results = ontology.to_ladr(resolve) File "/Users/cchui/Documents/GitHub/macleod/macleod/Ontology.py", line 204, in to_ladr ladr_output.append(axiom.to_ladr()) File "/Users/cchui/Documents/GitHub/macleod/macleod/logical/Axiom.py", line 433, in to_ladr return "{}.".format(ladr_logical(self.sentence)) File "/Users/cchui/Documents/GitHub/macleod/macleod/logical/Axiom.py", line 427, in ladr_logical return "({} {})".format(("all {} " * len(logical.variables)).format(*logical.variables), ladr_logical(logical.terms[0])) File "/Users/cchui/Documents/GitHub/macleod/macleod/logical/Axiom.py", line 423, in ladr_logical return "({})".format(" & ".join([ladr_logical(t) for t in logical.terms])) File "/Users/cchui/Documents/GitHub/macleod/macleod/logical/Axiom.py", line 423, in <listcomp> return "({})".format(" & ".join([ladr_logical(t) for t in logical.terms])) File "/Users/cchui/Documents/GitHub/macleod/macleod/logical/Axiom.py", line 425, in ladr_logical return "({})".format(" | ".join([ladr_logical(t) for t in logical.terms])) File "/Users/cchui/Documents/GitHub/macleod/macleod/logical/Axiom.py", line 425, in <listcomp> return "({})".format(" | ".join([ladr_logical(t) for t in logical.terms])) File "/Users/cchui/Documents/GitHub/macleod/macleod/logical/Axiom.py", line 410, in ladr_logical return "{}({})".format(logical.name, ",".join([ladr_logical(t) for t in logical.variables])) File "/Users/cchui/Documents/GitHub/macleod/macleod/logical/Axiom.py", line 410, in <listcomp> return "{}({})".format(logical.name, ",".join([ladr_logical(t) for t in logical.variables])) File "/Users/cchui/Documents/GitHub/macleod/macleod/logical/Axiom.py", line 412, in ladr_logical return "{}({})".format(logical.name, ",".join(logical.variables)) TypeError: sequence item 0: expected str instance, Function found