DB.DBA.RDF_LOAD_RDFXML_MT — Parses the content of large RDF/XML text as a sequence of separate RDF triples.


DB.DBA.RDF_LOAD_RDFXML_MT ( in strg varchar ,
  in base varchar ,
  in graph varchar ,
  in log_mode integer ,
  in threads integer ,
  in transactional integer );


For loading large resources when transactional integrity is not important (loading of a single resource may take more than one transaction). The function may or may not leave a transaction log, depending on log_mode . Hence, after successful load, one may need to execute the checkpoint statement to make sure that a server restart does not wipe out the results.



text of the resource.


base IRI to resolve relative IRIs to absolute.


target graph IRI, parsed triples will appear in that graph.


detail level of writing the effect of loading to the transaction log. 0 means log nothing, 1 means log only allocations of internal IDs for new IRIs and literals, 2 means log everything. If database crashes when the loading is in progress or after the loading but before checkpoint is made, 0 will means that the database become inconsistent, 1 means that the database is consistent but loaded quads may disappear so the loading should be repeated and log replay may produce wrong results if actions in it depend on the content of quad store, 2 means no danger (so the default is 2). Hence loading with mode 1 and especially mode 0 are faster than usual mode 2 but they require checkpoints after data loadings and mode 0 additionally requires a checkpoint and database backup right before the loading.


number of threads that insert quads into the database. It should not be less than 1, obviously; it is better to not set it greater than ((N-2)/k)-1 where N is the number of available CPU cores and k is the number of loadings that happen at the same time.


controls the transaction mode which is "0" by default i.e. off and can be turned on by setting it to "1".

Return Types

The return value is not specified and may be changed in future versions.


Example 24.262. Usage Example

The following example demonstrates importing data from the rdf file resource Kingsley_Idehen.rdf which can be downloaded from here

SQL> DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output ('tmp/Kingsley_Idehen.rdf'), '', '');
Done. -- 61 msec.
select *
from <>
where {?s ?p ?o};

s             p                    o
VARCHAR       VARCHAR              VARCHAR
_______________________________________________________________________________       42.485836      -71.214287                                                                 vdb                                   Virtuoso Data Space Bot                                                                 dav

10 Rows. -- 30 msec.

The following example demonstrates importing data from the rdf resource with URI:

SQL>create procedure MY_LOAD_FILE (in full_uri varchar, in in_resultset integer := 0)
  declare REPORT varchar;
  declare graph_uri, dattext varchar;
  declare app_env any;
  app_env := null;
  whenever sqlstate '*' goto err_rep;
  if (not in_resultset)
    result_names (REPORT);
  dattext := cast (XML_URI_GET_AND_CACHE (full_uri) as varchar);
  MY_SPARQL_REPORT (sprintf ('Downloading %s: %d bytes',
      full_uri, length (dattext) ) );
  graph_uri := full_uri;
  delete from RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_uri);
  DB.DBA.RDF_LOAD_RDFXML_MT (dattext, full_uri, graph_uri);
  return graph_uri;
  result (sprintf ('%s: %s', __SQL_STATE, __SQL_MESSAGE));
  return graph_uri;

Done. -- 0 msec.

SQL>create procedure MY_SPARQL_REPORT(in strg varchar)
  if (__tag(strg) <> 182)
    strg := cast (strg as varchar) || sprintf (' -- not a string, tag=%d', __tag(strg));
  strg := replace (strg, SPARQL_DAV_DATA_URI(), '\044{SPARQL_DAV_DATA_URI()}');
  strg := replace (strg, SPARQL_DAV_DATA_PATH(), '\044{SPARQL_DAV_DATA_PATH()}');
  strg := replace (strg, SPARQL_FILE_DATA_ROOT(), '\044{SPARQL_FILE_DATA_ROOT()}');
  result (strg);

Done. -- 0 msec.


Downloading 17773 bytes

1 Rows. -- 4046 msec.

select *
from <>
where {?s ?p ?o} ;

s                                             p                                               o
VARCHAR                                       VARCHAR                                         VARCHAR
__________________________________________________________________________________________________________                  Henry Story                  TimBL                  timbl                  965c47c5a70db7407210cef6e4e6f5374a525c5c