View on GitHub

setup_rdf_adb

Oracle's RDF Graph

Setup RDF Graph Server with Autonomous Database

Quick start:

Appendix:

Quick Start

Prerequisites

Create Autonomous Database

Oracle Cloud console > Oracle Database > Autonomous Database > Create Autonomous Database

Create Network for RDF Graph Server

Oracle Cloud console > Networking > Virtual Cloud Networks > Start VCN Wizard > VCN with Internet Connectivity

Public Subnet vcn01

Create RDF Graph Server

Oracle Cloud console > Marketplace > All Applications

Please check the IP address of this compute VM via the Web console.

Download Wallet

Oracle Cloud console > Oracle Database > Autonomous Database

Select the ADB created above > DB Connection

Download

Modify Wallet

Upload the wallet to the RDF Server and run a script to add the user name and password to the wallet.

$ scp -i <key> ~/Downloads/Wallet_<db_name>.zip opc@<ip_address>:
$ ssh -i <key> opc@<ip_address>
$ mkdir wallet
$ cd wallet
$ unzip ../Wallet_<db_name>.zip
$ export JAVA_HOME=/usr/local/java/jdk1.8.0_221
$ /u01/app/oracle/middleware/wls12214/oracle_common/bin/mkstore
  -wrl /home/opc/wallet -createCredential <db_name>_high ADMIN <password_1>
Enter wallet password: <password_2>

Example:

$ scp -i .ssh/id_rsa ~/Downloads/Wallet_ADB1.zip opc@192.0.2.1:
$ ssh -i .ssh/id_rsa opc@192.0.2.1
$ mkdir wallet
$ cd wallet
$ unzip ../Wallet_ADB1.zip
$ export JAVA_HOME=/usr/local/java/jdk1.8.0_221
$ /u01/app/oracle/middleware/wls12214/oracle_common/bin/mkstore \
  -wrl /home/opc/wallet -createCredential adb1_high ADMIN <password_1>
Enter wallet password: <password_2>

Download the modified wallet.

$ zip ../wallet_with_cred.zip *
$ exit
$ scp -i <key> opc@<ip_address>:~/wallet_with_cred.zip ~/Downloads/

Example:

$ zip ../wallet_with_cred.zip *
$ exit
$ scp -i .ssh/id_rsa opc@192.0.2.1:~/wallet_with_cred.zip ~/Downloads/

Upload Wallet

Sign in to the RDF Graph Server and Query UI

Data sources tab > Create > Wallet

Create RDF Network

Data tab

Data tab > RDF Network > Create network icon

Data tab

Data tab > Import > Upload data icon

Data tab > Import > Bulk load data icon

Run SPARQL Query

Data tab > Directory Tree > RDF Objects > Regular models

Right click the model (e.g. SAMPLE_MODEL) > Open

Click Execute button to run the SPARQL query in the text box.

rdf_query_ui

From a new browser tab, access the URL below to send a SPARQL query as a GET request.

https://<ip_address>:8001/orardf/api/v1/datasets/query?datasource=ADB1&datasetDef={"metadata":[{"networkOwner":"ADMIN","networkName":"NETWORK1","models":["SAMPLE_MODEL"]}]}&query=select ?s ?p ?o where { ?s ?p ?o} limit 10

Appendix

Change RDF Server Password

Access WebLogic Server console using Firefox.

Login with the default password.

Go to Security Realms > Users and Groups, and select weblogic.

Change password from the Passwords tab.

Login to RDF Graph Server console with the new password.

Load Triples with Graph Name

From RDF Server, upload data to a staging table as explained at Create RDF Network.

Add a new column for a graph name to the staging table as follows.

Data tab > Import > Bulk load data icon

Oracle Cloud console > Oracle Database > Autonomous Database

Select the ADB created above > Tools > Open Database Actions

create view SAMPLE_VIEW as
select
  RDF$STC_SUB
, RDF$STC_PRED
, RDF$STC_OBJ
, '<http://example.org/graph1>' as RDF$STC_GRAPH
from SAMPLE_TABLE

Go back to RDF Server and import from the staging table (= a new view SAMPLE_VIEW) to a model.

Data tab > Import > Bulk load data icon

Now this SPARQL query should return the graph name.

SELECT *
WHERE { GRAPH ?g { ?s ?p ?o }} 
LIMIT 500