if (cmd.hasArg(baseArg)) {
loader.setSystemBaseURI(cmd.getArg(baseArg).getValue());
}
loader.setResultSizeLimit(Database.NO_LIMIT);
Mapping mapping = loader.getMapping();
try {
// Trigger compilation
mapping.compiledPropertyBridges();
// Override the d2rq:resultSizeLimit given in the mapping
for (Database db: mapping.databases()) {
db.connectedDB().setDefaultFetchSize(DUMP_DEFAULT_FETCH_SIZE);
}
Model d2rqModel = loader.getModelD2RQ();
try {
RDFWriter writer = d2rqModel.getWriter(format.toUpperCase());
if (format.equals("RDF/XML") || format.equals("RDF/XML-ABBREV")) {
writer.setProperty("showXmlDeclaration", "true");
if (loader.getResourceBaseURI() != null) {
writer.setProperty("xmlbase", loader.getResourceBaseURI());
}
}
writer.write(d2rqModel, new OutputStreamWriter(out, "utf-8"), loader.getResourceBaseURI());
} catch (NoWriterForLangException ex) {
throw new D2RQException("Unknown format '" + format + "'", D2RQException.STARTUP_UNKNOWN_FORMAT);
} catch (UnsupportedEncodingException ex) {
throw new RuntimeException("Can't happen -- utf-8 is always supported");
}
} finally {
out.close();
mapping.close();
}
}