Open a terminal and go into the extracted folder. Then, execute the following command:
javac -cp relational-database-example-1.3.1.jar fr/lirmm/graphik/graal/examples/relational_db/NaturalRdbmsExample.java
Execute the following command:
java -cp relational-database-example-1.3.1.jar fr/lirmm/graphik/graal/examples/relational_db/NaturalRdbmsExample ./data/
KBBuilder kbb = new KBBuilder();
kbb.setStore(new NaturalRDBMSStore(new SqliteDriver(new File(rootDir, dbFilepath))));
kbb.addRules(new DlgpParser(new File(rootDir, ontoFilepath)));
kbb.setApproach(Approach.REWRITING_FIRST);
KnowledgeBase kb = kbb.build();
writer = new DlgpWriter();
ConjunctiveQuery query = DlgpParser.parseQuery("?(X, Y1, Y2) :- "
+ " <Professor>(X), "
+ " worksFor(X, <http://www.Department0.University0.edu>), "
+ " name(X, Y1), "
+ " emailAddress(X, Y2).");
writer.write("\n= Query =\n");
writer.write(query);
writer.write("\n= Answers =\n");
CloseableIterator results = kb.query(query);
if (results.hasNext()) {
do {
writer.write(results.next());
} while (results.hasNext());
} else {
writer.write("No answers.\n");
}
results.close();
writer.close();
kb.close();