Oracle® Spatial Resource Description Framework (RDF) 10g Release 2 (10.2) Part Number B19307-03 |
|
|
View PDF |
The MDSYS.SDO_RDF package contains subprograms (functions and procedures) for working with 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.
Format
SDO_RDF.ADD_NAMESPACES(
namespace_1 IN VARCHAR2,
namespace_2 IN VARCHAR2 DEFAULT NULL,
namespace_3 IN VARCHAR2 DEFAULT NULL);
Description
Adds up to three namespaces.
Parameters
Namespace name (required). Must be in a valid format for a namespace.
Namespace name (optional). Must be in a valid format for a namespace.
Namespace name (optional). Must be in a valid format for a namespace.
Usage Notes
This procedure adds one, two, or three namespaces to the MDSYS.RDF_NAMESPACE$ table. (Oracle does not use the MDSYS.RDF_NAMESPACE$ table in any of its internal operations; the table is provided as a convenience to users who may want to store namespaces that are used in their models.)
There is no significance to the order in which namespaces are specified.
For information about RDF namespaces in the database, see Section 1.2.2.
Examples
The following example adds three namespaces.
EXECUTE SDO_RDF.ADD_NAMESPACES('http://www.w3.org-/2001/XMLSchema#', - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', - 'http://www.w3.org/2000/01/rdf-schema#');
Format
SDO_RDF.CREATE_RDF_MODEL(
model_name IN VARCHAR2,
table_name IN VARCHAR2,
column_name IN VARCHAR2);
Description
Creates an RDF model.
Parameters
Name of the model.
Name of the table to hold references to RDF data for this model.
Name of the column of type SDO_RDF_TRIPLE_S in table_name
.
Usage Notes
You must create the table to hold references to RDF data before calling this procedure to create the RDF model. For more information, see Section 1.7.
This procedure adds the model to the MDSYS.RDF_MODEL$ table, which is described in Section 1.2.1.
This procedure is the only supported way to create a model. Do not use SQL INSERT statements with the MDSYS.RDF_MODEL$ table.
To delete a model, use the SDO_RDF.DROP_RDF_MODEL procedure.
Examples
The following example creates an RDF model named articles
. References to the RDF triple data for the model will be stored in the TRIPLE column of the ARTICLES_RDF_DATA table. (This example is an excerpt from Example 1-8 in Section 1.8.2.)
EXECUTE SDO_RDF.CREATE_RDF_MODEL('articles', 'articles_rdf_data', 'triple');
The definition of the ARTICLES_RDF_DATA table is as follows:
CREATE TABLE articles_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S);
Format
SDO_RDF.CREATE_RDF_NETWORK(
tablespace_name IN VARCHAR2
Description
Adds RDF support to the database.
Parameters
Name of the tablespace to be used for tables created by this procedure.
Usage Notes
This procedure creates system tables and other database objects used for RDF support.
You should create a tablespace for the RDF system tables and specify the tablespace name in the call to this procedure. (You should not specify the SYSTEM
tablespace.) The size needed for the tablespace that you create will depend on the amount of RDF data you plan to store.
You must connect to the database as a user with DBA privileges in order to call this procedure, and you should call the procedure only once for the database.
To remove RDF support from the database, you must connect as a user with DBA privileges and call the SDO_RDF.DROP_RDF_NETWORK procedure.
Examples
The following example creates a tablespace for RDF system tables and adds RDF support to the database.
CREATE TABLESPACE rdf_tblspace DATAFILE '/oradata/orcl/rdf_tblspace.dat' SIZE 1024M REUSE AUTOEXTEND ON NEXT 256M MAXSIZE UNLIMITED SEGMENT SPACE MANAGEMENT AUTO; . . . EXECUTE SDO_RDF.CREATE_RDF_NETWORK('rdf_tblspace');
Format
SDO_RDF.DROP_RDF_MODEL(
model_name IN VARCHAR2);
Description
Drops (deletes) an RDF model.
Parameters
Name of the model.
Usage Notes
This procedure deletes the model from the MDSYS.RDF_MODEL$ table, which is described in Section 1.2.1.
This procedure is the only supported way to delete a model. Do not use SQL DELETE statements with the MDSYS.RDF_MODEL$ table.
Only the creator of a model can delete the model.
Examples
The following example drops the RDF model named articles
.
EXECUTE SDO_RDF.DROP_RDF_MODEL('articles');
Format
SDO_RDF.DROP_RDF_NETWORK();
Description
Removes RDF support from the database.
Parameters
None.
Usage Notes
To remove RDF support from the database, you must connect as a user with DBA privileges and call this procedure.
Before you call this procedure, be sure to delete all RDF models and rulebases.
Examples
The following example removes RDF support from the database.
EXECUTE SDO_RDF.DROP_RDF_NETWORK;
Format
SDO_RDF.GET_MODEL_ID(
model_name IN VARCHAR2
) RETURN NUMBER;
Description
Returns the model ID number of an RDF model.
Parameters
Name of the RDF model.
Usage Notes
The model_name
value must match a value in the MDSYS.RDF_MODEL$ table, which is described in Section 1.2.1.
Examples
The following example returns the model ID number for the model named articles
. (This example is an excerpt from Example 1-8 in Section 1.8.2.)
SELECT SDO_RDF.GET_MODEL_ID('articles') AS model_id FROM DUAL; MODEL_ID ---------- 1
Format
SDO_RDF.GET_TRIPLE_ID(
model_id IN NUMBER,
subject IN VARCHAR2,
property IN VARCHAR2,
object IN VARCHAR2
) RETURN NUMBER;
or
SDO_RDF.GET_TRIPLE_ID(
model_name IN VARCHAR2,
subject IN VARCHAR2,
property IN VARCHAR2,
object IN VARCHAR2
) RETURN NUMBER;
Description
Returns the ID number of a triple in the specified RDF model, or a null value if the triple does not exist.
Parameters
ID number of the RDF model. Must match a value in the MODEL_ID column of the MDSYS.RDF_MODEL$ table, which is described in Section 1.2.1.
Name of the RDF model. Must match a value in the MODEL_NAME column of the MDSYS.RDF_MODEL$ table, which is described in Section 1.2.1.
RDF subject. Must match a value in the VALUE_NAME column of the MDSYS.RDF_VALUE$ table, which is described in Section 1.2.3.
RDF property. Must match a value in the VALUE_NAME column of the MDSYS.RDF_VALUE$ table, which is described in Section 1.2.3.
RDF object. Must match a value in the VALUE_NAME column of the MDSYS.RDF_VALUE$ table, which is described in Section 1.2.3.
Usage Notes
This function has two formats, enabling you to specify the RDF model by its model number or its name.
Examples
The following example returns the ID number of a triple . (This example is an excerpt from Example 1-8 in Section 1.8.2.)
SELECT SDO_RDF.GET_TRIPLE_ID( 'articles', 'http://www.nature.com/nature/Article2', 'http://purl.org/dc/terms/references', 'http://www.nature.com/nature/Article3') AS RDF_triple_id FROM DUAL; RDF_TRIPLE_ID ------------- 7
Format
SDO_RDF.IS_REIFIED_QUAD(
model_id IN NUMBER,
subject IN VARCHAR2,
property IN VARCHAR2,
object IN VARCHAR2
) RETURN VARCHAR2;
or
SDO_RDF.IS_REIFIED_QUAD(
model_name IN VARCHAR2,
subject IN VARCHAR2,
property IN VARCHAR2,
object IN VARCHAR2
) RETURN VARCHAR2;
Description
Checks if all four statements that make up the reification quad for a triple in a specified model are in the database.
Parameters
ID number of the RDF model. Must match a value in the MODEL_ID column of the MDSYS.RDF_MODEL$ table, which is described in Section 1.2.1.
Name of the RDF model. Must match a value in the MODEL_NAME column of the MDSYS.RDF_MODEL$ table, which is described in Section 1.2.1.
RDF subject. Must match a value in the VALUE_NAME column of the MDSYS.RDF_VALUE$ table, which is described in Section 1.2.3.
RDF property. Must match a value in the VALUE_NAME column of the MDSYS.RDF_VALUE$ table, which is described in Section 1.2.3.
RDF object. Must match a value in the VALUE_NAME column of the MDSYS.RDF_VALUE$ table, which is described in Section 1.2.3.
Usage Notes
This function returns the RDF statement if all four statements that make up the reification quad for a triple in a specified model are in the database; otherwise, it returns the string FALSE
.
For information about reification quads, see Section 1.2.7.
Examples
The following checks if a reification quad exists for a specified statement in an RDF model named candidates
. (This example refers to RDF statements in Section 1.2.7.)
SELECT SDO_RDF.IS_REIFIED_QUAD('candidates', 'a:PersonA', 'a:CandidateQuality', 'Good') FROM DUAL;
Format
SDO_RDF.IS_TRIPLE(
model_id IN NUMBER,
subject IN VARCHAR2,
property IN VARCHAR2,
object IN VARCHAR2) RETURN VARCHAR2;
or
SDO_RDF.IS_TRIPLE(
model_name IN VARCHAR2,
subject IN VARCHAR2,
property IN VARCHAR2,
object IN VARCHAR2) RETURN VARCHAR2;
Description
Checks if an RDF statement is an existing triple in the specified model in the database.
Parameters
ID number of the RDF model. Must match a value in the MODEL_ID column of the MDSYS.RDF_MODEL$ table, which is described in Section 1.2.1.
Name of the RDF model. Must match a value in the MODEL_NAME column of the MDSYS.RDF_MODEL$ table, which is described in Section 1.2.1.
RDF subject. Must match a value in the VALUE_NAME column of the MDSYS.RDF_VALUE$ table, which is described in Section 1.2.3.
RDF property. Must match a value in the VALUE_NAME column of the MDSYS.RDF_VALUE$ table, which is described in Section 1.2.3.
RDF object. Must match a value in the VALUE_NAME column of the MDSYS.RDF_VALUE$ table, which is described in Section 1.2.3.
Usage Notes
This function returns the string value FALSE
, TRUE
, or TRUE (EXACT)
:
FALSE
means that the statement is not a triple in the specified model the database.
TRUE
means that the statement matches the value of a triple or is the canonical representation of the value of a triple in the specified model the database.
TRUE (EXACT)
means that the specified subject
, property
, and object
values have exact matches in a triple in the specified model in the database.
Examples
The following checks if a statement is a triple in the database. In this case, there is an exact match. (This example is an excerpt from Example 1-8 in Section 1.8.2.)
SELECT SDO_RDF.IS_TRIPLE( 'articles', 'http://www.nature.com/nature/Article2', 'http://purl.org/dc/terms/references', 'http://www.nature.com/nature/Article3') AS is_triple FROM DUAL; IS_TRIPLE -------------------------------------------------------------------------------- TRUE (EXACT)