A SPARQL query engine.
|
This class is based on the engine at http://sparql.sourceforge.net/ by Ryan Levering, version 0.8.
This example runs a SELECT query on a data source and writes the results as XML to standard output.
C# Example |
MemoryStore datamodel = new MemoryStore(new RdfXmlReader("rdfdata.rdf")); string sparqlQuery = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" + "SELECT * WHERE { ?person rdf:type foaf:Agent . \n" + "?person foaf:name ?name . }"; SparqlEngine query = new SparqlEngine(sparqlQuery); query.Run(datamodel, Console.Out). |
Although this example sends the results to a stream, the results can be processed programmatically by passing a SemWeb.Query.QueryResultSink instead of a TextWriter.
See Also: Inherited members from Query.
Initialized the SPARQL query from a TextReader. |
Initializes the SPARQL query from a string. |
AllowPersistBNodes
|
bool . To be added. |
MimeType
|
string . Gets or sets the preferred MIME type for the output of the query. (Inherited from Query.) |
QueryMeta
|
SemWeb.Entity . A filter on the Meta value of statements in the target graph considered by the query. (Inherited from Query.) |
ReturnLimit
|
int . The number of bindings to return. (Inherited from Query.) |
ReturnStart
|
int . The index of the first binding to return. (Inherited from Query.) |
Type [read-only] | SparqlEngine.QueryType . Gets the type of the query. |
AddExternalFunction
(RdfFunction) Registers an external function that can be used in FILTER clauses. |
|
Ask
(SemWeb.SelectableSource) Executes an ASK query on the given data source and returns the result of the query as a boolean. |
|
Ask
(SemWeb.SelectableSource, System.IO.TextWriter) Executes an ASK query on the given data source and outputs the result of the query in the SPARQL results format to a TextWriter. |
|
Construct
(SemWeb.SelectableSource, SemWeb.StatementSink) Executes a CONSTRUCT query on the given data source and sends the constructed statements to a StatementSink. |
|
Construct
(SemWeb.SelectableSource, System.IO.TextWriter) Executes a CONSTRUCT query on the given data source and outputs the result of the query in the SPARQL results format to a TextWriter. |
|
Describe
(SemWeb.SelectableSource, SemWeb.StatementSink) Executes a DESCRIBE query on the given data source and sends the constructed statements to a StatementSink. |
|
Describe
(SemWeb.SelectableSource, System.IO.TextWriter) Executes a DESCRIBE query on the given data source and outputs the result of the query in the SPARQL results format to a TextWriter. |
|
abstract |
GetExplanation
() Returns a textual explanation of the query. (Inherited from Query.) |
GetQueryPrefixes
() Gets a NamespaceManager containing all of the PREFIX definitions used in the query. |
|
abstract |
Run
(SemWeb.SelectableSource, QueryResultSink) Runs the query on a data source, outputting to a QueryResultSink. (Inherited from Query.) |
Run
(SemWeb.SelectableSource, System.IO.TextWriter) Runs the query on a data source, outputting to a TextWriter. (Inherited from Query.) |
|
Select
(SemWeb.SelectableSource, System.IO.TextWriter) Executes a SELECT query on the given data source and outputs the result of the query in the SPARQL results format to a TextWriter. |
|
Select
(SemWeb.SelectableSource, QueryResultSink) Executes a SELECT query on the given data source and sends the resulting variable bindings to a QueryResultSink. |
Initializes the SPARQL query from a string.
Initialized the SPARQL query from a TextReader.
Executes an ASK query on the given data source and returns the result of the query as a boolean.
Executes an ASK query on the given data source and outputs the result of the query in the SPARQL results format to a TextWriter.
Executes a CONSTRUCT query on the given data source and sends the constructed statements to a StatementSink.
Executes a CONSTRUCT query on the given data source and outputs the result of the query in the SPARQL results format to a TextWriter.
Executes a DESCRIBE query on the given data source and sends the constructed statements to a StatementSink.
Executes a DESCRIBE query on the given data source and outputs the result of the query in the SPARQL results format to a TextWriter.
Executes a SELECT query on the given data source and outputs the result of the query in the SPARQL results format to a TextWriter.
Executes a SELECT query on the given data source and sends the resulting variable bindings to a QueryResultSink.
Gets the type of the query.
To be added.
Registers an external function that can be used in FILTER clauses.
Gets a NamespaceManager containing all of the PREFIX definitions used in the query.