use of org.eclipse.rdf4j.repository.sparql.SPARQLRepository in project AJAN-service by aantakli.
the class SendHTLELogs method readExternalRepo.
private boolean readExternalRepo(final ArrayNode array) throws IOException {
boolean bool = false;
Repository repo = new SPARQLRepository(repository.toString());
try (RepositoryConnection conn = repo.getConnection()) {
conn.begin(IsolationLevels.SERIALIZABLE);
TupleQuery mmuQuery = conn.prepareTupleQuery(MMU_LOGS);
TupleQueryResult mmuResult = mmuQuery.evaluate();
if (readMMUInstructions(array, mmuResult)) {
bool = true;
TupleQuery abortQuery = conn.prepareTupleQuery(ABORT_LOGS);
TupleQueryResult abortResult = abortQuery.evaluate();
readAbortInstructions(array, abortResult);
}
conn.close();
}
return bool;
}
use of org.eclipse.rdf4j.repository.sparql.SPARQLRepository in project amazon-neptune-tools by awslabs.
the class NeptuneSparqlClient method executeTupleQuery.
public void executeTupleQuery(String sparql, RdfTargetConfig targetConfig) throws IOException {
SPARQLRepository repository = chooseRepository();
ValueFactory factory = repository.getValueFactory();
try (RepositoryConnection connection = repository.getConnection();
OutputWriter outputWriter = targetConfig.createOutputWriter()) {
RDFWriter writer = targetConfig.createRDFWriter(outputWriter);
connection.prepareTupleQuery(sparql).evaluate(new TupleQueryHandler(writer, factory));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations