Click or drag to resize

TripleStoreExecuteQuery Method (SparqlQuery)

Note: This API is now obsolete.

Executes a SPARQL Query on the Triple Store.

Namespace:  VDS.RDF
Assembly:  dotNetRDF (in dotNetRDF.dll) Version:
[ObsoleteAttribute("This method of making queries is often error prone due to misconceptions about what data is being queries and we recommend using an ISparqlQueryProcessor instead, see remarks for more discussion")]
public virtual Object ExecuteQuery(
	SparqlQuery query


Type: VDS.RDF.QuerySparqlQuery
SPARQL Query as a SparqlQuery instance.

Return Value

Type: Object

[Missing <returns> documentation for "M:VDS.RDF.TripleStore.ExecuteQuery(VDS.RDF.Query.SparqlQuery)"]



This method of making queries often leads to no results because of misconceptions about what data is being queries. dotNetRDF's SPARQL engine only queries the default unnamed graph of the triple store (the graph added with a null URI) by default unless your query uses FROM clauses to change the default graph or you use GRAPH clauses to access named graphs in the store. Therefore a common mistake is to add a single graph to the store and then query the store which typically results in no results because usually the added graph is named and so is not queried.

We recommend using a ISparqlQueryProcessor instead for making queries over in-memory data since using our standard implementation (LeviathanQueryProcessor) affords you much more explicit control over which graphs are queried.

See Also