query method

Stream<Node> query(
  1. Database database,
  2. Term goal
)

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));
    }
  }
}