Library Version 12.1.3.0

Appendix B. Generating a New SPARQL Service WAR file
Prev |  | Next

## Appendix B. Generating a New SPARQL Service WAR file

It is possible to modify the SPARQL endpoint Web Application Archive (WAR file), for instance, to enhance its logic by adding a servlet or a filter. Generating a new SPARQL endpoint WAR file involves downloading Apache Jena Joseki, an open source SPARQL server that supports the SPARQL protocol and SPARQL queries. This section explains how to generate a web application archive (joseki.war) for the SPARQL Service endpoint.

1. Ensure that you have Java 6 installed, because it is required by Joseki 3.4.4.

2. Download Apache Jena Joseki 3.4.4 (joseki-3.4.4.zip) from http://sourceforge.net/projects/joseki/files/Joseki-SPARQL/.

3. Unpack joseki-3.4.4.zip into a temporary directory. For example:

       mkdir /tmp/joseki
       cp joseki-3.4.4.zip /tmp/joseki
       cd /tmp/joseki
       unzip joseki-3.4.4.zip

4. Ensure that you have downloaded and unzipped the RDF Graph feature for the Oracle NoSQL Database, as explained in Setup the System Environment.

5. Create a directory named `joseki.war` at the same level as the jena_adapter directory, and go to it. For example:

       mkdir /tmp/joseki.war
       cd /tmp/joseki.war

6. Copy necessary files into the directory created in the preceding step:

       cp /tmp/jena_adapter/joseki/* /tmp/joseki.war
       cp -rf /tmp/joseki/Joseki-3.4.4/webapps/joseki/StyleSheets \
       /tmp/joseki.war

7. Create directories and copy necessary files into them, as follows:

       mkdir /tmp/joseki.war/WEB-INF
       cp /tmp/jena_adapter/web/* /tmp/joseki.war/WEB-INF

       mkdir /tmp/joseki.war/WEB-INF/lib
       cp /tmp/joseki/Joseki-3.4.4/lib/joseki-3.4.4.jar \
       /tmp/joseki.war/WEB-INF/lib
       cp /tmp/jena_adapter/jar/*.jar /tmp/joseki.war/WEB-INF/lib
       cp <#JENA_DIR>/lib/* /tmp/joseki.war/WEB-INF/lib

       ## Assume KV_HOME points to the home directory of an
       ## Oracle NoSQL Database
       ## Release <#ORACLE>.
       cp $KVHOME/lib/kvclient.jar /tmp/joseki.war/WEB-INF/lib

8. Modify Apache Jena Joseki's configuration file (`joseki-config.ttl`) file located in `/tmp/joseki.war` to specify the store name, host name, and host port to access the Oracle NoSQL Database. This data will be used by the SPARQL Service endpoint to establish connections to the Oracle NoSQL Database and execute update and query operations. For detailed information about this configuration, see Configuring an Oracle NoSQL Database connection in the SPARQL service.

9. Check the files and the directory structure to make sure they reflect the following:

       .
       |-- META-INF
       | |-- MANIFEST.MF
       |-- StyleSheets
       | |-- joseki.css
       |-- WEB-INF
       | |-- lib
       | | |-- common-codec-1.5.jar
       | | |-- httpclient-4.1.2.jar
       | | |-- httpcore-4.1.3.jar
       | | |-- jena-arq-2.9.4.jar
       | | |-- jena-core-2.7.4.jar
       | | |-- jena-iri-0.9.4.jar
       | | |-- jena-tdb-0.9.4.jar
       | | |-- joseki-3.4.4.jar
       | | |-- kvclient.jar
       | | |-- log4j-1.2.16.jar
       | | |-- sdordfnosqlclient.jar
       | | |-- slf4j-api-1.6.4.jar
       | | |-- slf4j-log4j12-1.6.4.jar
       | | |-- xercesImpl-2.10.0.jar
       | | |-- xml-apis-1.4.01.jar
       | |-- web.xml
       |-- application.xml
       |-- index.html
       |-- joseki-config.ttl
       |-- update.html
       |-- xml-to-html.xsl

10. Build a .war file from the `/tmp/joseki.war` directory (a .war file is required if you want to deploy Apache Jena Joseki to an OC4J container), using the following commands:

        cd /tmp/joseki.war
        jar cvf /tmp/joseki_app.war *

Prev |  | Next
Appendix A. Prerequisite Software | Home | Appendix C. Third Party Licenses