From: Rob V. <rv...@do...> - 2014-03-18 14:18:22
|
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 |