query method
Implementation
Stream<Node> query(Database database, Term goal) async* {
final match = head.match(goal);
if (match != null) {
final newHead = head.substitute(match);
final newBody = body.substitute(match);
await for (final item in newBody.query(database)) {
yield newHead.substitute(newBody.match(item));
}
}
}