org.apache.jena.rdf.model.Model.begin()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(113)

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

Model.begin介绍

[英]Begin a new transaction.

All changes made to a model within a transaction, will either be made, or none of them will be made.
[中]开始一项新的交易。
在事务中对模型所做的所有更改都将进行,或者不进行任何更改。

代码示例

代码示例来源:origin: vivo-project/Vitro

@Override
public Model begin() {
  return inner.begin();
}

代码示例来源:origin: apache/jena

@Override
public SecuredModel begin() {
  holder.getBaseItem().begin();
  return holder.getSecuredItem();
}

代码示例来源:origin: apache/jena

/**
 * Begin a transaction on the model if transactions are supported.
 * 
 * @param m
 */
public static Model txnBegin(Model m) {
  if (m.supportsTransactions()) {
    return m.begin();
  }
  return m;
}

代码示例来源:origin: org.apache.jena/jena-core

/**
 * Begin a transaction on the model if transactions are supported.
 * 
 * @param m
 */
public static Model txnBegin(Model m) {
  if (m.supportsTransactions()) {
    return m.begin();
  }
  return m;
}

代码示例来源:origin: apache/jena

protected void addContent( Resource root, Model m, Content c )
  {
  if (m.supportsTransactions())
    {
    m.begin();
    try { c.fill( m ); m.commit(); }
    catch (Throwable t) { m.abort(); throw new TransactionAbortedException( root, t ); }
    }
  else
    c.fill( m );
  }

代码示例来源:origin: org.apache.jena/jena-core

protected void addContent( Resource root, Model m, Content c )
  {
  if (m.supportsTransactions())
    {
    m.begin();
    try { c.fill( m ); m.commit(); }
    catch (Throwable t) { m.abort(); throw new TransactionAbortedException( root, t ); }
    }
  else
    c.fill( m );
  }

代码示例来源:origin: apache/jena

private static void testInfModel(Dataset ds0) {
  Txn.executeWrite(ds0, ()->{});
  Model baseModel = ds0.getDefaultModel(); 
  Model model = ModelFactory.createInfModel(RDFSRuleReasonerFactory.theInstance().create(null), baseModel);
  if ( model.getGraph().getTransactionHandler().transactionsSupported() ) {
    // InfModels do not support transactions per se - they particpate if includes in a suitabel dataset.
    model.begin();
    long x = Iter.count(model.listStatements());
    model.commit();
    assertTrue(x > 10);
  }
}

相关文章

Model类方法