Jasper (Sicstus): calling Prolog
// Variable declarations omitedsp = new SICStus(argv,null); sp.load("train.ql"); pred = new SPPredicate(sp, "connected", 4, ""); to = new SPTerm(sp, "Orebro"); from = new SPTerm(sp, "Stockholm"); way = new SPTerm(sp).putVariable(); query = sp.openQuery(pred, new SPTerm[] { from, to, way, way }); while (query.nextSolution()) { System.out.println(way.toString()); }
|