MCPcopy Create free account
hub / github.com/SWI-Prolog/packages-jpl / main

Method main

src/examples/java/db/Db.java:10–21  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

8
9public class Db {
10 public static void main(String[] args) {
11 Term t = Term.textToTerm("consult('db.pl')");
12 Query.hasSolution(t);
13
14 Iterator<Map<String, Term>> solutionsIter = new Query("person(X, Y, Z)");
15 while (solutionsIter.hasNext()) {
16 Map<String, Term> sol = solutionsIter.next();
17 System.out.println("\t Solution found (now asserting to block?): " + sol.toString());
18 Query.oneSolution(String.format("assertz(name_of_person(%s))", sol.get("X").toString()));
19 }
20 Query.hasSolution("listing(name_of_person/1)");
21 }
22}

Callers

nothing calls this directly

Calls 6

textToTermMethod · 0.95
hasSolutionMethod · 0.95
hasNextMethod · 0.95
nextMethod · 0.95
oneSolutionMethod · 0.95
toStringMethod · 0.45

Tested by

no test coverage detected