Class SpinWrappedDataset
Provides SPIN capabilities for a Dataset over any SPIN-unaware IUpdateableStorage (including the InMemoryManager). TODO decide how to handle the default unnamed graph case TODO design a concurrency management policy
Inheritance
Inherited Members
Namespace: VDS.RDF.Query.Spin
Assembly: dotNetRdf.Query.Spin.dll
Syntax
public class SpinWrappedDataset : ISparqlDataset, ITripleIndex
Constructors
| Improve this Doc View SourceSpinWrappedDataset(Uri, IUpdateableStorage, IEnumerable<Uri>)
Inititalize a SPIN model upon a storage engine using a RDF SparqlDataset definition composed of the specified graphs.
Declaration
public SpinWrappedDataset(Uri datasetUri, IUpdateableStorage storage, IEnumerable<Uri> graphUris)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | datasetUri | |
| IUpdateableStorage | storage | |
| System.Collections.Generic.IEnumerable<T><System.Uri> | graphUris |
SpinWrappedDataset(Uri, IUpdateableStorage)
Inititalize a SpinWrapperDataset upon a storage engine using a RDF SparqlDataset definition.
Declaration
public SpinWrappedDataset(Uri datasetUri, IUpdateableStorage storage)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | datasetUri | |
| IUpdateableStorage | storage |
Fields
| Improve this Doc View SourceCommandCalls
The SPARQL update command calls made by this wrapper
Declaration
public List<string> CommandCalls
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<T><string> |
Properties
| Improve this Doc View SourceActiveGraphNames
Gets the enumeration of the names of the graphs that currently make up the active graph.
Declaration
public IEnumerable<IRefNode> ActiveGraphNames { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><IRefNode> |
ActiveGraphUris
Gets the enumeration of the Graph URIs that currently make up the active graph.
Declaration
public IEnumerable<Uri> ActiveGraphUris { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><System.Uri> |
DefaultGraphNames
Gets the enumeration of the names of the graphs that currently make up the default graph.
Declaration
public IEnumerable<IRefNode> DefaultGraphNames { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><IRefNode> |
DefaultGraphUris
Gets the enumeration of the Graph URIs that currently make up the default graph.
Declaration
public IEnumerable<Uri> DefaultGraphUris { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><System.Uri> |
GraphNames
Gets an enumeration of the names of all graphs in the dataset.
Declaration
public IEnumerable<IRefNode> GraphNames { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><IRefNode> |
Graphs
Gets all the Graphs in the Dataset.
Declaration
public IEnumerable<IGraph> Graphs { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><IGraph> |
GraphUris
Gets all the URIs of Graphs in the Dataset.
Declaration
public IEnumerable<Uri> GraphUris { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><System.Uri> |
HasTriples
Gets whether the Dataset has any Triples.
Declaration
public bool HasTriples { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
this[Uri]
Gets the Graph with the given URI from the Dataset.
Declaration
public IGraph this[Uri graphUri] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | graphUri | Graph URI. |
Property Value
| Type | Description |
|---|---|
| IGraph |
Remarks
This property need only return a read-only view of the Graph, code which wishes to modify Graphs should use the GetModifiableGraph() method to guarantee a Graph they can modify and will be persisted to the underlying storage.
this[IRefNode]
Gets the graph with the given name from the dataset.
Declaration
public IGraph this[IRefNode graphName] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName | Graph name. |
Property Value
| Type | Description |
|---|---|
| IGraph |
Remarks
This property need only return a read-only view of the Graph, code which wishes to modify Graphs should use the GetModifiableGraph() method to guarantee a Graph they can modify and will be persisted to the underlying storage.
Namespaces
Gets the Dataset namespace prefixes map if supported.
Declaration
public INamespaceMapper Namespaces { get; }
Property Value
| Type | Description |
|---|---|
| INamespaceMapper |
QuotedTriples
Gets all the quoted triples in teh dataset.
Declaration
public IEnumerable<Triple> QuotedTriples { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
Remarks
Note: The Triples returned from the method should be limited to those in the current Active Graph if present, otherwise those in the current Default Graph if present and finally the entire Dataset.
SourceUri
Returns the original dataset Uri
Declaration
public Uri SourceUri { get; }
Property Value
| Type | Description |
|---|---|
| System.Uri |
Triples
Gets all the Triples in the Dataset.
Declaration
public IEnumerable<Triple> Triples { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
Remarks
Note: The Triples returned from the method should be limited to those in the current Active Graph if present, otherwise those in the current Default Graph if present and finally the entire Dataset.
UpdatesMonitor
Gets/sets a graph to monitor global changes to the dataset. Responsibility for the management of this graph is left to the caller. Changes will be notified only at the end of the update process to avoid inducing too much I/O with each partial result.
Declaration
public IGraph UpdatesMonitor { get; set; }
Property Value
| Type | Description |
|---|---|
| IGraph |
Uri
Returns the current dataset Uri. If the dataset has been updated use SourceUri to get the orignal dataset Uri
Declaration
public Uri Uri { get; }
Property Value
| Type | Description |
|---|---|
| System.Uri |
UsesUnionDefaultGraph
Gets whether the Default Graph is treated as being the union of all Graphs in the dataset when no Default Graph is otherwise set.
Declaration
public bool UsesUnionDefaultGraph { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
| Improve this Doc View SourceAddGraph(IGraph)
Adds a graph in the dataset and submits it to SPIN processing. If the graph already exists in the dataset, this will lead its replacement by the new graph.
Declaration
public bool AddGraph(IGraph g)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g |
Returns
| Type | Description |
|---|---|
| System.Boolean |
ContainsQuotedTriple(Triple)
Gets whether the dataset contains a specific quoted triple.
Declaration
public bool ContainsQuotedTriple(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | Triple. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the dataset contains |
ContainsTriple(Triple)
Gets whether the Dataset contains a specific Triple.
Declaration
public bool ContainsTriple(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | Triple. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Discard()
Ensures that any changes to the Dataset (if any) are discarded.
Declaration
public void Discard()
Remarks
Primarily intended for use in implementations which support transactions though other implementations may wish to use this to ensure that changes to the dataset are persisted properly.
ExecuteQuery(string)
Executes a SPARQL query on the dataset
Declaration
public object ExecuteQuery(string sparqlQuery)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sparqlQuery |
Returns
| Type | Description |
|---|---|
| System.Object |
ExecuteUpdate()
Executes any pending SPARQL Update command from changes made to the dataset trough the API
Declaration
public void ExecuteUpdate()
ExecuteUpdate(string)
Executes the SPARQL Update command on the dataset
Declaration
public void ExecuteUpdate(string sparqlUpdateCommandSet)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sparqlUpdateCommandSet |
Flush()
Flushes changes to the dataset TODO handle dataset changes as updates instread of overwriting it to make it workable in a concurrent environment.
Declaration
public void Flush()
GetModifiableGraph(Uri)
Declaration
public IGraph GetModifiableGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | graphUri |
Returns
| Type | Description |
|---|---|
| IGraph |
GetModifiableGraph(IRefNode)
Gets the Graph with the given name from the Dataset.
Declaration
public IGraph GetModifiableGraph(IRefNode graphName)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName | Graph name. |
Returns
| Type | Description |
|---|---|
| IGraph |
Remarks
Graphs returned from this method must be modifiable and the Dataset must guarantee that when it is Flushed or Disposed of that any changes to the Graph are persisted.
Exceptions
| Type | Condition |
|---|---|
| System.NotSupportedException | May be thrown if the Dataset is immutable i.e. Updates not supported. |
GetQuoted(Uri)
Selects all quoted triples which have a Uri Node with the given Uri.
Declaration
public IEnumerable<Triple> GetQuoted(Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | uri | Uri. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuoted(INode)
Selects all quoted triples which contain the given Node.
Declaration
public IEnumerable<Triple> GetQuoted(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuotedWithObject(Uri)
Selects all quoted triples where the Object is a Uri Node with the given Uri.
Declaration
public IEnumerable<Triple> GetQuotedWithObject(Uri u)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | u | Uri. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuotedWithObject(INode)
Selects all quoted triples where the Object is a given Node.
Declaration
public IEnumerable<Triple> GetQuotedWithObject(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuotedWithPredicate(Uri)
Selects all quoted triples where the Predicate is a Uri Node with the given Uri.
Declaration
public IEnumerable<Triple> GetQuotedWithPredicate(Uri u)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | u | Uri. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuotedWithPredicate(INode)
Selects all quoted triples where the Predicate is a given Node.
Declaration
public IEnumerable<Triple> GetQuotedWithPredicate(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuotedWithPredicateObject(INode, INode)
Selects all quoted triples with the given Predicate and Object.
Declaration
public IEnumerable<Triple> GetQuotedWithPredicateObject(INode pred, INode obj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | pred | Predicate. |
| INode | obj | Object. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuotedWithSubject(Uri)
Selects all quoted triples where the Subject is a Uri Node with the given Uri.
Declaration
public IEnumerable<Triple> GetQuotedWithSubject(Uri u)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | u | Uri. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuotedWithSubject(INode)
Selects all quoted triples where the Subject is a given Node.
Declaration
public IEnumerable<Triple> GetQuotedWithSubject(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuotedWithSubjectObject(INode, INode)
Selects all quoted triples with the given Subject and Object.
Declaration
public IEnumerable<Triple> GetQuotedWithSubjectObject(INode subj, INode obj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | subj | Subject. |
| INode | obj | Object. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetQuotedWithSubjectPredicate(INode, INode)
Selects all quoted triples with the given Subject and Predicate.
Declaration
public IEnumerable<Triple> GetQuotedWithSubjectPredicate(INode subj, INode pred)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | subj | Subject. |
| INode | pred | Predicate. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriples(Uri)
Selects all Triples which have a Uri Node with the given Uri.
Declaration
public IEnumerable<Triple> GetTriples(Uri uti)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | uti |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriples(INode)
Selects all Triples which contain the given Node.
Declaration
public IEnumerable<Triple> GetTriples(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriplesWithObject(Uri)
Selects all Triples where the Object is a Uri Node with the given Uri.
Declaration
public IEnumerable<Triple> GetTriplesWithObject(Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | uri |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriplesWithObject(INode)
Selects all Triples where the Object is a given Node.
Declaration
public IEnumerable<Triple> GetTriplesWithObject(INode obj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | obj |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriplesWithPredicate(Uri)
Selects all Triples where the Predicate is a Uri Node with the given Uri.
Declaration
public IEnumerable<Triple> GetTriplesWithPredicate(Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | uri |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriplesWithPredicate(INode)
Selects all Triples where the Predicate is a given Node.
Declaration
public IEnumerable<Triple> GetTriplesWithPredicate(INode pred)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | pred |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriplesWithPredicateObject(INode, INode)
Selects all Triples with the given Predicate and Object.
Declaration
public IEnumerable<Triple> GetTriplesWithPredicateObject(INode pred, INode obj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | pred | Predicate. |
| INode | obj | Object. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriplesWithSubject(Uri)
Selects all Triples where the Subject is a Uri Node with the given Uri.
Declaration
public IEnumerable<Triple> GetTriplesWithSubject(Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | uri |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriplesWithSubject(INode)
Selects all Triples where the Subject is a given Node.
Declaration
public IEnumerable<Triple> GetTriplesWithSubject(INode subj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | subj |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriplesWithSubjectObject(INode, INode)
Selects all Triples with the given Subject and Object.
Declaration
public IEnumerable<Triple> GetTriplesWithSubjectObject(INode subj, INode obj)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | subj | Subject. |
| INode | obj | Object. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
GetTriplesWithSubjectPredicate(INode, INode)
Selects all Triples with the given Subject and Predicate.
Declaration
public IEnumerable<Triple> GetTriplesWithSubjectPredicate(INode subj, INode pred)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | subj | Subject. |
| INode | pred | Predicate. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Triple> |
HasGraph(Uri)
Gets whether a Graph with the given URI is the Dataset
Declaration
public bool HasGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | graphUri |
Returns
| Type | Description |
|---|---|
| System.Boolean |
HasGraph(IRefNode)
Gets whether a Graph with the given name is the Dataset.
Declaration
public bool HasGraph(IRefNode graphName)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName | Graph name. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
ImportGraph(Uri)
Declaration
public void ImportGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | graphUri |
ImportGraph(IGraph)
Imports a graph into the dataset and registers it as a SPIN.LibraryOntology for further SPIN processing.
Declaration
public void ImportGraph(IGraph graph)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | graph |
OnDatasetDescriptionChanged(object, GraphEventArgs)
Event handler to monitor the current Dataset
Declaration
protected void OnDatasetDescriptionChanged(object sender, GraphEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | |
| GraphEventArgs | args |
RemoveGraph(Uri)
Removes a graph from the Dataset. The underlying graph and it's entailments are not deleted from the store, however all pending changes on the graph are cancelled
Declaration
public bool RemoveGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | graphUri |
Returns
| Type | Description |
|---|---|
| System.Boolean |
RemoveGraph(IRefNode)
Removes a Graph from the Dataset.
Declaration
public bool RemoveGraph(IRefNode graphName)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName | Graph name. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Exceptions
| Type | Condition |
|---|---|
| System.NotSupportedException | May be thrown if the Dataset is immutable i.e. Updates not supported. |
ResetActiveGraph()
Resets the Active Graph to the previous Active Graph.
Declaration
public void ResetActiveGraph()
ResetDefaultGraph()
Resets the Default Graph to the previous Default Graph.
Declaration
public void ResetDefaultGraph()
SetActiveGraph(IEnumerable<Uri>)
Sets the Active Graph to be the merge of the Graphs with the given URIs.
Declaration
public void SetActiveGraph(IEnumerable<Uri> graphUris)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<T><System.Uri> | graphUris | Graph URIs. |
SetActiveGraph(IList<IRefNode>)
Sets the active graph to be the union of the graphs with the given names.
Declaration
public void SetActiveGraph(IList<IRefNode> graphNames)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IList<T><IRefNode> | graphNames |
SetActiveGraph(Uri)
Sets the Active Graph to be the Graph with the given URI.
Declaration
public void SetActiveGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | graphUri | Graph URI. |
SetActiveGraph(IRefNode)
Sets the active graph to be the graph with the given name.
Declaration
public void SetActiveGraph(IRefNode graphName)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName | Graph name. |
SetDefaultGraph(IEnumerable<Uri>)
Sets the Default Graph to be the merge of the Graphs with the given URIs.
Declaration
public void SetDefaultGraph(IEnumerable<Uri> graphUris)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<T><System.Uri> | graphUris | Graph URIs. |
SetDefaultGraph(IList<IRefNode>)
Sets the default graph to be the union of the graphs with the given names.
Declaration
public void SetDefaultGraph(IList<IRefNode> graphNames)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IList<T><IRefNode> | graphNames | Graph names. |
SetDefaultGraph(Uri)
Sets the Default Graph to be the Graph with the given URI.
Declaration
public void SetDefaultGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Uri | graphUri | Graph URI. |
SetDefaultGraph(IRefNode)
Sets the default graph to be the graph with the given name.
Declaration
public void SetDefaultGraph(IRefNode graphName)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName |