use of org.apache.jena.tdb2.loader.DataLoader in project jena by apache.
the class tdbloader method chooseLoader.
/**
* Decide on the bulk loader.
*/
private DataLoader chooseLoader(DatasetGraph dsg, String graphName) {
Objects.requireNonNull(dsg);
Node gn = null;
if (graphName != null)
gn = NodeFactory.createURI(graphName);
LoaderEnum useLoader = loader;
if (useLoader == null) {
// Default choice - phased if empty. basic if not.
boolean isEmpty = Txn.calculateRead(dsg, () -> dsg.isEmpty());
if (isEmpty)
useLoader = LoaderEnum.Phased;
else
useLoader = LoaderEnum.Basic;
}
MonitorOutput output = isQuiet() ? MonitorOutputs.nullOutput() : LoaderOps.outputToLog();
DataLoader loader = createLoader(useLoader, dsg, gn, output);
if (output != null)
output.print("Loader = %s", loader.getClass().getSimpleName());
return loader;
}
use of org.apache.jena.tdb2.loader.DataLoader in project jena by apache.
the class tdbloader method execBulkLoad.
private long execBulkLoad(DatasetGraph dsg, String graphName, List<String> urls, boolean showProgress) {
DataLoader loader = chooseLoader(dsg, graphName);
long elapsed = Timer.time(() -> {
loader.startBulk();
loader.load(urls);
loader.finishBulk();
});
return elapsed;
}
use of org.apache.jena.tdb2.loader.DataLoader in project jena by apache.
the class tdbloader method loadQuadsStdin.
private void loadQuadsStdin() {
DataLoader loader = chooseLoader(super.getDatasetGraph(), graphName);
StreamRDF dest = loader.stream();
if (lang == null)
lang = Lang.NQUADS;
RDFParser parser = RDFParser.create().lang(lang).source(System.in).build();
long elapsed = Timer.time(() -> {
loader.startBulk();
parser.parse(dest);
loader.finishBulk();
});
// return elapsed;
}
Aggregations