X

Best Practices from Oracle Development's A‑Team

Create a semantic network and RDF support on Oracle Database Cloud Service 19c

 

Introduction


This article will describe the steps to to create a semantic network for RDF support on Oracle 19c Spatial and Graph.
A new feature introduced with 19c is the ability to create a schema private semantic network. Prior to 19c, the semantic network was global to the entire database. 19c allows the choice of a global or schema private semantic network.

 

Prerequisites


Oracle Spatial and Graph must be installed and enabled, and partitioning must installed and enabled.
To check if Spatial and Graph is enabled:


SQL> select * from mdsys.rdf_parameter where attribute='SEM_VERSION';

NAMESPACE   ATTRIBUTE       VALUE       DESCRIPTION
--------------------------------------------

MDSYS       SEM_VERSION     19.1.0.0.0  VALID


select * from v$option where parameter = 'Partitioning';

SQL> select * from v$option where parameter = 'Partitioning';

PARAMETER       VALUE        CON_ID
--------------------------------------------

Partitioning    TRUE        0


Setup semantic network


Execute the following steps as the system user in the PDB, not the CBD$ROOT
Adjust the tablespace datafile path to meet your setup.


Create tablespace for your data


sqlplus system

SQL> alter session set container=DB0415_PDB1;

Session altered.

CREATE BIGFILE TABLESPACE rdf_tblspace DATAFILE '?/DATAFILE/rdf_tblspace.dat' SIZE 5g REUSE AUTOEXTEND ON NEXT 512 MAXSIZE UNLIMITED SEGMENT SPACE MANAGEMENT AUTO;

Create a user/schema for your data


SQL> create user rdfuser identified by YourPassWordHere123## DEFAULT TABLESPACE rdf_tblspace;
SQL> grant connect, resource, unlimited tablespace to rdfuser;
# Grant unlimited tablespace to the mdsys user.
SQL> GRANT UNLIMITED TABLESPACE TO MDSYS;

Create the semantic network


You can choose between the global semantic network, or schema private network at this step.
If you want the network only available to the RDFUSER you created, execute the following:


SQL> EXECUTE SEM_APIS.CREATE_SEM_NETWORK('rdf_tblspace', network_owner=>'RDFUSER', network_name=>'NET1');

This will create a semantic network called NET1 in the RDFUSER schema, and only be availble to the RDFUSER (and other users with DBA or that you share with).

If you want a global semantic network that is shared across the entire database, execute:


SQL> EXECUTE SEM_APIS.CREATE_SEM_NETWORK('rdf_tblspace');


This creates an unnamed network, in the MDSYS schema, that all users can share.

Drop the semantic network


To drop the private schema network:


SQL> EXECUTE SEM_APIS.DROP_SEM_NETWORK(network_owner=>'RDFUSER', network_name=>'NET1');

To drop a global network:


SQL> EXECUTE SEM_APIS.DROP_SEM_NETWORK;

Be the first to comment

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