Show / Hide Table of Contents

Class SparqlResultSet

Class for representing Sparql Result Sets.

Inheritance
System.Object
SparqlResultSet
Implements
System.Collections.Generic.IEnumerable<T><ISparqlResult>
System.Collections.IEnumerable
System.IDisposable
System.IEquatable<T><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

| Improve this Doc 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.

| Improve this Doc 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
System.Boolean result
| Improve this Doc 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
System.Collections.Generic.IEnumerable<T><ISparqlResult> results

Results.

Properties

| Improve this Doc View Source

Count

Gets the number of Results in the Result Set.

Declaration
public int Count { get; }
Property Value
Type Description
int
| Improve this Doc 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
System.Boolean
| Improve this Doc 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
| Improve this Doc View Source

Result

Gets the Result of an ASK Query.

Declaration
public bool Result { get; }
Property Value
Type Description
System.Boolean
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.

| Improve this Doc View Source

Results

Gets the List of Results.

Declaration
public List<ISparqlResult> Results { get; }
Property Value
Type Description
System.Collections.Generic.List<T><ISparqlResult>
| Improve this Doc View Source

ResultsType

Gets the Type of the Results Set.

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

Variables

Gets the Variables used in the Result Set.

Declaration
public IEnumerable<string> Variables { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<T><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

| Improve this Doc View Source

Dispose()

Disposes of a Result Set.

Declaration
public void Dispose()
| Improve this Doc 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
System.Boolean

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

| Improve this Doc View Source

GetEnumerator()

Gets an Enumerator for the Results List.

Declaration
public IEnumerator<ISparqlResult> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T><ISparqlResult>
| Improve this Doc 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.

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

| Improve this Doc 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.

| Improve this Doc 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

System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
System.IDisposable
System.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)
  • Improve this Doc
  • 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, string, string, string, bool)
    • ToTripleCollection(IGraph)
    • Trim()
  • Implements
  • Extension Methods
Back to top Generated by DocFX