Package com.complexible.stardog.api

Examples of com.complexible.stardog.api.Connection.begin()


   */
  public <T> T execute(ConnectionCallback<T> action) {
    Connection connection = dataSource.getConnection();
   
    try {
      connection.begin();
      T t =  action.doWithConnection(connection);
      connection.commit();
      return t;
    } catch (StardogException e) {
      log.error("Error executing ConnectionCallback", e);
View Full Code Here


    if (object != null) {
      objectValue = TypeConverter.asLiteral(object);
    }
   
    try {
      connection.begin();
      connection.remove().statements(subjectResource, predicateResource, objectValue, context);
      connection.commit();
    } catch (StardogException e) {
      log.error("Error with remove statement", e);
      throw new RuntimeException(e);
View Full Code Here

   */
  public void remove(String graphUri) {
    Connection connection = dataSource.getConnection();
   
    try {
      connection.begin();
      connection.remove().context(ValueFactoryImpl.getInstance().createURI(graphUri));
      connection.commit();
    } catch (StardogException e) {
      log.error("Error removing graph from Stardog", e);
      throw new RuntimeException(e);
View Full Code Here

    }
   
    Value objectValue = TypeConverter.asLiteral(object);
   
    try {
      connection.begin();
      connection.remove().statements(subjectResource, predicateResource, null, context);
      connection.add().statement(subjectResource, predicateResource, objectValue, context);
      connection.commit();
    } catch (StardogException e) {
      log.error("Error with remove statement", e);
View Full Code Here

   */
  public <T> T doWithAdder(AdderCallback<T> action) {
    Connection connection = dataSource.getConnection();
    Adder adder = null;
    try {
      connection.begin();
      adder = connection.add();
      T t = action.add(adder);
      connection.commit();
      return t;
    } catch (StardogException e) {
View Full Code Here

   */
  public <T> T doWithRemover(RemoverCallback<T> action) {
    Connection connection = dataSource.getConnection();
    Remover remover = null;
    try {
      connection.begin();
      remover = connection.remove();
      T t = action.remove(remover);
      connection.commit();
      return t;
    } catch (StardogException e) {
View Full Code Here

   */
  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);
      }
View Full Code Here

  @Override
  public void write(List<? extends T> items) throws Exception {
    Connection connection = dataSource.getConnection();
    Adder adder = null;
    try {
      connection.begin();
      adder = connection.add();
      callback.write(adder, items);
      connection.commit();
    } catch (StardogException e) {
      log.error("Error with SnarlItemWriter ", e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.