The MDSYS.SDO_RDF_INFERENCE package contains subprograms (functions and procedures) for using the inferencing capabilities of the Resource Description Framework (RDF) in an Oracle database. To use the subprograms in this chapter, you must understand the conceptual and usage information in Chapter 1.
This chapter provides reference information about the subprograms, listed in alphabetical order.
SDO_RDF_INFERENCE.CLEANUP_FAILED(
rdf_object_type IN VARCHAR2,
rdf_object_name IN VARCHAR2);
Drops (deletes) a specified rulebase or rules index if it is in a failed state.
Type of the RDF object: RULEBASE
for a rulebase or RULES_INDEX
for a rules index.
Name of the RDF object of type rdf_object_type
.
This procedure checks to see if the specified RDF object is in a failed state; and if the object is in a failed state, the procedure deletes the object.
A rulebase or rules index is in a failed state if a system failure occurred during the creation of that object. You can check if a rulebase or rules index is in a failed state by checking to see if the value of the STATUS column is FAILED
in the SDO_RULEBASE_INFO view (described in Section 1.2.10) or the SDO_RULES_INDEX_INFO view (described in Section 1.2.11), respectively.
If the rulebase or rules index is not in a failed state, this procedure performs no action and returns a successful status.
An exception is generated if the RDF object is currently being used.
The following example deletes the rulebase named family_rb
if (and only if) that rulebase is in a failed state.
EXECUTE SDO_RDF_INFERENCE.CLEANUP_FAILED('RULEBASE', 'family_rb');
SDO_RDF_INFERENCE.CREATE_RULEBASE(
rulebase_name IN VARCHAR2);
Creates a rulebase.
Name of the rulebase.
This procedure creates a user-defined rulebase. After creating the rulebase, you can add rules to it. To cause the rules in the rulebase to be applied in a query of RDF data, you can specify the rulebase in the call to the SDO_RDF_MATCH table function.
Rules and rulebases are explained in Section 1.2.10. The SDO_RDF_MATCH table function is described in Section 1.5,
The following example creates a rulebase named family_rb. (It is an excerpt from Example 1-9 in Section 1.8.2.)
EXECUTE SDO_RDF_INFERENCE.CREATE_RULEBASE('family_rb');
SDO_RDF_INFERENCE.CREATE_RULES_INDEX(
index_name_in IN VARCHAR2,
models_in IN SDO_RDF_MODELS,
rulebases_in IN SDO_RDF_RULEBASES);
Creates a rules index based on data in one or more RDF models and one or more rulebases.
Name of the rules index.
One or more RDF model names. Its data type is SDO_RDF_MODELS, which has the following definition: TABLE OF VARCHAR2(25)
One or more rulebase names. Its data type is SDO_RDF_RULEBASES, which has the following definition: TABLE OF VARCHAR2(25)
. Rules and rulebases are explained in Section 1.2.10.
This procedure creates a rules index. For information about rules indexes, see Section 1.2.11.
The following example creates a a rules index named family_rb_rix_family
, using the family
model and the RDFS
and family_rb
rulebases. (This example is an excerpt from Example 1-9 in Section 1.8.2.)
BEGIN SDO_RDF_INFERENCE.CREATE_RULES_INDEX( 'rdfs_rix_family', SDO_RDF_Models('family'), SDO_RDF_Rulebases('RDFS','family_rb')); END; /
SDO_RDF_INFERENCE.DROP_RULEBASE(
rulebase_name IN VARCHAR2);
Deletes a rulebase.
Name of the rulebase.
This procedure deletes the specified rulebase, making it no longer available for use in calls to the SDO_RDF_MATCH table function. For information about rulebases, see Section 1.2.10.
Only the creator of a rulebase can delete the rulebase.
The following example drops the rulebase named family_rb
.
EXECUTE SDO_RDF_INFERENCE.DROP_RULEBASE('family_rb');
SDO_RDF_INFERENCE.DROP_RULES_INDEX(
index_name IN VARCHAR2);
Deletes a rules index.
Name of the rules index.
This procedure deletes the specified rules index, making it no longer available for use with queries against RDF data. For information about rules indexes, see Section 1.2.11.
Only the owner of a rulebase can call this procedure to drop the rules index. However, a rules index can be dropped implicitly if an authorized user drops any model or rulebase on which the rules index is based; in such a case, the rules index is dropped automatically.
The following example drops the rules index named rdfs_rix_family
.
EXECUTE SDO_RDF_INFERENCE.DROP_RULES_INDEX ('rdfs_rix_family');
SDO_RDF_INFERENCE.DROP_USER_INFERENCE_OBJS(
uname IN VARCHAR2);
Drops (deletes) all rulebases and rules index owned by a specified database user.
Name of a database user. (This value is case sensitive; for example, HERMAN
and herman
are considered different users.)
You must have sufficient privileges to delete rules and rulebases for the specified user.
This procedure does not delete the database user. It deletes only RDF rulebases and rules indexes owned by that user.
The following example deletes all rulebases and rules indexes owned by user SCOTT
.
EXECUTE SDO_RDF_INFERENCE.DROP_USER_INFERENCE_OBJS('SCOTT'); PL/SQL procedure successfully completed.
SDO_RDF_INFERENCE.LOOKUP_RULES_INDEX (
models IN SDO_RDF_MODELS,
rulebases IN SDO_RDF_RULEBASES
) RETURN VARCHAR2;
Returns the name of the rules index based on the specified models and rulebases.
One or more RDF model names. Its data type is SDO_RDF_MODELS, which has the following definition: TABLE OF VARCHAR2(25)
One or more rulebase names. Its data type is SDO_RDF_RULEBASES, which has the following definition: TABLE OF VARCHAR2(25)
Rules and rulebases are explained in Section 1.2.10.
For a rulebase index to be returned, it must be based on all specified models and rulebases.
The following example find the rules index that is based on the family
model and the RDFS
and family_rb
rulebases. (It is an excerpt from Example 1-9 in Section 1.8.2.)
SELECT SDO_RDF_INFERENCE.LOOKUP_RULES_INDEX(SDO_RDF_MODELS('family'), SDO_RDF_RULEBASES('RDFS','family_rb')) AS lookup_rules_index FROM DUAL; LOOKUP_RULES_INDEX -------------------------------------------------------------------------------- RDFS_RIX_FAMILY