7.19 ORARDFLDR Utility for Bulk Loading RDF Data

This section describes using the ORARDFLDR utility program for Bulk Loading RDF Data.

This utility program loads all files in a directory into an RDF graph in Oracle database. It supports several RDF serializations like RDF/XML, Turtle, N-Triple, N-Quads and Trig. Files compressed with gzip can be directly loaded without uncompressing the gzip file. In addition, Unicode character escaping and long literals (CLOBs) are handled automatically.

Running ORARDFLDR Utility Program

The following describes the commands to execute ORARDFLDR:

Prerequisite: Ensure that the environment variable ${ORACLE_JENA_HOME} is pointing to the directory where the OTN kit is stored.

Usage:
java -cp ${ORACLE_JENA_HOME}/jar/'*' oracle.spatial.rdf.client.jena.utilities.RDFLoader <command_line_arguments>
For help details:
java -cp ${ORACLE_JENA_HOME}/jar/'*' oracle.spatial.rdf.client.jena.utilities.RDFLoader --help

For convenience, a shell script in the bin directory can also be executed. The following describes the commands to use this script

Prerequisite: Set ${ORACLE_JENA_HOME} and ensure ${ORACLE_JENA_HOME}/bin is in your Unix PATH environment variable.

Usage:
orardfldr <command_line_arguments>
For help details:
orardfldr --help

7.19.1 Using ORARDFLDR with Oracle Autonomous Database

This section describes using the ORARDFLDR utility with Oracle Autonomous Database.

The ORARDFLDR utility included with support for Apache Jena can be used to bulk load RDF files from your client computer to Oracle Autonomous Database. The connection with the database is based on a cloud wallet.

General instructions for connecting to an Oracle Autonomous Database with JDBC can be found in Java connectivity to ATP.

The following example describes establishing a JDBC connection to Oracle Autonomous Database following the Plain JDBC using JKS files procedure.

Example 7-36 JDBC connectivity to Oracle Autonomous Database

Prerequisite: Ensure you have the following Oracle jar files: ojdbc8.jar, ucp.jar, oraclepki.jar, osdt_core.jar, and osdt_cert.jar.

  1. Unzip your wallet_<dbname>.zip file. You should see something similar to the listing below after unzipping the file.
    [oracle@localhost Wallet_Info]$ ls
    cwallet.sso  keystore.jks      README      tnsnames.ora
    ewallet.p12  ojdbc.properties  sqlnet.ora  truststore.jks
  2. Modify ojdbc.properties to add JKS related connection properties. The final version of your ojdbc.properties file should be similar as shown below:

    # Connection property while using Oracle wallets.
    #oracle.net.wallet_location=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=${TNS_ADMIN})))
    # FOLLOW THESE STEPS FOR USING JKS
    # (1) Uncomment the following properties to use JKS.
    # (2) Comment out the oracle.net.wallet_location property above
    # (3) Set the correct password for both trustStorePassword and keyStorePassword.
    # It's the password you specified when downloading the wallet from OCI Console or the Service Console.
    javax.net.ssl.trustStore=${TNS_ADMIN}/truststore.jks
    javax.net.ssl.trustStorePassword=password
    javax.net.ssl.keyStore=${TNS_ADMIN}/keystore.jks
    javax.net.ssl.keyStorePassword=password

Use the following JDBC URL:

jdbc:oracle:thin:@dbname_alias?TNS_ADMIN=<path_to_wallet_directory>

The following examples loads the RDF files using the ORAFLDR utility for a database named rdfdb and having a wallet directory as /home/oracle/RDF/Wallet_Info/ .

Example 7-37 Using ORAFLDR Utility to load RDF Data files

Prerequisite: Ensure you have copied the prerequisite jars listed in Example 7-36 to $ORACLE_JENA_HOME/jar/.

Invoke ORARDFLDR to load RDF files from your client computer to an Autonomous database.

orardfldr --modelName=M1 --fileDir=./data --lang=N-TRIPLE 
    --jdbcUrl=jdbc:oracle:thin:@rdfdb_medium?TNS_ADMIN=/home/oracle/RDF/Wallet_Info/ 
    --user="RDFUSER" --password=password --networkOwner="RDFUSER" --networkName=NET1

It loads RDF data in N-Triple format into a model named M1 in a network named NET1 owned by RDFUSER. RDFUSER is also used for the database connection.