动态更新RDF文件

发布于 2024-08-15 16:50:46 字数 117 浏览 3 评论 0原文

是否可以通过网络表单根据用户生成的输入动态更新 rdf 文件?确切的场景是通过用户输入 html 表单来创建和更新概念定义。

我正在考虑 xpath,但是有没有更好/普遍接受/最佳实践的方法来做这种事情?

Is it possible to update an rdf file dynamically from user generated input through a webform? The exact scenario would beskos concept definitions being created and updated through user input to html forms.

I was considering xpath but is there a better / generally accepted / best practice way of doing this kind of thing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想挽留 2024-08-22 16:50:46

对于这种类型的事情,我有两种方法:

1 - 在三重存储中使用命名图形

您可以使用一个图形,该图形作为命名图形存储在支持三级更新的三重存储中,而不是编辑实际的固定文件(即您可以更改图中的各个三元组)。例如,您可以使用 Virtuoso基于 Jena 的商店 (Jena SDB/TDB) 来执行此操作,基本上任何支持 SPARUL 语言或有它自己的等效语言。

2 - 使用固定的 RDF 文件并更改它

从您提到的 XPath 来看,我假设您打算将文件存储为 RDF/XML。虽然 XPath 可能适用于此,但它将依赖于文件的确切序列化,并且可能会变得非常复杂。如果您的应用程序允许用户提交和编辑自己的文件,那么他们将无法保证 RDF 如何序列化为 RDF/XML,因此您的 XPath 表达式可能无法工作。如果您控制 RDF/XML 的所有序列化和处理,那么您可以将其保留为 XPath 可以使用的格式。

从我的角度来看,执行此方法的最简单方法是使用适当的 RDF 库将文件加载到内存中,在内存中对其进行操作,然后在用户完成时(或定期或其他方式)将整个文件保留回磁盘适合您的应用)

For this type of thing there are IMO two approaches:

1 - Using Named Graphs in a Triple Store

Rather than editing an actual fixed file you use a Graph which is stored as a named graph in a Triple Store that supports triple level updates (i.e. you can change individual Triples in a Graph). For example you could use a store like Virtuoso or a Jena based store (Jena SDB/TDB) to do this, basically any store that supports the SPARUL language or has it's own equivalent.

2 - Using a fixed RDF file and altering it

From your mention of XPath I assume that you are intending to store your file as RDF/XML. While XPath would potentially work for this it's going to be dependent on the exact serialization of your file and may get very complex. If your app is going to allow users to submit and edit their own files then they'll be no guarantees over how the RDF has been serialized into RDF/XML so your XPath expressions might not work. If you control all the serialization and processing of the RDF/XML then you can keep it in a format that your XPath will work on.

From my point of view the simplest way to do this approach is to load the file into memory using an appropriate RDF library, manipulate it in memory and then persist the whole thing back to disk when the user is done (or at regular intervals or whatever is appropriate to your application)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文