Class BaseTripleCollection
Abstract Base Class for Triple Collections.
Inheritance
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public abstract class BaseTripleCollection : IEnumerable<Triple>, IEnumerable, IDisposable
Remarks
Designed to allow the underlying storage of a Triple Collection to be changed at a later date without affecting classes that use it.
Properties
| Edit this page View SourceAsserted
Gets the triples that are asserted in the collection.
Declaration
public abstract IEnumerable<Triple> Asserted { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Triple> |
Remarks
This returns the same set of triples as the enumerator on this class, but as an IEnumerable<T> instance.
Count
Gets the number of asserted triples in the triple collection.
Declaration
public abstract int Count { get; }
Property Value
Type | Description |
---|---|
int |
this[(INode s, INode p, INode o)]
Gets the triples that match the provided pattern.
Declaration
public virtual IEnumerable<Triple> this[(INode s, INode p, INode o) pattern] { get; }
Parameters
Type | Name | Description |
---|---|---|
(INode s, INode p, INode o) | pattern | A tuple of subject, predicate and object node. Each item in the tuple is nullable, with a null value indicating a wildcard for matching in that position. |
Property Value
Type | Description |
---|---|
IEnumerable<Triple> |
this[Triple]
Gets the given triple.
Declaration
public abstract Triple this[Triple t] { get; }
Parameters
Type | Name | Description |
---|---|---|
Triple | t | Triple to retrieve. |
Property Value
Type | Description |
---|---|
Triple |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException | Thrown if the given Triple doesn't exist. |
ObjectNodes
Gets all the nodes which are objects of asserted triples in the triple collection.
Declaration
public abstract IEnumerable<INode> ObjectNodes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<INode> |
PredicateNodes
Gets all the nodes which are predicates of asserted triples in the triple collection.
Declaration
public abstract IEnumerable<INode> PredicateNodes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<INode> |
Quoted
Gets the triples that are quoted in the collection.
Declaration
public abstract IEnumerable<Triple> Quoted { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Triple> |
QuotedCount
Gets the number of quoted triples in the triple collection.
Declaration
public abstract int QuotedCount { get; }
Property Value
Type | Description |
---|---|
int |
QuotedObjectNodes
Gets all the nodes which are subjects of quoted triples in the triple collection.
Declaration
public abstract IEnumerable<INode> QuotedObjectNodes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<INode> |
QuotedPredicateNodes
Gets all the nodes which are predicates of quoted triples in the triple collection.
Declaration
public abstract IEnumerable<INode> QuotedPredicateNodes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<INode> |
QuotedSubjectNodes
Gets all the nodes which are objects of quoted triples in the triple collection.
Declaration
public abstract IEnumerable<INode> QuotedSubjectNodes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<INode> |
SubjectNodes
Gets all the nodes which are subjects of asserted triples in the triple collection.
Declaration
public abstract IEnumerable<INode> SubjectNodes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<INode> |
Methods
| Edit this page View SourceAdd(Triple)
Adds a Triple to the Collection.
Declaration
protected abstract bool Add(Triple t)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | Triple to add. |
Returns
Type | Description |
---|---|
bool |
Remarks
Adding a Triple that already exists should be permitted though it is not necessary to persist the duplicate to underlying storage.
Contains(Triple)
Determines whether a given Triple is asserted in the Triple Collection.
Declaration
public abstract bool Contains(Triple t)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | The Triple to test. |
Returns
Type | Description |
---|---|
bool | True if the triple exists as an asserted triple in the collection. |
ContainsQuoted(Triple)
Determines whether a given triple is quoted by a triple node of a triple in the collection.
Declaration
public abstract bool ContainsQuoted(Triple t)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | The triple to test. |
Returns
Type | Description |
---|---|
bool | True if the triple is quoted in the triple collection, false otherwise. |
Delete(Triple)
Deletes an asserted triple from the collection.
Declaration
protected abstract bool Delete(Triple t)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | Triple to remove. |
Returns
Type | Description |
---|---|
bool | True if the operation removed an asserted triple from the collection, false otherwise. |
Remarks
Deleting a triple that is not asserted in the collection should have no effect and give no error. Quoted triples cannot be removed from the collection via this method - instead they should be automatically removed when all asserted triples that reference them are removed. Deleting a triple that is both asserted and quoted will remove the assertion of the triple (and return true), but the triple will remain in the collection as a quoted triples.
Dispose()
Disposes of a Triple Collection.
Declaration
public abstract void Dispose()
GetEnumerator()
Gets the typed Enumerator for the Triple Collection.
Declaration
public abstract IEnumerator<Triple> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<Triple> | An enumerator over the asserted triples in the triple collection. |
QuotedWithObject(INode)
Gets all the quoted triples with the given Object.
Declaration
public virtual IEnumerable<Triple> QuotedWithObject(INode obj)
Parameters
Type | Name | Description |
---|---|---|
INode | obj | Object to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
QuotedWithPredicate(INode)
Gets all the quoted triples with the given Predicate.
Declaration
public virtual IEnumerable<Triple> QuotedWithPredicate(INode pred)
Parameters
Type | Name | Description |
---|---|---|
INode | pred | Predicate to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
QuotedWithPredicateObject(INode, INode)
Gets all the quoted triples with the given Predicate Object pair.
Declaration
public virtual IEnumerable<Triple> QuotedWithPredicateObject(INode pred, INode obj)
Parameters
Type | Name | Description |
---|---|---|
INode | pred | Predicate to lookup. |
INode | obj | Object to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
QuotedWithSubject(INode)
Gets all quoted triples with the given subject.
Declaration
public virtual IEnumerable<Triple> QuotedWithSubject(INode subj)
Parameters
Type | Name | Description |
---|---|---|
INode | subj | Subject to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
QuotedWithSubjectObject(INode, INode)
Gets all the quoted triples with the given Subject Object pair.
Declaration
public virtual IEnumerable<Triple> QuotedWithSubjectObject(INode subj, INode obj)
Parameters
Type | Name | Description |
---|---|---|
INode | subj | Subject to lookup. |
INode | obj | Object to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
QuotedWithSubjectPredicate(INode, INode)
Gets all the quoted triples with the given Subject Predicate pair.
Declaration
public virtual IEnumerable<Triple> QuotedWithSubjectPredicate(INode subj, INode pred)
Parameters
Type | Name | Description |
---|---|---|
INode | subj | Subject to lookup. |
INode | pred | Predicate to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
RaiseTripleAdded(Triple)
Helper method for raising the Triple Added event.
Declaration
protected void RaiseTripleAdded(Triple t)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | Triple. |
RaiseTripleRemoved(Triple)
Helper method for raising the Triple Removed event.
Declaration
protected void RaiseTripleRemoved(Triple t)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | Triple. |
WithObject(INode)
Gets all the asserted triples with the given object.
Declaration
public virtual IEnumerable<Triple> WithObject(INode obj)
Parameters
Type | Name | Description |
---|---|---|
INode | obj | Object to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
WithPredicate(INode)
Gets all the asserted triples with the given predicate.
Declaration
public virtual IEnumerable<Triple> WithPredicate(INode pred)
Parameters
Type | Name | Description |
---|---|---|
INode | pred | Predicate to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
WithPredicateObject(INode, INode)
Gets all the Triples with the given Predicate Object pair.
Declaration
public virtual IEnumerable<Triple> WithPredicateObject(INode pred, INode obj)
Parameters
Type | Name | Description |
---|---|---|
INode | pred | Predicate to lookup. |
INode | obj | Object to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
WithSubject(INode)
Gets all the asserted triples with the given subject.
Declaration
public virtual IEnumerable<Triple> WithSubject(INode subj)
Parameters
Type | Name | Description |
---|---|---|
INode | subj | Subject to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
WithSubjectObject(INode, INode)
Gets all the Triples with the given Subject Object pair.
Declaration
public virtual IEnumerable<Triple> WithSubjectObject(INode subj, INode obj)
Parameters
Type | Name | Description |
---|---|---|
INode | subj | Subject to lookup. |
INode | obj | Object to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
WithSubjectPredicate(INode, INode)
Gets all the asserted triples with the given subject/predicate pair.
Declaration
public virtual IEnumerable<Triple> WithSubjectPredicate(INode subj, INode pred)
Parameters
Type | Name | Description |
---|---|---|
INode | subj | Subject to lookup. |
INode | pred | Predicate to lookup. |
Returns
Type | Description |
---|---|
IEnumerable<Triple> |
Events
| Edit this page View SourceTripleAdded
Event which occurs when a triple is added to the collection as an asserted triple.
Declaration
public event TripleEventHandler TripleAdded
Event Type
Type | Description |
---|---|
TripleEventHandler |
TripleRemoved
Event which occurs when a triple is un-asserted from the collection.
Declaration
public event TripleEventHandler TripleRemoved
Event Type
Type | Description |
---|---|
TripleEventHandler |