简体   繁体   English

是否可以将内存中的 Jena 数据集存储为三重存储?

[英]Is it possible to store an in-memory Jena Dataset as a triple-store?

Warning!警告! This question is a catch, I bring 0 XP considering RDF systems, so I couldn't express this in a single question.这个问题是一个问题,考虑到 RDF 系统,我带来了 0 XP,所以我无法用一个问题来表达这一点。 Feel free to skip the first two paragraphs.随意跳过前两段。

What I'm trying to build, overall总体而言,我正在尝试构建的内容
I'm currently building a Spring app that will be the back-end for a system that will gather measurements.我目前正在构建一个 Spring 应用程序,它将成为收集测量值的系统的后端。
I want to store the info in a triple-store instead of an RDBMS.我想将信息存储在三重存储而不是 RDBMS 中。
So, you may imagine a Spring Boot app with the addition of the Jena library.因此,您可以想象一个添加了 Jena 库的 Spring Boot 应用程序。

The workflow of the system系统工作流程
About the methodology that I'm planning to deploy.关于我计划部署的方法。
1. Once the App is up and running it would either create or connect to an existing triple-store database. 1. 一旦应用程序启动并运行,它将创建或连接到现有的三重存储数据库。
2. A POST request reaches an app controller. 2. POST 请求到达应用程序控制器。
3. I use SPARQL query to insert the new entry to the triple-store. 3. 我使用 SPARQL 查询将新条目插入到三元组存储中。
4. Other Controller/Service/DAO methods exist to serve GET requests for SELECT queries on the triple-store. 4. 存在其他控制器/服务/DAO 方法来为三元组存储上的 SELECT 查询的 GET 请求提供服务。

*The only reason I provided such a detailed view of my final goal is to avoid answers that would call my question a XY-problem. *我提供如此详细的最终目标视图的唯一原因是避免将我的问题称为 XY 问题的答案。

The actual problem实际问题
1. Does a org.apache.jena.query.Dataset represent an in memory triple-store or is this kind of Dataset a completely different data structure? 1. org.apache.jena.query.Dataset代表内存三重存储还是这种数据集是完全不同的数据结构?
2. If a Dataset is indeed a triple-store, then how can I store this in-memory Dataset to retrieve it in a later session? 2. 如果数据集确实是三重存储,那么我如何存储这个内存中的数据集以在以后的会话中检索它?
3. If indeed one can store a Dataset, then what are the options? 3. 如果确实可以存储一个Dataset,那么有哪些选择? Is the default storing a Dataset as a file with .tdb extension?默认将数据集存储为扩展名为.tdb的文件吗? If so then what is the method for that and under which class?如果是这样,那么该方法是什么以及在哪个类下?
4. If so far I am correct in my guess then would the assemble method be sufficient to "retrieve" the triple-store from the file stored? 4. 如果到目前为止我的猜测是正确的,那么assemble方法是否足以从存储的文件中“检索”三重存储? 5. Do all triple-store databases follow this concept, of being stored in .tdb files? 5. 是否所有三重存储数据库都遵循这个概念,即存储在 .tdb 文件中?

org.apache.jena.query.Dataset is an interface - there are multiple implementations with different characteristics. org.apache.jena.query.Dataset是一个接口 - 有多种不同特性的实现。

DatasetFactory makes datasets of various kinds. DatasetFactory制作各种类型的数据集。 DatasetFactory.createTxnMem is an in-memory, transactional dataset. DatasetFactory.createTxnMem是内存中的事务数据集。 It can be initialized with the contents of files but updates do not change the files.它可以使用文件的内容进行初始化,但更新不会更改文件。

An in-memory only exists for the JVM-session.内存中仅存在于 JVM 会话中。

If you want data and data changes to persist across sessions, you can use TDB for persistent storage.如果您希望数据和数据更改跨会话持久保存,您可以使用 TDB 进行持久存储。 Try TDBFactory or TDB2Factory尝试TDBFactoryTDB2Factory

TDB (TDB1 or TDB2) are triplestore databases. TDB(TDB1 或 TDB2)是三重存储数据库。


Fuseki is the triple store server. Fuseki是三重商店服务器。 You can send SPARQL requests to Fuseki (query, update, bulk upload, ...)您可以向 Fuseki 发送 SPARQL 请求(查询、更新、批量上传等)

You can start Fuseki with a TDB database (it creates if it does not exist)您可以使用 TDB 数据库启动 Fuseki(如果不存在则创建)

fuseki-server -tdb2 --loc DB /myData

".tdb" isn't a file extension Apache Jena uses. “.tdb”不是 Apache Jena 使用的文件扩展名。 Databases are a directory of files.数据库是文件的目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM