bbbBB
bbbBB

Reputation: 65

Prolog checking the database

Is it possible to go through the database and check if any form of Predicate(Atom) exists by using the preicate isInData(Predicate,Atom)?

Upvotes: 0

Views: 405

Answers (1)

Paulo Moura
Paulo Moura

Reputation: 18663

You can use the ISO standard current_predicate/1 predicate, which checks/returns predicate indicators, i.e. terms of the form Functor/Arity.

There's also a de facto standard predicate_property/2 predicate that allows you to query the properties of a predicate given its calling template.

If you want to check not only predicates, by their clauses, you can use the ISO standard clause/2 predicate.

Given that you're using SWI-Prolog, to lookup the documentation for these predicates, got to its website and type their predicate indicators in the search box in the top-right corner.

Upvotes: 1

Related Questions