Setting up an RDF Graph Database in Oracle Cloud Infrastructure (OCI)

May 6, 2019 | 4 minute read
Emma Thomas
Principal Solutions Architect
Text Size 100%:

As part of Oracle Spatial and Graph in Oracle Database, Oracle delivers advanced RDF Semantic Graph data management and analysis. With native support for World Wide Web Consortium (W3C) standards; RDF, OWL and SPARQL. Application developers benefit from the industry’s leading open, scalable graph data platform on Oracle Database with triple-level security, and high performance and availability.

For this example we will look at enabling a Bare Metal based Oracle Enterprise Edition Extreme Performance version 18.5 to host our RDF graph. We will use this version as the needed partitioning is enabled automatically.

For an introduction into Graphs at Oracle click here.

Prerequisites

Basic knowledge of Oracle Cloud Infrastructure (OCI) and creation of

 

Create a Database Instance on OCI

First navigate access the OCI “Bare Metal, VM and Exadata” tooling which can be found under databases on the main left hand OCI menu.

Click the blue button “Launch DB System” which will pop up the database creation wizard.

OCI db wizard

Select the shape and CPU core count available to you.

Other settings under “DB System Information” can remain as default for this exercise.

Next enter the database related properties:

 

OCI db wizard

 

Hit the blue “Launch DB System” button.

Wait for your system to be provisioned.

 

Accessing your Database Instance on OCI

 

Once your database has been provisioned and the status has changed from PROVISIONING... to AVAILABLE.. you are ready to access the system.

To connect to your database you can follow the standard OCI instructions as detailed here:

https://docs.cloud.oracle.com/iaas/Content/Database/Tasks/connectingDB.htm

For this example I will talk through access using screenshots from Oracle’s SQL Developer Client which I used to connect to the database running in OCI.  The download for this application is currently here: https://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
Once installed. In the “connections” view, click the green plus sign, this will pop up a new window. Enter the details as below:

 

Connection Name Anything you wish
Username “system” for now
Password This is the password you entered when you creating the database above.
Hostname This can be your public IP which can be found on root database listing page here:
Port 1521
SID This is the name in the field “DATABASE NAME” you entered when you creating the database

 

Which will look like this:

Test your connection - if you are having connection issues double check your VCN settings in particular the port 1521 for the Oracle database default listener. https://docs.cloud.oracle.com/iaas/Content/Database/Tasks/network.htm

 

Enable RDF support

For reference we are generally following the steps detailed here:

https://docs.oracle.com/cd/B19306_01/appdev.102/b19307/sdo_rdf_concepts.htm

Connect using the above connection with the privileged user.

 

  1. Create a tablespace for the RDF system tables. You must be connected as a user with appropriate privileges to create the tablespace. The following example creates a tablespace named RDF_TBLSPACE:

CREATE TABLESPACE rdf_tblspace DATAFILE 'rdf_tblspace.dat' SIZE 1024M REUSE AUTOEXTEND ON NEXT 256M MAXSIZE UNLIMITED SEGMENT SPACE MANAGEMENT AUTO;

  1. Create a regular, non-DBA user to perform the load: Create a user (for example, named RDFUSER) with CONNECT, RESOURCE, and UNLIMITED TABLESPACE privileges.

alter session set "_ORACLE_SCRIPT"=true;

commit;

CREATE USER RDFUSER IDENTIFIED BY "MyPwd123!#" default tablespace rdf_tblspace;

GRANT CONNECT, RESOURCE TO RDFUSER;

GRANT UNLIMITED TABLESPACE TO RDFUSER;

GRANT UNLIMITED TABLESPACE TO MDSYS;   //Required for 19c

GRANT SELECT ANY DICTIONARY TO RDFUSER

  1. Creating a semantic data network adds semantic data support to an Oracle database. You must create a semantic data network as a user with DBA privileges, specifying a valid tablespace with adequate space. Create the network only once for an Oracle database.

EXECUTE SEM_APIS.CREATE_SEM_NETWORK('rdf_tblspace');

 

You should see:

PL/SQL procedure successfully completed.

And things are ready to go. Look out for the next blog in this series around populating your RDF with data.

 

Troubleshooting

If you see this:

Error starting at line : 1 in command -

BEGIN SEM_APIS.CREATE_SEM_NETWORK('rdf_tblspace'); END;Error report -

ORA-13199: Error during RDF Network creation: step_num=2

 SQLERRM=ORA-00439: feature not enabled: Partitioning

 Error backtrace is:

ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 23700

ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 23695

ORA-06512: at "MDSYS.MD", line 1723

ORA-06512: at "MDSYS.MDERR", line 17

ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 24837

ORA-06512: at "MDSYS.SDO_RDF", line 10944

ORA-06512: at "MDSYS.SDO_RDF", line 10968

ORA-06512: at "MDSYS.RDF_APIS", line 1636

ORA-06512: at line 1

13199. 00000 -  "%s"

*Cause:    This is an internal error.

*Action:   Contact Oracle Support Services.

 

Your database doesn’t have partitioning enabled. You will need to re-provision your database with this enabled.

Further Reading

For further reading please view this blog:

Intro to Graphs at Oracle

Emma Thomas

Principal Solutions Architect


Previous Post

What you should know when extending SaaS with VBCS – Part 5 Performance tips

Angelo Santagata | 6 min read

Next Post


Securing SSH with IDCS' OAuth service using the Device Code flow

Christopher Johnson | 11 min read