X

Oracle Big Data Spatial and Graph - technical tips, best practices, and news from the product team

  • January 19, 2017

Enable REST Interface for Oracle Big Data Spatial and Graph on Oracle BigDataLite VM

Alan Wu
Architect

In this blog post, I am going to show you a few quick steps to enable Rexster-based REST interface for BDSG property graph in Oracle BigDataLite VM (4.5 and above).

First of all, download and copy the following Java libraries into/opt/oracle/oracle-spatial-graph/property_graph/dal/webapp/
directory.


  blueprints-rexster-graph-2.3.0.jar
  commons-cli-1.2.jar
  commons-configuration-1.6.jar
  grizzly-core-2.2.16.jar
  grizzly-http-2.2.16.jar
  grizzly-http-server-2.2.16.jar
  grizzly-http-servlet-2.2.16.jar
  javassist-3.15.0-GA.jar
  javax.servlet-api-3.0.1.jar
  jersey-core-1.17.jar
  jersey-json-1.17.jar
  jersey-server-1.17.jar
  jersey-servlet-1.17.jar
  jung-algorithms-2.0.1.jar
  jung-api-2.0.1.jar
  jung-visualization-2.0.1.jar
  msgpack-0.6.5.jar
  rexster-core-2.3.0.jar
  rexster-protocol-2.3.0.jar
  rexster-server-2.3.0.jar

In the same directory, update rexster.xml (can be found in the same zip file) with the correct port, base-uri, and connection/graph information for a BDSG property graph.The following shows a snippet of the relevant rexster xml configuration file.

<?xml version="1.0" encoding="UTF-8"?>
<rexster>
    <http>
        <server-port>8182</server-port>
        <server-host>0.0.0.0</server-host>
        <base-uri>http://127.0.0.1</base-uri>
        <web-root>public</web-root>
        <character-set>UTF-8</character-set>
...
        <graph>
            <graph-name>test_nosql</graph-name>
           
<graph-type>oracle.pg.nosql.OraclePropertyGraphConfiguration</graph-type>

           <properties>
             <host>127.0.0.1</host>
             <port>5000</port>
             <storeName>kvstore</storeName>
           </properties>
            <extensions>
                <allows>
                   
                  <allow>tp:gremlin</allow>

                </allows>
            </extensions>
        </graph>

...
 

We are almost there. The last step is to create rexster-opg.sh under the same directory,

$ cat /opt/oracle/oracle-spatial-graph/property_graph/dal/webapp/rexster-opg.sh

#!/bin/bash
CP=$( echo `dirname $0`/*.jar . | sed 's/ /:/g')
CP=$CP:$(find -L `dirname $0`/../../lib/ -name "*.jar" | tr '\n' ':')
CP=$CP:$(find -L `dirname $0`/../groovy/ -name "*.jar" | tr '\n' ':')
PUBLIC=`dirname $0`/../public/
# Find Java
if [ "$JAVA_HOME" = "" ] ; then
    JAVA="java -server"
else
    JAVA="$JAVA_HOME/bin/java -server"
fi
# Set Java options
if [ "$JAVA_OPTIONS" = "" ] ; then
    JAVA_OPTIONS="-Xms2G -Xmx4G "
fi
# Launch the application
$JAVA $JAVA_OPTIONS -cp $CP com.tinkerpop.rexster.Application $@ -wr $PUBLIC
# Return the program's exit code
exit $?

############################

Now, we are all ready to go, to start the REST service,

sh ./rexster-opg.sh --start -c ./rexster.xml 
 

To test the newly created REST service,  run the following commands from a Linux terminal. They should create a new vertex and then read it out from the REST endpoint.


curl --output /tmp/curl.log --data "query=dummy" "http://127.0.0.1:8182/graphs/test_nosql/vertices/123?name=a&hobby=b"

curl "http://127.0.0.1:8182/graphs/test_nosql/vertices/123"

Cheers,

p.s. The following list of wget commands can help you locate the jar files needed. You can run them in a Linux terminal. Don't forget to set proxy if your terminal is behind a corporate firewall.

echo "Downloading dependency blueprints-rexster-graph-2.3.0.jar"
wget http://central.maven.org/maven2/com/tinkerpop/blueprints/blueprints-rexster-graph/2.3.0/blueprints-rexster-graph-2.3.0.jar

echo "Downloading dependency commons-cli-1.2.jar"
wget http://central.maven.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.jar

echo "Downloading dependency commons-configuration-1.6.jar"
wget http://central.maven.org/maven2/commons-configuration/commons-configuration/1.6/commons-configuration-1.6.jar

echo "Downloading dependency grizzly-core-2.2.16.jar"
wget http://central.maven.org/maven2/org/glassfish/grizzly/grizzly-core/2.2.16/grizzly-core-2.2.16.jar

echo "Downloading dependency grizzly-http-2.2.16.jar"
wget http://central.maven.org/maven2/org/glassfish/grizzly/grizzly-http/2.2.16/grizzly-http-2.2.16.jar

echo "Downloading dependency grizzly-http-server-2.2.16.jar"
wget http://central.maven.org/maven2/org/glassfish/grizzly/grizzly-http-server/2.2.16/grizzly-http-server-2.2.16.jar

echo "Downloading dependency grizzly-http-servlet-2.2.16.jar"
wget http://central.maven.org/maven2/org/glassfish/grizzly/grizzly-http-servlet/2.2.16/grizzly-http-servlet-2.2.16.jar

echo "Downloading dependency javassist-3.15.0-GA.jar"
wget http://central.maven.org/maven2/org/javassist/javassist/3.15.0-GA/javassist-3.15.0-GA.jar

echo "Downloading dependency javax.servlet-api-3.0.1.jar"
wget http://central.maven.org/maven2/javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1.jar

echo "Downloading dependency jersey-core-1.17.jar"
wget http://central.maven.org/maven2/com/sun/jersey/jersey-core/1.17/jersey-core-1.17.jar

echo "Downloading dependency jersey-json-1.17.jar"
wget http://central.maven.org/maven2/com/sun/jersey/jersey-json/1.17.1/jersey-json-1.17.1.jar

echo "Downloading dependency jersey-server-1.17.jar"
wget http://central.maven.org/maven2/com/sun/jersey/jersey-server/1.17/jersey-server-1.17.jar

echo "Downloading dependency jersey-servlet-1.17.jar"
wget http://central.maven.org/maven2/com/sun/jersey/jersey-servlet/1.17/jersey-servlet-1.17.jar

echo "Downloading dependency jung-algorithms-2.0.1.jar"
wget http://central.maven.org/maven2/net/sf/jung/jung-algorithms/2.0.1/jung-algorithms-2.0.1.jar

echo "Downloading dependency jung-api-2.0.1.jar"
wget http://central.maven.org/maven2/net/sf/jung/jung-api/2.0.1/jung-api-2.0.1.jar

echo "Downloading dependency jung-visualization-2.0.1.jar"
wget http://central.maven.org/maven2/net/sf/jung/jung-visualization/2.0.1/jung-visualization-2.0.1.jar

echo "Downloading dependency msgpack-0.6.5.jar"
wget http://central.maven.org/maven2/org/msgpack/msgpack/0.6.5/msgpack-0.6.5.jar

echo "Downloading dependency rexster-core-2.3.0.jar"
wget http://central.maven.org/maven2/com/tinkerpop/rexster/rexster-core/2.3.0/rexster-core-2.3.0.jar

echo "Downloading dependency rexster-protocol-2.3.0.jar"
wget http://central.maven.org/maven2/com/tinkerpop/rexster/rexster-protocol/2.3.0/rexster-protocol-2.3.0.jar

echo "Downloading dependency rexster-server-2.3.0.jar"
wget http://central.maven.org/maven2/com/tinkerpop/rexster/rexster-server/2.3.0/rexster-server-2.3.0.jar

 

 

 

Join the discussion

Comments ( 1 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.