Resource... contexts)
throws IOException, RDFParseException, RepositoryException
{
OpenRDFUtil.verifyContextNotNull(contexts);
RDFParser rdfParser = Rio.createParser(dataFormat, getRepository().getValueFactory());
rdfParser.setVerifyData(true);
rdfParser.setStopAtFirstError(true);
rdfParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);
RDFInserter rdfInserter = new RDFInserter(this);
rdfInserter.enforceContext(contexts);
rdfParser.setRDFHandler(rdfInserter);
boolean autoCommit = isAutoCommit();
setAutoCommit(false);
try {
if (inputStreamOrReader instanceof InputStream) {
rdfParser.parse((InputStream)inputStreamOrReader, baseURI);
}
else if (inputStreamOrReader instanceof Reader) {
rdfParser.parse((Reader)inputStreamOrReader, baseURI);
}
else {
throw new IllegalArgumentException(
"inputStreamOrReader must be an InputStream or a Reader, is a: "
+ inputStreamOrReader.getClass());