Show / Hide Table of Contents

Class SparqlResult

Class for representing a Row of a Sparql Result Set.

Inheritance
object
SparqlResult
Implements
ISparqlResult
IEnumerable<KeyValuePair<string, INode>>
IEnumerable
IEquatable<ISparqlResult>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: VDS.RDF.Query
Assembly: dotNetRdf.dll
Syntax
public sealed class SparqlResult : ISparqlResult, IEnumerable<KeyValuePair<string, INode>>, IEnumerable, IEquatable<ISparqlResult>

Constructors

| Edit this page View Source

SparqlResult()

Creates a new empty SPARQL Result which can only be filled by methods internal to the dotNetRDF Library.

Declaration
public SparqlResult()
| Edit this page View Source

SparqlResult(IEnumerable<KeyValuePair<string, INode>>)

Creates a new SPARQL Result with the specified set of result bindings.

Declaration
public SparqlResult(IEnumerable<KeyValuePair<string, INode>> bindings)
Parameters
Type Name Description
IEnumerable<KeyValuePair<string, INode>> bindings

An enumeration of key-value pairs that bind a variable name to a node value.

Properties

| Edit this page View Source

Count

Gets the number of Variables for which this Result contains Bindings.

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

IsGroundResult

Gets whether a Result is a Ground Result.

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

A Ground Result is a result which is considered to be a fixed fact. In practise this means it contains no Blank Nodes.

| Edit this page View Source

this[int]

Gets the Value that is bound at the given Index.

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

Index whose Value you wish to retrieve.

Property Value
Type Description
INode
Remarks

As of 1.0.0 the order of variables in a result may/may not vary depending on the original query. If a specific variable list was declared dotNetRDF tries to preserve that order but this may not always happen depending on how results are received.

Exceptions
Type Condition
IndexOutOfRangeException

Thrown if there is nothing bound at the given Index.

| Edit this page View Source

this[string]

Gets the Value that is bound to the given Variable.

Declaration
public INode this[string variable] { get; }
Parameters
Type Name Description
string variable

Variable whose Value you wish to retrieve.

Property Value
Type Description
INode
Exceptions
Type Condition
RdfException

Thrown if there is nothing bound to the given Variable Name for this Result.

| Edit this page View Source

Variables

Gets the set of Variables that are bound in this Result.

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

Methods

| Edit this page View Source

Equals(object)

Override of the Equals method for Results.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj
Returns
Type Description
bool
Overrides
object.Equals(object)
Remarks

Used implicitly in applying Distinct and Reduced modifiers to the Result Set.

| Edit this page View Source

Equals(ISparqlResult)

Declaration
public bool Equals(ISparqlResult other)
Parameters
Type Name Description
ISparqlResult other
Returns
Type Description
bool
| Edit this page View Source

GetEnumerator()

Enumerates the Bindings of Variable Names to Values in this Result.

Declaration
public IEnumerator<KeyValuePair<string, INode>> GetEnumerator()
Returns
Type Description
IEnumerator<KeyValuePair<string, INode>>
Remarks

Does not respect the ordering of the variables (if any).

| Edit this page View Source

GetHashCode()

Override of the GetHashCode method for Results.

Declaration
public override int GetHashCode()
Returns
Type Description
int
Overrides
object.GetHashCode()
Remarks

Used implicitly in applying Distinct and Reduced modifiers to the Result Set.

| Edit this page View Source

HasBoundValue(string)

Checks whether a given Variable has a non-null value for this result.

Declaration
public bool HasBoundValue(string variable)
Parameters
Type Name Description
string variable

Variable Name.

Returns
Type Description
bool

True if the variable is present and has a non-null value, false otherwise.

| Edit this page View Source

HasValue(string)

Checks whether a given Variable has a value (which may be null) for this result.

Declaration
public bool HasValue(string variable)
Parameters
Type Name Description
string variable

Variable Name.

Returns
Type Description
bool

True if the variable is present, false otherwise.

Remarks

Returns true even if the value is null, use HasBoundValue(string) instead to see whether a non-null value is present for a variable.

| Edit this page View Source

SetValue(string, INode)

Internal Only Method for setting the Value of a Result.

Declaration
public void SetValue(string variable, INode value)
Parameters
Type Name Description
string variable

Variable Name.

INode value

Value bound to the Variable.

| Edit this page View Source

ToString()

Displays the Result as a comma separated string of pairs of the form ?var = value.

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()
| Edit this page View Source

ToString(INodeFormatter)

Displays the Result as a comma separated string of paris of the form ?var = value where values are formatted using the given Node Formatter.

Declaration
public string ToString(INodeFormatter formatter)
Parameters
Type Name Description
INodeFormatter formatter

Node Formatter.

Returns
Type Description
string
| Edit this page View Source

Trim()

Removes all Variables Bindings where the Variable is Unbound.

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

TryGetBoundValue(string, out INode)

Tries to get a non-null value for the variable.

Declaration
public bool TryGetBoundValue(string variable, out INode value)
Parameters
Type Name Description
string variable

Variable.

INode value

Value.

Returns
Type Description
bool

True if the variable was present and bound, false otherwise.

| Edit this page View Source

TryGetValue(string, out INode)

Tries to get a value (which may be null) for the variable.

Declaration
public bool TryGetValue(string variable, out INode value)
Parameters
Type Name Description
string variable

Variable.

INode value

Value.

Returns
Type Description
bool

True if the variable was present (even it was unbound) and false otherwise.

| Edit this page View Source

Value(string)

Gets the Value that is bound to the given Variable.

Declaration
public INode Value(string variable)
Parameters
Type Name Description
string variable

Variable whose Value you wish to retrieve.

Returns
Type Description
INode
Exceptions
Type Condition
RdfException

Thrown if there is nothing bound to the given Variable Name for this Result.

Implements

ISparqlResult
IEnumerable<T>
IEnumerable
IEquatable<T>

Extension Methods

Extensions.ChunkBy<T>(IEnumerable<T>, int)
Extensions.IsDisjoint<T>(IEnumerable<T>, IEnumerable<T>)
Extensions.ToSafeString(object)
DynamicExtensions.AsDynamic(ISparqlResult)
Extensions.AsEnumerable<T>(T)
  • Edit this page
  • View Source
In this article
  • Constructors
    • SparqlResult()
    • SparqlResult(IEnumerable<KeyValuePair<string, INode>>)
  • Properties
    • Count
    • IsGroundResult
    • this[int]
    • this[string]
    • Variables
  • Methods
    • Equals(object)
    • Equals(ISparqlResult)
    • GetEnumerator()
    • GetHashCode()
    • HasBoundValue(string)
    • HasValue(string)
    • SetValue(string, INode)
    • ToString()
    • ToString(INodeFormatter)
    • Trim()
    • TryGetBoundValue(string, out INode)
    • TryGetValue(string, out INode)
    • Value(string)
  • Implements
  • Extension Methods
Back to top Generated by DocFX