Click or drag to resize

TripleStoreExecuteQuery Method (String)

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(
	string query


Type: SystemString
SPARQL Query as unparsed String.

Return Value

Type: Object

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



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