D2RQ exposes the contents of relational databases as RDF. It consists of:
D2RQ 将关系数据库的内容公开为 RDF。它包括:
- The D2RQ Mapping Language. Use it to write mappings between database tables and RDF vocabularies or OWL ontologies.
D2RQ 映射语言。使用它来编写数据库表和 RDF 词汇表或 OWL 本体之间的映射。 - The D2RQ Engine, a SPARQL-to-SQL rewriter that can evaluate SPARQL queries over your mapped database. It extends ARQ, the query engine that is part of Apache Jena.
D2RQ 引擎是一个 SPARQL 到 SQL 重写器,可以评估映射数据库上的 SPARQL 查询。它扩展了 ARQ,这是 Apache Jena 的一部分的查询引擎。 - D2R Server, a web application that provides access to the database via the SPARQL Protocol, as Linked Data, and via a simple HTML interface.
D2R Server,一个 Web 应用程序,通过 SPARQL 协议(作为链接数据)和简单的 HTML 界面提供对数据库的访问。
Learn more about D2RQ at its homepage: http://d2rq.org/
在其主页了解有关 D2RQ 的更多信息:http://d2rq.org/
Apache License, Version 2.0
Apache 许可证,版本 2.0
http://www.apache.org/licenses/LICENSE-2.0.html
Please use the issue tracker here on GitHub for feature/bug discussion and support requests.
请使用 GitHub 上的问题跟踪器进行功能/错误讨论和支持请求。
You need some tools in order to be able to build D2RQ. Depending on your operating system, they may or may not be already installed.
您需要一些工具才能构建 D2RQ。根据您的操作系统,它们可能已安装,也可能尚未安装。
- git, for forking the source code repository from GitHub. Run
git
on the command line to see if it's there.
git,用于从 GitHub 分叉源代码存储库。在命令行上运行git
以查看它是否存在。 - Java JDK v5 or later, for compiling Java sources. Run
java -version
andjavac
on the command line to see if it's there.
Java JDK v5 或更高版本,用于编译 Java 源代码。在命令行上运行java -version
和javac
以查看它是否存在。 - Apache Ant, for building D2RQ. Run
ant
on the command line to see if it's there.
Apache Ant,用于构建 D2RQ。在命令行上运行ant
以查看它是否存在。
Get the code by forking the GitHub repository and cloning your fork, or directly clone the main repository:
通过分叉 GitHub 存储库并克隆您的分叉来获取代码,或者直接克隆主存储库:
git clone git@github.com:d2rq/d2rq.git
D2RQ uses Apache Ant as its build system. You can run ant -p
from the project's main directory to get an overview of available targets:
D2RQ 使用 Apache Ant 作为其构建系统。您可以从项目的主目录运行 ant -p
来获取可用目标的概述:
To run the D2RQ tools, you need to do at least ant jar
.
要运行 D2RQ 工具,您至少需要执行 ant jar
。
ant all 全部蚂蚁 | Generate distribution files in zip and tar.gz formats 生成 zip 和 tar.gz 格式的分发文件 |
ant clean 蚂蚁干净 | Deletes all generated artefacts 删除所有生成的工件 |
ant compile 蚂蚁编译 | Compile project classes 编译项目类 |
ant compile.tests ant 编译.测试 | Compile test classes 编译测试类 |
ant jar 蚂蚁罐 | Generate project jar file 生成项目jar文件 |
ant javadoc 蚂蚁javadoc | Generate Javadoc API documentation 生成 Javadoc API 文档 |
ant tar 蚂蚁焦油 | Generate distribution file in tar.gz format 生成 tar.gz 格式的分发文件 |
ant test 蚂蚁测试 | Run tests 运行测试 |
ant vocab.config | Regenerate Config vocabulary files from Turtle source 从 Turtle 源重新生成 Config 词汇文件 |
ant vocab.d2rq 蚂蚁词汇.d2rq | Regenerate D2RQ vocabulary files from Turtle source 从 Turtle 源重新生成 D2RQ 词汇文件 |
ant war 蚂蚁大战 | Generate war archive for deployment in servlet container 生成 war 存档以在 servlet 容器中部署 |
ant zip 蚂蚁拉链 | Generate distribution file in zip format 生成 zip 格式的分发文件 |
After building with ant jar
, you can test-run the various components. Let's assume you have a MySQL database called mydb
on your machine.
使用 ant jar
构建后,您可以测试运行各个组件。假设您的计算机上有一个名为 mydb
的 MySQL 数据库。
./generate-mapping -u root -o mydb.ttl jdbc:mysql:///mydb
This generates a mapping file mydb.ttl
for your database.
这将为您的数据库生成一个映射文件 mydb.ttl
。
./dump-rdf -m mydb.ttl -o dump.nt
This creates dump.nt
, a dump containing the mapped RDF in N-Triples format.
这将创建 dump.nt
,这是一个包含 N-Triples 格式的映射 RDF 的转储。
./d2r-server mydb.ttl
This starts up a server at http://localhost:2020/
这将在 http://localhost:2020/ 启动服务器
Edit /webapp/WEB-INF/web.xml
to point the configFile
parameter to the location of your mapping file.
编辑 /webapp/WEB-INF/web.xml
将 configFile
参数指向映射文件的位置。
Build a war file with ant war
.
使用 ant war
构建一个 war 文件。
Deploy the war file, e.g., by copying it into the servlet container's webapps
directory.
部署 war 文件,例如将其复制到 servlet 容器的 webapps
目录中。
The unit tests can be executed with ant test
.
可以使用 ant test
执行单元测试。
Some unit tests rely on MySQL being present, and require that two databases are created:
一些单元测试依赖于 MySQL 的存在,并要求创建两个数据库:
-
A database called
iswc
that contains the data from/doc/example/iswc-mysql.sql
:
名为iswc
的数据库,其中包含来自/doc/example/iswc-mysql.sql
的数据:echo "CREATE DATABASE iswc" | mysql -u root mysql -u root iswc < doc/example/iswc-mysql.sql
echo "创建数据库 iswc" | mysql -u root mysql -u root iswc < doc/example/iswc-mysql.sql -
An empty database called
D2RQ_TEST
.
名为D2RQ_TEST
的空数据库。