This method returns a java.util.Map, which represents a binding from the names of query variables to terms within the next solution. For example, if a Query has an occurrence of a jpl.Variable, say, named "X", one can obtain the Term bound to "X" in the solution by looking up "X" in the Map. <p
()
| 497 | * @throws NoSuchElementException if there are no more new solutions. |
| 498 | */ |
| 499 | public final Map<String, Term> nextSolution() { |
| 500 | if (hasMoreSolutions()) { |
| 501 | hasNextSolution = null; // we reset this as we moved the pointer (we now do not know if there is a new one) |
| 502 | return getCurrentSolutionBindings(); |
| 503 | } else |
| 504 | throw new NoSuchElementException("Query has already yielded all solutions"); |
| 505 | } |
| 506 | |
| 507 | private Map<String, Term> getCurrentSolutionBindings() { |
| 508 | if (!open) { |