Virtuoso hints and tips

Skip to end of metadata
Go to start of metadata

Querying and filtering date types

Problem

I am having trouble date filtering on sparql queries. I have a number of query scripts that were working before the recent virtuoso upgrade. Is there a new sparql format for date filtering, or dates are stored and compared different in Virtuoso v6.1.0?

Solution

Seems (since the newest version??) you have to cast the date type explicitly:

sparql select ?post ?d from <http://boards.ie> where {
?post <http://purl.org/dc/terms/created> ?d .
filter (xsd:dateTime(?d) > xsd:dateTime("2006-01-01T00:00:00"))
}
limit 100

Ingestion issue when data contains long URIs

Important: we assume that you already know how to run an ingestion procedure on Virtuoso. If not, refer to The complete tutorial for RDF data ingestion in Virtuoso.

Problem

You started an ingestion procedure and the log (virtuoso.log file) contains errors like this:
15:57:33 PL LOG: File graph-summary-2011-10-11/00002.nt.gz error 23000 SR133: Can not set NULL to not nullable column 'DB.DBA.RDF_QUAD.O'

Reason

Your dataset contains long URIs that are badly processed by Virtuoso.
For example, the following URI will lead to the error and the whole file will not be processed!
<http://vocab.sindice.net/edge1218573982136685081n7994173148008273058n1368714023>

Solution

  1. Add this parameter under [SPARQL] section in virtuoso.ini config file located in your database directory (default is database/):
    ShortenLongURIs = 1
  2. Restart Virtuoso
  3. Open an isql connection
  4. Clear the queue in load_list table with the command DELETE FROM load_list WHERE ll_state=0 OR ll_state=1
  5. Reload your dataset with ld_dir
  6. Restart the ingestion

And you're done!

Important note

Virtuoso Open source version 6.1.4 does not support the parameter, but you can apply a patch. See http://ods.openlinksw.com/wiki/main/Main/VirtTipsAndTricksGuideShortenLongURIs

How to delete big graphs

  1. Open an isql connection
  2. log_enable(3,1);
  3. SPARQL CLEAR GRAPH <http://the-graph-you-want>;

Check which isql statements are running

  • status('c');
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.