How can I adjust the frequency of RDF text indexing?
What
You may want to change the frequency of Virtuoso's RDF text index updates.
You can decrease the frequency, if your queries are usually made some time after data inserts/updates.
You can also increase the frequency to real-time, if you need inserts/updates to be immediately available for queries.
Why
Virtuoso's RDF text indexes (that is, the indexes on literal object values, which are distinct from the indexes of URIs in any position) are updated periodically as a batch operation; by default, the interval is one (1) minute.
This means that typed literals (xsd:string
s, XML, BLOB
s/CLOB
s, etc.) which are inserted or changed by SPARUL or other methods may not be immediately available to bif:contains
, bif:xcontains
, or other functions that depend on the text index.
How
- First, force a synchronization of the RDF text index:
SQL> DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ ();
- Next, set the text index to your desired frequency, using the
VT_BATCH_UPDATE()
function.- To update the index in real time, immediately after every change, use --
SQL> DB.DBA.VT_BATCH_UPDATE ( 'DB.DBA.RDF_OBJ', 'OFF', NULL );
- To decrease the frequency, use this form (changing the "1" below to your preferred interval, in minutes) --
SQL> DB.DBA.VT_BATCH_UPDATE ( 'DB.DBA.RDF_OBJ', 'ON', 1 );
- To update the index in real time, immediately after every change, use --
- Insert some example data:
SQL> SPARQL INSERT INTO <http://example.com> { <http://www.worldcat.org/Book_11> <http://schema.org/name> "Kalimero" . }; Query result: callret-0 ANY Insert into <http://example.com>, 1 (or less) triples -- done No. of rows in result: 1
- Check the inserted triples:
SQL> SELECT * FROM <http://example.com> WHERE { <http://www.worldcat.org/Book_11> ?p ?o }; Query result: p o ANY ANY http://schema.org/name Kalimero No. of rows in result: 1
- Check the inserted triples using
bif:contains
:
SQL> SELECT * WHERE { <http://www.worldcat.org/Book_11> ?p ?o . ?o bif:contains "Kalimero" }; Query result: p o ANY ANY http://schema.org/name Kalimero No. of rows in result: 1
Related
-
bif:contains
documentation -
bif:xcontains
documentation - Virtuoso
DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ()
function usage example -
What free-text options can I use with
bif:contains
?