External Data Sources: R2RML and triggers options

I’m using the “R2RML Upload” and and I check the check box options:

Generate RDB2RDF triggers

Enable Data Syncs with Physical Quad Store

I get a transient graph and a physical graph. Unfortunately not trigger is created.
Before using this functionality, I did several tests with “R2RML Upload” or with the “Linked Data Views Wizard”: could it be that something got corrupted?

Or are at all triggers for external sources supported?

When you say Before using this functionality, I did several tests with “R2RML Upload” or with the “Linked Data Views Wizard”, I presume this was against local tables in Virtuoso, as triggers will not be created on externally linked tables?

So triggers on externally linked tables are not supported, correct?

That is correct … so you effectively have the equivalent of the Materialized Views in PostgreSQL which as with the REFRESH MATERIALIZED VIEW ... command in PostgreSQL you can refresh with the Virtuoso RDF_VIEW_SYNC_TO_PHYSICAL function …

Meaning I can:

  • Attach an external table
  • Create a Transient RDF View
  • Use the the Virtuoso RDF_VIEW_SYNC_TO_PHYSICAL function to create a physical graph and set the triggers?

Am I correct? Is there sort of tutorial on that?

thanks for the support

Yes, that is correct. See the Virtuoso HowTo: Generating Linked Data from CSV version of Northwind Database for an example use case of the RDF_VIEW_SYNC_TO_PHYSICAL function. Although, note, as stated previously, no triggers will be created in the remote database.

One more thing which is not 100% clear to me.

Does the RDF_VIEW_SYNC_TO_PHYSICAL function maintain in sync the transient and the physical graphs, or does it just generate the physical triples once? Imagine to have an external table, a transient graph (generated via RDF Views Wizard or via R2RML Upload), and a physical graph generated via the mentioned function. If something changes in the external table, the transient view reflects this change: does the physical graph get re-synchronized?

One more question: what does it happen at SPARQL level. I mean if someone issue a “describe” request on a resource without specifying any graph, from which graph is the description returned, the transient or the physical?

The RDF_VIEW_SYNC_TO_PHYSICAL functions will sync physical graph once with the transient graph when it is run, and as no triggers can be created on the remote, it would not be aware of any changes to the remote SQL data. Thus RDF_VIEW_SYNC_TO_PHYSICAL would have to be run again if you want it to resync with the remote SQL data via the transient graph (RDF View).

If you execute a “describe” query without a graph name then the query would be executed against ALL graphs in the Quad Store or the DefaultGraph if one is set via a pragma or the Virtuoso INI file.