这是用户在 2024-6-21 21:29 为 https://github.com/d2rq/d2rq/blob/master/README.md 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?
Skip to content
This repository has been archived by the owner on Jan 3, 2021. It is now read-only.

Files

Latest commit

909c6f1 · Mar 17, 2015

History

History
101 lines (60 loc) · 3.95 KB

README.md

File metadata and controls

101 lines (60 loc) · 3.95 KB

D2RQ – A Database to RDF Mapper
D2RQ – 数据库到 RDF 映射器

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 界面提供对数据库的访问。

Homepage and Documentation
主页和文档

Learn more about D2RQ at its homepage: http://d2rq.org/
在其主页了解有关 D2RQ 的更多信息:http://d2rq.org/

License 执照

Apache License, Version 2.0
Apache 许可证,版本 2.0

http://www.apache.org/licenses/LICENSE-2.0.html

Contact, feedback, discussion
联系、反馈、讨论

Please use the issue tracker here on GitHub for feature/bug discussion and support requests.
请使用 GitHub 上的问题跟踪器进行功能/错误讨论和支持请求。

Building from source 从源头构建

Prerequisites 先决条件

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 and javac on the command line to see if it's there.
    Java JDK v5 或更高版本,用于编译 Java 源代码。在命令行上运行 java -versionjavac 以查看它是否存在。
  • Apache Ant, for building D2RQ. Run ant on the command line to see if it's there.
    Apache Ant,用于构建 D2RQ。在命令行上运行 ant 以查看它是否存在。

Getting the source 获取源码

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

Doing Ant builds 进行 Ant 构建

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 蚂蚁javadocGenerate Javadoc API documentation
生成 Javadoc API 文档
ant tar 蚂蚁焦油Generate distribution file in tar.gz format
生成 tar.gz 格式的分发文件
ant test 蚂蚁测试Run tests 运行测试
ant vocab.configRegenerate Config vocabulary files from Turtle source
从 Turtle 源重新生成 Config 词汇文件
ant vocab.d2rq 蚂蚁词汇.d2rqRegenerate 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 格式的分发文件

Running D2RQ 运行 D2RQ

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 数据库。

Generating a default mapping file
生成默认映射文件

./generate-mapping -u root -o mydb.ttl jdbc:mysql:///mydb

This generates a mapping file mydb.ttl for your database.
这将为您的数据库生成一个映射文件 mydb.ttl

Dumping the database 转储数据库

./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 的转储。

Running D2R Server 运行 D2R 服务器

./d2r-server mydb.ttl

This starts up a server at http://localhost:2020/
这将在 http://localhost:2020/ 启动服务器

Deploying D2R Server into a servlet container
将 D2R Server 部署到 servlet 容器中

Edit /webapp/WEB-INF/web.xml to point the configFile parameter to the location of your mapping file.
编辑 /webapp/WEB-INF/web.xmlconfigFile 参数指向映射文件的位置。

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 目录中。

Running the unit tests 运行单元测试

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 的存在,并要求创建两个数据库:

  1. 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

  2. An empty database called D2RQ_TEST.
    名为 D2RQ_TEST 的空数据库。

d2rq/README.md at master · d2rq/d2rq · GitHub