Class SparqlResultSet
Class for representing Sparql Result Sets.
Inheritance
Implements
Inherited Members
Namespace: VDS.RDF.Query
Assembly: dotNetRdf.dll
Syntax
public sealed class SparqlResultSet : IEnumerable<ISparqlResult>, IEnumerable, IDisposable, IEquatable<SparqlResultSet>
Constructors
| Improve this Doc View SourceSparqlResultSet()
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.
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 |
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 SourceCount
Gets the number of Results in the Result Set.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
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 |
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 |
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.
Results
Gets the List of Results.
Declaration
public List<ISparqlResult> Results { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><ISparqlResult> |
ResultsType
Gets the Type of the Results Set.
Declaration
public SparqlResultsType ResultsType { get; }
Property Value
Type | Description |
---|---|
SparqlResultsType |
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 SourceDispose()
Disposes of a Result Set.
Declaration
public void Dispose()
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. |
GetEnumerator()
Gets an Enumerator for the Results List.
Declaration
public IEnumerator<ISparqlResult> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T><ISparqlResult> |
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.
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.
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.