【问题标题】:Jena's TDB dataset got TDBTransactionException when try to commit an transactionJena 的 TDB 数据集在尝试提交事务时出现 TDBTransactionException
【发布时间】:2018-04-22 09:16:42
【问题描述】:

这是我写的:

public static void main(String[] args) {
    Dataset dataset = TDBFactory.createDataset("/tmp/someThings");
    dataset.begin(ReadWrite.WRITE);
    Model model = dataset.getDefaultModel();
    model.setNsPrefix("kg", "http://sankuai.com/kg");
    Resource resource = model.createResource("http://sankuai.com/kg/jena");
    resource.addProperty(model.createProperty("kg", "language"), "SPARQL");
    dataset.commit();
    System.out.println(model);
}

但是给我一些输出,它显示一个错误:

Exception in thread "main" org.apache.jena.tdb.transaction.TDBTransactionException: Not in a transaction

是不是我做错了什么?

【问题讨论】:

    标签: graph sparql rdf jena


    【解决方案1】:

    问题是当我检索模型时:

    System.out.println(model);
    

    它必须包含在交易中,我不是...

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多