C.3 Working with RDF Semantic Networks Using SQL Developer

You can create an RDF semantic network to work with RDF data using SQL Developer.

You can view the available networks in the database schema associated with your connection by expanding the Networks node in the RDF Semantic Graph tree.

From Release 19c onwards, an RDF semantic network is supported in both user schema and MDSYS schema. See the following table to determine the semantic network type recommended for you depending on your database version.

Table C-2 Recommended Semantic Network Type

Database Release Supported Network(s) Recommended Network
18c or earlier All RDF metadata belongs only to MDSYS Network. MDSYS Network
19c or later
  • MDSYS Network
  • Schema-Private Network
Schema-Private Network

C.3.1 Creating an RDF Semantic Network Using SQL Developer

Under the Networks node, you can create one or more RDF semantic networks.

To create a new semantic network:

  1. Right-click Networks and select Create Semantic Network.

    This operation is available for users depending on the Oracle Database version and the SQL Developer version used. See the following table for more information:

    Table C-3 Release Specific Instructions to Create a Semantic Network

    Oracle DB Release SQL Developer Version User Requirement
    18c or earlier Any Only a user having a DBA role can create an MDSYS network.
    For Release 19c- prior 19.3 Any Only a user having a DBA role can create a schema-private network.
    19.3 or later Prior 20.3 Only a user having a DBA role can create a schema-private network.
    19.3 or later 20.3 or later Any database user can create a schema-private network directly.

    Create Semantic Network window opens as shown:

    Figure C-3 Create Semantic Network

    Description of Figure C-3 follows
    Description of "Figure C-3 Create Semantic Network"
  2. Select a Network Owner, that is, the database schema that will be the owner of the network.
    • For release 18c and earlier, the owner is always MDSYS.
    • For release 19c before 19.3, select the network owner.
    • For release 19.3 and later, the network owner is always the connection user schema.
  3. Enter a Network Name.

    Note:

    For release 18c and earlier, this field is blank and not editable.
  4. Select a Tablespace to be associated with the network. (If the tablespace or tablespaces necessary for semantic networks do not already exist, see Creating Tablespaces for Semantic Networks Using SQL Developer.)
  5. Click Apply.

    The RDF semantic network is created.

    You can verify the RDF semantic network creation by viewing the following child nodes under the created Nework:

    • REGULAR_MODELS
    • VIRTUAL_MODELS
    • RDF_VIEWS
    • RULEBASES
    • ENTAILMENTS
    • NETWORK_INDEXES (RDF_LINK$)
    • DATATYPE_INDEXES (RDF_VALUE$)
    • BULK_LOAD_TRACES

You can now perform the following operations on each created network:

  • Gather Statistics
  • Refresh semantic network indexes
  • Purge unused values
  • Drop semantic network

C.3.1.1 Creating Tablespaces for Semantic Networks Using SQL Developer

If the tablespace or tablespaces required for semantic networks do not already exist, you can create them.

You can adjust those that were created automatically as part of the semantic network setup operation.

The recommended practice is to use three tablespaces for RDF Semantic Graph:

  • Tablespace for RDF storage (create a new tablespace named RDFTBS)

  • Tablespace for temporary data (create a new tablespace named TEMPTBS)

  • Tablespace for other user data (use the existing tablespace named USERS)

In the DBA navigator (not the Connections navigator), for the system connection click Storage, then Tablespaces. For the new tablespaces (right-click and select Create New), and select any desired name (the ones listed here are just examples). Accept default values or specified desired options.

  1. Create RDFTBS for storing RDF data.

    Name (tablespace name): RDFTBS

    Tablespace Type: Permanent

    Under File Specification, Name: 'RDFTBS.DBF'

    Directory: Desired file system directory. For example: /u01/app/oracle/oradata/orcl12c/orcl

    File Size: Desired file initial size. For example: 1 G

    Check Reuse and Auto Extend On.

    Next Size: Desired size of each extension increment. For example: 512 M

    Max Size: Desired file maximum size. For example: 10 G

    Click OK.

  2. Create TEMPTBS for temporary work space.

    Right-click and select Create New.

    Name (tablespace name): TEMPTBS

    Tablespace Type: Temporary

    Under File Specification, Name: 'TEMPTBS.DBF'

    Directory: Desired file system directory. For example: /u01/app/oracle/oradata/orcl12c/orcl

    File Size: Desired file initial size. For example: 1 G

    Check Reuse and Auto Extend On.

    Next Size: Desired size of each extension increment. For example: 256 M

    Max Size: Desired file maximum size. For example: 8 G

  3. Make TEMPTBS the default temporary tablespace for the database, by using the SQL Worksheet for the system connection’s SQL Worksheet to execute the following statement:

    SQL> alter database default temporary tablespace TEMPTBS;

C.3.2 Refreshing Semantic Network Indexes Using SQL Developer

RDF uses semantic network indexes (some created automatically), which you can refresh.

You can create additional semantic indexes if you wish, and you can adjust those that were created automatically.

There are multicolumn B-Tree semantic indexes over the following columns:

  • S - subject

  • P - predicate

  • C - canonical object

  • G - graph

  • M - model

Two indexes are created by default: PCSGM and PSCGM. However, you can use a three-index setup to better cover more combinations of S, P, and C: PSCGM, SPCGM, and CSPGM.

In the Connections navigator (not the DBA navigator), expand the system connection, expand RDF Semantic Graph, then click Network Indexes (RDF_LINK).

  1. Add the SPCGM index.

    Right-click and select Create Semantic Index. Suggested Index code: SPCGM

    Click OK.

  2. Add the CSPGM index.

    Right-click and select Create Semantic Index. Suggested Index code: CSPGM

    Click OK.

  3. Drop the PSCGM index.

    Right-click RDF_LINK_PSCGM_IDX and select Drop Semantic Index.

The result will be these three indexes:

  • RDF_LINK_PSCGM_IDX

  • RDF_LINK_SPCGM_IDX

  • RDF_LINK_CSPGM_IDX

C.3.3 Gathering RDF Statistics Using SQL Developer

You can gather statistics about RDF and OWL tables and their indexes.

To gather statistics about a semantic network, right-click the network name and select Gather Statistics.

The following parameters can be defined in the dialog box:

Network Owner: The connection user (not editable).

Network Name: Name of the network (not editable).

Just on Values: If enabled (checked), collects statistics only on the table containing the lexical values of triples. If not enabled (unchecked), collects statistics on all major tables related to the storage of RDF and OWL data.

Degree of Parallelism: Number of parallel execution servers associated with the operation.

To complete the network creation, click Apply.

C.3.4 Purging Unused Values from a Network Using SQL Developer

You can purge unused (invalid) geometry literal values from the semantic network.

Deletion of triples over time may lead to a subset of the values in the RDF_VALUE$ table becoming unused in any of the RDF triples or rules currently in the semantic network. To delete such unused values from the RDF_VALUE$ table, right-click the network name and select Purge Unused Values..

The following parameters can be defined in the dialog box:

Network Owner: The connection user (not editable).

Network Name: Name of the network (not editable).

MBV_METHOD=SHADOW: If enabled (checked), may result faster processing when a large number of values need to be purged.

Degree of Parallelism: Number of parallel execution servers associated with the operation.

PUV_COMPUTE_VIDS_USED: If enabled (checked), may result faster processing when most of the values are expected to be purged.

Extra Flags: Specify any additional keywords and values to be added in the flags parameter for the SEM_APIS.PURGE_UNUSED_VALUES procedure that will be executed (click the SQL tab to see the complete SQL statement).

To perform the operation, click Apply.

C.3.5 Dropping a Semantic Network Using SQL Developer

Dropping a semantic network removes structures used for persistent storage of semantic data..

To drop a semantic network, right-click the network name and select Drop Semantic Network.

The following parameters can be defined in the dialog box:

Network Owner: The connection user (not editable).

Network Name: Name of the network (not editable).

Cascade: If enabled (checked), also drops any existing semantic technology models and rulebases for the network, and removes structures used for persistent storage of semantic data for the network. If not enabled (unchecked), the operation will fail if any semantic technology models or rulebases exist in the network.

To perform the operation, click Apply.