SEM_APIS.SPARQL_TO_SQL
Format
SEM_APIS.SPARQL_TO_SQL(
sparql_query IN CLOB,
models IN RDF_MODELS DEFAULT NULL,
rulebases IN RDF_RULEBASES DEFAULT NULL,
aliases IN RDF_ALIASES DEFAULT NULL,
index_status IN VARCHAR2 DEFAULT NULL,
options IN VARCHAR2 DEFAULT NULL
graphs IN RDF_GRAPHS DEFAULT NULL,
named_graphs IN RDF_GRAPHS DEFAULT NULL,
network_owner IN VARCHAR2 DEFAULT NULL,
network_name IN VARCHAR2 DEFAULT NULL) RETURN CLOB;
Description
Translates a SPARQL query into a SQL query string that can be executed by an application program.
Parameters
sparql_query
A string literal with one or more triple patterns, usually containing variables.
models
The model or models to use.
rulebases
One or more rulebases whose rules are to be applied to the query
aliases
One or more namespaces to be used for expansion of qualified names in the query pattern.
index_status
The status of the relevant entailment for this query.
options
Options that can affect the results of queries.
graphs
The set of named graphs from which to construct the default graph for the query.
named_graphs
The set of named graphs that can be matched by a GRAPH clause.
network_owner
Owner of the RDF network. (See Table: network_owner and network_name Parameters.)
network_name
Name of the RDF network. (See Table: network_owner and network_name Parameters.)
Usage Notes
Before using this procedure, be sure you understand the material in Using the SEM_APIS.SPARQL_TO_SQL Function to Query RDF Data.
For information about RDF network types and options, see RDF Networks.
Examples
The following example translates a SPARQL query into a SQL query string.
DECLARE
sparql_stmt clob;
sql_stmt clob;
BEGIN
sparql_stmt := '{?x :grandParentOf ?y . ?x rdf:type :Male}';
sql_stmt := sem_apis.sparql_to_sql(
sparql_stmt,
sem_models('family'),
SEM_Rulebases('RDFS','family_rb'),
SEM_ALIASES(SEM_ALIAS('','http://www.example.org/family/')),
null);
execute immediate
'create table gf_table as
select x grandfather, y grandchild from('|| sql_stmt || ')';
END;
/