manager.close();
sail.shutDown();
}
private static void loadFile(final String file, SailConnection sc, ValueFactory vf, CommitManager manager) throws RDFParseException, RDFHandlerException, FileNotFoundException, IOException {
NTriplesParser parser = new NTriplesParser(vf);
TripleHandler handler = new TripleHandler(sc, manager);
parser.setRDFHandler(handler);
parser.setStopAtFirstError(false);
parser.setParseErrorListener(new ParseErrorListener() {
@Override
public void warning(String msg, int lineNo, int colNo) {
System.err.println("warning: " + msg);
System.err.println("file: " + file + " line: " + lineNo + " column: " +colNo);
}
@Override
public void error(String msg, int lineNo, int colNo) {
System.err.println("error: " + msg);
System.err.println("file: " + file + " line: " + lineNo + " column: " +colNo);
}
@Override
public void fatalError(String msg, int lineNo, int colNo) {
System.err.println("fatal: " + msg);
System.err.println("file: " + file + " line: " + lineNo + " column: " +colNo);
}
});
parser.parse(new BufferedInputStream(new FileInputStream(new File(file))), "http://dbpedia.org/");
}