From: Frank S. <fs...@in...> - 2014-12-02 15:41:49
|
Hey Rob, many thanks for your efforts! This is really a strange behaviour and it took me a while to figure out what happens. I found, that the corrupted data is in a different graph. My data (the "ok" data) is in the graph "http://creativeartefact.org/", the corrupt data is in "http://creativeartefact.org/testGraph/Simon/". But I set the defaultGraphUri at the SparqlRemoteEndpoint, so maybe when using POST the defaultGraphUri is somehow lost? It seems, that you only get the results you get with curl, when no default graph ist set. I'll leave the corrupt data a bit longer at the server, if you want to check this. For the problem with invalid results returned from the server: Would it be an option, to simply ignore those currupt results, maybe mentioning that there is invalid data on the server but still returning the valid ones? Thanks again for sorting that out and for providing a great tool and even greater support! :) Frank Am 02.12.2014 15:26, schrieb Rob Vesse: > Frank > > I can reproduce this with CURL so it is not a dotNetRDF specific issue. > It appears to be caused by the Virtuoso server producing bad data, for > example I see the following data (invalid parts highlighted): > > { "head": { "link": [], "vars": ["uri", "label", "dis", "ann"] }, > "results": { "distinct": false, "ordered": true, "bindings": [ > { "uri": { "type": "uri", "value": > "Artist_1416733236244501848883290000000" } , "label": { "type": "uri", > "value": "asd" } , "dis": { "type": "uri", "value": "agasgagagdadg" } , > "ann": { "type": "literal", "value": "afasasfaaff" }}, > { "uri": { "type": "uri", "value": "Artist_12345" } , "label": { "type": > "literal", "value": "fooArtist" } , "dis": { "type": "literal", "value": > "fooDisam" } , "ann": { "type": "literal", "value": "fooannotation" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/mbrainzImport/44a415ad-77db-4d30-8889-557dffecbe14" > } , "label": { "type": "literal", "value": "molllust" } , "dis": { > "type": "literal", "value": "Opera metal from Leipzig" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/mbrainzImport/9a6103bb-2c8b-4dd2-92d2-e005cb75293a" > } , "label": { "type": "literal", "value": "Disillusion" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/mbrainzImport/8db9aa29-c2f4-4bcb-b592-15c7d4dd3a89" > } , "label": { "type": "literal", "value": "Haggard" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/f2ca3b66-745e-4a4b-8d6d-8b4f9442adca" > } , "label": { "type": "literal", "value": "AGETO" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/5ccd3208-8cac-4b33-b6f4-bc90caba3518" > } , "label": { "type": "literal", "value": "Metal Artist 1" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/665b9d77-ee5d-48d2-885c-f49589c26ec0" > } , "label": { "type": "literal", "value": "Folk Artist 1" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/e11e8bc6-f8b7-4b5f-9f3b-aba935b3e67c" > } , "label": { "type": "literal", "value": "RnB Artist 2" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/f878f0e1-8f06-403f-a32a-8da3f8c5a1ae" > } , "label": { "type": "literal", "value": "Classic Artist 1" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/d5247124-b894-46d0-a34c-b40c4a18f6af" > } , "label": { "type": "literal", "value": "RnB Artist 1" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/d1801f46-2a45-46b6-89b9-4ea822d8f92b" > } , "label": { "type": "literal", "value": "RnB Artist 1 feat. Mister > Blue" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/2e0684ca-8894-4a25-a605-99ced78cb7d6" > } , "label": { "type": "literal", "value": "Funk Artist 1" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/17e232ee-05d7-4f2e-8aac-3cab76771381" > } , "label": { "type": "literal", "value": "Various Artists" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/b00c0dec-ad00-4560-a429-4a935e8408b2" > } , "label": { "type": "literal", "value": "Brass Artist 1" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/4b276c0b-67c4-47f6-bda3-97211ad47352" > } , "label": { "type": "literal", "value": "Topselling Artist 1" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/cae8a5ec-0a8e-448c-883f-c9694595a50e" > } , "label": { "type": "literal", "value": "World Artist 1" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/acc145e9-b9bf-4086-a12a-d45d4f2b9767" > } , "label": { "type": "literal", "value": "Topselling Artist 1, Another > Rapper & More" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/agetoTest/c21ad3b7-80d5-439e-b4ba-081824907257" > } , "label": { "type": "literal", "value": "Topselling Artist 2" }}, > { "uri": { "type": "uri", "value": > "http://creativeartefact.org/gemachecker/2807886f-a5d5-426f-aaea-554bc85a3170" > } , "label": { "type": "literal", "value": "Unloved" }} ] } } > > Note that Virtuoso is returning invalid URIs, SPARQL Results require > that URIs returned be absolute > (http://answers.semanticweb.com/questions/2134/are-relative-uris-permitted-in-sparql-results) > > I have tried requesting different result formats and see the same > invalid data, why a GET produces different results to a POST is still > unclear to me but the fact remains that the data being returned is bad. > There does seem to be something strange with that server because > sometimes it returns me different answers, sometimes I have to POST to > get the bad answers and other times a GET produces bad answers. > > I'm afraid there is no workaround that I know off since even though we > do allow you to tweak the requested results format (via the > ResultsAcceptHeader) property the bad data is returned regardless of > format so the only things you can do is ask the owners of the endpoint > to fix the data and report the issue to the Virtuoso folks. > > I have filed CORE-432 > (http://dotnetrdf.org/tracker/Issues/IssueDetail.aspx?id=432) to track > the need to make the parsers return a more informative error when this > happens. I also filed CORE-433 > (http://dotnetrdf.org/tracker/Issues/IssueDetail.aspx?id=433) which > tracks a related bug I found where our SPARQL CSV parser could reject > some valid data. These will get fixed for the next release but they > won't resolve your problem only make it more obvious that it is the > server that is in error. > > Thanks for reporting this, > > Rob > > > On 01/12/2014 13:54, "Frank Schumacher" <fs...@in... > <mailto:fs...@in...>> wrote: > > Hey Rob, > > Do you have a complete stack trace from the case where it fails? > > > sure: > > System.UriFormatException: Ungültiger URI: Das URI-Format konnte nicht > bestimmt werden. > bei System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind > uriKind) > bei System.Uri..ctor(String uriString) > bei VDS.RDF.UriFactory.Create(String uri) > bei > VDS.RDF.Parsing.SparqlJsonParser.ParseBoundVariable(SparqlJsonParserContext > > context, String var, SparqlResult r, Boolean headSeen) > bei > VDS.RDF.Parsing.SparqlJsonParser.ParseBinding(SparqlJsonParserContext > context, Boolean headSeen) > bei > VDS.RDF.Parsing.SparqlJsonParser.ParseBindings(SparqlJsonParserContext > context, Boolean headSeen) > bei > VDS.RDF.Parsing.SparqlJsonParser.ParseResults(SparqlJsonParserContext > context, Boolean headSeen) > bei > VDS.RDF.Parsing.SparqlJsonParser.ParseBody(SparqlJsonParserContext > context) > bei > VDS.RDF.Parsing.SparqlJsonParser.ParseResultSetObject(SparqlJsonParserContext > > context) > bei VDS.RDF.Parsing.SparqlJsonParser.Parse(TextReader input, > ISparqlResultsHandler handler) > bei VDS.RDF.Parsing.SparqlJsonParser.Load(ISparqlResultsHandler > handler, TextReader input) > bei VDS.RDF.Parsing.SparqlJsonParser.Load(ISparqlResultsHandler > handler, StreamReader input) > bei > VDS.RDF.Query.SparqlRemoteEndpoint.QueryWithResultSet(ISparqlResultsHandler > > handler, String sparqlQuery) > bei VDS.RDF.Query.SparqlRemoteEndpoint.QueryWithResultSet(String > sparqlQuery) > > UriFormatException implies there is some invalid data somewhere, > the fact > that you are using SparqlRemoteEndpoint suggests that the remote > server > may be returning some bad data that we can't process though this > should > probably not manifest as a UriFormatException directly but as a > RdfParseException if this is the case. > > > From the results I get through the html-interface, I can't see any > stange data. Here is a request that fails and doesn't try to get all > data: > > PREFIX mbo: <http://creativeartefact.org/ontology/> PREFIX rdfs: > <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT * WHERE {?uri a > mbo:Artist. ?uri rdfs:label ?label. OPTIONAL {?uri mbo:disambiguation > ?dis}. OPTIONAL {?uri mbo:annotation ?ann}. } > > You might also test it via http://creativeartefact.org/sparql > > As for why POST versus non-POST would make a difference I do not > know, I > will try and take a proper look later today. > > > That would be great :) > > Note that SparqlRemoteEndpoint will automatically change to POST > when a > query is above a certain length regardless of the explicit > setting, the > explicit setting is mostly useful just to force a POST in all cases. > > > Hm, really? A while ago, I got an error, when a Sparql-Query was too > long and I solved it by manually setting the http-mode. But maybe this > was due to another reason than the length of the statement? > > If there is more information I can provide to pinpoint the problem, > just > let me know! > > Thanks, > Frank > > > Rob > > On 01/12/2014 12:14, "Frank Schumacher" > <fs...@in... <mailto:fs...@in...>> > wrote: > > Hello again, > > I narrowed it down a bit more, the error seems to happen, > when the > endpoint is set to POST: > > SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new > Uri("http://creativeartefact.org/sparql"), > "http://creativeartefact.org/"); > endpoint.HttpMode = "POST"; > > SparqlResultSet sparqlResults = > endpoint.QueryWithResultSet("PREFIX mbo: > <http://creativeartefact.org/ontology/> PREFIX rdfs: > <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT * > WHERE {?uri a > mbo:Organiser. ?uri rdfs:label ?label. OPTIONAL {?uri > mbo:city ?city}. > OPTIONAL {?uri mbo:street ?street}. OPTIONAL {?uri > mbo:postalcode > ?postalcode}. }"); > > SparqlResultSet sparqlResults = > endpoint.QueryWithResultSet("SELECT * > WHERE {?uri ?label ?city.}"); > > The first statement executes, but the second throws the > error. When > commenting out the line endpoint.HttpMode = "POST"; - also > the second > one executes. > > As my statements can get rather long, I need post to make > sure the > SPARQL request doesn't exceed the allowed length for GET. > Any idea, how > to solve this problem? > > Thanks in advance, > Frank > > #Am 28.11.2014 18:03, schrieb Frank Schumacher: > > I made some more tests and it is getting even stranger. > I tried more > test queries and even the simplest ones fail. For > testing, I made two > call. The first one works, the second raises the error. > When I try to > step into it with F11, it tells me: > > Aufruflistenort (callstackposition?): > > VDS.Common.dll!VDS.Common.Tries.AbstractTrie<string,char,System.Uri>.Move > ToNode(string > key) Zeile 211 > > Here is the line that works: > SparqlResultSet sparqlResults = > args.Endpoint.QueryWithResultSet("PREFIX > mbo: <http://creativeartefact.org/ontology/> PREFIX rdfs: > <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT > * WHERE {?uri a > mbo:Organiser. ?uri rdfs:label ?label. OPTIONAL {?uri > mbo:city ?city}. > OPTIONAL {?uri mbo:street ?street}. OPTIONAL {?uri > mbo:postalcode > ?postalcode}. }"); > > and here the one that raises the error: > SparqlResultSet sparqlResults = > args.Endpoint.QueryWithResultSet("SELECT > * WHERE {?uri ?label ?city}"); > > I'm really puzzled ... > > Ciao, > Frank > > Am 28.11.2014 17:08, schrieb Frank Schumacher: > > Hello Rob, > > I get a really strange UriFormatException > (Ungültiger URI: Das > URI-Format konnte nicht bestimmt werden.) when calling > SparqlRemoteEndpoint.QueryWithResultSet with the > following query: > > PREFIX mbo: <http://creativeartefact.org/ontology/> > PREFIX rdfs: > <http://www.w3.org/2000/01/rdf-schema#> SELECT > DISTINCT ?uri ?label > ?dis > ?ann WHERE {?uri a mbo:Artist. ?uri rdfs:label > ?label. OPTIONAL {?uri > mbo:disambiguation ?dis}. OPTIONAL {?uri > mbo:annotation ?ann}. } > > With a similar query, I don't get any error: > > PREFIX mbo: <http://creativeartefact.org/ontology/> > PREFIX rdfs: > <http://www.w3.org/2000/01/rdf-schema#> SELECT > DISTINCT * WHERE {?uri a > mbo:Organiser. ?uri rdfs:label ?label. OPTIONAL > {?uri mbo:city ?city}. > OPTIONAL {?uri mbo:street ?street}. OPTIONAL {?uri > mbo:postalcode > ?postalcode}. } > > When running the problematic query in the > browser-frontend of my > sparql-endpoint, I get the results as expected. Any > idea, where the > problem might be? > > Ciao, > 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! * > ************************************************ > > -------------------------------------------------------------------------- > ---- > 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.clkt > rk > _______________________________________________ > dotNetRDF-Support mailing list > dot...@li... > <mailto:dot...@li...> > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-support > > > > > > > ------------------------------------------------------------------------------ > 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-Support mailing list > dot...@li... > <mailto: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! * > ************************************************ > > ------------------------------------------------------------------------------ > 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-Support mailing list > dot...@li... > <mailto:dot...@li...> > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-support > > > > ------------------------------------------------------------------------------ > 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-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! * ************************************************ |