Show / Hide Table of Contents

Interface ISparqlDataset

Interfaces for Datasets that SPARQL Queries and Updates can be applied to.
Namespace: VDS.RDF.Query.Datasets
Assembly: dotNetRDF.dll
Syntax
public interface ISparqlDataset
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:

  1. If an Active Graph is set then Queries operate over that
  2. Otherwise if a Default Graph is set then Queries operate over that
  3. 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
Please note that the Query may change the Active and Default Graph over the course of the query depending on the Query e.g. FROM, FROM NAMED and GRAPH all can potentially change these.

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

| Improve this Doc View Source

ActiveGraphUris

Gets the enumeration of the Graph URIs that currently make up the active graph.
Declaration
IEnumerable<Uri> ActiveGraphUris { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Uri>
| Improve this Doc View Source

DefaultGraphUris

Gets the enumeration of the Graph URIs that currently make up the default graph.
Declaration
IEnumerable<Uri> DefaultGraphUris { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Uri>
| Improve this Doc View Source

Graphs

Gets all the Graphs in the Dataset.
Declaration
IEnumerable<IGraph> Graphs { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IGraph>
| Improve this Doc View Source

GraphUris

Gets all the URIs of Graphs in the Dataset.
Declaration
IEnumerable<Uri> GraphUris { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Uri>
| Improve this Doc View Source

HasTriples

Gets whether the Dataset has any Triples.
Declaration
bool HasTriples { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Item[Uri]

Gets the Graph with the given URI from the Dataset.
Declaration
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(Uri) method to guarantee a Graph they can modify and will be persisted to the underlying storage.

| Improve this Doc View Source

Triples

Gets all the Triples in the Dataset.
Declaration
IEnumerable<Triple> Triples { get; }
Property Value
Type Description
System.Collections.Generic.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.

| Improve this Doc View Source

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
System.Boolean

Methods

| Improve this Doc View Source

AddGraph(IGraph)

Adds a Graph to the Dataset.
Declaration
bool AddGraph(IGraph g)
Parameters
Type Name Description
IGraph g Graph.
Returns
Type Description
System.Boolean
Exceptions
Type Condition
System.NotSupportedException May be thrown if the Dataset is immutable i.e. Updates not supported.
System.NotSupportedException May be thrown if the Dataset is immutable.
| Improve this Doc View Source

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
System.Boolean
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

GetModifiableGraph(Uri)

Gets the Graph with the given URI from the Dataset.
Declaration
IGraph GetModifiableGraph(Uri graphUri)
Parameters
Type Name Description
System.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
System.NotSupportedException May be thrown if the Dataset is immutable i.e. Updates not supported.
System.NotSupportedException May be thrown if the Dataset is immutable.
| Improve this Doc View Source

GetTriplesWithObject(INode)

Gets all the Triples in the Dataset with the given Object.
Declaration
IEnumerable<Triple> GetTriplesWithObject(INode obj)
Parameters
Type Name Description
INode obj Object.
Returns
Type Description
System.Collections.Generic.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.

| Improve this Doc View Source

GetTriplesWithPredicate(INode)

Gets all the Triples in the Dataset with the given Predicate.
Declaration
IEnumerable<Triple> GetTriplesWithPredicate(INode pred)
Parameters
Type Name Description
INode pred Predicate.
Returns
Type Description
System.Collections.Generic.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.

| Improve this Doc View Source

GetTriplesWithPredicateObject(INode, INode)

Gets all the Triples in the Dataset with the given Predicate and Object.
Declaration
IEnumerable<Triple> GetTriplesWithPredicateObject(INode pred, INode obj)
Parameters
Type Name Description
INode pred Predicate.
INode obj Object.
Returns
Type Description
System.Collections.Generic.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.

| Improve this Doc View Source

GetTriplesWithSubject(INode)

Gets all the Triples in the Dataset with the given Subject.
Declaration
IEnumerable<Triple> GetTriplesWithSubject(INode subj)
Parameters
Type Name Description
INode subj Subject.
Returns
Type Description
System.Collections.Generic.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.

| Improve this Doc View Source

GetTriplesWithSubjectObject(INode, INode)

Gets all the Triples in the Dataset with the given Subject and Object.
Declaration
IEnumerable<Triple> GetTriplesWithSubjectObject(INode subj, INode obj)
Parameters
Type Name Description
INode subj Subject.
INode obj Object.
Returns
Type Description
System.Collections.Generic.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.

| Improve this Doc View Source

GetTriplesWithSubjectPredicate(INode, INode)

Gets all the Triples in the Dataset with the given Subject and Predicate.
Declaration
IEnumerable<Triple> GetTriplesWithSubjectPredicate(INode subj, INode pred)
Parameters
Type Name Description
INode subj Subject.
INode pred Predicate.
Returns
Type Description
System.Collections.Generic.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.

| Improve this Doc View Source

HasGraph(Uri)

Gets whether a Graph with the given URI is the Dataset.
Declaration
bool HasGraph(Uri graphUri)
Parameters
Type Name Description
System.Uri graphUri Graph URI.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

RemoveGraph(Uri)

Removes a Graph from the Dataset.
Declaration
bool RemoveGraph(Uri graphUri)
Parameters
Type Name Description
System.Uri graphUri Graph URI.
Returns
Type Description
System.Boolean
Exceptions
Type Condition
System.NotSupportedException May be thrown if the Dataset is immutable i.e. Updates not supported.
System.NotSupportedException May be thrown if the Dataset is immutable.
| Improve this Doc View Source

ResetActiveGraph()

Resets the Active Graph to the previous Active Graph.
Declaration
void ResetActiveGraph()
| Improve this Doc View Source

ResetDefaultGraph()

Resets the Default Graph to the previous Default Graph.
Declaration
void ResetDefaultGraph()
| Improve this Doc View Source

SetActiveGraph(IEnumerable<Uri>)

Sets the Active Graph to be the merge of the Graphs with the given URIs.
Declaration
void SetActiveGraph(IEnumerable<Uri> graphUris)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Uri> graphUris Graph URIs.
| Improve this Doc View Source

SetActiveGraph(Uri)

Sets the Active Graph to be the Graph with the given URI.
Declaration
void SetActiveGraph(Uri graphUri)
Parameters
Type Name Description
System.Uri graphUri Graph URI.
| Improve this Doc View Source

SetDefaultGraph(IEnumerable<Uri>)

Sets the Default Graph to be the merge of the Graphs with the given URIs.
Declaration
void SetDefaultGraph(IEnumerable<Uri> graphUris)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Uri> graphUris Graph URIs.
| Improve this Doc View Source

SetDefaultGraph(Uri)

Sets the Default Graph to be the Graph with the given URI.
Declaration
void SetDefaultGraph(Uri graphUri)
Parameters
Type Name Description
System.Uri graphUri Graph URI.

Extension Methods

Extensions.AsEnumerable<T>(T)
  • Improve this Doc
  • View Source
In This Article
  • Properties
    • ActiveGraphUris
    • DefaultGraphUris
    • Graphs
    • GraphUris
    • HasTriples
    • Item[Uri]
    • Triples
    • UsesUnionDefaultGraph
  • Methods
    • AddGraph(IGraph)
    • ContainsTriple(Triple)
    • Discard()
    • Flush()
    • GetModifiableGraph(Uri)
    • GetTriplesWithObject(INode)
    • GetTriplesWithPredicate(INode)
    • GetTriplesWithPredicateObject(INode, INode)
    • GetTriplesWithSubject(INode)
    • GetTriplesWithSubjectObject(INode, INode)
    • GetTriplesWithSubjectPredicate(INode, INode)
    • HasGraph(Uri)
    • RemoveGraph(Uri)
    • ResetActiveGraph()
    • ResetDefaultGraph()
    • SetActiveGraph(IEnumerable<Uri>)
    • SetActiveGraph(Uri)
    • SetDefaultGraph(IEnumerable<Uri>)
    • SetDefaultGraph(Uri)
  • Extension Methods
Back to top Generated by DocFX