This has been done:
-
Cloned the d2rq repo as a bare repo with
git clone --mirror https://github.com:d2rq/d2rq.git
-
Stripped the cloned d2rq repository history of jar files
java -jar ../../Downloads/bfg-1.12.8.jar --delete-files "*.jar" d2rq.git cd d2rq.git git reflog expire --expire=now --all && git gc --prune=now --aggressive
-
Cloned the stripped bare repo, checked out the most current branch, and removed the origin
cd .. git clone d2rq.git d2rq-maven cd d2rq-maven git checkout d2rq2016 git remote remove origin
-
Moved the contents of src/ to src/main/java (with history preserved)
-
Moved the contents of test/ to src/test/java (with history preserved)
-
Removed the eclipse project files
-
Added a pom.xml file with all of the dependencies I could find, in the exact same version as the stripped jar files
-
Pushed the repository to a new github repository, http://github.com/steinarb/d2rq-maven
The joseki-3.4.4.jar dependency couldn't be satisfied on maven central. To avoid "polluting" this repository with a jar (all binaries checked into a git repository, are part of all future clones of the repository), I put the joseki into a separate git repository. Therefore, the initial checkout and build of this project, is doing the following commands:
git clone https://github.com/steinarb/d2rq-maven-dependencies.git
cd d2rq-maven-dependencies
mvn clean install
cd ..
git clone https://github.com/steinarb/d2rq-maven.git
cd d2rq-maven
mvn clean install
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.
Learn more about D2RQ at its homepage: http://d2rq.org/
Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0.html
The project's mailing list is here: https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel
Also check the open issues here on GitHub for feature/bug discussion.
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
git
on the command line to see if it's there. - Java JDK v5 or later, for compiling Java sources. Run
java -version
andjavac
on the command line to see if it's there. - Apache Ant, for building D2RQ. Run
ant
on the command line to see if it's there.
Get the code by forking the GitHub repository and cloning your fork, or directly clone the main repository:
git clone [email protected]: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:
To run the D2RQ tools, you need to do at least ant jar
.
ant all | Generate distribution files in zip and tar.gz formats |
ant clean | Deletes all generated artefacts |
ant compile | Compile project classes |
ant compile.tests | Compile test classes |
ant jar | Generate project jar file |
ant javadoc | Generate Javadoc API documentation |
ant tar | Generate distribution file in tar.gz format |
ant test | Run tests |
ant vocab.config | Regenerate Config vocabulary files from Turtle source |
ant vocab.d2rq | Regenerate D2RQ vocabulary files from Turtle source |
ant war | Generate war archive for deployment in servlet container |
ant zip | Generate distribution file in zip format |
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.
./generate-mapping -u root -o mydb.ttl jdbc:mysql:///mydb
This generates a mapping file mydb.ttl
for your database.
./dump-rdf -m mydb.ttl -o dump.nt
This creates dump.nt
, a dump containing the mapped RDF in N-Triples format.
./d2r-server mydb.ttl
This starts up a server at http://localhost:2020/
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.
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
iswc
that 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
.