This appendix describes the required steps that you must perform before you can use any types, synonyms, or PL/SQL packages related to RDF Semantic Graph support in the current Oracle Database release. You must run one or more scripts, and you must ensure that Spatial and Graph is installed and the Partitioning option is enabled. These requirements are explained in Section A.1.
This appendix also describes the steps if, after enabling RDF Semantic Graph support, you need to do any of the following:
Downgrade the RDF Semantic Graph support to that provided with a previous Oracle Database release, as explained in Section A.2.
Remove all support for RDF Semantic Graph from the database, as explained in Section A.3.
Before you can use any types, synonyms, or PL/SQL packages related to RDF Semantic Graph support in the current Oracle Database release, you must either install the capabilities in a new Oracle Database installation or upgrade the capabilities from a previous release, following the steps in whichever of the following sections applies to your situation:
Section A.1.1, "Enabling RDF Semantic Graph Support in a New Database Installation"
Section A.1.2, "Upgrading RDF Semantic Graph Support from Release 11.1 or 11.2"
In addition, you must ensure that Spatial and Graph is installed and the Partitioning option is enabled, as explained in Section A.1.3.
To enable RDF Semantic Graph support in a new installation of Oracle Database Release 11.2 or later, follow these steps:
Connect to the database as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).
Start SQL*Plus, and enter the following statement:
Linux: @$ORACLE_HOME/md/admin/catsem.sql
Windows: @%ORACLE_HOME%\md\admin\catsem.sql
If a semantic network already exists, or if any RDF Semantic Graph types, tables, or PL/SQL packages already exist, the catsem.sql
script exits with an error.
If the script completes successfully, a row with the following column values is inserted into the MDSYS.RDF_PARAMETER table:
NAMESPACE: MDSYS
ATTRIBUTE: SEM_VERSION
VALUE: (string starting with 12.1
)
DESCRIPTION: VALID
If you use Workspace Manager with RDF data, you must also run the appropriate script after you run catsem.sql
, as explained in Section 6.1, "Enabling Workspace Manager Support for RDF Data".
If you are upgrading from Oracle Database Release 11.1 or 11.2 that includes the semantic technologies support, the semantic technologies support is automatically upgraded to Release 12.1 or later when the database is upgraded.
However, you may also need to migrate RDF data if you have an existing Release 11.1 or 11.2 RDF network containing triples that include typed literal values of type xsd:float, xsd:double, xsd:boolean, or xsd:time.
To check if you need to migrate RDF data, connect to the database as a user with DBA privileges and query the MDSYS.RDF_PARAMETER table, as follows:
SELECT namespace, attribute, value FROM mdsys.rdf_parameter WHERE namespace='MDSYS' AND attribute IN ('FLOAT_DOUBLE_DECIMAL', 'XSD_TIME', 'XSD_BOOLEAN', 'DATA_CONVERSION_CHECK');
If the FLOAT_DOUBLE_DECIMAL, XSD_TIME, or XSD_BOOLEAN attributes have the string value INVALID
or if the DATA_CONVERSION_CHECK attribute has the string value FAILED_UNABLE_TO_LOCK_APPLICATION_TABLES
, FAILED_INSUFFICIENT_WORKSPACE_PRIVILEGES
, or FAILED_OLS_POLICIES_ARE_ENABLED
, you need to migrate RDF data.
However, if the FLOAT_DOUBLE_DECIMAL, XSD_TIME, and XSD_BOOLEAN attributes do not exist or have the string value VALID
and if the DATA_CONVERSION_CHECK attribute does not exist, you do not need to migrate RDF data. However, if your semantic network may have any empty RDF literals, see Section A.1.2.1, "Handling of Empty RDF Literals"; and if you choose to migrate existing empty literals to the new format, follow the steps in this section.
To migrate RDF data, follow these steps:
Connect to the database as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted), and enter: SET CURRENT_SCHEMA=MDSYS
Ensure that the user MDSYS has the following privileges:
INSERT privilege on all application tables in the semantic network
ALTER ANY INDEX privilege (optional: only necessary if Semantic Indexing for Documents is being used)
ACCESS privilege for any workspace in which version-enabled application tables have been modified (optional: only necessary if Workspace Manager is being used for RDF data)
Ensure that any OLS policies for RDF data are temporarily disabled (optional: only necessary if OLS for RDF Data is being used). OLS policies can be re-enabled after running convert_old_rdf_data.
Start SQL*Plus. If you want to migrate the RDF data without converting existing empty literals to the new format (see Section A.1.2.1), enter the following statement:
EXECUTE sdo_rdf_internal.convert_old_rdf_data;
If you want to migrate the RDF data and also convert existing empty literals to the new format, call convert_old_rdf_data
with the flags
parameter set to 'CONVERT_ORARDF_NULL'
. In addition, you can use an optional tablespace_name
parameter to specify the tablespace to use when creating intermediate tables during data migration. For example, the following statement migrates old semantic data, converts existing "orardf:null "
values to "", and uses the MY_TBS tablespace for any intermediate tables:
EXECUTE sdo_rdf_internal.convert_old_rdf_data( flags=>'CONVERT_ORARDF_NULL', tablespace_name=>'MY_TBS');
The sdo_rdf_internal.convert_old_rdf_data
procedure may take a significant amount of time to run if the semantic network contains many triples that are using (or affected by use of) xsd:float, xsd:double, xsd:time, or xsd:boolean typed literals.
Enter the following statement:
Linux: @$ORACLE_HOME/md/admin/semrelod.sql
Windows: @%ORACLE_HOME%\md\admin\semrelod.sql
Note:
You may encounter the ORA-00904 (invalid identifier) error when executing a SEM_MATCH query if thesdo_rdf_internal.convert_old_rdf_data
procedure and the semrelod.sql
script were not run after the upgrade to Release 12.1 or later.The way empty-valued RDF literals are handled was changed in Release 11.2. Before this release, the values of empty-valued literals were converted to "orardf:null"
. In Release 11.2 and later, such values are stored without modification (that is, as ""). However, whether you migrate existing "orardf:null"
values to "" is optional.
To check if "orardf:null"
values exist in your semantic network, connect to the database as a user with DBA privileges and query the MDSYS.RDF_PARAMETER table, as follows:
SELECT namespace, attribute, value FROM mdsys.rdf_parameter WHERE namespace='MDSYS' AND attribute = 'NULL_LITERAL';
If the NULL_LITERAL attribute has the value EXISTS
, then "orardf:null"
values are present in your semantic network.
Oracle Spatial and Graph must be installed before you can use any of the RDF and OWL capabilities. Oracle Locator is not sufficient. For information about Spatial and Graph and Locator, see Oracle Spatial and Graph Developer's Guide.
The Partitioning option must be enabled before you can use any of the RDF and OWL capabilities. For licensing information about the Partitioning option, see Oracle Database Licensing Information. For usage information about partitioning, see Oracle Database VLDB and Partitioning Guide.
This section explains how to downgrade the RDF Semantic Graph support, in conjunction with an Oracle Database downgrade to Release 11.2.
Downgrading is strongly discouraged, except for rare cases where it is necessary. If you downgrade to a previous release, you will not benefit from bug fixes and enhancements that have been made in intervening releases.
If you have enabled Workspace Manager support for RDF data, you must remove that support before you downgrade RDF Semantic Graph support in the database, as explained in Section 6.1.1.
If you need to downgrade to Oracle Database Release 11.2, the semantic technologies component will be downgraded automatically when you downgrade the database. However, any RDF or OWL data that is specific to Release 12 (that is, Release 12 or later RDF/OWL persistent structures that are not supported in previous versions) must be dropped before you perform the downgrade, so that the database is compatible with Release 11.2.
To check if any Release 12.1 or later RDF data is incompatible with Release 11.2, perform the following steps:
Connect to the database (Release 12.1 or later) as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).
Start SQL*Plus, and enter the following statements:
SET SERVEROUT ON EXECUTE SDO_SEM_DOWNGRADE.CHECK_112_COMPATIBLE;
If any RDF data is incompatible with Release 11.2, the procedure generates an error and displays a list of the incompatible data. In this case, you must perform the following steps:
Remove any Release 12.1 or later release-specific RDF or OWL data if you have not already done so, as explained earlier in this section.
Perform the database downgrade.
Connect to the Release 11.2 database as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).
Start SQL*Plus, and enter the following statement:
Linux: @$ORACLE_HOME/md/admin/semrelod.sql
Windows: @%ORACLE_HOME%\md\admin\semrelod.sql
If the script completes successfully, a row with the following column values is inserted into the MDSYS.RDF_PARAMETER table:
NAMESPACE: MDSYS
ATTRIBUTE: SEM_VERSION
VALUE: (string starting with 112
)
DESCRIPTION: VALID
After the semrelod.sql
script completes successfully, Oracle semantic technologies support for Release 11.2 is enabled and ready to use, and all Release 11.2-compatible data is preserved.
This section explains how to remove the RDF Semantic Graph support from the database. Removing this support is strongly discouraged, unless you have a strong reason for doing it. After you remove this support, no applications or database users will be able to use any types, synonyms, or PL/SQL packages related to RDF Semantic Graph support.
If you have enabled Workspace Manager support for RDF data, you must remove that support before you remove RDF Semantic Graph support from the database, as explained in Section 6.1.1.
To remove the RDF Semantic Graph support from the database, perform the following steps:
Connect to the database as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).
Start SQL*Plus, and enter the following statement:
Linux: @$ORACLE_HOME/md/admin/semremov.sql
Windows: @%ORACLE_HOME%\md\admin\semremov.sql
The semremov.sql
script drops the semantic network and removes any RDF Semantic Graph types, tables, and PL/SQL packages: