00001 import java.util.Hashtable; 00002 import jpl.*; 00003 import jpl.Query; 00004 00005 public class SemWeb 00006 { public static void 00007 main(String argv[]) 00008 { String t1 = "use_module(library('semweb/rdf_db'))"; 00009 Query q1 = new Query(t1); 00010 00011 System.out.println( t1 + " " + (q1.hasSolution() ? "succeeded" : "failed") ); 00012 00013 Query ql = new Query("rdf_load('test.rdf')"); 00014 System.out.println(ql.hasSolution() ? "loaded" : "load failed"); 00015 00016 String t2 = "rdf(S,P,O)"; 00017 Query q2 = new Query(t2); 00018 while ( q2.hasMoreSolutions() ) 00019 { java.util.Hashtable s2 = q2.nextSolution(); 00020 System.out.println("{" + s2.get("S") + 00021 ", " + s2.get("P") + 00022 ", " + s2.get("O") + "}"); 00023 } 00024 } 00025 00026 } 00027 00028