Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right output on console but wrong by pyswip.query() #36

Closed
ghost opened this issue Jun 13, 2018 · 4 comments
Closed

Right output on console but wrong by pyswip.query() #36

ghost opened this issue Jun 13, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Jun 13, 2018

I am using pyswip to play with geoquery dataset.

In [1]: from Prolog import prolog

In [2]: prolog.consult('geobase')
In [3]: prolog.consult('geoquery')
In [4]: list(prolog.query('answer(A,(river(A),loc(A,B),const(B,stateid(california)))).'))

It can get right result with prolog but weired output with pyswip:

Answer = [colorado]
Out[71]: [{'A': Variable(68), 'B': Variable(71)}] 
@hits-nlp
Copy link

I'm having a very similar issue, with a 'findall' query working correctly when called in the PL console, but returning a list of atoms instead of values when called from pyswip:

{'PROFILE': [Atom('7248900'), Atom('7249412'), Atom('7249796')]}

Has there been any progress on this?

@hits-nlp
Copy link

OK, got it, it has to to with how Atoms are rendered by Python when submitted to print()...

@hits-nlp
Copy link

I modified easy.py as follows:
def repr(self):
return str(self.chars.decode("utf-8"))

Now the above query returns:

{'PROFILE': [conf_cscw_jeffaylmss92, conf_ht_shackelfordss93, conf_ht_smiths91]}

@yuce
Copy link
Owner

yuce commented Jan 16, 2019

@hits-nlp The updated code for pyswip is at: https://github.com/yuce/pyswip/tree/refactor It is currently missing (a lot of) things, but the working parts should be more robust. Depending on your use case, it may work better.

@yuce yuce closed this as completed Aug 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants