A Query is something that returns all of the ways a set of variables may bind to a graph. This is the abstract base class of several query methods.
The SemWeb.Query.GraphMatch class provides a query algorithm to match a graph with variables against another graph.
The SemWeb.Query.Sparql class provides a SPARQL query engine.
Namespace: SemWeb.Query
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.0, 1.0.6.2
See Also: Inherited members from object.
⊟ Protected Constructors
Query ()The protected no-arg constructor used by subclasses. ⊟ Public Properties
MimeType string . Gets or sets the preferred MIME type for the output of the query. QueryMeta Entity . A filter on the Meta value of statements in the target graph considered by the query. ReturnLimit int . The number of bindings to return. ReturnStart int . The index of the first binding to return. ⊟ Public Methods
abstractGetExplanation () : string Returns a textual explanation of the query. abstractRun (SelectableSource, SemWeb.Query.QueryResultSink) Runs the query on a data source, outputting to a QueryResultSink.Run (SelectableSource, System.IO.TextWriter) Runs the query on a data source, outputting to a TextWriter.
⊟ Query Constructor
The protected no-arg constructor used by subclasses.
protected Query ()⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb.Query
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ GetExplanation Method
Returns a textual explanation of the query.
public abstract string GetExplanation ()⊟ Returns
A textual string describing the query or how the query will be performed.⊟ Remarks
This method is provided for debugging or for users to be able to optimize the query based on the information in the returned string.⊟ Requirements
Namespace: SemWeb.Query
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ MimeType Property
Gets or sets the preferred MIME type for the output of the query.
public virtual string MimeType { set; get; }⊟ Value
The preferred MIME type for the output of the query.⊟ Remarks
This propery returns the MIME type of the output that results from calling SemWeb.Query.Run(SemWeb.SelectableSource, System.IO.TextWriter). Output is often in the SPARQL XML Results format, so this property often returns "application/sparql-results+xml".
The SemWeb.Query.SparqlEngine class handles several different types of queries. ASK and SELECT queries return the MIME type above. CONSTRUCT and DESCRIBE queries will be output in RDF/XML format by default, and so this property returns "application/rdf+xml" for those queries.
This property can also be used to change the ouput format of queries, where supported. A MIME type that is not supported or recognized will cause the property setter to throw NotSupportedException. Always catch this exception when setting this property.
The SemWeb.GraphMatch class ignores the property and always outputs in the SPARQL Results XML format.
Using the SemWeb.Query.SparqlEngine class, SPARQL SELECT queries support application/sparql-results+xml (or text/xml), text/csv, and text/html. SPARQL ASK queries support application/sparql-results+xml (or text/xml) and text/plain. SPARQL CONSTRUCT and DESCRIBE queries can be set to output in either RDF/XML or N3 format by setting this property to "application/n3" or any of the values listed in SemWeb.RdfWriter.Create(string, System.IO.TextWriter).
⊟ Requirements
Namespace: SemWeb.Query
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ QueryMeta Property
A filter on the Meta value of statements in the target graph considered by the query.
public SemWeb.Entity QueryMeta { set; get; }⊟ Value
The value of this property is null by default, meaning the Meta field of statements in the target graph is ignored for the purposes of the query. Otherwise, the query is restricted to statements with the given entity as a Meta value.⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb.Query
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ ReturnLimit Property
The number of bindings to return.
public int ReturnLimit { set; get; }⊟ Value
The maximum number of bindings to return, or -1 to return all bindings.⊟ Remarks
All bindings are returned by default.⊟ Requirements
Namespace: SemWeb.Query
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ ReturnStart Property
The index of the first binding to return.
public int ReturnStart { set; get; }⊟ Value
The index of the first binding to return. The value of this property is 1-based.⊟ Remarks
The first binding returned is by default the first binding.⊟ Requirements
Namespace: SemWeb.Query
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Run Method
Runs the query on a data source, outputting to a QueryResultSink.
⊟ Parameters
- source
- The data source to query.
- resultsink
- The sink to which each set of variable bindings is written.
⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb.Query
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ Run Method
Runs the query on a data source, outputting to a TextWriter.
⊟ Parameters
- source
- The data source to query.
- output
- The TextWriter to which to write results.
⊟ Remarks
The normal output format uses the SemWeb.Query.SparqlXmlQuerySink.⊟ Requirements
Namespace: SemWeb.Query
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2