2016-06-23 56 views
0

我試圖使用dotNetRdfXamarin和dotNetRdf

這是我的代碼查詢DBpedia中與Xamarin:

SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri("http://dbpedia.org/sparql"), "http://dbpedia.org"); 

    //Make a SELECT query against the Endpoint 
    SparqlResultSet results = endpoint.QueryWithResultSet("SELECT DISTINCT ?Concept WHERE {[] a ?Concept}"); 
    foreach (SparqlResult result in results) 
    { 
     Console.WriteLine(result.ToString()); 
    } 

    //Make a DESCRIBE query against the Endpoint 
    IGraph g = endpoint.QueryWithResultGraph("DESCRIBE "); 
    foreach (Triple t in g.Triples) 
    { 
     Console.WriteLine(t.ToString()); 
    } 

此代碼的工作在C#項目很大,但裏面Xamarin我有以下錯誤上QueryWithResultSet

void SparqlRemoteEndpoint.QueryWithResultSet(string query, SparqlResultsCallback callback, object state)(+1 overload) 
Makes a Query asynchronously where the expected Result is a SparqlResultSet i.e. SELECT and ASK Queries 

我不明白我需要創建什麼回調。

怎麼了?

回答

0

並非所有平臺都支持同步HTTP操作,因此所有不支持此功能的平臺都需要使用異步方法。

這是他們選擇不支持所有平臺上相同API集的.Net平臺的限制