Show / Hide Table of Contents

Class TripleStore

Class for representing Triple Stores which are collections of RDF Graphs.
Inheritance
System.Object
BaseTripleStore
TripleStore
DiskDemandTripleStore
ThreadSafeTripleStore
WebDemandTripleStore
Implements
IInMemoryQueryableStore
IInferencingTripleStore
IUpdateableTripleStore
ITripleStore
System.IDisposable
Inherited Members
BaseTripleStore._graphs
BaseTripleStore.IsEmpty
BaseTripleStore.Graphs
BaseTripleStore.Triples
BaseTripleStore.Add(IGraph)
BaseTripleStore.Add(IGraph, Boolean)
BaseTripleStore.AddFromUri(Uri)
BaseTripleStore.AddFromUri(Uri, Boolean)
BaseTripleStore.Remove(Uri)
BaseTripleStore.HasGraph(Uri)
BaseTripleStore.Item[Uri]
BaseTripleStore.GraphAdded
BaseTripleStore.GraphRemoved
BaseTripleStore.GraphChanged
BaseTripleStore.GraphCleared
BaseTripleStore.GraphMerged
BaseTripleStore.RaiseGraphAdded(IGraph)
BaseTripleStore.RaiseGraphAdded(GraphEventArgs)
BaseTripleStore.RaiseGraphRemoved(IGraph)
BaseTripleStore.RaiseGraphRemoved(GraphEventArgs)
BaseTripleStore.OnGraphRemoved(Object, GraphEventArgs)
BaseTripleStore.RaiseGraphChanged(GraphEventArgs)
BaseTripleStore.OnGraphChanged(Object, GraphEventArgs)
BaseTripleStore.RaiseGraphChanged(IGraph)
BaseTripleStore.RaiseGraphCleared(GraphEventArgs)
BaseTripleStore.OnGraphCleared(Object, GraphEventArgs)
BaseTripleStore.RaiseGraphMerged(GraphEventArgs)
BaseTripleStore.OnGraphMerged(Object, GraphEventArgs)
BaseTripleStore.AttachEventHandlers(IGraph)
BaseTripleStore.DetachEventHandlers(IGraph)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: VDS.RDF
Assembly: dotNetRDF.dll
Syntax
public class TripleStore : BaseTripleStore, IInMemoryQueryableStore, IInferencingTripleStore, IUpdateableTripleStore, ITripleStore, IDisposable

Constructors

| Improve this Doc View Source

TripleStore()

Creates a new Triple Store using a new empty Graph collection.
Declaration
public TripleStore()
| Improve this Doc View Source

TripleStore(BaseGraphCollection)

Creates a new Triple Store using the given Graph collection which may be non-empty.
Declaration
public TripleStore(BaseGraphCollection graphCollection)
Parameters
Type Name Description
BaseGraphCollection graphCollection Graph Collection.

Fields

| Improve this Doc View Source

_inferenceGraphUri

Graph Uri for the special Graph used to store inferred information.
Declaration
protected Uri _inferenceGraphUri
Field Value
Type Description
System.Uri
| Improve this Doc View Source

_reasoners

List of Reasoners that are applied to Graphs as they are added to the Triple Store.
Declaration
protected List<IInferenceEngine> _reasoners
Field Value
Type Description
System.Collections.Generic.List<IInferenceEngine>
| Improve this Doc View Source

_storeInferencesExternally

Controls whether inferred information is stored in a special Graph or in the original Graph.
Declaration
protected bool _storeInferencesExternally
Field Value
Type Description
System.Boolean

Methods

| Improve this Doc View Source

AddInferenceEngine(IInferenceEngine)

Adds an Inference Engine to the Triple Store.
Declaration
public void AddInferenceEngine(IInferenceEngine reasoner)
Parameters
Type Name Description
IInferenceEngine reasoner Reasoner to add.
| Improve this Doc View Source

ApplyInference(IGraph)

Applies Inference to the given Graph.
Declaration
public void ApplyInference(IGraph g)
Parameters
Type Name Description
IGraph g Graph to apply inference to.
| Improve this Doc View Source

ClearInferenceEngines()

Clears all Inference Engines from the Triple Store.
Declaration
public void ClearInferenceEngines()
| Improve this Doc View Source

Contains(Triple)

Returns whether the Store contains the given Triple within the Query Triples.
Declaration
public bool Contains(Triple t)
Parameters
Type Name Description
Triple t Triple to search for.
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Dispose()

Disposes of a Triple Store.
Declaration
public override void Dispose()
Overrides
BaseTripleStore.Dispose()
| Improve this Doc View Source

ExecuteQuery(String)

Executes a SPARQL Query on the Triple Store.
Declaration
[Obsolete("This method of making queries is often error prone due to misconceptions about what data is being queries and we recommend using an ISparqlQueryProcessor instead, see remarks for more discussion")]
public virtual object ExecuteQuery(string query)
Parameters
Type Name Description
System.String query SPARQL Query as unparsed String.
Returns
Type Description
System.Object
Remarks

This method of making queries often leads to no results because of misconceptions about what data is being queries. dotNetRDF's SPARQL engine only queries the default unnamed graph of the triple store (the graph added with a null URI) by default unless your query uses FROM clauses to change the default graph or you use GRAPH clauses to access named graphs in the store. Therefore a common mistake is to add a single graph to the store and then query the store which typically results in no results because usually the added graph is named and so is not queried.

We recommend using a ISparqlQueryProcessor instead for making queries over in-memory data since using our standard implementation (LeviathanQueryProcessor) affords you much more explicit control over which graphs are queried.

| Improve this Doc View Source

ExecuteQuery(IRdfHandler, ISparqlResultsHandler, String)

Executes a SPARQL Query on the Triple Store processing the results with an appropriate handler from those provided.
Declaration
[Obsolete("This method of making queries is often error prone due to misconceptions about what data is being queries and we recommend using an ISparqlQueryProcessor instead, see remarks for more discussion")]
public virtual void ExecuteQuery(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string query)
Parameters
Type Name Description
IRdfHandler rdfHandler RDF Handler.
ISparqlResultsHandler resultsHandler Results Handler.
System.String query SPARQL Query as unparsed String.
Remarks

This method of making queries often leads to no results because of misconceptions about what data is being queries. dotNetRDF's SPARQL engine only queries the default unnamed graph of the triple store (the graph added with a null URI) by default unless your query uses FROM clauses to change the default graph or you use GRAPH clauses to access named graphs in the store. Therefore a common mistake is to add a single graph to the store and then query the store which typically results in no results because usually the added graph is named and so is not queried.

We recommend using a ISparqlQueryProcessor instead for making queries over in-memory data since using our standard implementation (LeviathanQueryProcessor) affords you much more explicit control over which graphs are queried.

| Improve this Doc View Source

ExecuteQuery(IRdfHandler, ISparqlResultsHandler, SparqlQuery)

Executes a SPARQL Query on the Triple Store processing the results with an appropriate handler from those provided.
Declaration
[Obsolete("This method of making queries is often error prone due to misconceptions about what data is being queries and we recommend using an ISparqlQueryProcessor instead, see remarks for more discussion")]
public virtual void ExecuteQuery(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, SparqlQuery query)
Parameters
Type Name Description
IRdfHandler rdfHandler RDF Handler.
ISparqlResultsHandler resultsHandler Results Handler.
SparqlQuery query SPARQL Query as unparsed String.
Remarks

This method of making queries often leads to no results because of misconceptions about what data is being queries. dotNetRDF's SPARQL engine only queries the default unnamed graph of the triple store (the graph added with a null URI) by default unless your query uses FROM clauses to change the default graph or you use GRAPH clauses to access named graphs in the store. Therefore a common mistake is to add a single graph to the store and then query the store which typically results in no results because usually the added graph is named and so is not queried.

We recommend using a ISparqlQueryProcessor instead for making queries over in-memory data since using our standard implementation (LeviathanQueryProcessor) affords you much more explicit control over which graphs are queried.

| Improve this Doc View Source

ExecuteQuery(SparqlQuery)

Executes a SPARQL Query on the Triple Store.
Declaration
[Obsolete("This method of making queries is often error prone due to misconceptions about what data is being queries and we recommend using an ISparqlQueryProcessor instead, see remarks for more discussion")]
public virtual object ExecuteQuery(SparqlQuery query)
Parameters
Type Name Description
SparqlQuery query SPARQL Query as a SparqlQuery instance.
Returns
Type Description
System.Object
Remarks

This method of making queries often leads to no results because of misconceptions about what data is being queries. dotNetRDF's SPARQL engine only queries the default unnamed graph of the triple store (the graph added with a null URI) by default unless your query uses FROM clauses to change the default graph or you use GRAPH clauses to access named graphs in the store. Therefore a common mistake is to add a single graph to the store and then query the store which typically results in no results because usually the added graph is named and so is not queried.

We recommend using a ISparqlQueryProcessor instead for making queries over in-memory data since using our standard implementation (LeviathanQueryProcessor) affords you much more explicit control over which graphs are queried.

| Improve this Doc View Source

ExecuteUpdate(String)

Executes an Update against the Triple Store.
Declaration
public void ExecuteUpdate(string update)
Parameters
Type Name Description
System.String update SPARQL Update Command(s).
Remarks
As per the SPARQL 1.1 Update specification the command string may be a sequence of commands.
| Improve this Doc View Source

ExecuteUpdate(SparqlUpdateCommand)

Executes a single Update Command against the Triple Store.
Declaration
public void ExecuteUpdate(SparqlUpdateCommand update)
Parameters
Type Name Description
SparqlUpdateCommand update SPARQL Update Command.
| Improve this Doc View Source

ExecuteUpdate(SparqlUpdateCommandSet)

Executes a set of Update Commands against the Triple Store.
Declaration
public void ExecuteUpdate(SparqlUpdateCommandSet updates)
Parameters
Type Name Description
SparqlUpdateCommandSet updates SPARQL Update Command Set.
| Improve this Doc View Source

GetTriples(List<Uri>, Uri)

Selects all Triples which have a Uri Node with the given Uri from a Subset of Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriples(List<Uri> graphUris, Uri uri)
Parameters
Type Name Description
System.Collections.Generic.List<System.Uri> graphUris List of the Graph URIs of Graphs you want to select over.
System.Uri uri Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriples(List<Uri>, INode)

Selects all Triples which contain the given Node from a Subset of Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriples(List<Uri> graphUris, INode n)
Parameters
Type Name Description
System.Collections.Generic.List<System.Uri> graphUris List of the Graph URIs of Graphs you want to select over.
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriples(Uri)

Selects all Triples which have a Uri Node with the given Uri from all the Query Triples.
Declaration
public IEnumerable<Triple> GetTriples(Uri uri)
Parameters
Type Name Description
System.Uri uri Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriples(INode)

Selects all Triples which contain the given Node from all Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriples(INode n)
Parameters
Type Name Description
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithObject(List<Uri>, Uri)

Selects all Triples where the Object is a Uri Node with the given Uri from a Subset of Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithObject(List<Uri> graphUris, Uri u)
Parameters
Type Name Description
System.Collections.Generic.List<System.Uri> graphUris List of the Graph URIs of Graphs you want to select over.
System.Uri u Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithObject(List<Uri>, INode)

Selects all Triples where the Object is a given Node from a Subset of Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithObject(List<Uri> graphUris, INode n)
Parameters
Type Name Description
System.Collections.Generic.List<System.Uri> graphUris List of the Graph URIs of Graphs you want to select over.
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithObject(Uri)

Selects all Triples where the Object is a Uri Node with the given Uri from all Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithObject(Uri u)
Parameters
Type Name Description
System.Uri u Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithObject(INode)

Selects all Triples where the Object is a given Node from all Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithObject(INode n)
Parameters
Type Name Description
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithPredicate(List<Uri>, Uri)

Selects all Triples where the Predicate is a Uri Node with the given Uri from a Subset of Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithPredicate(List<Uri> graphUris, Uri u)
Parameters
Type Name Description
System.Collections.Generic.List<System.Uri> graphUris List of the Graph URIs of Graphs you want to select over.
System.Uri u Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithPredicate(List<Uri>, INode)

Selects all Triples where the Predicate is a given Node from a Subset of Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithPredicate(List<Uri> graphUris, INode n)
Parameters
Type Name Description
System.Collections.Generic.List<System.Uri> graphUris List of the Graph URIs of Graphs you want to select over.
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithPredicate(Uri)

Selects all Triples where the Predicate is a Uri Node with the given Uri from all Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithPredicate(Uri u)
Parameters
Type Name Description
System.Uri u Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithPredicate(INode)

Selects all Triples where the Predicate is a given Node from all Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithPredicate(INode n)
Parameters
Type Name Description
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithPredicateObject(INode, INode)

Selects all the Triples with the given Predicate-Object pair from all the Query Triples.
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<Triple>
| Improve this Doc View Source

GetTriplesWithSubject(List<Uri>, Uri)

Selects all Triples where the Subject is a Uri Node with the given Uri from a Subset of Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithSubject(List<Uri> graphUris, Uri u)
Parameters
Type Name Description
System.Collections.Generic.List<System.Uri> graphUris List of the Graph URIs of Graphs you want to select over.
System.Uri u Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithSubject(List<Uri>, INode)

Selects all Triples where the Subject is a given Node from a Subset of Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithSubject(List<Uri> graphUris, INode n)
Parameters
Type Name Description
System.Collections.Generic.List<System.Uri> graphUris List of the Graph URIs of Graphs you want to select over.
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithSubject(Uri)

Selects all Triples where the Subject is a Uri Node with the given Uri from all Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithSubject(Uri u)
Parameters
Type Name Description
System.Uri u Uri.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithSubject(INode)

Selects all Triples where the Subject is a given Node from all Graphs in the Triple Store.
Declaration
public IEnumerable<Triple> GetTriplesWithSubject(INode n)
Parameters
Type Name Description
INode n Node.
Returns
Type Description
System.Collections.Generic.IEnumerable<Triple>
| Improve this Doc View Source

GetTriplesWithSubjectObject(INode, INode)

Selects all the Triples with the given Subject-Object pair from all the Query Triples.
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<Triple>
| Improve this Doc View Source

GetTriplesWithSubjectPredicate(INode, INode)

Selects all the Triples with the given Subject-Predicate pair from all the Query Triples.
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<Triple>
| Improve this Doc View Source

OnGraphAdded(Object, GraphEventArgs)

Event Handler for the GraphAdded event of the underlying Graph Collection which calls the normal event processing of the parent class BaseTripleStore and then applies Inference to the newly added Graph.
Declaration
protected override void OnGraphAdded(object sender, GraphEventArgs args)
Parameters
Type Name Description
System.Object sender Sender.
GraphEventArgs args Graph Event Arguments.
Overrides
BaseTripleStore.OnGraphAdded(Object, GraphEventArgs)
| Improve this Doc View Source

RemoveInferenceEngine(IInferenceEngine)

Removes an Inference Engine from the Triple Store.
Declaration
public void RemoveInferenceEngine(IInferenceEngine reasoner)
Parameters
Type Name Description
IInferenceEngine reasoner Reasoner to remove.

Implements

IInMemoryQueryableStore
IInferencingTripleStore
IUpdateableTripleStore
ITripleStore
System.IDisposable

Extension Methods

Extensions.AsEnumerable<T>(T)
TripleStoreExtensions.LoadFromFile(ITripleStore, String, IStoreReader)
TripleStoreExtensions.LoadFromFile(ITripleStore, String)
TripleStoreExtensions.LoadFromUri(ITripleStore, Uri, IStoreReader)
TripleStoreExtensions.LoadFromUri(ITripleStore, Uri)
TripleStoreExtensions.LoadFromString(ITripleStore, String, IStoreReader)
TripleStoreExtensions.LoadFromString(ITripleStore, String)
TripleStoreExtensions.LoadFromEmbeddedResource(ITripleStore, String, IStoreReader)
TripleStoreExtensions.LoadFromEmbeddedResource(ITripleStore, String)
TripleStoreExtensions.SaveToFile(ITripleStore, String, IStoreWriter)
TripleStoreExtensions.SaveToFile(ITripleStore, String)
  • Improve this Doc
  • View Source
In This Article
  • Constructors
    • TripleStore()
    • TripleStore(BaseGraphCollection)
  • Fields
    • _inferenceGraphUri
    • _reasoners
    • _storeInferencesExternally
  • Methods
    • AddInferenceEngine(IInferenceEngine)
    • ApplyInference(IGraph)
    • ClearInferenceEngines()
    • Contains(Triple)
    • Dispose()
    • ExecuteQuery(String)
    • ExecuteQuery(IRdfHandler, ISparqlResultsHandler, String)
    • ExecuteQuery(IRdfHandler, ISparqlResultsHandler, SparqlQuery)
    • ExecuteQuery(SparqlQuery)
    • ExecuteUpdate(String)
    • ExecuteUpdate(SparqlUpdateCommand)
    • ExecuteUpdate(SparqlUpdateCommandSet)
    • GetTriples(List<Uri>, Uri)
    • GetTriples(List<Uri>, INode)
    • GetTriples(Uri)
    • GetTriples(INode)
    • GetTriplesWithObject(List<Uri>, Uri)
    • GetTriplesWithObject(List<Uri>, INode)
    • GetTriplesWithObject(Uri)
    • GetTriplesWithObject(INode)
    • GetTriplesWithPredicate(List<Uri>, Uri)
    • GetTriplesWithPredicate(List<Uri>, INode)
    • GetTriplesWithPredicate(Uri)
    • GetTriplesWithPredicate(INode)
    • GetTriplesWithPredicateObject(INode, INode)
    • GetTriplesWithSubject(List<Uri>, Uri)
    • GetTriplesWithSubject(List<Uri>, INode)
    • GetTriplesWithSubject(Uri)
    • GetTriplesWithSubject(INode)
    • GetTriplesWithSubjectObject(INode, INode)
    • GetTriplesWithSubjectPredicate(INode, INode)
    • OnGraphAdded(Object, GraphEventArgs)
    • RemoveInferenceEngine(IInferenceEngine)
  • Implements
  • Extension Methods
Back to top Generated by DocFX