Class SparqlResult
Class for representing a Row of a Sparql Result Set.
Inheritance
System.Object
SparqlResult
Implements
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, INode>>
System.Collections.IEnumerable
System.Runtime.Serialization.ISerializable
System.Xml.Serialization.IXmlSerializable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: VDS.RDF.Query
Assembly: dotNetRDF.dll
Syntax
[Serializable]
public sealed class SparqlResult : IEnumerable<KeyValuePair<string, INode>>, IEnumerable, ISerializable, IXmlSerializable
Constructors
| Improve this Doc View SourceSparqlResult()
Creates a new empty SPARQL Result which can only be filled by methods internal to the dotNetRDF Library.
Declaration
public SparqlResult()
SparqlResult(ISet)
Creates a new SPARQL Result from the given Set.
Declaration
public SparqlResult(ISet s)
Parameters
Type | Name | Description |
---|---|---|
ISet | s | Set. |
SparqlResult(ISet, IEnumerable<String>)
Creates a new SPARQL Result from the given Set which contains only the given variables in the given order.
Declaration
public SparqlResult(ISet s, IEnumerable<string> variables)
Parameters
Type | Name | Description |
---|---|---|
ISet | s | Set. |
System.Collections.Generic.IEnumerable<System.String> | variables | Variables. |
Properties
| Improve this Doc View SourceCount
Gets the number of Variables for which this Result contains Bindings.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsGroundResult
Gets whether a Result is a Ground Result.
Declaration
public bool IsGroundResult { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
A Ground Result is a result which is considered to be a fixed fact. In practise this means it contains no Blank Nodes.
|
Improve this Doc
View Source
Item[Int32]
Gets the Value that is bound at the given Index.
Declaration
public INode this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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 |
---|---|
System.IndexOutOfRangeException | Thrown if there is nothing bound at the given Index. |
Item[String]
Gets the Value that is bound to the given Variable.
Declaration
public INode this[string variable] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.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. |
Variables
Gets the set of Variables that are bound in this Result.
Declaration
public IEnumerable<string> Variables { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
Methods
| Improve this Doc View SourceEquals(Object)
Override of the Equals method for Results.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
System.Object.Equals(System.Object)
Remarks
Used implicitly in applying Distinct and Reduced modifiers to the Result Set.
|
Improve this Doc
View Source
GetEnumerator()
Enumerates the Bindings of Variable Names to Values in this Result.
Declaration
public IEnumerator<KeyValuePair<string, INode>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.String, INode>> |
Remarks
Does not respect the ordering of the variables (if any).
|
Improve this Doc
View Source
GetHashCode()
Override of the GetHashCode method for Results.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.Object.GetHashCode()
Remarks
Used implicitly in applying Distinct and Reduced modifiers to the Result Set.
|
Improve this Doc
View Source
GetObjectData(SerializationInfo, StreamingContext)
Gets the data for serialization.
Declaration
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | Serialization Information. |
System.Runtime.Serialization.StreamingContext | context | Streaming Context. |
GetSchema()
Gets the schema for XML serialization.
Declaration
public XmlSchema GetSchema()
Returns
Type | Description |
---|---|
System.Xml.Schema.XmlSchema |
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 |
---|---|---|
System.String | variable | Variable Name. |
Returns
Type | Description |
---|---|
System.Boolean | True if the variable is present and has a non-null value, false otherwise. |
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 |
---|---|---|
System.String | variable | Variable Name. |
Returns
Type | Description |
---|---|
System.Boolean | 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.
|
Improve this Doc
View Source
ReadXml(XmlReader)
Reads the data for XML deserialization (.Net serialization not the official SPARQL results serialization).
Declaration
public void ReadXml(XmlReader reader)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | reader | XML Reader. |
ToString()
Displays the Result as a comma separated string of pairs of the form ?var = value.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
System.Object.ToString()
|
Improve this Doc
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 |
---|---|
System.String |
Trim()
Removes all Variables Bindings where the Variable is Unbound.
Declaration
public void Trim()
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 |
---|---|---|
System.String | variable | Variable. |
INode | value | Value. |
Returns
Type | Description |
---|---|
System.Boolean | True if the variable was present and bound, false otherwise. |
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 |
---|---|---|
System.String | variable | Variable. |
INode | value | Value. |
Returns
Type | Description |
---|---|
System.Boolean | True if the variable was present (even it was unbound) and false otherwise. |
Value(String)
Gets the Value that is bound to the given Variable.
Declaration
public INode Value(string variable)
Parameters
Type | Name | Description |
---|---|---|
System.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. |
WriteXml(XmlWriter)
Writes the data for XML serialization (.Net serialization not the official SPARQL results serialization).
Declaration
public void WriteXml(XmlWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | XML Writer. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Enumerates the Bindings of Variable Names to Values in this Result.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
Implements
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
System.Runtime.Serialization.ISerializable
System.Xml.Serialization.IXmlSerializable