本文整理了Java中org.eclipse.rdf4j.repository.RepositoryConnection.setAutoCommit
方法的一些代码示例,展示了RepositoryConnection.setAutoCommit
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryConnection.setAutoCommit
方法的具体详情如下:
包路径:org.eclipse.rdf4j.repository.RepositoryConnection
类名称:RepositoryConnection
方法名:setAutoCommit
[英]Enables or disables auto-commit mode for the connection. If a connection is in auto-commit mode, then all updates will be executed and committed as individual transactions. Otherwise, the updates are grouped into transactions that are terminated by a call to either #commit or #rollback. By default, new connections are in auto-commit mode.
NOTE: If this connection is switched to auto-commit mode during a transaction, the transaction is committed.
[中]启用或禁用连接的自动提交模式。如果连接处于自动提交模式,则所有更新都将作为单个事务执行和提交。否则,更新会被分组到事务中,并通过调用#提交或#回滚来终止。默认情况下,新连接处于自动提交模式。
注意:如果在事务期间将此连接切换到自动提交模式,则事务将被提交。
代码示例来源:origin: eclipse/rdf4j
/**
* @deprecated use {@link #begin()} instead.
*/
@Deprecated
@Override
public void setAutoCommit(boolean autoCommit)
throws RepositoryException
{
super.setAutoCommit(autoCommit);
getDelegate().setAutoCommit(autoCommit);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* @deprecated use {@link #begin()} instead.
*/
@Deprecated
@Override
public void setAutoCommit(boolean autoCommit)
throws RepositoryException
{
super.setAutoCommit(autoCommit);
getDelegate().setAutoCommit(autoCommit);
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testInferencerQueryDuringTransaction()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(bob, name, nameBob);
assertTrue(testCon.hasStatement(bob, RDF.TYPE, RDFS.RESOURCE, true));
testCon.setAutoCommit(true);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-event
@Override
@Deprecated
public void setAutoCommit(boolean autoCommit)
throws RepositoryException
{
boolean wasAutoCommit = isAutoCommit();
getDelegate().setAutoCommit(autoCommit);
if (activated && wasAutoCommit != autoCommit) {
for (RepositoryConnectionListener listener : listeners) {
listener.setAutoCommit(getDelegate(), autoCommit);
}
if (autoCommit) {
for (RepositoryConnectionListener listener : listeners) {
listener.commit(getDelegate());
}
}
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@Override
@Deprecated
public void setAutoCommit(boolean autoCommit)
throws RepositoryException
{
boolean wasAutoCommit = isAutoCommit();
getDelegate().setAutoCommit(autoCommit);
if (activated && wasAutoCommit != autoCommit) {
for (RepositoryConnectionListener listener : listeners) {
listener.setAutoCommit(getDelegate(), autoCommit);
}
if (autoCommit) {
for (RepositoryConnectionListener listener : listeners) {
listener.commit(getDelegate());
}
}
}
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testInferencerUpdates()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(bob, name, nameBob);
testCon.remove(bob, name, nameBob);
testCon.setAutoCommit(true);
assertFalse(testCon.hasStatement(bob, RDF.TYPE, RDFS.RESOURCE, true));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testSubClassInference()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(woman, RDFS.SUBCLASSOF, person);
testCon.add(man, RDFS.SUBCLASSOF, person);
testCon.add(alice, RDF.TYPE, woman);
testCon.setAutoCommit(true);
assertTrue(testCon.hasStatement(alice, RDF.TYPE, person, true));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testRollback()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(alice, name, nameAlice);
assertTrue("Uncommitted updates should be visible to own connection", testCon.hasStatement(alice, name,
nameAlice, false));
testCon.rollback();
assertFalse("Repository should not contain statement after rollback", testCon.hasStatement(alice, name,
nameAlice, false));
testCon.setAutoCommit(true);
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testAutoCommit()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(alice, name, nameAlice);
assertTrue("Uncommitted update should be visible to own connection", testCon.hasStatement(alice, name,
nameAlice, false));
testCon.commit();
assertTrue("Repository should contain statement after commit", testCon.hasStatement(alice, name,
nameAlice, false));
testCon.setAutoCommit(true);
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testMakeExplicit()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(woman, RDFS.SUBCLASSOF, person);
testCon.add(alice, RDF.TYPE, woman);
testCon.setAutoCommit(true);
assertTrue(testCon.hasStatement(alice, RDF.TYPE, person, true));
testCon.add(alice, RDF.TYPE, person);
assertTrue(testCon.hasStatement(alice, RDF.TYPE, person, true));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testInferencerTransactionIsolation()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(bob, name, nameBob);
assertTrue(testCon.hasStatement(bob, RDF.TYPE, RDFS.RESOURCE, true));
assertFalse(testCon2.hasStatement(bob, RDF.TYPE, RDFS.RESOURCE, true));
testCon.setAutoCommit(true);
assertTrue(testCon.hasStatement(bob, RDF.TYPE, RDFS.RESOURCE, true));
assertTrue(testCon2.hasStatement(bob, RDF.TYPE, RDFS.RESOURCE, true));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testGetContextIDs()
throws Exception {
assertEquals(0, testCon.getContextIDs().asList().size());
// load data
testCon.setAutoCommit(false);
testCon.add(bob, name, nameBob, context1);
assertEquals(Arrays.asList(context1), Iterations.asList(testCon.getContextIDs()));
testCon.remove(bob, name, nameBob, context1);
assertEquals(0, Iterations.asList(testCon.getContextIDs()).size());
testCon.setAutoCommit(true);
assertEquals(0, Iterations.asList(testCon.getContextIDs()).size());
testCon.add(bob, name, nameBob, context2);
assertEquals(Arrays.asList(context2), Iterations.asList(testCon.getContextIDs()));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testDuplicateFilter()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(bob, name, nameBob);
testCon.add(bob, name, nameBob);
testCon.add(bob, name, nameBob);
testCon.setAutoCommit(true);
RepositoryResult<Statement> result = testCon.getStatements(bob, name, null, true);
result.enableDuplicateFilter();
int count = 0;
while (result.hasNext()) {
result.next();
count++;
}
assertEquals(1, count);
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testRemoveStatementCollection()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(alice, name, nameAlice);
testCon.add(bob, name, nameBob);
testCon.setAutoCommit(true);
assertTrue(testCon.hasStatement(bob, name, nameBob, false));
assertTrue(testCon.hasStatement(alice, name, nameAlice, false));
Collection<Statement> c = Iterations.addAll(testCon.getStatements(null, null, null, false),
new ArrayList<Statement>());
testCon.remove(c);
assertFalse(testCon.hasStatement(bob, name, nameBob, false));
assertFalse(testCon.hasStatement(alice, name, nameAlice, false));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testRemoveStatements()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(bob, name, nameBob);
testCon.add(alice, name, nameAlice);
testCon.setAutoCommit(true);
assertTrue(testCon.hasStatement(bob, name, nameBob, false));
assertTrue(testCon.hasStatement(alice, name, nameAlice, false));
testCon.remove(bob, name, nameBob);
assertFalse(testCon.hasStatement(bob, name, nameBob, false));
assertTrue(testCon.hasStatement(alice, name, nameAlice, false));
testCon.remove(alice, null, null);
assertFalse(testCon.hasStatement(alice, name, nameAlice, false));
assertTrue(testCon.isEmpty());
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testTransactionIsolation()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(bob, name, nameBob);
assertTrue(testCon.hasStatement(bob, name, nameBob, false));
assertFalse(testCon2.hasStatement(bob, name, nameBob, false));
testCon.commit();
assertTrue(testCon.hasStatement(bob, name, nameBob, false));
assertTrue(testCon2.hasStatement(bob, name, nameBob, false));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testEmptyRollback()
throws Exception {
assertTrue(testCon.isEmpty());
assertTrue(testCon2.isEmpty());
testCon.setAutoCommit(false);
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertFalse(testCon.isEmpty());
assertTrue(testCon2.isEmpty());
testCon.rollback();
assertTrue(testCon.isEmpty());
assertTrue(testCon2.isEmpty());
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testEmptyCommit()
throws Exception {
assertTrue(testCon.isEmpty());
assertTrue(testCon2.isEmpty());
testCon.setAutoCommit(false);
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertFalse(testCon.isEmpty());
assertTrue(testCon2.isEmpty());
testCon.commit();
assertFalse(testCon.isEmpty());
assertFalse(testCon2.isEmpty());
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testSizeRollback()
throws Exception {
assertEquals(0, testCon.size());
assertEquals(0, testCon2.size());
testCon.setAutoCommit(false);
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertEquals(1, testCon.size());
assertEquals(0, testCon2.size());
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertEquals(2, testCon.size());
assertEquals(0, testCon2.size());
testCon.rollback();
assertEquals(0, testCon.size());
assertEquals(0, testCon2.size());
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testSizeCommit()
throws Exception {
assertEquals(0, testCon.size());
assertEquals(0, testCon2.size());
testCon.setAutoCommit(false);
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertEquals(1, testCon.size());
assertEquals(0, testCon2.size());
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertEquals(2, testCon.size());
assertEquals(0, testCon2.size());
testCon.commit();
assertEquals(2, testCon.size());
assertEquals(2, testCon2.size());
}
内容来源于网络,如有侵权,请联系作者删除!