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

Querying without adding to database? #24

Open
borgauf opened this issue Feb 10, 2023 · 2 comments
Open

Querying without adding to database? #24

borgauf opened this issue Feb 10, 2023 · 2 comments

Comments

@borgauf
Copy link

borgauf commented Feb 10, 2023

Could you enlighten us on exactly how the goal querying works? For example, I've got a query that has multiple answers, but I seem to only get the first one.

`child(john,sue).
child(john,sam).
child(jane,sue).
child(jane,sam).
child(sue,george).
child(sue,gina).

male(john).

male(sam).
male(george).
female(june).
female(sue).
female(jane).

parent(Y,X) :- child(X,Y).

father(Y,X) :- child(X,Y), male(Y).

opp_sex(X,Y) :- male(X), female(Y).
opp_sex(Y,X) :- male(X), female(Y).

grand_father(X,Z) :- father(X,Y), parent(Y,Z).`

`#+NAME: grandfather1
#+HEADER: :session prolog-sess
#+HEADER: :goal gf(X,Z)
#+BEGIN_SRC prolog
gf(X,Z) :- grand_father(X,Z).
#+END_SRC

#+RESULTS: grandfather1
| A | = | george, |
| B | = | john. |`

There should be a george, jane match too. So how do you get the SWI ";" behavior?

@ljos
Copy link
Owner

ljos commented Feb 16, 2023

With a session it purposefully cuts the evaluation. See L215. It shouldn't be impossible to change the code to support being able to list out all results, but the easiest for you now is to instead find all the goals of a solution.

@borgauf
Copy link
Author

borgauf commented Feb 16, 2023 via email

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