From: Iván P. <iva...@gm...> - 2015-02-20 11:17:25
|
Hi again. it's been a while but I got back to work on this and despite trying to follow your suggestion on disabling the http debugging, I found no way to do this effectively. I tried in visual studio, tools->options->debugging->just-in-time, and UNselecting all options, based on what I read on msdn pages, but still when I run my solution this exception arises. As a reminder, since I firstly asked this long time ago, here is my code: ---------- using System; using VDS.RDF; using VDS.RDF.Query; using VDS.RDF.Storage; namespace ConsoleApplication3 { class ReadFromBrightstarDB { static void Main(string[] args) { Options.HttpDebugging = true; Options.HttpFullDebugging = true; //Create a connection to BrightstarDB SPARQL Query endpoint SparqlConnector connect = new SparqlConnector(new Uri("http:// <IP_ADDRESS>:8090/brightstar/cobacoreDV2/sparql")); PersistentTripleStore store = new PersistentTripleStore(connect); //IEnumerable<Uri> graphs = connect.ListGraphs(); //foreach (Uri uri in graphs) //{ // Console.WriteLine(uri.ToString()); //} Object results = store.ExecuteQuery("SELECT * WHERE {?s ?p ?o}"); if (results is SparqlResultSet) { //Print out the results SparqlResultSet rset = (SparqlResultSet)results; //Create/open a file to write output into it System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\output.txt"); foreach (SparqlResult result in rset) { file.WriteLine(result.ToString()); //Console.WriteLine(result.ToString()); } file.Close(); } } } } ---------- when the exception arises, the line with the sparql query is highlighted in yellow in the IDE, and before that the whole data in the triplestore I access is shown in console, even though now I don't print in console, but rather try to do it on a text file (although I don't even know whether the write to file is even executed at all). any further guide on this would be very appreciated, Iván 2014-12-02 14:48 GMT+00:00 Rob Vesse <rv...@do...>: > Ivan > > As the error message says you have Full HTTP Debugging enabled and this > prevents the calling code from using the HTTP response normally, disable > HTTP debugging and this error will go away > > Rob > > From: Iván Palomares <iva...@gm...> > Reply-To: dotNetRDF Developer Discussion and Feature Request < > dot...@li...> > Date: Tuesday, 2 December 2014 14:45 > > To: dotNetRDF Developer Discussion and Feature Request < > dot...@li...> > Subject: Re: [dotNetRDF-Develop] connecting to a BrighstarDB store from > dotnetRDF > > Many thanks for this! it seems that was the main source of the problem. > It has been partially solved, there is still a minor issue but I can > figure out the reason. Now a lot of the triplestore data is shown in > console but after having finished printing in console, the following > exception arises: > > An unhandled exception of type 'VDS.RDF.RdfException' occurred in > dotNetRDF.dll > > Additional information: Full HTTP Debugging is enabled and the HTTP > response stream has been consumed and written to the standard error stream, > the stream is no longer available for calling code to consume > > I'm not pretty if what I have to do to prevent this from appearing is > doing something like try-catch statements in Java. Seemingly the code > executed completely and did what I wanted, except for this "distubring" > exception, am I wrong? > > many thanks, > Iván > > 2014-12-02 11:24 GMT+00:00 Rob Vesse <rv...@do...>: > >> Ivan >> >> Kal appears to have confirmed what I said in my email, Brightstar is >> responding with unexpected data because you are using the incorrect >> endpoint URI >> >> Note that ListGraphs() is internally just a query to the remote database >> so as you suggested and Kal has confirmed the problem is in your connection >> settings. >> >> Correcting the endpoint URL should hopefully resolve your issue >> >> Rob >> >> From: Kal Ahmed <ka...@ne...> >> Reply-To: dotNetRDF Developer Discussion and Feature Request < >> dot...@li...> >> Date: Tuesday, 2 December 2014 08:18 >> To: dotNetRDF Developer Discussion and Feature Request < >> dot...@li...> >> Subject: Re: [dotNetRDF-Develop] connecting to a BrighstarDB store from >> dotnetRDF >> >> Hi, >> >> I believe this is a problem with the URL you are using for the SPARQL >> endpoint. The correct SPARQL endpoint for your store is >> http://<IP>:8090/brightstar/<STORE>/sparql as described here: >> http://brightstardb.readthedocs.org/en/latest/SPARQL_Endpoint/ >> >> Cheers >> >> Kal >> >> On Mon, Dec 1, 2014 at 4:28 PM, Iván Palomares <iva...@gm...> >> wrote: >> >>> Hi, >>> Thanks to all who are trying to help with this question. In order to try >>> to find out the source of the problem, I replaced the code where the SparQL >>> query is executed and shown, by something simple in which I attempt to >>> obtain the graphs in the triplestore ans show its URIs. >>> >>> * //Create a connection to BrightstarDB SPARQL Query endpoint* >>> * SparqlConnector connect = new SparqlConnector(new >>> Uri("http://<IP>:8090/brightstar/<STORE>"));* >>> * PersistentTripleStore store = new >>> PersistentTripleStore(connect);* >>> >>> >>> * IEnumerable<Uri> graphs = connect.ListGraphs();* >>> * foreach (Uri uri in graphs)* >>> * {* >>> * Console.WriteLine(uri.ToString());* >>> * }* >>> >>> Now I obtain a new exception in the ListGraphs() line, a >>> RdfStorageException being unhandled: >>> >>> An unhandled exception of type 'VDS.RDF.Storage.RdfStorageException' >>> occurred in dotNetRDF.dll >>> >>> Additional information: An unexpected error occurred while listing >>> Graphs from the Store. See inner exception for further details >>> >>> This makes me thing that perhaps the source of the problem is not in the >>> previous query itself, but rather somewhere before, in the connection >>> settings? Maybe the classes SaprqlConnector and the PersistentTripleStore >>> as a wrapper, are not the appropriate choice to connect to a BrightstarDB >>> triplestore? >>> >>> Also, to give you more info, my triplestore has been directly imported >>> into BrightstarDB from a .owl file that was previously generated from an >>> ontology in Protegé. The importation process in BrightstarDB was done with >>> a management tool called Polaris it seemingly was all done correctly, >>> according to the output I received when I imported it. >>> >>> Kind regards, >>> Iván >>> >>> 2014-12-01 12:02 GMT+00:00 Iván Palomares <iva...@gm...>: >>> >>>> Hi, >>>> I'm currently trying to make a first connection from a .NET project >>>> with dotnetRDF, to a BrightstarDB remote endpoint in which I have a >>>> triplestore. >>>> The code I use is quite simple, just try to connect and execute a >>>> "trival" SPARQL query, as follows (<IP>, <PORT> and <STORE_NAME> stand for >>>> the existing address >>>> and triplestore name I want to access): >>>> >>>> namespace ConsoleApplication3 >>>> { >>>> >>>> class ReadFromBrightstarDB >>>> { >>>> static void Main(string[] args) >>>> { >>>> //Create a connection to BrightstarDB SPARQL Query endpoint >>>> SparqlConnector connect = new SparqlConnector(new Uri("http://<IP>:<PORT>/brightstar/<STORE_NAME>")); >>>> PersistentTripleStore store = new PersistentTripleStore(connect); >>>> >>>> Object results = store.ExecuteQuery("SELECT * WHERE {?s ?p ?o}"); >>>> if(results is SparqlResultSet) >>>> { >>>> //Print out the results >>>> SparqlResultSet rset = (SparqlResultSet)results; >>>> foreach (SparqlResult result in rset) >>>> { >>>> Console.WriteLine(result.ToString()); >>>> } >>>> } >>>> >>>> } >>>> } >>>> >>>> }When executing, I obtain an exception entitled "RDFParseException was >>>> unhandled", with the following description: >>>> >>>> An unhandled exception of type 'VDS.RDF.Parsing.RdfParseException' >>>> occurred in dotNetRDF.dll >>>> Additional information: Unable to Parse a SPARQL Result Set from the >>>> provided XML since the Document Element is not a <sparql> element! >>>> >>>> Any help would be appreciate, I'm quite new to .NET in general and >>>> BrightStarDB as well as to SparQL, so maybe there is a very silly issue >>>> here but I couldn't find it yet. >>>> Thanks! >>>> Iván >>>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server >>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards >>> with Interactivity, Sharing, Native Excel Exports, App Integration & more >>> Get technology previously reserved for billion-dollar corporations, FREE >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> dotNetRDF-develop mailing list >>> dot...@li... >>> https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop >>> >>> >> >> >> -- >> Kal Ahmed >> Director, Networked Planet Limited >> e: kal...@ne... >> w: www.networkedplanet.com >> ------------------------------------------------------------------------------ >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from >> Actuate! Instantly Supercharge Your Business Reports and Dashboards with >> Interactivity, Sharing, Native Excel Exports, App Integration & more Get >> technology previously reserved for billion-dollar corporations, FREE >> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk_______________________________________________ >> dotNetRDF-develop mailing list dot...@li... >> https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop >> >> >> >> ------------------------------------------------------------------------------ >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server >> from Actuate! Instantly Supercharge Your Business Reports and Dashboards >> with Interactivity, Sharing, Native Excel Exports, App Integration & more >> Get technology previously reserved for billion-dollar corporations, FREE >> >> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk >> _______________________________________________ >> dotNetRDF-develop mailing list >> dot...@li... >> https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop >> >> > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from > Actuate! Instantly Supercharge Your Business Reports and Dashboards with > Interactivity, Sharing, Native Excel Exports, App Integration & more Get > technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk_______________________________________________ > dotNetRDF-develop mailing list dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop > > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk > _______________________________________________ > dotNetRDF-develop mailing list > dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop > > |