use of org.apache.rya.indexing.pcj.fluo.client.util.FluoLoader in project incubator-rya by apache.
the class LoadTriplesCommand method execute.
@Override
public void execute(final Connector accumulo, final String ryaTablePrefix, final RyaSailRepository rya, final FluoClient fluo, final String[] args) throws ArgumentsException, ExecutionException {
checkNotNull(accumulo);
checkNotNull(fluo);
checkNotNull(args);
log.trace("Executing the Load Triples Command...");
// Parse the command line arguments.
final Parameters params = new Parameters();
try {
new JCommander(params, args);
} catch (final ParameterException e) {
throw new ArgumentsException("Could not load the Triples file because of invalid command line parameters.", e);
}
// Iterate over the Statements that are in the input file and write them to Fluo.
log.trace("Loading RDF Statements from the Triples file '" + params.nTriplesFile + "'.");
final Path triplesPath = Paths.get(params.nTriplesFile);
try {
final RDFParser parser = Rio.createParser(RDFFormat.forFileName(triplesPath.getFileName().toString()));
final FluoLoader loader = new FluoLoader(fluo, new InsertTriples());
parser.setRDFHandler(loader);
parser.parse(Files.newInputStream(triplesPath), triplesPath.toUri().toString());
} catch (final Exception e) {
throw new ExecutionException("Could not load the RDF file into the Fluo app.", e);
}
log.trace("Finished executing the Load Triples Command.");
}
Aggregations