D.4 Example Queries Using Graph Adapter for Eclipse RDF4J

This section describes example queries for using Oracle RDF Graph Adapter for Eclipse RDF4J in an existing MDSYS network.

To run a query, you must do the following:

  1. Include any example code described in Example Queries Using Oracle RDF Graph Adapter for Eclipse RDF4J in a Java source file.
  2. Define a CLASSPATH environment variable named CP to include the relevant jar files. For example, it may be defined as follows:
    setenv CP .:ojdbc8.jar:ucp.jar:oracle-rdf4j-adapter-4.2.1.jar:log4j-api-2.17.2.jar:log4j-core-2.17.2.jar:log4j-slf4j-impl-2.17.2.jar:slf4j-api-1.7.36.jar:eclipse-rdf4j-4.2.1-onejar.jar:commons-io-2.11.0.jar

    Note:

    The preceding setenv command assumes that the jar files are located in the current directory. You may need to alter the command to indicate the ___location of these jar files in your environment.
  3. Compile the Java source file. For example, to compile the source file Test.java, run the following command:
    javac -classpath $CP Test.java
  4. Run the compiled file on an RDF graph (model) named TestModel in an existing MDSYS network by executing the following command:
    java -classpath $CP Test jdbc:oracle:thin:@localhost:1521:orcl scott <password-for-scott> TestModel