Show / Hide Table of Contents

Class VirtuosoManager

A Manager for accessing the Native Virtuoso Quad Store.
Inheritance
System.Object
BaseAsyncSafeConnector
VirtuosoManager
Implements
IAsyncStorageProvider
IUpdateableStorage
IQueryableStorage
IStorageProvider
IStorageCapabilities
System.IDisposable
IConfigurationSerializable
Inherited Members
BaseAsyncSafeConnector.ParentServer
BaseAsyncSafeConnector.AsyncParentServer
BaseAsyncSafeConnector.LoadGraph(IGraph, Uri)
BaseAsyncSafeConnector.LoadGraph(IGraph, String)
BaseAsyncSafeConnector.LoadGraph(IRdfHandler, Uri)
BaseAsyncSafeConnector.LoadGraph(IRdfHandler, String)
BaseAsyncSafeConnector.UpdateGraph(Uri, IEnumerable<Triple>, IEnumerable<Triple>)
BaseAsyncSafeConnector.UpdateGraph(String, IEnumerable<Triple>, IEnumerable<Triple>)
BaseAsyncSafeConnector.DeleteGraph(Uri)
BaseAsyncSafeConnector.DeleteGraph(String)
BaseAsyncSafeConnector.LoadGraph(IGraph, Uri, AsyncStorageCallback, Object)
BaseAsyncSafeConnector.LoadGraph(IGraph, String, AsyncStorageCallback, Object)
BaseAsyncSafeConnector.LoadGraph(IRdfHandler, Uri, AsyncStorageCallback, Object)
BaseAsyncSafeConnector.LoadGraph(IRdfHandler, String, AsyncStorageCallback, Object)
BaseAsyncSafeConnector.SaveGraph(IGraph, AsyncStorageCallback, Object)
BaseAsyncSafeConnector.UpdateGraph(Uri, IEnumerable<Triple>, IEnumerable<Triple>, AsyncStorageCallback, Object)
BaseAsyncSafeConnector.UpdateGraph(String, IEnumerable<Triple>, IEnumerable<Triple>, AsyncStorageCallback, Object)
BaseAsyncSafeConnector.DeleteGraph(Uri, AsyncStorageCallback, Object)
BaseAsyncSafeConnector.DeleteGraph(String, AsyncStorageCallback, Object)
BaseAsyncSafeConnector.ListGraphs(AsyncStorageCallback, Object)
Namespace: VDS.RDF.Storage
Assembly: dotNetRDF.Data.Virtuoso.dll
Syntax
public class VirtuosoManager : BaseAsyncSafeConnector, IAsyncStorageProvider, IUpdateableStorage, IQueryableStorage, IStorageProvider, IStorageCapabilities, IConfigurationSerializable
Remarks

This class implements IStorageProvider allowing it to be used with any of the general classes that support this interface as well as the Virtuoso specific classes.

Although this class takes a Database Name to ensure compatability with any Virtuoso installation (i.e. this allows for the Native Quad Store to be in a non-standard database) generally you should always specify DB as the Database Name parameter.

Virtuoso automatically assigns IDs to Blank Nodes input into it, these IDs are not based on the actual Blank Node ID so inputting a Blank Node with the same ID multiple times will result in multiple Nodes being created in Virtuoso. This means that data containing Blank Nodes which is stored to Virtuoso and then retrieved will have different Blank Node IDs to those input. In addition there is no guarentee that when you save a Graph containing Blank Nodes into Virtuoso that retrieving it will give the same Blank Node IDs even if the Graph being saved was originally retrieved from Virtuoso. Finally please see the remarks on the UpdateGraph(Uri, IEnumerable<Triple>, IEnumerable<Triple>) method which deal with how insertion and deletion of triples containing blank nodes into existing graphs operates.

You can use a null Uri or an empty String as a Uri to indicate that operations should affect the Default Graph. Where the argument is only a Graph a null BaseUri property indicates that the Graph affects the Default Graph.

Constructors

| Improve this Doc View Source

VirtuosoManager(String)

Creates a Manager for a Virtuoso Native Quad Store.
Declaration
public VirtuosoManager(String connectionString)
Parameters
Type Name Description
String connectionString Connection String.
Remarks
Allows the end user to specify a customised connection string.
| Improve this Doc View Source

VirtuosoManager(String, String, String)

Creates a Manager for a Virtuoso Native Quad Store.
Declaration
public VirtuosoManager(String db, String user, String password)
Parameters
Type Name Description
String db Database Name.
String user Username.
String password Password.
Remarks
Assumes the Server is on the localhost and the port is the default installation port of 1111.
| Improve this Doc View Source

VirtuosoManager(String, String, String, Int32)

Creates a Manager for a Virtuoso Native Quad Store.
Declaration
public VirtuosoManager(String db, String user, String password, int timeout)
Parameters
Type Name Description
String db Database Name.
String user Username.
String password Password.
System.Int32 timeout Connection Timeout in Seconds.
Remarks
Assumes the Server is on the localhost and the port is the default installation port of 1111.
| Improve this Doc View Source

VirtuosoManager(String, Int32, String, String, String)

Creates a Manager for a Virtuoso Native Quad Store.
Declaration
public VirtuosoManager(String server, int port, String db, String user, String password)
Parameters
Type Name Description
String server Server.
System.Int32 port Port.
String db Database Name.
String user Username.
String password Password.
| Improve this Doc View Source

VirtuosoManager(String, Int32, String, String, String, Int32)

Creates a Manager for a Virtuoso Native Quad Store.
Declaration
public VirtuosoManager(String server, int port, String db, String user, String password, int timeout)
Parameters
Type Name Description
String server Server.
System.Int32 port Port.
String db Database Name.
String user Username.
String password Password.
System.Int32 timeout Connection Timeout in Seconds.
Remarks
Timeouts less than equal to zero are ignored and treated as using the default timeout which is dictated by the underlying Virtuoso ADO.Net provider.

Fields

| Improve this Doc View Source

DefaultDB

Default Database for Virtuoso Server Quad Store.
Declaration
public const String DefaultDB = null
Field Value
Type Description
String
| Improve this Doc View Source

DefaultPort

Default Port for Virtuoso Servers.
Declaration
public const int DefaultPort = null
Field Value
Type Description
System.Int32

Properties

| Improve this Doc View Source

DeleteSupported

Returns that deleting Graphs is supported.
Declaration
public override bool DeleteSupported { get; }
Property Value
Type Description
System.Boolean
Overrides
BaseAsyncSafeConnector.DeleteSupported
| Improve this Doc View Source

HasActiveTransaction

Gets whether there is any active transaction on the Virtuoso database.
Declaration
public bool HasActiveTransaction { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

HasOpenConnection

Gets whether there is an active connection to the Virtuoso database.
Declaration
public bool HasOpenConnection { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IOBehaviour

Gets the IO Behaviour of the store.
Declaration
public override IOBehaviour IOBehaviour { get; }
Property Value
Type Description
IOBehaviour
Overrides
BaseAsyncSafeConnector.IOBehaviour
| Improve this Doc View Source

IsReadOnly

Returns that the Manager is not read-only.
Declaration
public override bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean
Overrides
BaseAsyncSafeConnector.IsReadOnly
| Improve this Doc View Source

IsReady

Returns that the Manager is ready.
Declaration
public override bool IsReady { get; }
Property Value
Type Description
System.Boolean
Overrides
BaseAsyncSafeConnector.IsReady
| Improve this Doc View Source

ListGraphsSupported

Returns that listing graphs is supported.
Declaration
public override bool ListGraphsSupported { get; }
Property Value
Type Description
System.Boolean
Overrides
BaseAsyncSafeConnector.ListGraphsSupported
| Improve this Doc View Source

UpdateSupported

Indicates that Updates are supported by the Virtuoso Native Quad Store.
Declaration
public override bool UpdateSupported { get; }
Property Value
Type Description
System.Boolean
Overrides
BaseAsyncSafeConnector.UpdateSupported

Methods

| Improve this Doc View Source

DeleteGraph(String)

Deletes a Graph from the store.
Declaration
public override void DeleteGraph(String graphUri)
Parameters
Type Name Description
String graphUri URI of the Graph to delete.
| Improve this Doc View Source

DeleteGraph(Uri)

Deletes a Graph from the Virtuoso store.
Declaration
public override void DeleteGraph(Uri graphUri)
Parameters
Type Name Description
Uri graphUri URI of the Graph to delete.
| Improve this Doc View Source

Dispose()

Disposes of the Manager.
Declaration
public override void Dispose()
Overrides
BaseAsyncSafeConnector.Dispose()
| Improve this Doc View Source

ListGraphs()

Lists the Graphs in the store.
Declaration
public override IEnumerable<Uri> ListGraphs()
Returns
Type Description
IEnumerable<Uri>
Overrides
BaseAsyncSafeConnector.ListGraphs()
| Improve this Doc View Source

LoadGraph(IGraph, String)

Loads a Graph from the Quad Store.
Declaration
public override void LoadGraph(IGraph g, String graphUri)
Parameters
Type Name Description
IGraph g Graph to load into.
String graphUri URI of the Graph to Load.
| Improve this Doc View Source

LoadGraph(IGraph, Uri)

Loads a Graph from the Quad Store.
Declaration
public override void LoadGraph(IGraph g, Uri graphUri)
Parameters
Type Name Description
IGraph g Graph to load into.
Uri graphUri URI of the Graph to Load.
| Improve this Doc View Source

LoadGraph(IRdfHandler, String)

Loads a Graph from the Quad Store.
Declaration
public override void LoadGraph(IRdfHandler handler, String graphUri)
Parameters
Type Name Description
IRdfHandler handler RDF Handler.
String graphUri URI of the Graph to Load.
| Improve this Doc View Source

LoadGraph(IRdfHandler, Uri)

Loads a Graph from the Quad Store.
Declaration
public override void LoadGraph(IRdfHandler handler, Uri graphUri)
Parameters
Type Name Description
IRdfHandler handler RDF Handler.
Uri graphUri URI of the Graph to Load.
| Improve this Doc View Source

Query(String)

Executes a SPARQL Query on the native Quad Store.
Declaration
public Object Query(String sparqlQuery)
Parameters
Type Name Description
String sparqlQuery SPARQL Query to execute.
Returns
Type Description
Object
Remarks

This method will first attempt to parse the query into a SparqlQuery object. If this succeeds then the Query Type can be used to determine how to handle the response.

If the parsing fails then the query will be executed anyway using Virtuoso's SPASQL (SPARQL + SQL) syntax. Parsing can fail because Virtuoso supports various SPARQL extensions which the library does not support. These include things like aggregate functions but also SPARUL updates (the non-standard precusor to SPARQL 1.1 Update).

If you use an aggregate query which has an Integer, Decimal or Double type result then you will receive a SparqlResultSet containing a single SparqlResult which has contains a binding for a variable named Result which contains a LiteralNode typed to the appropriate datatype.

Exceptions
Type Condition
RdfQueryException Thrown if an error occurs in making the query.
| Improve this Doc View Source

Query(IRdfHandler, ISparqlResultsHandler, String)

Executes a SPARQL Query on the native Quad Store processing the results with an appropriate handler from those provided.
Declaration
public void Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, String sparqlQuery)
Parameters
Type Name Description
IRdfHandler rdfHandler RDF Handler.
ISparqlResultsHandler resultsHandler Results Handler.
String sparqlQuery SPARQL Query to execute.
Remarks

This method will first attempt to parse the query into a SparqlQuery object. If this succeeds then the Query Type can be used to determine how to handle the response.

If the parsing fails then the query will be executed anyway using Virtuoso's SPASQL (SPARQL + SQL) syntax. Parsing can fail because Virtuoso supports various SPARQL non-standardised extensions which the library does not support. These include things like aggregate functions but also SPARUL updates (the non-standard precusor to SPARQL 1.1 Update).

If you use an aggregate query which has an Integer, Decimal or Double type result then you will receive a SparqlResultSet containing a single SparqlResult which has contains a binding for a variable named Result which contains a LiteralNode typed to the appropriate datatype.

Exceptions
Type Condition
RdfQueryException Thrown if an error occurs in making the query.
| Improve this Doc View Source

SaveGraph(IGraph)

Saves a Graph into the Quad Store (Warning: Completely replaces any existing Graph with the same URI).
Declaration
public override void SaveGraph(IGraph g)
Parameters
Type Name Description
IGraph g Graph to save.
Overrides
BaseAsyncSafeConnector.SaveGraph(IGraph)
Remarks
Completely replaces any previously saved Graph with the same Graph URI.
| Improve this Doc View Source

SerializeConfiguration(ConfigurationSerializationContext)

Serializes the connection's configuration.
Declaration
public void SerializeConfiguration(ConfigurationSerializationContext context)
Parameters
Type Name Description
ConfigurationSerializationContext context Configuration Serialization Context.
| Improve this Doc View Source

ToString()

Gets a String which gives details of the Connection.
Declaration
public override string ToString()
Returns
Type Description
System.String
| Improve this Doc View Source

Update(String)

Executes a SPARQL Update on the native Quad Store.
Declaration
public void Update(String sparqlUpdate)
Parameters
Type Name Description
String sparqlUpdate SPARQL Update to execute.
Remarks

This method will first attempt to parse the update into a SparqlUpdateCommandSet object. If this succeeds then each command in the command set will be issued to Virtuoso.

If the parsing fails then the update will be executed anyway using Virtuoso's SPASQL (SPARQL + SQL) syntax. Parsing can fail because Virtuoso supports various SPARQL extensions which the library does not support and primarily supports SPARUL updates (the precusor to SPARQL 1.1 Update).

Exceptions
Type Condition
SparqlUpdateException Thrown if an error occurs in making the update.
| Improve this Doc View Source

UpdateGraph(String, IEnumerable<Triple>, IEnumerable<Triple>)

Updates a Graph in the Quad Store.
Declaration
public override void UpdateGraph(String graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals)
Parameters
Type Name Description
String graphUri Graph Uri of the Graph to update.
IEnumerable<Triple> additions Triples to be added.
IEnumerable<Triple> removals Triples to be removed.
| Improve this Doc View Source

UpdateGraph(Uri, IEnumerable<Triple>, IEnumerable<Triple>)

Updates a Graph in the Quad Store.
Declaration
public override void UpdateGraph(Uri graphUri, IEnumerable<Triple> additions, IEnumerable<Triple> removals)
Parameters
Type Name Description
Uri graphUri Graph Uri of the Graph to update.
IEnumerable<Triple> additions Triples to be added.
IEnumerable<Triple> removals Triples to be removed.
Remarks

In the case of inserts where blank nodes are present the data will be inserted but new blank nodes will be created. You cannot insert data that refers to existing blank nodes via this method, consider using a INSERT WHERE style SPARQL Update instead.

Note that Blank Nodes cannot always be deleted successfully, if you have retrieved the triples you are now trying to delete from Virtuoso and they contain blank nodes then this will likely work as expected. Otherwise deletetions of Blank Nodes cannot be guaranteed.

If the Graph being modified is relatively small it may be safer to load the graph into memory, makes the modifications there and then persist the graph back to the store (which overwrites the previous version of the graph).

Implements

IAsyncStorageProvider
IUpdateableStorage
IQueryableStorage
IStorageProvider
IStorageCapabilities
System.IDisposable
IConfigurationSerializable

Extension Methods

Extensions.AsEnumerable<T>(T)
  • Improve this Doc
  • View Source
In This Article
  • Constructors
    • VirtuosoManager(String)
    • VirtuosoManager(String, String, String)
    • VirtuosoManager(String, String, String, Int32)
    • VirtuosoManager(String, Int32, String, String, String)
    • VirtuosoManager(String, Int32, String, String, String, Int32)
  • Fields
    • DefaultDB
    • DefaultPort
  • Properties
    • DeleteSupported
    • HasActiveTransaction
    • HasOpenConnection
    • IOBehaviour
    • IsReadOnly
    • IsReady
    • ListGraphsSupported
    • UpdateSupported
  • Methods
    • DeleteGraph(String)
    • DeleteGraph(Uri)
    • Dispose()
    • ListGraphs()
    • LoadGraph(IGraph, String)
    • LoadGraph(IGraph, Uri)
    • LoadGraph(IRdfHandler, String)
    • LoadGraph(IRdfHandler, Uri)
    • Query(String)
    • Query(IRdfHandler, ISparqlResultsHandler, String)
    • SaveGraph(IGraph)
    • SerializeConfiguration(ConfigurationSerializationContext)
    • ToString()
    • Update(String)
    • UpdateGraph(String, IEnumerable<Triple>, IEnumerable<Triple>)
    • UpdateGraph(Uri, IEnumerable<Triple>, IEnumerable<Triple>)
  • Implements
  • Extension Methods
Back to top Generated by DocFX