www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

AMI APIs
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Geo Spatial
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Phrases
RDF data
db.dba.group_concat
db.dba.group_concat_...
db.dba.group_digest
db.dba.rdf_64bit_upg...
db.dba.rdf_all_user_...
db.dba.rdf_audit_met...
db.dba.rdf_backup_me...
db.dba.rdf_convert_r...
db.dba.rdf_datatype_...
db.dba.rdf_default_u...
db.dba.rdf_default_u...
db.dba.rdf_geo_add
db.dba.rdf_geo_fill
db.dba.rdf_graph_col...
db.dba.rdf_graph_dif...
db.dba.rdf_graph_gro...
db.dba.rdf_graph_gro...
db.dba.rdf_graph_sec...
db.dba.rdf_graph_use...
db.dba.rdf_graph_use...
db.dba.rdf_langmatch...
db.dba.rdf_load_rdfa
db.dba.rdf_load_rdfx...
db.dba.rdf_load_rdfx...
db.dba.rdf_quad_uri
db.dba.rdf_quad_uri_...
db.dba.rdf_quad_uri_...
db.dba.rdf_regex
db.dba.rdf_restore_m...
db.dba.rdf_suo_apply...
db.dba.rdf_suo_diff_...
db.dba.rdf_triples_t...
db.dba.rdf_triples_t...
db.dba.rdf_ttl2hash
db.dba.rdf_void_stor...
db.dba.sample
db.dba.sparql_eval
db.dba.sparql_eval_t...
db.dba.sparql_rdb2rd...
db.dba.sparql_rdb2rd...
db.dba.sparql_rexec
db.dba.sparql_rexec_...
db.dba.sparql_rexec_...
db.dba.sparql_select...
db.dba.ttlp
db.dba.ttlp_mt
db.dba.ttlp_mt_local...
isref
rdf_view_sync_to_phy...
__xml_get_ns_prefix
__xml_get_ns_uri
__xml_ns_iristr
__xml_ns_uname
__xml_nsexpand_irist...
http_nt_triple
http_ttl_triple
iri_split
ld_dir
rdfs_rule_set
sparql_to_sql_text
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
VAD
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web & Internet
XML
XPATH & XQUERY

Functions Index

sparql_to_sql_text

Converts a sparql query directly to SQL.
varchar sparql_to_sql_text (in squery varchar);
Description

The sparql_to_sql_text() function can be used to convert a SPARQL query directly to the SQL it would be executed as.

Parameters
squery – The sparql query to be converted.
Return Types

A string will be returned containing the converted sparql query.

Examples
Using the sparql_to_sql_text() function

This simple example shows how to covert sparql query in SQL:

SQL> select sparql_to_sql_text('select * where {?s ?p ?o}');
sparql_to_sql_text
VARCHAR
_______________________________________________________________________________

SELECT __id2i ( /*retval[*/ "s-1-1-t0"."S" /* s */ /*]retval*/ ) AS /*tmpl*/ "s",
  __id2i ( /*retval[*/ "s-1-1-t0"."P" /* p */ /*]retval*/ ) AS /*tmpl*/ "p",
  __ro2sq ( /*retval[*/ "s-1-1-t0"."O" /* o */ /*]retval*/ ) AS /*tmpl*/ "o"
FROM DB.DBA.RDF_QUAD AS "s-1-1-t0"
OPTION (QUIETCAST)

1 Rows. -- 15 msec.
See Also

DB.DBA.SPARQL_EVAL_TO_ARRAY

DB.DBA.SPARQL_EVAL

DB.DBA.SPARQL_RDB2RDF_CODEGEN

DB.DBA.SPARQL_RDB2RDF_LIST_TABLES

DB.DBA.SPARQL_REXEC

DB.DBA.SPARQL_REXEC_TO_ARRAY

DB.DBA.SPARQL_REXEC_WITH_META

DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS