Bug CORE-219
1 vote

Sesame returns application/xml Content Type for SELECT query and dotNetRDF fails to parse response

Created by Rob Vesse on 3/30/2012 8:06 PM Last Updated by Rob Vesse on 8/23/2012 6:00 PM
%
 (hrs)
Logged: 0  (hrs)

 Description

Reported via direct email to myself by Constantinos Orphanides

 

Original stack trace:

'[Line 5 Column 15] Expected an ElementEvent but encountered a 'VDS.RDF.Parsing.Events.RdfXml.EndElementEvent' Occurred in Grammar Production 'PropertyElement' '. See server logs for more details. The exception stack trace is:
at VDS.RDF.Parsing.RdfXmlParser.GrammarProductionPropertyElement(RdfXmlParserContext context, IEventQueue`1 eventlist, IRdfXmlEvent parent) at VDS.RDF.Parsing.RdfXmlParser.GrammarProductionPropertyElementList(RdfXmlParserContext context, IEventQueue`1 eventlist, IRdfXmlEvent parent) at VDS.RDF.Parsing.RdfXmlParser.GrammarProductionNodeElement(RdfXmlParserContext context, IEventQueue`1 eventlist) at VDS.RDF.Parsing.RdfXmlParser.GrammarProductionResourcePropertyElement(RdfXmlParserContext context, IEventQueue`1 eventlist, IRdfXmlEvent parent) at VDS.RDF.Parsing.RdfXmlParser.GrammarProductionPropertyElement(RdfXmlParserContext context, IEventQueue`1 eventlist, IRdfXmlEvent parent) at VDS.RDF.Parsing.RdfXmlParser.GrammarProductionPropertyElementList(RdfXmlParserContext context, IEventQueue`1 eventlist, IRdfXmlEvent parent) at VDS.RDF.Parsing.RdfXmlParser.GrammarProductionNodeElement(RdfXmlParserContext context, IEventQueue`1 eventlist) at VDS.RDF.Parsing.RdfXmlParser.GrammarProductionNodeElementList(RdfXmlParserContext context, IEventQueue`1 eventlist) at VDS.RDF.Parsing.RdfXmlParser.GrammarProductionDoc(RdfXmlParserContext context, RootEvent root) at VDS.RDF.Parsing.RdfXmlParser.ProcessEventQueue(RdfXmlParserContext context) at VDS.RDF.Parsing.RdfXmlParser.Parse(RdfXmlParserContext context) at VDS.RDF.Parsing.RdfXmlParser.Load(IRdfHandler handler, TextReader input) at VDS.RDF.Parsing.RdfXmlParser.Load(IRdfHandler handler, StreamReader input) at VDS.RDF.Storage.BaseSesameHttpProtocolConnector.Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, String sparqlQuery) at VDS.RDF.Storage.BaseSesameHttpProtocolConnector.Query(String sparqlQuery) at ContextCreator.FcaBedrock.ContextCreator.IFcaBedrock.PostFormalContextJson(String sparqlQuery, String repositoryId, String repositoryConnection, String minSuppObjs, String minSuppAtts) in C:\Users\acesco1\Desktop\ContextCreator\ContextCreator\ContextCreator\FcaBedrock.svc.cs:line 109 at SyncInvokePostFormalContextJson(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

 

Requested he turn on HTTP debugging and got the following dump:

 

# HTTP DEBUGGING #
HTTP Request to http://cubist.hallam.shu.ac.uk:8080/openrdf-workbench/repositori
es/CUBISTHWU?query=PREFIX%20rdfs%3A%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-
schema%23%3E%20PREFIX%20rdf%3A%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-sy
ntax-ns%23%3E%20PREFIX%20hwu%3A%3Chttp%3A%2F%2Fwww.cubist_project.eu%2FHWU%23%3E
%20PREFIX%20%3A%3Chttp%3A%2F%2Fwww.cubist_project.eu%2FHWU%23%3E%20PREFIX%20owl%
3A%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%3E%20PREFIX%20xsd%3A%3Chttp%3A
%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%20SELECT%20DISTINCT%20%3Fo1%20%3Fa1%20
WHERE%20%7B%20%3Fx1%20rdf%3Atype%20%3ATissue%20%3B%20rdfs%3Alabel%20%3Fo1%20.%20
%3Fx1%20hwu%3Ahas_theiler_stage%20hwu%3Atheiler_stage_07%20.%20OPTIONAL%20%7B%20
%3Fx3%20rdf%3Atype%20%3AGene%20%3B%20rdfs%3Alabel%20%3Fa1%20.%20%20%20%3Fx2%20rd
f%3Atype%20%20Textual_Annotation%20.%20%20%20%3Fx2%20hwu%3Ain_tissue%20%3Fx1%20.
%20%20%20%3Fx2%20hwu%3Ahas_involved_gene%20%3Fx3%20.%20%20%20%3Fx2%20hwu%3Ahas_s
trength%20hwu%3Alevel_detected%20.%7D%20%7D%20ORDER%20BY%20%3Fo1%20%3Fa1

GET
Accept:application/rdf+xml,text/xml,application/xml,text/plain,text/ntriples,tex
t/ntriples+turtle,application/rdf-triples,application/x-ntriples,text/turtle,app
lication/x-turtle,application/turtle,text/n3,text/rdf+n3,application/sparql-resu
lts+xml,application/sparql-results+json,text/boolean,application/json,text/json,
text/csv,text/comma-separated-values,text/tab-separated-values,text/html,applica
tion/xhtml+xml,*/*;q=0.5


HTTP Response from http://cubist.hallam.shu.ac.uk:8080/openrdf-workbench/reposit
ories/CUBISTHWU/summary
HTTP/1.1 200 OK

Content-Length:969
Content-Type:application/xml;charset=UTF-8
Date:Fri, 30 Mar 2012 17:30:53 GMT
Last-Modified:Thu, 29 Mar 2012 21:41:05 GMT
Server:Apache-Coyote/1.1

<?xml version='1.0' encoding='utf-8'?>
<?xml-stylesheet type='text/xsl' href='/openrdf-workbench/transformations/summar
y.xsl'?>
<sparql xmlns='http://www.w3.org/2005/sparql-results#' xmlns:q='http://www.openr
df.org/schema/qname#'>
  <head>
    <variable name='id'/>
    <variable name='description'/>
    <variable name='location'/>
    <variable name='server'/>
    <link href='info'/>
  </head>
  <results ordered='false' distinct='false'>
    <result>
      <binding name='id'>
        <literal>CUBISTHWU</literal>
      </binding>
      <binding name='description'>
        <literal>CUBIST HWU Data</literal>
      </binding>
      <binding name='location'>
        <literal>http://cubist.hallam.shu.ac.uk:8080/openrdf-sesame/repositories
/CUBISTHWU</literal>
      </binding>
      <binding name='server'>
        <literal>http://cubist.hallam.shu.ac.uk:8080/openrdf-sesame</literal>
      </binding>
    </result>
  </results>
</sparql>

# END HTTP DEBUGGING #
Unable to Parse this RDF/XML since System.Xml was unable to parse the document,
see Inner Exception for details

 

The bug is caused by Sesame returning application/xml as the content type for the RDF response which dotNetRDF maps to RDF/XML and not to SPARQL XML results so the wrong parser gets used and an eror is thrown

    Rob Vesse (Tuesday, July 03, 2012 2:04 AM) #

Have not heard any further response on whether our efforts resolve this issue from the user who reported it, can assume may persist and will proceed with it as a known issue for the release

    Rob Vesse (Thursday, May 31, 2012 8:01 PM) #

Hopefully we now have a workaround for this and we are waiting on user confirmation of the fix

    Rob Vesse (Monday, April 02, 2012 7:42 PM) #

Issue has been reported as still being present in 0.6.2

 

# HTTP DEBUGGING #
HTTP Request to http://cubist.hallam.shu.ac.uk:8080/openrdf-workbench/repositori
es/CUBISTHWU?query=PREFIX%20rdfs%3A%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-
schema%23%3E%20PREFIX%20rdf%3A%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-sy
ntax-ns%23%3E%20PREFIX%20hwu%3A%3Chttp%3A%2F%2Fwww.cubist_project.eu%2FHWU%23%3E
%20PREFIX%20%3A%3Chttp%3A%2F%2Fwww.cubist_project.eu%2FHWU%23%3E%20PREFIX%20owl%
3A%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%3E%20PREFIX%20xsd%3A%3Chttp%3A
%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%20SELECT%20DISTINCT%20%3Fo1%20%3Fa1%20
WHERE%20%7B%20%3Fx1%20rdf%3Atype%20%3ATissue%20%3B%20rdfs%3Alabel%20%3Fo1%20.%20
%3Fx1%20hwu%3Ahas_theiler_stage%20hwu%3Atheiler_stage_07%20.%20OPTIONAL%20%7B%20
%3Fx3%20rdf%3Atype%20%3AGene%20%3B%20rdfs%3Alabel%20%3Fa1%20.%20%20%20%3Fx2%20rd
f%3Atype%20%20Textual_Annotation%20.%20%20%20%3Fx2%20hwu%3Ain_tissue%20%3Fx1%20.
%20%20%20%3Fx2%20hwu%3Ahas_involved_gene%20%3Fx3%20.%20%20%20%3Fx2%20hwu%3Ahas_s
trength%20hwu%3Alevel_detected%20.%7D%20%7D%20ORDER%20BY%20%3Fo1%20%3Fa1

GET
Accept:application/rdf+xml,text/xml,application/xml,application/rdf+xml,text/xml
,application/xml,text/plain,text/ntriples,text/ntriples+turtle,application/rdf-t
riples,application/x-ntriples,text/plain,text/ntriples,text/ntriples+turtle,appl
ication/rdf-triples,application/x-ntriples,text/turtle,application/x-turtle,appl
ication/turtle,text/turtle,application/x-turtle,application/turtle,text/n3,text/
rdf+n3,text/n3,text/rdf+n3,application/sparql-results+xml,application/sparql-res
ults+xml,application/sparql-results+json,application/sparql-results+json,text/bo
olean,application/json,text/json,application/json,text/json,text/csv,text/comma-
separated-values,text/csv,text/comma-separated-values,text/tab-separated-values,
text/tab-separated-values,text/html,application/xhtml+xml,text/html,application/
xhtml+xml,*/*;q=0.5


HTTP Response from http://cubist.hallam.shu.ac.uk:8080/openrdf-workbench/reposit
ories/CUBISTHWU/summary
HTTP/1.1 200 OK

Content-Length:969
Content-Type:application/xml;charset=UTF-8
Date:Mon, 02 Apr 2012 18:24:44 GMT
Last-Modified:Thu, 29 Mar 2012 21:41:05 GMT
Server:Apache-Coyote/1.1

<?xml version='1.0' encoding='utf-8'?>
<?xml-stylesheet type='text/xsl' href='/openrdf-workbench/transformations/summar
y.xsl'?>
<sparql xmlns='http://www.w3.org/2005/sparql-results#' xmlns:q='http://www.openr
df.org/schema/qname#'>
  <head>
    <variable name='id'/>
    <variable name='description'/>
    <variable name='location'/>
    <variable name='server'/>
    <link href='info'/>
  </head>
  <results ordered='false' distinct='false'>
    <result>
      <binding name='id'>
        <literal>CUBISTHWU</literal>
      </binding>
      <binding name='description'>
        <literal>CUBIST HWU Data</literal>
      </binding>
      <binding name='location'>
        <literal>http://cubist.hallam.shu.ac.uk:8080/openrdf-sesame/repositories
/CUBISTHWU</literal>
      </binding>
      <binding name='server'>
        <literal>http://cubist.hallam.shu.ac.uk:8080/openrdf-sesame</literal>
      </binding>
    </result>
  </results>
</sparql>

# END HTTP DEBUGGING #
Unable to Parse this RDF/XML since System.Xml was unable to parse the document,
see Inner Exception for details

 

    Rob Vesse (Friday, March 30, 2012 9:12 PM) #

Made a couple of tweaks to Sesame query submission both to better set the Accept Header and to more intelligently choose the parser