SemWeb.Query.VariableBindings

SemWeb : SemWeb.Query Namespace
VariableBindings Class

Represents a row of results from a query.

[System.Reflection.DefaultMember("Item")] public class VariableBindings

#### Remarks

This class maps variables to their target values in a single row of query results.

## Members

See Also: Inherited members from object.

### Constructors

VariableBindings (SemWeb.Variable[], SemWeb.Resource[]) Constructs a VariableBindings instance.

### Properties

Count [read-only] | int . The number of variables represented by this row.
Item [SemWeb.Variable] [read-only] default property | SemWeb.Resource . Gets the resource bound by a variable.
Item [string] [read-only] default property | SemWeb.Resource . Gets the resource bound by a variable of the given name.
Values [read-only] | System.Collections.Generic.IList<SemWeb.Resource> . The values bound by the variables in this row.
Variables [read-only] | System.Collections.Generic.IList<SemWeb.Variable> . The variables bound in this row.

### Methods

| Substitute (SemWeb.Statement) : SemWeb.Statement Performs a substitution on a statement.

## Member Details

### VariableBindings Constructor

public VariableBindings (SemWeb.Variable[] vars, SemWeb.Resource[] vals)

Constructs a VariableBindings instance.

#### Parameters

vars
  The variables.
vals
  Their corresponding values (in the same order). Values may be `null` to indicate an unbound variable.

#### Remarks

None.

### Count Property

public int Count { get; }

The number of variables represented by this row.

#### Value

The number of variables in the row.

#### Remarks

None.

### Item Property

public SemWeb.Resource this [SemWeb.Variable variable] { get; }

This is the default property for this class.

Gets the resource bound by a variable.

#### Parameters

variable
  A variable mentioned in this row.

#### Value

The value of the variable, or `null` if the variable is unbound in this row.

#### Remarks

None.

### Substitute Method

public SemWeb.Statement Substitute (SemWeb.Statement template)

Performs a substitution on a statement.

#### Parameters

template
  A statement template (a statement with possibly null fields).

#### Returns

A new statement will all occurrences of variables in this row of bindings replaced by their values.

#### Remarks

If a variable in the Subject, Predicate, or Meta fields is bound by a Literal value, a InvalidCastException is thrown.

### Values Property

public System.Collections.Generic.IList<SemWeb.Resource> Values { get; }

The values bound by the variables in this row.

#### Value

The values of the variables, in the same order as the variables are in the Variables property.

#### Remarks

A value may be `null` to indicate an unbound variable.

### Variables Property

public System.Collections.Generic.IList<SemWeb.Variable> Variables { get; }

The variables bound in this row.

#### Value

The variables bound in this row.

#### Remarks

None.

### Item Property

public SemWeb.Resource this [string variableName] { get; }

This is the default property for this class.

Gets the resource bound by a variable of the given name.

#### Parameters

variableName
  The name of a variable in the binding set.

#### Value

The resource that is bound by the variable in this row of results, or `null` if the variable is not bound.

#### Remarks

If more than one variable (distinct Variable instance) has the same name in this row, the result of this function is unspecified. Use the other overload of this method instead.