www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Overview

What is Virtuoso?
Why Do I Need Virtuoso?
Key Features of Virtuoso
Virtuoso 6 FAQ
Tips and Tricks
How Can I execute SPARQL queries containing '$' character using ISQL? How can I find on which table deadlocks occur? How Can I configure parameters to avoid out of memory error? What are "Generate RDB2RDF triggers" and "Enable Data Syncs with Physical Quad Store" RDF Views options? How to Manage Date Range SPARQL queries? How can I see which quad storages exist and in which quad storage a graph resides? Can I drop and re-create the DefaultQuadStorage? How to display only some information from RDF graph? Is it possible to have the SPARQL endpoint on a different port than the Conductor? How to enable the Virtuoso Entity Framework 3.5 ADO.Net Provider in Visual Studio 2010? How Can I Control the normalization of UNICODE3 accented chars in free-text index? How Can I define graph with virt:rdf_sponger option set to "on"? How do I use SPARUL to change a selection of property values from URI References to Literals? How is a Checkpoint performed against a Virtuoso Clustered Server? How can I use CONSTRUCT with PreparedStatements? How can perform SPARQL Updates without transactional log size getting exceed? How can I write custom crawler using PL? How Can I Get an exact mapping for a date? How Can I Get certificate attributes using SPARQL? How can I make Multi Thread Virtuoso connection using JDBC?? How Do I Perform Bulk Loading of RDF Source Files into one or more Graph IRIs? How to exploit RDF Schema and OWL Inference Rules with minimal effort? How can I dump arbitrary query result as N-Triples? How do I bind named graph parameter in prepared statement? How can I insert binary data to Virtuoso RDF storage in plain queries and with parameter binding via ADO.NET calls? How can I insert RDF data from Visual Studio to Virtuoso? How does default describe mode work? What should I do if the Virtuoso Server is not responding to HTTP requests? How can I replicate all graphs?

1.5. Tips and Tricks

1.5.1. How Can I execute SPARQL queries containing '$' character using ISQL?

Assuming a SPARQL query should filter on the length of labels:

SELECT ?label
FROM <http://mygraph.com>
WHERE 
  { 
    ?s ?p ?label
    FILTER(regex(str(?label), "^.{1,256}$") )
  } 

ISQL uses '$' character as a prefix for macro names of its preprocessor. When '$' character is used in SPARQL query to be executed in ISQL, the character should be replaced with '$$' notation or an escape char + numeric code:

SQL> SPARQL 
SELECT ?label
FROM <http://mygraph.com>
WHERE 
  { 
    ?s ?p ?label
    FILTER(REGEX(str(?label), "^.{1,256}$$") )
  } 	

Note also that the FILTER written in this way, finds ?label-s with length less than 256.

To achieve fast results, REGEX should be replaced with the bif:length function:

SQL> SPARQL 
SELECT ?label
FROM <http://mygraph.com>
WHERE 
  { 
    ?s ?p ?label
    FILTER (bif:length(str(?label))<= 256)
  } 	

In this way the SPARQL query execution can work much faster if the interoperability is not required and ?label-s are numerous.


1.5.2. How can I find on which table deadlocks occur?

One possible way to find on which table deadlocks occur is to execute the following statement:

SELECT TOP 10 * 
FROM SYS_L_STAT 
ORDER BY deadlocks DESC	

1.5.3. How Can I configure parameters to avoid out of memory error?

In order to avoid out of memory error, you should make sure the values for the paramaters NumberOfBuffers and MaxCheckpointRemap are not set with the same values.

For example, the following configuration will cause an error out of memory:

# virtuoso.ini

...
[Parameters]
NumberOfBuffers = 246837
MaxDirtyBuffers = 18517
MaxCheckpointRemap = 246837
...

Changing the value of the parameter MaxCheckpointRemap with let's say 1/4 of the DB size will resolve the issue.


1.5.4. What are "Generate RDB2RDF triggers" and "Enable Data Syncs with Physical Quad Store" RDF Views options?

These RDF Views options basically persist the triples in the transient View Graph in the Native Quad Store. The Data Sync is how you keep the transient views in sync with the persisted triples.

Without this capability you cannot exploit faceted browsing without severe performance overhead when using Linked Data based conceptual views over ODBC or JDBC accessible data sources.

Note: Using these options when the RFViews have already been created is not currently possible via the Conductor UI. Instead you should be able to add them manually from isql:

  1. Drop the RDF View graph and Quad Map.
  2. Create it again with the RDB2RDF Triggers options enabled.
See Also:

RDB2RDF Triggers


1.5.5. How to Manage Date Range SPARQL queries?

The following examples demonstrate how to manage date range in a SPARQL query:

Example with date range

SELECT ?s ?date 
FROM <http://dbpedia.org> 
WHERE 
  { 
    ?s ?p ?date . FILTER ( ?date >= "19450101"^^xsd:date && ?date <= "19451231"^^xsd:date )  
  } 
LIMIT 100

Example with bif:contains

Suppose there is the following query using bif:contains for date:

If ?date is of type xsd:date or xsd:dateTime and of valid syntax then bif:contains(?date, '"1945*"' ) will not found it, because it will be parsed at load/create and stored as SQL DATE value.

So if data are all accurate and typed properly then the filter is:

(?date >= xsd:date("1945-01-01") && ?date < xsd:date("1946-01-01"))	

i.e. the query should be:

SELECT DISTINCT ?s ?date
FROM <http://dbpedia.org>
WHERE
  {
    ?s ?p ?date . FILTER( ?date >= xsd:date("1945-01-01") && ?date < xsd:date("1946-01-01")  && (str(?p) != str(rdfs:label)) )
  }
LIMIT 10	

If data falls, then the free-text will be OK for tiny examples but not for "big" cases because bif:contains(?date, '"1945*"') would require that less than 200 words in the table begins with 1945. Still, some data can be of accurate type and syntax so range comparison should be used for them and results aggregated via UNION.

If dates mention timezones then the application can chose the beginning and the end of the year in some timezones other than the default.


1.5.6. How can I see which quad storages exist and in which quad storage a graph resides?

Let's take for example a created RDF view from relational data in Virtuoso. The RDF output therefor should have two graphs which reside in a quad storage named for ex.:

http://localhost:8890/rdfv_demo/quad_storage/default	

Also the RDF is accessible over the SPARQL endpoint with the following query:

define input:storage <http://localhost:8890/rdfv_demo/quad_storage/default>
SELECT * 
WHERE 
  { 
    ?s ?p ?o 
  }	

Now one could ask is there a way to define internally (once) that the quad storage should be included in queries to the SPARQL endpoint? So that the user does not have to define the input:storage explicitly in each query, like this:

http://localhost:8890/sparql?query=select * where { ?s ?p ?o }&default-graph-uri=NULL&named-graph-uri=NULL	

All metadata about all RDF storages are kept in "system" graph <http://www.openlinksw.com/schemas/virtrdf#> ( namespace prefix virtrdf: ). Subjects of type virtrdf:QuadStorage are RDF storages. There are three of them by default:

SQL> SPARQL SELECT * FROM virtrdf: WHERE { ?s a virtrdf:QuadStorage };
s
VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage
http://www.openlinksw.com/schemas/virtrdf#DefaultServiceStorage
http://www.openlinksw.com/schemas/virtrdf#SyncToQuads

3 Rows. -- 3 msec.	

There are two ways of using the RDF View from above in SPARQL endpoint without define input:storage:

  1. Create RDF View right in virtrdf:DefaultQuadStorage or add the view in other storage and then copy it from there to virtrdf:DefaultQuadStorage.
    • In any of these two variants, use:
      SPARQL ALTER QUAD STORAGE virtrdf:DefaultQuadStorage . . .	
      
  2. Use SYS_SPARQL_HOST table as described here and set SH_DEFINES so it contains your favorite define input:storage.

1.5.7. Can I drop and re-create the DefaultQuadStorage?

Currently system metadata consist of three "levels":

  1. QuadMapFormats are used to describe transformations of individual SQL values (or types of SQL values),
  2. QuadMaps refers to QuadMapFormats (via QuadMapValues) and describe some "minimal" independent RDB2RDF transformations,
  3. QuadStorages organizes QuadMaps.

QuadStorages contains only "symlinks" to maps, if you drop a storage you don't drop all mappings inside. If you drop the DefaultQuadStorage or some other built-in thing, it can be safely recovered by DB.DBA.RDF_AUDIT_METADATA, with first parameter set to 1. This will keep your own data intact. However we recommend to write a script that declares all your formats, RDF Views and storages, to be able to reproduce the configuration after any failures.


1.5.8. How to display only some information from RDF graph?

Virtuoso supports graph-level security, as described here but not subject-level or predicate-level. When exposing data that needs protected access, triples should be confined to private name graphs which are protected by ACLs using WebID.

Note, how you can use WebID to protect Virtuoso SPARQL endpoints.

See Also:

RDF Graphs Security


1.5.9. Is it possible to have the SPARQL endpoint on a different port than the Conductor?

Virtuoso Web Server has the capability to create extra listeners using the Conductor interface.

  1. At install time you have your HTTP Server port in your virtuoso.ini set to 8890, which you want to keep in your local network as this contains ALL the endpoints that you have registered in Virtuoso. So as long as you do not open this port in your firewall, you can only get at it from the local machine.
  2. Next you should create a new vhost entry using the EXTERNAL name of your machine and use port 80 (or a higher port if you do not want to run as root) for ex.:
    Interface: 0.0.0.0
    Port: 8080
    Http Host:  my.example.com	
    
  3. Next you add a "New directory to this line", click on "Type" radio button and choose "Sparql access point" from the drop-down list and press Next button. Set "Path" to /sparql and press the "Save Changes" button to store.
  4. At this point you have created: http://my.example.com:8080/sparql which functions exactly the same as your internal http://localhost:8890/sparql. You can now open your firewall and allow outside machines to connect to port 8080 so people can use your SPARQL endpoint without access to any other endpoint on your Virtuoso installation.
  5. You should probably also change your virtuoso.ini so:
    [URIQA]
    DefaultHost = my.example.com:8080	
    
  6. If you use port 80, you do not have to add :80 at the end of this setting, although it should not make any difference.
  7. You can now add other directories / endpoints to the new my.example.com interface you just created e.g. a nice / directory that points to a index.html which describes your site etc.
See Also:

Internet Domains


1.5.10. How to enable the Virtuoso Entity Framework 3.5 ADO.Net Provider in Visual Studio 2010?

The Virtuoso Entity Framework 3.5 ADO.Net Provider is current only list as a Visible control in the Visual Studio 2008 IDE as the current installers only create the necessary registry entries for Visual Studio 2008. To make it visible in the Visual Studio 2010's IDE the following registry settings need to be manually updated and manual addtions to some of the VS 2010 XML configuration files:

  1. Export following registry keys to .reg files and using a text editor, such as Wordpad, edit the Visual Studio version numbers from 8.0 or 9.0 to 10.0:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\DataProviders\{EE00F82B-C5A4-4073-8FF1-33F815C9801D}
    - and -
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\DataSources\{90FBCAF2-8F42-47CD-BF1A-88FF41173060}
    
  2. Once edited, save and double click them to create the new registry entries under:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0....	
    
  3. In addition, locate the file C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config, locate the node, then locate the <add name="VirtuosoClient3? Data Provider" ... node within it:
    <add name="VirtuosoClient3 Data Provider" invariant="OpenLink.Data.Virtuoso"
        description=".NET Framework Data Provider for Virtuoso" type="OpenLink.Data.Virtuoso.VirtuosoClientFactory, virtado3, Version=6.2.3128.2, Culture=neutral, PublicKeyToken=391bf132017ae989" />	
    

and copy is to the equivalent C:\WINDOWS\Microsoft.NET\Frameworks\v4.0.30128\CONFIG\machine.config location.

Visual Studio 2010 will then have the necessary information to locate and load the Virtuoso ADO.Net provider in its IDE.

The registry should typically contain the following entries for Visual Studio 2010 as a result:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}]
@=".NET Framework Data Provider for Virtuoso"
"AssociatedSource"="{4D90D7C5-69A6-43EE-83ED-59A0E442D260}"
"CodeBase"="C:\\Windows\\assembly\\GAC_MSIL\\virtado3\\6.2.3128.1__391bf132017ae989\\virtado3.dll"
"Description"="Provider_Description, OpenLink.Data.Virtuoso.DDEX.Net3.DDEXResources, virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
"DisplayName"="Provider_DisplayName, OpenLink.Data.Virtuoso.DDEX.Net3.DDEXResources, virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
"InvariantName"="OpenLink.Data.Virtuoso"
"PlatformVersion"="2.0"
"ShortDisplayName"="Provider_ShortDisplayName, OpenLink.Data.Virtuoso.DDEX.Net3.DDEXResources, virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
"Technology"="{77AB9A9D-78B9-4ba7-91AC-873F5338F1D2}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IDSRefBuilder]
@="Microsoft.VisualStudio.Data.Framework.DSRefBuilder"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataAsyncCommand]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataCommand]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataConnectionProperties]
@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataConnectionProperties"
"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataConnectionSupport]
@="Microsoft.VisualStudio.Data.Framework.AdoDotNet.AdoDotNetConnectionSupport"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataConnectionUIControl]
@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataConnectionUIControl"
"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataConnectionUIProperties]
@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataConnectionProperties"
"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataMappedObjectConverter]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataObjectIdentifierResolver]
@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataObjectIdentifierResolver"
"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataObjectSupport]
@="Microsoft.VisualStudio.Data.Framework.DataObjectSupport"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
"XmlResource"="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoObjectSupport"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataSourceInformation]
@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataSourceInformation"
"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataTransaction]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataViewSupport]
@="Microsoft.VisualStudio.Data.Framework.DataViewSupport"
"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
"XmlResource"="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoViewSupport"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataSources\{4D90D7C5-69A6-43EE-83ED-59A0E442D260}]
@="OpenLink Virtuoso Data Source"
"DefaultProvider"="{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataSources\{4D90D7C5-69A6-43EE-83ED-59A0E442D260}\SupportingProviders]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataSources\{4D90D7C5-69A6-43EE-83ED-59A0E442D260}\SupportingProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}]
"Description"="DataSource_Description, OpenLink.Data.Virtuoso.DDEX.Net3.DDEXResources, virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989" 	

The next Virtuoso releases, 6.3+ will support this new Visual Studio 2010 release out of the box.


1.5.11. How Can I Control the normalization of UNICODE3 accented chars in free-text index?

The normalization of UNICODE3 accented chars in free-text index can be controlled by setting up the configuration parameter XAnyNormalization in the virtuoso.ini config file, section [I18N]. This parameter controls whether accented UNICODE characters should be converted to their non-accented base variants at the very beginning of free-text indexing or parsing a free-text query string. The parameter's value is an integer that is bitmask with only 2 bits in use atm:

  1. 0: the default behavior, do not normalize anything, so "Jose" and "José" are two distinct words.
  2. 2: Any combined char is converted to its (smallest known) base. So "é" will lose its accent and become plain old ASCII "e".
  3. 3: This is equl to 1|2 and when set then performs both conversions. As a result, pair of base char and combinig char loses its second char and chars with accents will lose accents.

If the parameter is required at all, the needed value is probably 3. So the fragment of virtuoso.ini is:

[I18N]
XAnyNormalization=3

In some seldom case the value of 1 can be appropriate. The parameter should be set once before creating the database. If changed on the existing database, all free-text indexes that may contain non-ASCII data should be re-created. On a typical system, the parameter affects all text columns, XML columns, RDF literals and queries.

Strictly speaking, it affects not all of them but only items that use default "x-any" language or language derived from x-any such as "en" and "en-US" but if you haven't tried writing new C plugins for custom languages you should not look so deep.

As an example, with XAnyNormalization=3 once can get the following:

SQL>SPARQL 

INSERT IN <http://InternationalNSMs/>
   { <s> <sp> "Índio João Macapá Júnior Tôrres Luís Araújo José" ; 
     <ru> "Он добавил картошки, посолил и поставил аквариум на огонь" . }

INSERT INTO <http://InternationalNSMs/>, 2 (or less) triples -- done


SQL> DB.DBA.RDF_OBJ_FT_RULE_ADD (null, null, 'InternationalNSMs.wb');

Done. -- 0 msec.

SQL>vt_inc_index_db_dba_rdf_obj();

Done. -- 26 msec.

SQL>SPARQL 
SELECT * 
FROM <http://InternationalNSMs/> 
WHERE 
  {
    ?s ?p ?o 
  }
ORDER BY ASC (str(?o))

s  sp  Índio João Macapá Júnior Tôrres Luís Araújo José
s  ru  Он добавил картошки, посолил и поставил аквариум на огонь

2 Rows. -- 2 msec.

SQL> SPARQL 
SELECT * 
FROM <http://InternationalNSMs/> 
WHERE 
  { 
    ?s ?p ?o . ?o bif:contains "'Índio João Macapá Júnior Tôrres Luís Araújo José'" . 
  }

s  sp  Índio João Macapá Júnior Tôrres Luís Araújo José

1 Rows. -- 2 msec.

SQL>SPARQL 
SELECT * 
FROM <http://InternationalNSMs/> 
WHERE
  { 
    ?s ?p ?o . ?o bif:contains "'Indio Joao Macapa Junior Torres Luis Araujo Jose'" . }

s  sp  Índio João Macapá Júnior Tôrres Luís Araújo José

1 Rows. -- 1 msec.

SQL> SPARQL 
SELECT * 
FROM <http://InternationalNSMs/> 
WHERE 
  { 
    ?s ?p ?o . ?o bif:contains "'поставил аквариум на огонь'" . }

s  ru  Он добавил картошки, посолил и поставил аквариум на огонь

There was also request for function that normalizes characters in strings as free-text engine will do with XAnyNormalization=3 , the function will be provided as a separate patch and depends on this specific patch.

See Also:

Virtuoso Configuration File


1.5.12. How Can I define graph with virt:rdf_sponger option set to "on"?

Suppose we have the following scenario:

  1. Create Virtuoso user using Conductor.
  2. Create for the user a RDF Sink folder.
  3. In the properties of the RDF sink folder add the following virt:rdf_graph option:
    http://localhost:8080/DAV/home/dba/rdf_sink/	
    
  4. Set virt:rdf_sponger to "on".
  5. Upload RDF files to the RDF Sink folder.
  6. As result the RDF data should be stored in graph for ex. (depending on your folder name etc.):
    http://local.virt/DAV/home/wa_sink/rdf_sink/wa_address_agents.rdf	
    
  7. In order to define any graph you want with the option from above, you should execute:
    SQL>DAV_PROP_SET (davLocation,  'virt:rdf_graph', iri, _uid, _pwd);	
    
    • Calling this function uses the given IRI as the graph IRI when sponging stuff put in the rdf_sink/ collection davLocation.
  8. Finally you should execute the following command to get the RDF data from the new graph:
    SQL>SELECT DAV_PPROP_GET ('/DAV/home/dba/rdf_sink/', 'virt:rdf_graph','dba', 'dba');	
    

1.5.13. How do I use SPARUL to change a selection of property values from URI References to Literals?

Assume a given graph where triples are comprised of property values that are mixed across URI References and Typed Literals as exemplified by the results of the query below:

SELECT DISTINCT ?sa ?oa 
FROM <http://ucb.com/nbeabase>
WHERE 
  { 
    ?sa a <http://ucb.com/nbeabase/resource/Batch> .
    ?sa <http://ucb.com/nbeabase/resource/chemAbsNo> ?oa . FILTER regex(?oa, '-','i')
  }

You can use the following SPARUL pattern to harmonize the property values across relevant triples in a specific graph, as shown below:

SQL> SPARQL 
INSERT INTO GRAPH <http://ucb.com/nbeabase> 
  { 
    ?sa <http://ucb.com/nbeabase/resource/sampleId> `str (?oa)` 
  }  
WHERE 
  { 
    ?sa <http://ucb.com/nbeabase/resource/chemAbsNo> ?oa . FILTER regex(?oa, '-','i')   
  }	

1.5.14. How is a Checkpoint performed against a Virtuoso Clustered Server?

The cluster cl_exec() function is used to perform a checkpoint across all node of a Virtuoso cluster as follows:

SQL>cl_exec ('checkpoint'); 	

This typically needs to be run after loading RDF datasets into a Virtuoso cluster to prevent lose of data when the cluster is restarted.


1.5.15. How can I use CONSTRUCT with PreparedStatements?

Assume a given query which uses pragma output:format '_JAVA_' with CONSTRUCT:

SPARQL DEFINE output:format '_JAVA_'
   CONSTRUCT { ?s ?p ?o }
WHERE
  { 
    ?s ?p ?o . 
    FILTER (?s = iri(?::0)) 
  }
LIMIT 1

In order to work correctly, the query should be modified to:

SPARQL DEFINE output:format '_JAVA_'
   CONSTRUCT { `iri(?::0)` ?p ?o }
WHERE
  { 
    `iri(?::0)` ?p ?o 
  }
LIMIT 1	

Equivalent variant of the query is also:

SPARQL DEFINE output:format '_JAVA_'
  CONSTRUCT { ?s ?p ?o }
WHERE
  { 
    ?s ?p ?o . 
    FILTER (?s = iri(?::0)) 
  }
LIMIT 1	

1.5.16. How can perform SPARQL Updates without transactional log size getting exceed?

Since SPARUL updates are generally not meant to be transactional, it is best to run these in:

SQL> log_enable (2);	

mode, which commits every operation as it is done. This prevents one from running out of rollback space. Also for bulk updates, transaction logging can be turned off. If so, one should do a manual checkpoint after the operation to ensure persistence across server restart since there is no roll forward log.

Alternatively, the "TransactionAfterImageLimit" parameter can be set in the virtuoso.ini config file to a higher value than its 50MB default:

#virtuoso.ini
...
[Parameters]
...
TransactionAfterImageLimit = N bytes default 50000000
...	
See Also:

Using SPARUL

Virtuoso INI Parameters


1.5.17. How can I write custom crawler using PL?

The following code is an example of loading data via crawler with special function to generate link for downloading:

create procedure EUROPEANA_STORE ( 
  in _host varchar, 
  in _url varchar, 
  in _root varchar, 
  inout _content varchar, 
  in _s_etag varchar, 
  in _c_type varchar, 
  in store_flag int := 1, 
  in udata any := null, 
  in lev int := 0)
{
   declare url varchar;
   declare xt, xp any;
   declare old_mode int;
   xt := xtree_doc (_content, 2);
   xp := xpath_eval ('//table//tr/td/a[@href]/text()', xt, 0);
   commit work;
   old_mode := log_enable (3,1);
   foreach (any u in xp) do
     {
       u := cast (u as varchar);
       url := sprintf ('http://semanticweb.cs.vu.nl/europeana/api/export_graph?graph=%U&mimetype=default&format=turtle', u);
       dbg_printf ('%s', u);
	 {
	   declare continue handler for sqlstate '*' { 
	     dbg_printf ('ERROR: %s', __SQL_MESSAGE);
	   };
	   SPARQL LOAD ?:url into GRAPH ?:u;
	 }
     }
   log_enable (old_mode, 1);
   return WS.WS.LOCAL_STORE (_host, _url, _root, _content, _s_etag, _c_type, store_flag, 0);
}	
See Also:

Set Up the Content Crawler to Gather RDF


1.5.18. How Can I Get an exact mapping for a date?

Assume a given attempts to get an exact mapping for the literal "1950" using bif:contains:

SPARQL
SELECT DISTINCT ?s ?o 
FROM <http://dbpedia.org> 
WHERE 
  {
    ?s ?p ?o . 
   FILTER( bif:contains (?o, '"1950"') 
           && isLiteral(?o) 
           && ( str(?p) ! = rdfs:label  || str(?p) !=  foaf:name 
           && ( ?o='1950')
         )
  }	

As an integer 1950 or date 1950-01-01 are not texts, they are not in free-text index and thus invisible for CONTAINS free-text predicate.

A possible way to make them visible that way is to introduce an additional RDF predicate that will contain objects of the triples in question, converted to strings via str() function.

Thus better results will be approached: if searches about dates are frequent then a new predicate can have date/datetime values extracted from texts, eliminating the need for bif:contains.

Therefor, the query from above should be changed to:

SPARQL
SELECT DISTINCT ?s ?o 
FROM <http://dbpedia.org> 
WHERE 
  {
    ?s ?p ?o . 
    FILTER (  isLiteral(?o) 
              && (  str(?p) != str(rdfs:label) || str(?p) !=  foaf:name ) 
              && str(?o) in ("1950", "1950-01-01"))
  }

1.5.19. How Can I Get certificate attributes using SPARQL?

The SPARQL query should use the cert:hex and cert:decimal in order to get to the values, so for ex:

PREFIX cert: <http://www.w3.org/ns/auth/cert#> 
PREFIX rsa: <http://www.w3.org/ns/auth/rsa#> 

SELECT ?webid 
FROM <http://webid.myxwiki.org/xwiki/bin/view/XWiki/homepw4>
WHERE 
  {
    [] cert:identity ?webid ;
             rsa:modulus ?m ;
     rsa:public_exponent ?e .
     ?m cert:hex "b520f38479f5803a7ab33233155eeef8ad4e1f575b603f7780f3f60ceab1\n34618fbe117539109c015c5f959b497e67c1a3b2c96e5f098bb0bf2a6597\n779d26f55fe8d320de7af0562fd2cd067dbc9d775b22fc06e63422717d00\na6801dedafd7b54a93c3f4e59538475673972e524f4ec2a3667d0e1ac856\nd532e32bf30cef8c1adc41718920568fbe9f793daeeaeeaa7e8367b7228a\n895a6cf94545a6f6286693277a1bc7750425ce6c35d570e89453117b88ce\n24206afd216a705ad08b7c59\n"^^xsd:string .
     ?e cert:decimal "65537"^^xsd:string
  }	

1.5.20. How can I make Multi Thread Virtuoso connection using JDBC??

See details here.


1.5.21. How Do I Perform Bulk Loading of RDF Source Files into one or more Graph IRIs?

See details here.


1.5.22. How to exploit RDF Schema and OWL Inference Rules with minimal effort?

When you install Virtuoso, it's reasoner and highly scalable inference capabilities may not be obvious. Typical cases involve using rdfs:subClassOf predicates in queries and wondering why reasoning hasn't occurred in line with the semantics defined in RDF Schema.

The experience applies when using more sophisticated predicates from OWL such as owl:equivalentProperty, owl:equivalentClass, owl:sameAs, owl:SymmetricalProperty, owl:inverseOf etc ...

Virtuoso implemented inference rules processing in a loosely coupled manner that allow users to conditionally apply inference context (via rules) to SPARQL queries. Typically, you have to create these rules following steps outlined here.

This tips and tricks note provides a shortcut for setting up and exploring RDF Schema and OWL reasoning once you've installed the Virtuoso Faceted Browser VAD package.

See Also:

Inference Rules and Reasoning

Virtuoso Faceted Browser Installation and configuration

Virtuoso Facets Web Service


1.5.23. How can I dump arbitrary query result as N-Triples?

Assume the following arbitrary query:

SPARQL define output:format "NT" 
CONSTRUCT { ?s a ?t } 
FROM virtrdf:
WHERE { ?s a ?t };	

For iteration over result-set of an arbitrary query, use exec_next() in a loop that begins with exec() with cursor output variable as an argument and ends with exec_close() after it is out of data.


1.5.24. How do I bind named graph parameter in prepared statement?

Assume the following SPARQL query:

CONSTRUCT 
  { 
    ?s ?p ?o
  } 
FROM ?context 
WHERE 
  { 
    ?s ?p ?o 
  }	

To bind the named graph context of the query from above, the best solution due to performance implications, is to change the syntax of the query as:

CONSTRUCT 
  { 
    ?s ?p ?o
  } 
WHERE 
  { 
    graph `iri(??)` { ?s ?p ?o } 
  }	

Note: In case of using "FROM clause", it needs a constant in order to check at the compile time whether the IRI refers to a graph or a graph group:


1.5.25. How can I insert binary data to Virtuoso RDF storage in plain queries and with parameter binding via ADO.NET calls?

The following example shows different methods for insert binary data to Virtuoso RDF storage in plain queries and with parameter binding via ADO.NET calls:

# Test_Bin.cs


using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Data;
using OpenLink.Data.Virtuoso;

#if ODBC_CLIENT
namespace OpenLink.Data.VirtuosoOdbcClient
#elif CLIENT
namespace OpenLink.Data.VirtuosoClient
#else
namespace OpenLink.Data.VirtuosoTest
#endif
{
    class Test_Bin
    {
        [STAThread]
        static void Main(string[] args)
        {
            IDataReader myread = null;
            IDbConnection c;

            c = new VirtuosoConnection("HOST=localhost:1111;UID=dba;PWD=dba;");

            IDbCommand cmd = c.CreateCommand();
            int ros;

            try
            {
                c.Open();

                cmd.CommandText = "sparql clear graph <ado.bin>";
                cmd.ExecuteNonQuery();

//insert binary as base64Binary
                cmd.CommandText = "sparql insert into graph <ado.bin> { <res1> <attr> \"GpM7\"^^<http://www.w3.org/2001/XMLSchema#base64Binary> }";
                cmd.ExecuteNonQuery();

//insert binary as hexBinary
                cmd.CommandText = "sparql insert into graph <ado.bin> { <res2> <attr> \"0FB7\"^^<http://www.w3.org/2001/XMLSchema#hexBinary> }";
                cmd.ExecuteNonQuery();


//prepare for insert with parameter binding
                cmd.CommandText = "sparql define output:format '_JAVA_' insert into graph <ado.bin> { `iri($?)` <attr> `bif:__rdf_long_from_batch_params($?,$?,$?)` }";

//bind parameters for insert binary as base64Binary
                IDbDataParameter param = cmd.CreateParameter();
                param.ParameterName = "p1";
                param.DbType = DbType.AnsiString;
                param.Value = "res3";
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p2";
                param.DbType = DbType.Int32;
                param.Value = 4;
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p3";
                param.DbType = DbType.AnsiString;
                param.Value = "GpM7";
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p4";
                param.DbType = DbType.AnsiString;
                param.Value = "http://www.w3.org/2001/XMLSchema#base64Binary";
                cmd.Parameters.Add(param);

                cmd.ExecuteNonQuery();

                cmd.Parameters.Clear();

//bind parameters for insert binary as hexBinary
                param = cmd.CreateParameter();
                param.ParameterName = "p1";
                param.DbType = DbType.AnsiString;
                param.Value = "res4";
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p2";
                param.DbType = DbType.Int32;
                param.Value = 4;
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p3";
                param.DbType = DbType.AnsiString;
                param.Value = "0FB7";
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p4";
                param.DbType = DbType.AnsiString;
                param.Value = "http://www.w3.org/2001/XMLSchema#hexBinary";
                cmd.Parameters.Add(param);

                cmd.ExecuteNonQuery();

                cmd.Parameters.Clear();

//bind parameters for insert binary as byte[]
                param = cmd.CreateParameter();
                param.ParameterName = "p1";
                param.DbType = DbType.AnsiString;
                param.Value = "res5";
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p2";
                param.DbType = DbType.Int32;
                param.Value = 3;
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p3";
                param.DbType = DbType.Binary;
                byte[] bin_val = {0x01, 0x02, 0x03, 0x04, 0x05};
                param.Value = bin_val;
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p4";
                param.DbType = DbType.AnsiString;
                param.Value = System.DBNull.Value; 
                cmd.Parameters.Add(param);

                cmd.ExecuteNonQuery();

                cmd.Parameters.Clear();

//execute select and check the results
                cmd.CommandText = "sparql SELECT ?s ?o FROM <ado.bin> WHERE {?s ?p ?o}"; ;
                myread = cmd.ExecuteReader();
                int r = 0;

                while (myread.Read())
                {
                    Console.WriteLine("=== ROW === "+r);
                    for (int i = 0; i < myread.FieldCount; i++)
                    {
                        string s;
                        if (myread.IsDBNull(i))
                            Console.Write("N/A|\n");
                        else
                        {
                            object o = myread.GetValue(i);
                            Type t = myread.GetFieldType(i);

                            s = myread.GetString(i);
                            Console.Write(s + "[");
                            if (o is SqlExtendedString)
                            {
                                SqlExtendedString se = (SqlExtendedString)o;
                                Console.Write("IriType=" + se.IriType + ";StrType=" + se.StrType + ";Value=" + se.ToString());
                                Console.Write(";ObjectType=" + o.GetType() + "]|\n");
                            }
                            else if (o is SqlRdfBox)
                            {
                                SqlRdfBox se = (SqlRdfBox)o;
                                Console.Write("Lang=" + se.StrLang + ";Type=" + se.StrType + ";Value=" + se.Value);
                                Console.Write(";ObjectType=" + o.GetType() + "]|\n");
                                object v = se.Value;
                                if (v is System.Byte[])
                                {
                                    byte[] vb = (byte[])v;
                                    for (int z = 0; z < vb.Length; z++)
                                    {
                                        Console.WriteLine(""+z+"="+vb[z]);
                                    }
                                }
                            }
                            else
                                Console.Write(o.GetType() + "]|\n");
                        }
                    }
                    r++;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
            finally
            {
                //		  if (myread != null)
                //		    myread.Close();

                if (c.State == ConnectionState.Open)
                    c.Close();

            }

        }
    }
}

Output log for example is in the log.txt:

# log.txt
=== ROW === 0
res1[IriType=IRI;StrType=IRI;Value=res1;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
GpM7[Lang=;Type=http://www.w3.org/2001/XMLSchema#base64Binary;Value=GpM7;ObjectType=OpenLink.Data.Virtuoso.SqlRdfBox]|
=== ROW === 1
res2[IriType=IRI;StrType=IRI;Value=res2;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
0FB7[Lang=;Type=http://www.w3.org/2001/XMLSchema#hexBinary;Value=0FB7;ObjectType=OpenLink.Data.Virtuoso.SqlRdfBox]|
=== ROW === 2
res3[IriType=IRI;StrType=IRI;Value=res3;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
GpM7[Lang=;Type=http://www.w3.org/2001/XMLSchema#base64Binary;Value=GpM7;ObjectType=OpenLink.Data.Virtuoso.SqlRdfBox]|
=== ROW === 3
res4[IriType=IRI;StrType=IRI;Value=res4;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
0FB7[Lang=;Type=http://www.w3.org/2001/XMLSchema#hexBinary;Value=0FB7;ObjectType=OpenLink.Data.Virtuoso.SqlRdfBox]|
=== ROW === 4
res5[IriType=IRI;StrType=IRI;Value=res5;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
0102030405[System.Byte[]]|	

1.5.26. How can I insert RDF data from Visual Studio to Virtuoso?

The following example shows how to insert RDF Data from Visual Studio to Virtuoso:

    
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Data;
using OpenLink.Data.Virtuoso;

#if ODBC_CLIENT
namespace OpenLink.Data.VirtuosoOdbcClient
#elif CLIENT
namespace OpenLink.Data.VirtuosoClient
#else
namespace OpenLink.Data.VirtuosoTest
#endif
{
    class Test_Insert
    {
        [STAThread]
        static void Main(string[] args)
        {
            IDataReader myread = null;
            IDbConnection c;

            c = new VirtuosoConnection("HOST=localhost:1111;UID=dba;PWD=dba;Charset=UTF-8");

            IDbCommand cmd = c.CreateCommand();
            int ros;

            try
            {
                c.Open();

                cmd.CommandText = "sparql clear graph <ado.net>";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P01> \"131\"^^<http://www.w3.org/2001/XMLSchema#short> }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P02> \"1234\"^^<http://www.w3.org/2001/XMLSchema#integer> }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P03> \"12345.12\"^^<http://www.w3.org/2001/XMLSchema#float> }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P04> \"123456.12\"^^<http://www.w3.org/2001/XMLSchema#double> }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P05> \"123456.12\"^^<http://www.w3.org/2001/XMLSchema#decimal> }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P06> \"01020304\"^^<http://www.w3.org/2001/XMLSchema#hexBinary> }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P07> \"01.20.1980T04:51:13\"^^<http://www.w3.org/2001/XMLSchema#dateTime> }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P08> \"01.20.1980\"^^<http://www.w3.org/2001/XMLSchema#date> }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P09> \"01:20:19\"^^<http://www.w3.org/2001/XMLSchema#time> }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P10> \"test\" }";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "sparql define output:format '_JAVA_' insert into graph <ado.net> { <b> `iri($?)` `bif:__rdf_long_from_batch_params($?,$?,$?)` }";

//add Object URI
                add_triple(cmd, "S01", 1, "test1", null);

//add Object BNode
                add_triple(cmd, "S02", 1, "_:test2", null);


//add Literal
                add_triple(cmd, "S03", 3, "test3", null);

//add Literal with Datatype
                add_triple(cmd, "S04", 4, "1234", "http://www.w3.org/2001/XMLSchema#integer");

//add Literal with Lang
                add_triple(cmd, "S05", 5, "test5", "en");


                add_triple(cmd, "S06", 3, (short)123, null);
                add_triple(cmd, "S07", 3, 1234, null);
                add_triple(cmd, "S08", 3, (float)12345.12, null);
                add_triple(cmd, "S09", 3, 123456.12, null);
                add_triple(cmd, "S10", 3, new DateTime(2001, 02, 23, 13, 44, 51, 234), null);
                add_triple(cmd, "S11", 3, new DateTime(2001, 02, 24), null);
                add_triple(cmd, "S12", 3, new TimeSpan(19, 41, 23), null);
 

                add_triple(cmd, "S13", 4, "GpM7", "http://www.w3.org/2001/XMLSchema#base64Binary");
                add_triple(cmd, "S14", 4, "0FB7", "http://www.w3.org/2001/XMLSchema#hexBinary");
                byte[] bin_val = { 0x01, 0x02, 0x03, 0x04, 0x05 };
                add_triple(cmd, "S15", 3, bin_val, null);

            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
            finally
            {

                if (c.State == ConnectionState.Open)
                    c.Close();

            }

        }


        static void add_triple(IDbCommand cmd, string sub, int ptype, object val, string val_add)
        {
                cmd.Parameters.Clear();

                IDbDataParameter param = cmd.CreateParameter();
                param.ParameterName = "p1";
                param.DbType = DbType.AnsiString;
                param.Value = sub;
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p2";
                param.DbType = DbType.Int32;
                param.Value = ptype;
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p3";
                if (val != null && val.GetType() == typeof (System.String))
                    param.DbType = DbType.AnsiString;
                param.Value = val;
                cmd.Parameters.Add(param);

                param = cmd.CreateParameter();
                param.ParameterName = "p4";
                param.DbType = DbType.AnsiString;
                param.Value = val_add;
                cmd.Parameters.Add(param);

                cmd.ExecuteNonQuery();
        }



    }
}	
See Also:

RDF Insert Methods in Virtuoso


1.5.27. How does default describe mode work?

The default describe mode works only if subject has a type/class. To get any anonymous subject described CBD mode should be used:

 
$ curl -i -L -H "Accept: application/rdf+xml" http://lod.openlinksw.com/describe/?url=http%3A%2F%2Fwww.mpii.de%2Fyago%2Fresource%2FEddie%255FMurphy
HTTP/1.1 303 See Other
Date: Mon, 21 Mar 2011 14:24:36 GMT
Server: Virtuoso/06.02.3129 (Linux) x86_64-generic-linux-glibc25-64  VDB
Content-Type: text/html; charset=UTF-8
Accept-Ranges: bytes
TCN: choice
Vary: negotiate,accept,Accept-Encoding
Location: http://lod.openlinksw.com/sparql?query=%20DESCRIBE%20%3Chttp%3A%2F%2Fwww.mpii.de%2Fyago%2Fresource%2FEddie%255FMurphy%3E&format=application%
2Frdf%2Bxml
Content-Length: 0

HTTP/1.1 200 OK
Date: Mon, 21 Mar 2011 14:24:37 GMT
Server: Virtuoso/06.02.3129 (Linux) x86_64-generic-linux-glibc25-64  VDB
Accept-Ranges: bytes
Content-Type: application/rdf+xml; charset=UTF-8
Content-Length: 467967

<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<rdf:Description rdf:about="http://www.mpii.de/yago/resource/MTV%5FMovie%5FAward%5Ffor%5FBest%5FComedic%5FPerformance"><n0pred:hasInternalWikipediaLinkTo xmlns:n0pred="http://www.mpii.de/yago/resource/" rdf:resource="http://www.mpii.de/yago/resource/Eddie%5FMurphy"/></rdf:Description>
<rdf:Description rdf:about="http://www.mpii.de/yago/resource/#fact_23536547421"><rdf:subject rdf:resource="http://www.mpii.de/yago/resource/Eddie%5FMurphy"/></rdf:Description>
<rdf:Description rdf:about="http://www.mpii.de/yago/resource/#fact_23536896725"><rdf:object rdf:resource="http://www.mpii.de/yago/resource/Eddie%5FMurphy"/></rdf:Description>
...

1.5.28. What should I do if the Virtuoso Server is not responding to HTTP requests?

Assume the Virtuoso server is not responding to HTTP requests although SQL connection is working. In order to determine what activity is being performed that might account for this:

  1. Check the status:
     
    SQL> status('');
    REPORT
    VARCHAR
    _______________________________________________________________________________
    
    
    OpenLink Virtuoso VDB Server
    Version 06.02.3129-pthreads for Linux as of Mar 16 2011 
    Registered to Uriburner (Personal Edition, unlimited connections)
    Started on: 2011/03/17 10:49 GMT+60
     
    Database Status:
      File size 0, 37598208 pages, 7313125 free.
      1000000 buffers, 993399 used, 76771 dirty 0 wired down, repl age 25548714 0 w. io 0 w/crsr.
      Disk Usage: 2642884 reads avg 4 msec, 30% r 0% w last  1389 s, 1557572 writes,
        15331 read ahead, batch = 79.  Autocompact 308508 in 219226 out, 28% saved.
    Gate:  71130 2nd in reads, 0 gate write waits, 0 in while read 0 busy scrap. 
    Log = virtuoso.trx, 14922248 bytes
    VDB: 0 exec 0 fetch 0 transact 0 error
    1757362 pages have been changed since last backup (in checkpoint state)
    Current backup timestamp: 0x0000-0x00-0x00
    Last backup date: unknown
    Clients: 5 connects, max 2 concurrent
    RPC: 116 calls, -1 pending, 1 max until now, 0 queued, 2 burst reads (1%), 0 second brk=9521074176
    Checkpoint Remap 331113 pages, 0 mapped back. 1180 s atomic time.
        DB master 37598208 total 7313125 free 331113 remap 40593 mapped back
       temp  569856 total 569851 free
     
    Lock Status: 52 deadlocks of which 0 2r1w, 86078 waits,
       Currently 1 threads running 0 threads waiting 0 threads in vdb.
    Pending:
    
    
    25 Rows. -- 1274 msec.
    SQL> 
    	
    
  2. Connect with the PL debugger and see what is running currently using the info threads call:
     
    $ isql 1111 dba <password> -D
    DEBUG> info threads	
    
  3. This should return the current code being executed by the Sever.
  4. Run txn_killall() to kill any pending transactions which may enable the server to start responding to HTTP requests again:
     
    
    SQL> txn_killall();
    
    Done. -- 866 msec.	
    

1.5.29. How can I replicate all graphs?

To replicate all graphs ( except the system graph http://www.openlinksw.com/schemas/virtrdf# ), one should use http://www.openlinksw.com/schemas/virtrdf#rdf_repl_all as graph IRI:

 
SQL> DB.DBA.RDF_RDF_REPL_GRAPH_INS ('http://www.openlinksw.com/schemas/virtrdf#rdf_repl_all');