本文整理了Java中org.apache.jena.graph.Graph.getTransactionHandler()
方法的一些代码示例,展示了Graph.getTransactionHandler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getTransactionHandler()
方法的具体详情如下:
包路径:org.apache.jena.graph.Graph
类名称:Graph
方法名:getTransactionHandler
[英]returns this Graph's transaction handler
[中]返回此图的事务处理程序
代码示例来源:origin: apache/jena
@Override
public TransactionHandler getTransactionHandler()
{
return graph.getTransactionHandler() ;
}
代码示例来源:origin: apache/jena
private static void addHandler(Map<Object, TransactionHandler> handlers, Graph graph) {
TransactionHandler th = graph.getTransactionHandler();
if ( ! th.transactionsSupported() )
return;
Object key = calcKey(graph);
if ( th.transactionsSupported() )
handlers.put(key, th) ;
}
代码示例来源:origin: apache/jena
/**
* Commit the transaction on the graph if transactions are supported.
*
* @param g
*/
public static void txnCommit(Graph g) {
if (g.getTransactionHandler().transactionsSupported()) {
g.getTransactionHandler().commit();
}
}
代码示例来源:origin: apache/jena
/**
* Rollback (abort) the transaction on the graph if transactions are
* supported.
*
* @param g
*/
public static void txnRollback(Graph g) {
if (g.getTransactionHandler().transactionsSupported()) {
g.getTransactionHandler().abort();
}
}
}
代码示例来源:origin: apache/jena
@Override
public TransactionHandler getTransactionHandler() {
return (getBaseGraph() == null) ? super.getTransactionHandler() : getBaseGraph().getTransactionHandler();
}
代码示例来源:origin: apache/jena
public static void txnRun( Graph g, Runnable r ) {
if (g.getTransactionHandler().transactionsSupported()) {
g.getTransactionHandler().execute( r );
} else {
r.run();
}
}
代码示例来源:origin: org.apache.jena/jena-core
public void testExecuteInTransactionCatchesThrowable() {
Graph g = getGraph();
TransactionHandler th = g.getTransactionHandler();
if (th.transactionsSupported()) {
try { th.execute( ()-> { throw new Error() ; } ); }
catch (JenaException x) {}
}
}
代码示例来源:origin: apache/jena
public void testExecuteInTransactionCatchesThrowable() {
Graph g = getGraph();
TransactionHandler th = g.getTransactionHandler();
if (th.transactionsSupported()) {
try { th.execute( ()-> { throw new Error() ; } ); }
catch (JenaException x) {}
}
}
代码示例来源:origin: org.apache.jena/jena-core
@ContractTest
public void testGetTransactionHandler()
{
Graph g = producer.newInstance();
assertNotNull("Must return a Transaction handler",
g.getTransactionHandler());
}
代码示例来源:origin: apache/jena
@Test(expected=JenaException.class)
public void sink_graph_txn_5() {
DatasetGraph dsg = DatasetGraphSink.create();
Graph g = dsg.getDefaultGraph();
TransactionHandler h = g.getTransactionHandler();
h.commit();
}
}
代码示例来源:origin: apache/jena
@Test public void graph_txn_1() {
Graph g = dsg.getDefaultGraph();
Triple t = SSE.parseTriple("(:S :P :O)");
g.getTransactionHandler().execute(()->g.add(t));
g.getTransactionHandler().execute(()->
Assert.assertTrue(g.contains(t))
);
}
代码示例来源:origin: apache/jena
@Test(expected=JenaException.class)
public void zero_graph_txn_5() {
DatasetGraph dsg = DatasetGraphZero.create();
Graph g = dsg.getDefaultGraph();
TransactionHandler h = g.getTransactionHandler();
h.commit();
}
代码示例来源:origin: apache/jena
@Test public void graph_txn_2() {
Graph g = dsg.getDefaultGraph();
Triple t = SSE.parseTriple("(:S :P :O)");
g.getTransactionHandler().execute(()->g.add(t));
Graph g2 = dsg.getDefaultGraph();
g2.getTransactionHandler().execute(()->
Assert.assertTrue(g.contains(t))
);
}
代码示例来源:origin: apache/jena
@Test(expected=JenaException.class)
public void zero_graph_txn_3() {
DatasetGraph dsg = DatasetGraphZero.create();
Graph g = dsg.getDefaultGraph();
TransactionHandler h = g.getTransactionHandler();
h.begin();
h.begin();
}
代码示例来源:origin: apache/jena
@Test public void zero_graph_txn_2() {
DatasetGraph dsg = DatasetGraphZero.create();
Graph g = dsg.getDefaultGraph();
TransactionHandler h = g.getTransactionHandler();
h.begin();
h.abort();
}
代码示例来源:origin: apache/jena
@Test public void graph_txn_3() {
Node gn = SSE.parseNode(":gn");
Graph g = dsg.getGraph(gn);
Triple t = SSE.parseTriple("(:S :P :O)");
Quad q = Quad.create(gn, t);
g.getTransactionHandler().execute(()->g.add(t));
g.getTransactionHandler().execute(()->{
Assert.assertTrue(g.contains(t));
dsg.contains(q);
});
}
}
代码示例来源:origin: apache/jena
@Test(expected=JenaException.class)
public void zero_graph_txn_4() {
DatasetGraph dsg = DatasetGraphZero.create();
Graph g = dsg.getDefaultGraph();
TransactionHandler h = g.getTransactionHandler();
h.begin();
h.commit();
h.abort();
}
代码示例来源:origin: apache/jena
@Test public void graphDSG_view_txn_1() {
DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
Graph graph = dsg.getDefaultGraph();
assertTrue(graph instanceof GraphView);
assertTrue(graph.getTransactionHandler().transactionsSupported());
}
代码示例来源:origin: apache/jena
@Test public void graphDSG_view_txn_2() {
DatasetGraph dsg = DatasetGraphFactory.createGeneral();
// NOT dsg.getDefaultGraph()
Graph graph = GraphView.createDefaultGraph(dsg);
assertTrue( graph instanceof GraphView );
assertFalse(graph.getTransactionHandler().transactionsSupported());
}
代码示例来源:origin: apache/jena
@Test(expected=JenaException.class)
public void sink_graph_txn_4() {
DatasetGraph dsg = DatasetGraphSink.create();
Graph g = dsg.getDefaultGraph();
TransactionHandler h = g.getTransactionHandler();
h.begin();
h.commit();
h.abort();
}
内容来源于网络,如有侵权,请联系作者删除!