Skip to content

Commit

Permalink
dasgate now works with das-query-engine v0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
CICS-Oleg committed Feb 8, 2024
1 parent a031c02 commit a44b218
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
22 changes: 7 additions & 15 deletions python/hyperon/exts/das_gate/dasgate.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,19 @@ def _handle2atom3(self, h):

def query(self, query_atom):
query = self._atom2dict_new(query_atom)
vars = [x for x in self._get_all_vars(query_atom)]

query_params = {
"toplevel_only": False,
"return_type": QueryOutputFormat.ATOM_INFO,
'query_scope': 'local_only'
}
answer = self.das.query(query,
query_params)
answer = [query_answer for query_answer in self.das.query(query)]
new_bindings_set = BindingsSet.empty()

if not answer:
return new_bindings_set

for a in answer:
bindings = Bindings()
if isinstance(a, list):
b = a[0]
else:
b = a
var = vars[0]['name'][1:]
bindings.add_var_binding(V(var), self._handle2atom3(b))
for var, val in a.assignment.mapping.items():
# remove '$', because it is automatically added
bindings.add_var_binding(V(var[1:]), self._handle2atom(val))
new_bindings_set.push(bindings)

return new_bindings_set

def query_old(self, query_atom):
Expand Down
5 changes: 1 addition & 4 deletions repl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ description = "A shell to execute MeTTa"

[dependencies]
anyhow = { version = "1.0.75", features = ["std"] }
<<<<<<< HEAD
# rustyline = { version = "12.0.0", features = ["derive"] }
# rustyline = {git = "https://github.com/luketpeterson/rustyline", version = "12.0.0", features = ["derive"] }
# TODO: Yay, our fix landed in main. Still needs to publish however. One step closer
rustyline = {git = "https://github.com/kkawakam/rustyline", version = "12.0.0", features = ["derive"] }
=======
#rustyline = {git = "https://github.com/kkawakam/rustyline", version = "12.0.0", features = ["derive"] }
rustyline = { version = "13.0.0", features = ["derive"] }
>>>>>>> 7b73a4f48478b9a91b111c2b50a0f979c0ad4772
clap = { version = "4.4.0", features = ["derive"] }
signal-hook = "0.3.17"
pyo3 = { version = "0.19.2", features = ["auto-initialize"], optional = true }
Expand Down

0 comments on commit a44b218

Please sign in to comment.