org.eclipse.rdf4j.repository.RepositoryConnection.isAutoCommit()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中org.eclipse.rdf4j.repository.RepositoryConnection.isAutoCommit方法的一些代码示例,展示了RepositoryConnection.isAutoCommit的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryConnection.isAutoCommit方法的具体详情如下:
包路径:org.eclipse.rdf4j.repository.RepositoryConnection
类名称:RepositoryConnection
方法名:isAutoCommit

RepositoryConnection.isAutoCommit介绍

[英]Indicates if the connection is in auto-commit mode. The connection is in auto-commit mode when no transaction is currently active, that is, when:

  1. #begin() has not been called or;
  2. #commit() or #rollback() have been called to finish the transaction.
    [中]指示连接是否处于自动提交模式。当前没有事务处于活动状态时,连接处于自动提交模式,即:
    1.#begin()未被调用或删除;
    1.#commit()或#rollback()已被调用以完成事务。

代码示例

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

/**
 * @deprecated since release 2.7.0. Use {@link #isActive()} instead.
 */
@Override
@Deprecated
public boolean isAutoCommit()
  throws RepositoryException
{
  return getDelegate().isAutoCommit();
}

代码示例来源:origin: eclipse/rdf4j

/**
 * @deprecated since release 2.7.0. Use {@link #isActive()} instead.
 */
@Override
@Deprecated
public boolean isAutoCommit()
  throws RepositoryException
{
  return getDelegate().isAutoCommit();
}

代码示例来源:origin: franzinc/agraph-java-client

@Test
public void testConsecutiveUpdatesInSameTransaction()
    throws Exception {
  // this tests if consecutive updates in the same transaction behave
  // correctly. See issue SES-930
  logger.debug("executing test testConsecutiveUpdatesInSameTransaction");
  StringBuilder update1 = new StringBuilder();
  update1.append(getNamespaceDeclarations());
  update1.append("DELETE { ?x foaf:name ?y } WHERE {?x foaf:name ?y }");
  boolean autoCommit = con.isAutoCommit();
  con.setAutoCommit(false);
  Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update1.toString());
  assertFalse(con.hasStatement(bob, RDFS.LABEL, f.createLiteral("Bob"), true));
  assertFalse(con.hasStatement(alice, RDFS.LABEL, f.createLiteral("Alice"), true));
  operation.execute();
  // update should be visible to own connection.
  assertFalse(con.hasStatement(bob, FOAF.NAME, f.createLiteral("Bob"), true));
  assertFalse(con.hasStatement(alice, FOAF.NAME, f.createLiteral("Alice"), true));
  StringBuilder update2 = new StringBuilder();
  update2.append(getNamespaceDeclarations());
  update2.append("INSERT { ?x rdfs:label ?y } WHERE {?x foaf:name ?y }");
  operation = con.prepareUpdate(QueryLanguage.SPARQL, update2.toString());
  operation.execute();
  // update should not have resulted in any inserts: where clause is empty.
  assertFalse(con.hasStatement(bob, RDFS.LABEL, f.createLiteral("Bob"), true));
  assertFalse(con.hasStatement(alice, RDFS.LABEL, f.createLiteral("Alice"), true));
  con.setAutoCommit(autoCommit);
}

代码示例来源:origin: franzinc/agraph-java-client

update.append("DELETE { ?x foaf:name ?y } INSERT {?x rdfs:label ?y . } WHERE {?x foaf:name ?y }");
boolean autoCommit = con.isAutoCommit();

相关文章

微信公众号

最新文章

更多