use of org.apache.jena.system.progress.MonitorOutput 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.system.progress.MonitorOutput in project jena by apache.
the class Loader method create.
/**
* Create a {@link DataLoader}. {@code DataLoader}s provide a {@code StreamRDF}
* interface as well as an operation to load data from files or URLs.
* <p>
* To use the loader:
*
* <pre>
* loader.startBulk();
* send data ...
* use stream()
* or load(files)
* or a mixture.
* loader.finishBulk();
* </pre>
*/
public static DataLoader create(DatasetGraph dataset, boolean showProgress) {
MonitorOutput output = showProgress ? LoaderOps.outputToLog() : MonitorOutputs.nullOutput();
DataLoader loader = LoaderFactory.createLoader(dataset, output);
return loader;
}
use of org.apache.jena.system.progress.MonitorOutput in project jena by apache.
the class Loader method read.
/**
* Load the contents of files or remote web data into a dataset using the basic data loader.
*/
public static void read(DatasetGraph dataset, List<String> dataURLs, boolean showProgress) {
MonitorOutput output = showProgress ? LoaderOps.outputToLog() : MonitorOutputs.nullOutput();
DataLoader loader = LoaderFactory.basicLoader(dataset, output);
loader.startBulk();
try {
loader.load(dataURLs);
loader.finishBulk();
} catch (RuntimeException ex) {
loader.finishException(ex);
throw ex;
}
}
Aggregations