I am implementing a program which need to somehow add facts into a "Prolog" query. But I don't know how to do it. For example: In my "Prolog" database, I have a rule:
engineer(X) :-
employee(X,department_a).
Now I want to check if jack is an engineer, so the query would be:
engineer(jack).
To make this query success, there should be a fact as: employee(jack,department_a).
in database.
However in my program, I don't want to add (or assert) this fact into database, for reason that the program I am working on is a distributed system so that which department jack belongs to is unknown to database. In other words, I am looking for some way that can make prolog engine deduct based on its own database and given facts (the given fact is not stored in database but along with the query).
Is there any way how can I do it? Any suggestions is appreciated.
asertz
`retract` on the server side. But I have a feeling, that you can do it easier and in a more making sense way. But since you are not explaining well what is your requirement, it's hard to point it out. – Eugene Sh.