RDF4J Workbench添加RDF:如何添加多个文件? [英] RDF4J Workbench Add RDF: How do I add multiple files?

查看:137
本文介绍了RDF4J Workbench添加RDF:如何添加多个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用RDF4J Workbench 2.1.2.

I'm using RDF4J Workbench 2.1.2.

System Information
Application Information
Application Name    RDF4J Workbench
Version 2.1.2
Runtime Information
Operating System    Windows 10 10.0 (amd64)
Java Runtime    Oracle Corporation Java HotSpot(TM) 64-Bit Server VM (1.8.0_111)
Process User    gwcox
Memory
Used    315 MB
Maximum 889 MB

我有一组RDF文件,其中包含我正在处理的本体.一些RDF文件会导入其他文件.例如,我的实例化本体/RDF文件导入了定义我的类和关系的几种本体.

I have a set of RDF files containing ontologies I'm working on. Some RDF files import others. For example, my instantiations ontology/RDF file imports the several ontologies defining my classes and relationships.

RDF文件存储在本地,而不是存储在用于标识它们的URI上.在开发和调试过程中,我经常需要清除存储库并重新加载本体.目前,需要加载六个本体才能实现全部功能.

The RDF files are stored locally, not at the URIs used to identify them. I often need to clear my repository and re-load my ontologies in the process of development and debugging. At present, a half-dozen ontologies need to be loaded for full functionality.

如何将存储为本地文件的多个本体加载到RDF4J工作台中的活动存储库中?我可以使用RDF4J工作台本身或命令行脚本来进行加载.我知道我可以在工作台上多次手动使用Modify/Add命令,但是我想将其减少为一个命令以节省时间并避免错误.

How can I load multiple ontologies stored as local files into my active repository in RDF4J workbench? I can use RDF4J workbench itself or a command line script to do the loading. I know I can manually use the Modify/Add command from the workbench multiple times, but I'd like to reduce it to one command to save time and avoid errors.

谢谢.

推荐答案

RDF4J Workbench本身不具有一次性添加多个文件的功能.

RDF4J Workbench itself has no functionality to add multiple files in one go.

但是,如果您需要重复执行此操作,则一种简单的方法是使用控制台,并为其编写一个简短的批处理脚本.该脚本只是一个带有连续控制台命令(每行一个)的文本文件.例如:

However, if this is something that you need to repeatedly execute, a simple approach is to use the Console, and write a short batch script for it. The script is simply a text file with successive Console commands (one per line). For example:

open myRepository
clear
load /path/to/file1.rdf into urn:context1
load /path/to/file2.rdf into urn:context2

然后,您可以简单地通过执行(从命令行)执行此操作:

Then you can simply execute this by doing (from the command line):

cat script.txt | ./console.sh 

另一种实现所需功能的方法是使用curl,并通过其 REST API .例如,要使用curl将Turtle文件上传到您的存储库,您需要执行以下操作:

Another way to achieve what you want is to use curl, and to access the RDF4J Server directly via its REST API. For example, to upload a Turtle file to your repository using curl, you'd do something like this:

curl -X POST -H "Content-type: text/turtle" --data-binary @file.ttl http://localhost:8080/rdf4j-server/repositories/myRepo/statements

最后,您当然也可以使用 RDF4J存储库API编写一个简短的Java程序与服务器通信.

Finally, you could of course also write a short Java program, using the RDF4J Repository API to communicate with the server.

这篇关于RDF4J Workbench添加RDF:如何添加多个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆