You can query the dynamic database from the listener.
A query is specified with a goal pattern.
Syntactically - a goal is the same as a structure or atom (a
structure with 0 arguments).
Semantically - a goal is a pattern to be matched against in-memory
clauses (dynamic or static).
Unification is the name of the pattern-matching algorithm.
If the goal unifies with the head of a clause, then the query succeeds (true/yes); if not it fails (fail/no)
Backtracking is the name of the search algorithm used to find a clause head that unifies.
logicbase:
seats(727,100). seats(747,300).
queries:
?- seats(727,100). yes ?- seats(727,50). no