Skip Headers
Oracle® Database Semantic Technologies Developer's Guide
11g Release 2 (11.2)

Part Number E25609-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

A Enabling, Downgrading, or Removing Semantic Technologies Support

This appendix describes the required steps that you must perform before you can use any types, synonyms, or PL/SQL packages related to Oracle semantic technologies support in the current Oracle Database release. You must run one or more scripts, and you must ensure that Spatial 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 semantic technologies support, you need to do any of the following:

A.1 Enabling Semantic Technologies Support

Before you can use any types, synonyms, or PL/SQL packages related to Oracle semantic technologies 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:

If you upgraded to Release 11.2.0.2.0 and your Semantic Technologies installation is invalid, see Section A.1.4, "Release 11.2.0.2: Required Actions if Semantic Technologies Installation is Invalid"

In addition, you must ensure that Spatial is installed and the Partitioning option is enabled, as explained in Section A.1.5.

A.1.1 Enabling Semantic Technologies Support in a New Database Installation

To enable semantic technologies support in a new installation of Oracle Database Release 11.2 (or for an upgrade from Release 10.2 if no RDF network exists, as explained in Section A.1.3), follow these steps:

  1. Connect to the database as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).

  2. 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 semantic technologies 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 112)

  • 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".

A.1.2 Upgrading Semantic Technologies Support from Release 11.1

If you are upgrading from Oracle Database Release 11.1 that includes the semantic technologies support for Release 11.1, the semantic technologies support is automatically upgraded to Release 11.2 when the database is upgraded. If you use Workspace Manager with RDF data, you must also run the appropriate script after the upgrade of semantic technologies support, as explained in Section 6.1, "Enabling Workspace Manager Support for RDF Data".

However, you will also need to migrate RDF data if you have an existing Release 11.1 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:

  1. 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

  2. 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)

  3. 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.

  4. 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.

  5. 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 the sdo_rdf_internal.convert_old_rdf_data procedure and the semrelod.sql script were not run after the upgrade to Release 11.2.

A.1.2.1 Handling of Empty RDF Literals

The way empty-valued RDF literals are handled has changed in Release 11.2. Before this release, the values of empty-valued literals were converted to "orardf:null ". In Release 11.2, 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.

A.1.3 Upgrading Semantic Technologies Support from Release 10.2

If you are upgrading from Oracle Database Release 10.2 that includes the semantic technologies support for Release 10.2, the actions required depend on whether there is an existing RDF network.

If there is not an existing RDF network, skip the rest of this section and follow the instructions in Section A.1.1, "Enabling Semantic Technologies Support in a New Database Installation".

If there is an existing RDF network, perform the following steps after the Oracle Database upgrade:

  1. Connect to the database (Release 11.2) as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).

  2. Start SQL*Plus, and enter the following statement:

    • Linux: @$ORACLE_HOME/md/admin/catsem10i.sql

    • Windows: @%ORACLE_HOME%\md\admin\catsem10i.sql

    The catsem10i.sql script enables Release 11.2 semantic technologies support and migrates RDF data from Release 10.2 to Release 11.2 format. The script may take a long time to run if the existing Release 10.2 RDF network contains a large amount of RDF data.

A.1.4 Release 11.2.0.2: Required Actions if Semantic Technologies Installation is Invalid

Further action may be required if your Semantic Technologies installation is invalid after upgrading to Release 11.2.0.2.0. (This is not an issue with upgrades to Release 11.2.0.3 and later.) Action is required if either or both of the following are true after upgrading to Release 11.2.0.2.0:

  • A row exists with the following values in the MDSYS.RDF_PARAMETER table:

    MDSYS   SEM_VERSION   11202   INVALID
    
  • The STATUS column value is INVALID in any row returned by the following query:

    SELECT object_name, status FROM all_objects WHERE object_name = 'SEMCONTEXTINDEXMETHODS' or object_name = 'PRLLIDX_CREATE';
    

In such a case, enter the following sequence of commands as SYSDBA to complete the upgrade of your installation:

SQL> @ $ORACLE_HOME/md/admin/sdordfctx.sql
SQL> @ $ORACLE_HOME/md/admin/semrelod.sql
SQL> EXECUTE sys.validate_sdo;

For the preceding commands:

  • When running sdordfctx.sql, you can ignore any ORA-01921, ORA-02303, ORA-00955, and ORA-29809 errors.

  • Executing sys.validate_sdo is needed only if SDO is invalid, which it could be if Semantic Technologies is invalid; however, there is no harm in executing sys.validate_sdo in any case.

After running the preceding commands, check whether your Semantic Technologies installation is valid by checking if a row exists with the following values in the MDSYS.RDF_PARAMETER table:

MDSYS   SEM_VERSION   11202   VALID

A.1.5 Spatial and Partitioning Requirements

Oracle Spatial must be installed before you can use any of the RDF and OWL capabilities. Oracle Locator is not sufficient. For information about Spatial and Locator, see Oracle Spatial 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.

A.2 Downgrading Semantic Technologies Support to a Previous Release

This section explains how to downgrade the semantic technologies support, in conjunction with an Oracle Database downgrade to Release 11.1 or 10.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 semantic technologies support in the database, as explained in Section 6.1.1.

A.2.1 Downgrading to Release 11.1 Semantic Technologies Support

If you need to downgrade to Oracle Database Release 11.1, the semantic technologies component will be downgraded automatically when you downgrade the database. However, any RDF or OWL data that is specific to Release 11.2 (that is, Release 11.2 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.1.

Any virtual models will not be preserved during a downgrade, because they are only available through a Release 11.1.0.7.0 patch (number 7600122) that was made available on My Oracle Support (MetaLink) in November, 2008. To use virtual models, you must reapply this patch after the downgrade, and then re-create the virtual models. For convenience, you can use the semvmrecreate.sql script to generate a script that you can later use (after the downgrade) to automatically re-create any virtual models that were present in the Release 11.2 semantic network. To do so, follow these steps before you downgrade the database :

  1. Connect to the database (Release 11.2) as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).

  2. Start SQL*Plus, and enter a statement in the following format:

    • Linux: @$ORACLE_HOME/md/admin/semvmrecreate.sql /my_dir_path/my_vm_recreate.sql

    • Windows: @%ORACLE_HOME%\md\admin\semvmrecreate.sql \my_dir_path\my_vm_recreate.sql

    where my_dir_path is the path to the location in which to create the my_vm_recreate.sql script file. (You can use another file name for the script, if you want.)

To check if any Release 11.2 RDF data is incompatible with Release 11.1, perform the following steps:

  1. Connect to the database (Release 11.2) as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).

  2. Start SQL*Plus, and enter the following statements:

    SET SERVEROUT ON
    EXECUTE SDO_SEM_DOWNGRADE.CHECK_111_COMPATIBLE;
    

If any RDF data is incompatible with Release 11.1, the procedure generates an error and displays a list of the incompatible data. In this case, you must run the semrelod111.sql script after the database downgrade, as follows:

  1. In the Release 11.2 database, save a copy of the semrelod111.sql file, which is in the following location:

    • Linux: $ORACLE_HOME/md/admin/semrelod111.sql

    • Windows: %ORACLE_HOME%\md\admin\semrelod111.sql

  2. If you have any virtual models that you want to be able to re-create after the download, run the semvmrecreate.sql script (if you have not already done so), as explained earlier in this section.

  3. Remove any Release 11.2 release-specific RDF or OWL data (including virtual models) if you have not already done so, as explained earlier in this section.

  4. Perform the database downgrade.

  5. In the Release 11.1 database, copy the saved copy of the semrelod111.sql file to the following location:

    • Linux: $ORACLE_HOME/md/admin/

    • Windows: %ORACLE_HOME%\md\admin\

  6. Connect to the Release 11.1 database as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).

  7. Start SQL*Plus, and enter the following statement:

    • Linux: @$ORACLE_HOME/md/admin/semrelod111.sql

    • Windows: @%ORACLE_HOME%\md\admin\semrelod111.sql

    After the semrelod111.sql script completes successfully, Oracle semantic technologies support for Release 11.1 is enabled and ready to use, and all Release 11.1-compatible data is preserved.

  8. If you want to enable support for virtual models, apply the Release 11.1.0.7 interim patch number 7600122.

  9. If you previously generated a my_vm_recreate.sql script to re-create your virtual models after the downgrade, go to the my_dir_path location, connect to the database as the SYS user with SYSDBA privileges, start SQL*Plus, and run the my_vm_recreate.sql script.

A.2.2 Downgrading to Release 10.2 Semantic Technologies Support

If you need to downgrade to Oracle Database Release 10.2, follow the instructions in Section A.2.1 to downgrade to Release 11.1, and then follow the instructions in the rest of this section (taken from the Release 11.1 manual) to downgrade from Release 11.1 to Release 10.2.

If you need to downgrade to Oracle Database Release 10.2, and if you used Oracle Database Release 11 RDF or OWL features and want to preserve existing semantic data and rulebases, you must execute a statement to prepare for the downgrade, perform the downgrade, and execute another statement to restore the semantic data.

However, the following considerations apply:

  • Entailed graph data will not be preserved, because the same information can be regenerated using the Oracle Database Release 10.2 RDF inference API.

  • No rulebases or rules indexes related to OWL are preserved, because Oracle Database Release 10.2 did not support the OWL vocabulary.

Perform the following steps:

  1. Before the database downgrade, connect to the Release 11 database as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).

  2. Start SQL*Plus and enter the following statement:

    EXECUTE SDO_SEM_DOWNGRADE.PREPARE_DOWNGRADE_FROM_11;
    

    When this statement executes successfully, all existing semantic data and rulebases are saved. You will restore the semantic data after the database downgrade.

  3. Perform the database downgrade.

  4. Download the following file from the Semantic Technologies page of the Oracle Technology Network site: sdosemdgu.plb

  5. If (and only if) your Oracle Database Release 10.2 release number is 10.2.0.1, click the Software link, and download and install the RDF-specific patch. (This patch is needed because Release 10.2.0.1 did not have the batch loading feature, which is used to restore the semantic data.)

  6. Connect to the Release 10.2 database as the SYS user with SYSDBA privileges.

  7. Start SQL*Plus and enter a statement in the following statement:

    EXECUTE SDO_SEM_DOWNGRADE_UTL.PREPARE_DOWNGRADE_TO_102('<tablespace-name>');
    

    Where <tablespace-name> is the name of the tablespace in which the RDF network will be created.

    When this statement executes successfully, all semantic data that had been saved before the downgrade is restored and ready to use.

A.3 Removing Semantic Technologies Support

This section explains how to remove the semantic technologies 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 Oracle semantic technologies support.

If you have enabled Workspace Manager support for RDF data, you must remove that support before you remove semantic technologies support from the database, as explained in Section 6.1.1.

To remove the semantic technologies support from the database, perform the following steps:

  1. Connect to the database (Release 11.2) as the SYS user with SYSDBA privileges (SYS AS SYSDBA, and enter the SYS account password when prompted).

  2. 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 semantic technologies types, tables, and PL/SQL packages: