From: Frank S. <fs...@in...> - 2014-03-18 15:13:13
|
Hey Rob, this was exactly the problem! Thanks a lot! I also considered your recomendation about using the SparqlRemoteUpdateEndpoint class - it works fine. Is it possible to get any feedback about the success of the action like in sql (from where I come), i.e. "5 triples deleted" or "2 triples inserted"? Thanks again, you saved my day :) Frank Am 18.03.2014 15:17, schrieb Rob Vesse: > I'm guessing you do anything with the result of the QueryRaw() call which > is a HttpWebResponse? > > If you don't then you are leaving the connections open and the .Net > runtime imposes a limit on the number of open connections to a single > server. I believe this is in fact 2 connections hence why the third > request always fails since it is waiting for a connection to be free but > they are already used by the previous request. You should make sure you > wrap any usage of QueryRaw() in a using block like so: > > using (HttpWebResponse response = endpoint.QueryRaw(update)) { > // If you get here then the request succeeded and we close the response > explicitly > response.Close(); > } > > Then even if the request errors the using block ensures that any response > gets disposed of (which internally closes the connection) so you are > covered either way. > > You may want to consider using the complementary > SparqlRemoteUpdateEndpoint class for running updates, it has an Update() > method which handles submitting SPARQL updates and ensuring connections > are appropriately closed. > > Hope this helps, > > Rob > > On 18/03/2014 13:12, "Frank Schumacher" <fs...@in...> > wrote: > >> Hi folks, >> >> I am using the dotNetRDF-Framework to access a SPARQL-endpoint of our >> virtuoso server. At first, let me thank you to provide this framework, >> as it is a good tool for a semantic web beginner to get started with! >> >> I just stumbled upon a mysterious error, which I hope you can shed some >> light on. I am trying some examples to see how to insert/delete triples >> to the graph. After executing a delete and an insert, the endpoint >> doesn't react anymore and I run into a timeout. But let me show you some >> code! >> >> // define the endpoint >> SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new >> Uri("http://www.creativeartefact.org/sparql"), >> "http://139.18.2.148/MusicBusinessOntology"); >> endpoint.Timeout = 100000; >> >> // get everything in the graph >> string everything = "select * where {?s ?p ?o}"; >> >> // insert data >> string insert1 = "INSERT DATA { GRAPH >> <http://139.18.2.148/MusicBusinessOntology> { >> <http://139.18.2.148/MusicBusinessOntology/URIDISILLU> >> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> >> <http://artefakt.org/MusicBusinessVocabulary/MusicArtist>. >> <http://139.18.2.148/MusicBusinessOntology/URIDISILLU> >> <http://www.w3.org/2000/01/rdf-schema#label> \"Disillusion\" . } }"; >> >> // delete data >> string delete1 = "DELETE WHERE { GRAPH >> <http://139.18.2.148/MusicBusinessOntology> { >> <http://139.18.2.148/MusicBusinessOntology/URIDISILLU> ?p ?o } }"; >> >> 1) endpoint.QueryRaw(delete1); >> 2) endpoint.QueryRaw(insert1); >> 3) SparqlResultSet results = endpoint.QueryWithResultSet(everything); >> >> when I execute delete and insert, the next query will run into a timeout >> >> 1) endpoint.QueryRaw(delete1); >> 3) SparqlResultSet results = endpoint.QueryWithResultSet(everything); >> works >> >> 2) endpoint.QueryRaw(insert1); >> 3) SparqlResultSet results = endpoint.QueryWithResultSet(everything); >> works as well >> >> It is always the third request: >> 1) endpoint.QueryRaw(delete1); >> 2) endpoint.QueryRaw(insert1); >> 3) endpoint.QueryRaw(delete1); >> 4) endpoint.QueryRaw(insert1); >> 5) SparqlResultSet results = endpoint.QueryWithResultSet(everything); >> >> => the timeout occurs at the third query. >> >> I even put a breakpoint at the third line. Before executing this line, I >> execute the select statement vie webinterface against the >> SPAQRL-endpoint. The webinterface request works fine - but if I let the >> program continue, it still runs into a timeout. I even tried a second >> SparqlRemoteEndpoint instance - same problem. >> >> Any idea, what might be the reason for this behaviour and how to fix it? >> >> Many thanks, >> Frank >> >> -- >> ************************************************ >> * Universität Leipzig, Institut für Informatik * >> * Abteilung Betriebliche Informationssysteme * >> * http://bis.informatik.uni-leipzig.de * >> * Tel.: 0341 / 97 32 256 * >> * * >> * ========== Opera Metal: molllust =========== * >> * http://www.molllust.com * >> * M'era Luna Newcomer 2013! * >> ************************************************ >> >> -------------------------------------------------------------------------- >> ---- >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and their >> applications. Written by three acclaimed leaders in the field, >> this first edition is now available. Download your free book today! >> http://p.sf.net/sfu/13534_NeoTech >> _______________________________________________ >> dotNetRDF-Support mailing list >> dot...@li... >> https://lists.sourceforge.net/lists/listinfo/dotnetrdf-support > > > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > dotNetRDF-Support mailing list > dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-support > -- ************************************************ * Universität Leipzig, Institut für Informatik * * Abteilung Betriebliche Informationssysteme * * http://bis.informatik.uni-leipzig.de * * Tel.: 0341 / 97 32 256 * * * * ========== Opera Metal: molllust =========== * * http://www.molllust.com * * M'era Luna Newcomer 2013! * ************************************************ |