Virtuoso (RDF-store) underlying source code for caching [techniques] and query processing

Hello Pouya,

1 . Yes, Virtuoso first translates SPARQL to SQL and then executes the SQL. If you connect via isql you can read the intermediate SQL by writing

set blobs on;
select sparql_to_sql_text ('text_of_your_sparql_query_here') as x long varchar;

(the text of sparql query should not contain leading SPARQL keyword and if it contains single quotes then they should be repeated twice, like inside any other SQL string constant)

The query execution plan and SPARQL to SQL text can also be obtained as detailed here.

If you connect via SPARQL web service endpoint then you can mark the
“Generate SPARQL compilation report (instead of executing the query)”
checkbox to read the SQL text among other diagnostics as detailed here.

2 . Virtuoso does not cache any results; of course it caches recently accessed parts of source data in tables and it caches the compiled queries but not the results.

3 . For the sake of speed SPARQL is parsed into internal tree-like representation and other compiler’s internal data at the same time, there’s no point in time when there’s a “nice to process” syntax tree.

1 Like