* @param graph Graph to use for the adder
* @param graphUri graph URi to use
*/
public void add(Graph graph, String graphUri) {
Resource context = (graphUri == null ? null : ValueFactoryImpl.getInstance().createURI(graphUri));
Connection connection = dataSource.getConnection();
try {
connection.begin();
if (context != null) {
connection.add().graph(graph, context);
} else {
connection.add().graph(graph);
}
connection.commit();
} catch (StardogException e) {
log.error("Error adding graph to Stardog", e);
throw new RuntimeException(e);
} finally {
context = null;