Tasawer Khan
Tasawer Khan

Reputation: 6148

Library for .NET that returns SPARQL results in some structured List instead of standard XML format?

Is there any Library for .NET that returns SPARQL results in some structured List instead of standard XML format? I am using SemWeb. I could not find any such method.

Upvotes: 1

Views: 146

Answers (1)

user205512
user205512

Reputation: 8898

SemWeb does appear to provide the building blocks for what you want. Looking at the documentation it seems QueryResultSink is what you want. You could build a list of results using that, or work directly with the results as they arrive.

Alternatively try dotnetrdf. This introduction shows that queries result in a SparqlResultSet that you can iterate through.

From the examples:

TripleStore store = new TripleStore();
// ...data...
Object results = store.ExecuteQuery("SELECT * WHERE {?s ?p ?o}");
if (results is SparqlResultSet) {
    SparqlResultSet rset = (SparqlResultSet)results; 
    foreach (SparqlResult result in rset) { 
        Console.WriteLine(result.ToString());
    }
}

Upvotes: 1

Related Questions