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

More Tutorial Info Needed #90

Open
Enhitech opened this issue Dec 21, 2020 · 0 comments
Open

More Tutorial Info Needed #90

Enhitech opened this issue Dec 21, 2020 · 0 comments

Comments

@Enhitech
Copy link

Hi. I'm using JPL to operate a knowledge base dynamically. However I cannot find any resources that tells me how to do that.

For example, I can use the following code to create a new fact and append it to KB:

Atom a = new Atom("a");
Atom b = new Atom("b");
Compound p = new Compound("parent", new Term[]{a, b});
Query q = new Query(new Compound("assertz", new Term[]{p}));
q.hasSolution();q1.close();

which is the Java version of the following command in swipl:

assertz(parent(a, b)).

But I cannot find a way to add the following rules to KB:

assertz((ancestor(X, Y) :- parent(X, Y))).
assertz((ancestor(X, Y) :- parent(X, Z), ancestor(Z, Y))).

Moreover, I cannot create the following query:

?- parent(X, Y), parent(Y, Z).

which is simply answered in the terminal version of swipl.

Is there any way to achieve these purposes? If so, please add such methods in tutorial pages. 👍

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

1 participant