D2rq
Database to RDF mapping engine and SPARQL server
Install / Use
/learn @d2rq/D2rqREADME
D2RQ – A Database to RDF Mapper
D2RQ exposes the contents of relational databases as RDF. It consists of:
- The D2RQ Mapping Language. Use it to write mappings between database tables and RDF vocabularies or OWL ontologies.
- 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.
- D2R Server, a web application that provides access to the database via the SPARQL Protocol, as Linked Data, and via a simple HTML interface.
Homepage and Documentation
Learn more about D2RQ at its homepage: http://d2rq.org/
License
Apache License, Version 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.
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.
- git, for forking the source code repository from GitHub. Run
giton the command line to see if it's there. - Java JDK v5 or later, for compiling Java sources. Run
java -versionandjavacon the command line to see if it's there. - Apache Ant, for building D2RQ. Run
anton the command line to see if it's there.
Getting the source
Get the code by forking the GitHub repository and cloning your fork, or directly clone the main repository:
git clone git@github.com:d2rq/d2rq.git
Doing Ant builds
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:
To run the D2RQ tools, you need to do at least ant jar.
Running 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.
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.
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.
Running D2R Server
./d2r-server mydb.ttl
This starts up a server at http://localhost:2020/
Deploying D2R Server into a servlet container
Edit /webapp/WEB-INF/web.xml to point the configFile parameter to the location of your mapping file.
Build a war file with ant war.
Deploy the war file, e.g., by copying it into the servlet container's webapps directory.
Running the unit tests
The unit tests can be executed with ant test.
Some unit tests rely on MySQL being present, and require that two databases are created:
-
A database called
iswcthat contains the data from/doc/example/iswc-mysql.sql:echo "CREATE DATABASE iswc" | mysql -u root mysql -u root iswc < doc/example/iswc-mysql.sql
-
An empty database called
D2RQ_TEST.
Related Skills
feishu-drive
338.7k|
things-mac
338.7kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
338.7kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
yu-ai-agent
1.9k编程导航 2025 年 AI 开发实战新项目,基于 Spring Boot 3 + Java 21 + Spring AI 构建 AI 恋爱大师应用和 ReAct 模式自主规划智能体YuManus,覆盖 AI 大模型接入、Spring AI 核心特性、Prompt 工程和优化、RAG 检索增强、向量数据库、Tool Calling 工具调用、MCP 模型上下文协议、AI Agent 开发(Manas Java 实现)、Cursor AI 工具等核心知识。用一套教程将程序员必知必会的 AI 技术一网打尽,帮你成为 AI 时代企业的香饽饽,给你的简历和求职大幅增加竞争力。
