Interface ISparqlDataset
Interfaces for Datasets that SPARQL Queries and Updates can be applied to.
Inherited Members
Namespace: VDS.RDF.Query.Datasets
Assembly: dotNetRdf.dll
Syntax
public interface ISparqlDataset : ITripleIndex
Remarks
Note: For all operations that take a Graph URI a null Uri should be considered to refer to the Default Graph of the dataset.
Default and Active Graph
Leviathan expects that a Query operates over the Dataset in the following order:
- If an Active Graph is set then Queries operate over that
- Otherwise if a Default Graph is set then Queries operate over that
- Finally the Queries operate over the all triples, the notion of all triples may be dataset implementation specific i.e. may be union of all graphs, the default unnamed graph only or something else entirely
You can limit your queries to use specific portions of your dataset by using the SetActiveGraph() and SetDefaultGraph() methods on your dataset instance before then passing it to the LeviathanQueryProcessor.
Note: By default the InMemoryDataset uses the Union of all Graphs in the Dataset if no Active/Default Graph is otherwise specified. Use the UsesUnionDefaultGraph property to see whether a Dataset implementation behaves in this way.
Properties
| Edit this page View SourceActiveGraphNames
Gets the enumeration of the names of the graphs that currently make up the active graph.
Declaration
IEnumerable<IRefNode> ActiveGraphNames { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<IRefNode> |
ActiveGraphUris
Gets the enumeration of the Graph URIs that currently make up the active graph.
Declaration
[Obsolete("Replaced by ActiveGraphNames. This implementation will NOT report graphs with blank node names.")]
IEnumerable<Uri> ActiveGraphUris { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<Uri> |
DefaultGraphNames
Gets the enumeration of the names of the graphs that currently make up the default graph.
Declaration
IEnumerable<IRefNode> DefaultGraphNames { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<IRefNode> |
DefaultGraphUris
Gets the enumeration of the Graph URIs that currently make up the default graph.
Declaration
[Obsolete("Replaced by DefaultGraphNames. This implementation will NOT report graphs with blank node names.")]
IEnumerable<Uri> DefaultGraphUris { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<Uri> |
GraphNames
Gets an enumeration of the names of all graphs in the dataset.
Declaration
IEnumerable<IRefNode> GraphNames { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<IRefNode> |
GraphUris
Gets all the URIs of Graphs in the Dataset.
Declaration
[Obsolete("Replaced by GraphNames. This property will not include graphs named with a blank node.")]
IEnumerable<Uri> GraphUris { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<Uri> |
Graphs
Gets all the Graphs in the Dataset.
Declaration
IEnumerable<IGraph> Graphs { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<IGraph> |
HasTriples
Gets whether the Dataset has any Triples.
Declaration
bool HasTriples { get; }
Property Value
| Type | Description |
|---|---|
| bool |
this[Uri]
Gets the Graph with the given URI from the Dataset.
Declaration
[Obsolete("Replaced by this[IRefNode]")]
IGraph this[Uri graphUri] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| 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
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.
QuotedTriples
Gets all the quoted triples in teh dataset.
Declaration
IEnumerable<Triple> QuotedTriples { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<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.
Triples
Gets all the Triples in the Dataset.
Declaration
IEnumerable<Triple> Triples { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<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.
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
bool UsesUnionDefaultGraph { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceAddGraph(IGraph)
Adds a Graph to the Dataset.
Declaration
bool AddGraph(IGraph g)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph. |
Returns
| Type | Description |
|---|---|
| bool |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | May be thrown if the Dataset is immutable i.e. Updates not supported. |
| NotSupportedException | May be thrown if the Dataset is immutable. |
ContainsQuotedTriple(Triple)
Gets whether the dataset contains a specific quoted triple.
Declaration
bool ContainsQuotedTriple(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | Triple. |
Returns
| Type | Description |
|---|---|
| bool | True if the dataset contains |
ContainsTriple(Triple)
Gets whether the Dataset contains a specific Triple.
Declaration
bool ContainsTriple(Triple t)
Parameters
| Type | Name | Description |
|---|---|---|
| Triple | t | Triple. |
Returns
| Type | Description |
|---|---|
| bool |
Discard()
Ensures that any changes to the Dataset (if any) are discarded.
Declaration
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.
Flush()
Ensures that any changes to the Dataset (if any) are flushed to the underlying Storage.
Declaration
void Flush()
Remarks
While partly 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.
GetModifiableGraph(Uri)
Gets the Graph with the given URI from the Dataset.
Declaration
[Obsolete("Replaced by GetModifiableGraph(IRefNode)")]
IGraph GetModifiableGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | graphUri | Graph URI. |
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 |
|---|---|
| NotSupportedException | May be thrown if the Dataset is immutable i.e. Updates not supported. |
| NotSupportedException | May be thrown if the Dataset is immutable. |
GetModifiableGraph(IRefNode)
Gets the Graph with the given name from the Dataset.
Declaration
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 |
|---|---|
| NotSupportedException | May be thrown if the Dataset is immutable i.e. Updates not supported. |
HasGraph(Uri)
Gets whether a Graph with the given URI is the Dataset.
Declaration
[Obsolete("Replaced by HasGraph(IRefNode)")]
bool HasGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | graphUri | Graph URI. |
Returns
| Type | Description |
|---|---|
| bool |
HasGraph(IRefNode)
Gets whether a Graph with the given name is the Dataset.
Declaration
bool HasGraph(IRefNode graphName)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName | Graph name. |
Returns
| Type | Description |
|---|---|
| bool |
RemoveGraph(Uri)
Removes a Graph from the Dataset.
Declaration
[Obsolete("Replaced by RemoveGraph(IRefNode)")]
bool RemoveGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | graphUri | Graph URI. |
Returns
| Type | Description |
|---|---|
| bool |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | May be thrown if the Dataset is immutable i.e. Updates not supported. |
| NotSupportedException | May be thrown if the Dataset is immutable. |
RemoveGraph(IRefNode)
Removes a Graph from the Dataset.
Declaration
bool RemoveGraph(IRefNode graphName)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName | Graph name. |
Returns
| Type | Description |
|---|---|
| bool |
Exceptions
| Type | Condition |
|---|---|
| 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
void ResetActiveGraph()
ResetDefaultGraph()
Resets the Default Graph to the previous Default Graph.
Declaration
void ResetDefaultGraph()
SetActiveGraph(IEnumerable<Uri>)
Sets the Active Graph to be the merge of the Graphs with the given URIs.
Declaration
[Obsolete("Replaced by SetActiveGraph(IList<IRefNode>)")]
void SetActiveGraph(IEnumerable<Uri> graphUris)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Uri> | graphUris | Graph URIs. |
SetActiveGraph(IList<IRefNode>)
Sets the active graph to be the union of the graphs with the given names.
Declaration
void SetActiveGraph(IList<IRefNode> graphNames)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<IRefNode> | graphNames |
SetActiveGraph(Uri)
Sets the Active Graph to be the Graph with the given URI.
Declaration
[Obsolete("Replaced by SetActiveGraph(IRefNode)")]
void SetActiveGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | graphUri | Graph URI. |
SetActiveGraph(IRefNode)
Sets the active graph to be the graph with the given name.
Declaration
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
[Obsolete("Replaced by SetDefaultGraph(IList<IRefNode>)")]
void SetDefaultGraph(IEnumerable<Uri> graphUris)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Uri> | graphUris | Graph URIs. |
SetDefaultGraph(IList<IRefNode>)
Sets the default graph to be the union of the graphs with the given names.
Declaration
void SetDefaultGraph(IList<IRefNode> graphNames)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<IRefNode> | graphNames | Graph names. |
SetDefaultGraph(Uri)
Sets the Default Graph to be the Graph with the given URI.
Declaration
[Obsolete("Replaced by SetDefaultGraph(IRefNode)")]
void SetDefaultGraph(Uri graphUri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | graphUri | Graph URI. |
SetDefaultGraph(IRefNode)
Sets the default graph to be the graph with the given name.
Declaration
void SetDefaultGraph(IRefNode graphName)
Parameters
| Type | Name | Description |
|---|---|---|
| IRefNode | graphName |