Class SparqlResultSet
Class for representing Sparql Result Sets.
Inheritance
System.Object
SparqlResultSet
Implements
System.Collections.Generic.IEnumerable<SparqlResult>
System.Collections.IEnumerable
System.IDisposable
System.Runtime.Serialization.ISerializable
System.Xml.Serialization.IXmlSerializable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: VDS.RDF.Query
Assembly: dotNetRDF.dll
Syntax
[Serializable]
public sealed class SparqlResultSet : IEnumerable<SparqlResult>, IEnumerable, IDisposable, ISerializable, IXmlSerializable
Constructors
| Improve this Doc View SourceSparqlResultSet()
Creates an Empty Sparql Result Set.
Declaration
public SparqlResultSet()
Remarks
Useful where you need a possible guarentee 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(Boolean)
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<SparqlResult>)
Creates a Sparql Result Set for the collection of results.
Declaration
public SparqlResultSet(IEnumerable<SparqlResult> results)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<SparqlResult> | results | Results. |
SparqlResultSet(SparqlEvaluationContext)
Creates a SPARQL Result Set for the Results of a Query with the Leviathan Engine.
Declaration
public SparqlResultSet(SparqlEvaluationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| SparqlEvaluationContext | context | SPARQL Evaluation Context. |
Properties
| Improve this Doc View SourceCount
Gets the number of Results in the Result Set.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
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 |
Remarks
Item[Int32]
Index directly into the Results.
Declaration
public SparqlResult this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | Index of the Result you wish to retrieve. |
Property Value
| Type | Description |
|---|---|
| SparqlResult |
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<SparqlResult> Results { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<SparqlResult> |
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<System.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(Object)
Determines whether two Result Sets are equal.
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
Experimental and not yet complete.
|
Improve this Doc
View Source
GetEnumerator()
Gets an Enumerator for the Results List.
Declaration
public IEnumerator<SparqlResult> GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerator<SparqlResult> |
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 |
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. |
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
ToTripleCollection(IGraph, String, String, String)
Converts a Result Set into a Triple Collection.
Declaration
public BaseTripleCollection ToTripleCollection(IGraph g, string subjVar, string predVar, string objVar)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraph | g | Graph to generate the Nodes in. |
| System.String | subjVar | Variable whose value should be used for Subjects of Triples. |
| System.String | predVar | Variable whose value should be used for Predicates of Triples. |
| System.String | objVar | Variable whose value should be used for Object of Triples. |
Returns
| Type | Description |
|---|---|
| BaseTripleCollection |
Remarks
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.
|
Improve this Doc
View Source
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()
Gets an Enumerator for the Results List.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.IEnumerator |
Implements
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
System.IDisposable
System.Runtime.Serialization.ISerializable
System.Xml.Serialization.IXmlSerializable