*/
protected void addInputStreamOrReader(Object inputStreamOrReader, String baseURI, RDFFormat dataFormat,
Resource... contexts)
throws IOException, RDFParseException, StoreException
{
RDFParser rdfParser = Rio.createParser(dataFormat, 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();
if (autoCommit) {
// Add the stream in a single transaction
begin();
}
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());