Show / Hide Table of Contents

Class SparqlResultSet

Class for representing Sparql Result Sets.

Inheritance
object
SparqlResultSet
Implements
IEnumerable<ISparqlResult>
IEnumerable
IDisposable
IEquatable<SparqlResultSet>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: VDS.RDF.Query
Assembly: dotNetRdf.dll
Syntax
public sealed class SparqlResultSet : IEnumerable<ISparqlResult>, IEnumerable, IDisposable, IEquatable<SparqlResultSet>

Constructors

| Edit this page View Source

SparqlResultSet()

Creates an Empty Sparql Result Set.

Declaration
public SparqlResultSet()
Remarks

Useful where you need a possible guarantee of returning an result set even if it proves to be empty and also necessary for the implementation of Result Set Parsers.

| Edit this page View Source

SparqlResultSet(bool)

Creates a Sparql Result Set for the Results of an ASK Query with the given Result value.

Declaration
public SparqlResultSet(bool result)
Parameters
Type Name Description
bool result
| Edit this page View Source

SparqlResultSet(IEnumerable<ISparqlResult>)

Creates a Sparql Result Set for the collection of results.

Declaration
public SparqlResultSet(IEnumerable<ISparqlResult> results)
Parameters
Type Name Description
IEnumerable<ISparqlResult> results

Results.

Properties

| Edit this page View Source

Count

Gets the number of Results in the Result Set.

Declaration
public int Count { get; }
Property Value
Type Description
int
| Edit this page View Source

IsEmpty

Gets whether the Result Set is empty and can have Results loaded into it.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
bool
| Edit this page View Source

this[int]

Index directly into the Results.

Declaration
public ISparqlResult this[int index] { get; }
Parameters
Type Name Description
int index

Index of the Result you wish to retrieve.

Property Value
Type Description
ISparqlResult
| Edit this page View Source

Result

Gets the Result of an ASK Query.

Declaration
public bool Result { get; }
Property Value
Type Description
bool
Remarks

Result Set is deemed to refer to an ASK query if the Variables list is empty since an ASK Query result has an empty <head>. It is always true for any other Query type where one/more variables were requested even if the Result Set is empty.

| Edit this page View Source

Results

Gets the List of Results.

Declaration
public List<ISparqlResult> Results { get; }
Property Value
Type Description
List<ISparqlResult>
| Edit this page View Source

ResultsType

Gets the Type of the Results Set.

Declaration
public SparqlResultsType ResultsType { get; }
Property Value
Type Description
SparqlResultsType
| Edit this page View Source

Variables

Gets the Variables used in the Result Set.

Declaration
public IEnumerable<string> Variables { get; }
Property Value
Type Description
IEnumerable<string>
Remarks

As of 1.0 where possible dotNetRDF tries to preserve the ordering of variables however this may not be possible depending on where the result set originates from or how it is populated.

Methods

| Edit this page View Source

Dispose()

Disposes of a Result Set.

Declaration
public void Dispose()
| Edit this page View Source

Equals(SparqlResultSet)

Determines whether two results sets are equal.

Declaration
public bool Equals(SparqlResultSet results)
Parameters
Type Name Description
SparqlResultSet results

The other result set to compare with this one.

Returns
Type Description
bool

True if the result sets contain the same set of results (using graph comparison where blank nodes are involved), false otherwise.

| Edit this page View Source

GetEnumerator()

Gets an Enumerator for the Results List.

Declaration
public IEnumerator<ISparqlResult> GetEnumerator()
Returns
Type Description
IEnumerator<ISparqlResult>
| Edit this page View Source

ToTripleCollection(IGraph)

Converts a Result Set into a Triple Collection.

Declaration
public BaseTripleCollection ToTripleCollection(IGraph g)
Parameters
Type Name Description
IGraph g

Graph to generate the Nodes in.

Returns
Type Description
BaseTripleCollection
Remarks

Assumes the Result Set contains three variables ?s, ?p and ?o to use as the Subject, Predicate and Object respectively. Only Results for which all three variables have bound values will generate Triples.

| Edit this page View Source

ToTripleCollection(IGraph, string, string, string, bool)

Converts a Result Set into a Triple Collection.

Declaration
public BaseTripleCollection ToTripleCollection(IGraph g, string subjVar, string predVar, string objVar, bool fullTripleIndex = true)
Parameters
Type Name Description
IGraph g

Graph to generate the Nodes in.

string subjVar

Variable whose value should be used for Subjects of Triples.

string predVar

Variable whose value should be used for Predicates of Triples.

string objVar

Variable whose value should be used for Object of Triples.

bool fullTripleIndex

Indicates if the returned triple collection should include all indexes (true) or only the basic indexes (false).

Returns
Type Description
BaseTripleCollection
Remarks

Only Results for which all three variables have bound values will generate Triples.

| Edit this page View Source

Trim()

Trims the Result Set to remove unbound variables from results.

Declaration
public void Trim()
Remarks

Note: This does not remove empty results this only removes unbound variables from individual results.

Implements

IEnumerable<T>
IEnumerable
IDisposable
IEquatable<T>

Extension Methods

Extensions.ChunkBy<T>(IEnumerable<T>, int)
Extensions.IsDisjoint<T>(IEnumerable<T>, IEnumerable<T>)
Extensions.ToSafeString(object)
SparqlResultSetExtensions.ToDataTable(SparqlResultSet)
DynamicExtensions.AsDynamic(SparqlResultSet)
Extensions.AsEnumerable<T>(T)
  • Edit this page
  • View Source
In this article
  • Constructors
    • SparqlResultSet()
    • SparqlResultSet(bool)
    • SparqlResultSet(IEnumerable<ISparqlResult>)
  • Properties
    • Count
    • IsEmpty
    • this[int]
    • Result
    • Results
    • ResultsType
    • Variables
  • Methods
    • Dispose()
    • Equals(SparqlResultSet)
    • GetEnumerator()
    • ToTripleCollection(IGraph)
    • ToTripleCollection(IGraph, string, string, string, bool)
    • Trim()
  • Implements
  • Extension Methods
Back to top Generated by DocFX