In Python it's much easier to parse the response if you request the results
in JSON format. But you don't need to go that low level, SPARQLWrapper
takes care of that: https://rdflib.github.io/sparqlwrapper


On Fri, Jul 12, 2019, 12:09 Jim Amsden <[email protected]> wrote:

> I'm using REST to sent a SPARQL query to an endpoint and get back a SPARQL
> result set:
> ```
> <?xml version="1.0"?>
> <sparql xmlns="http://www.w3.org/2005/sparql-results#";>
>   <head>
>     <variable name="validate"/>
>     <variable name="cr"/>
>     <variable name="tc"/>
>     <variable name="req"/>
>   </head>
>   <results>
>     <result>
>       <binding name="validate">
>         <uri>http://open-services.net/ns/qm#validatesRequirement</uri>
>       </binding>
>       <binding name="cr">
>         <uri>
> https://jazz.net/jazz04/resource/itemName/com.ibm.team.workitem.WorkItem/60473
> </uri>
>       </binding>
>       <binding name="tc">
>         <uri>
> https://resrqm01.rtp.raleigh.ibm.com/jazz/oslc_qm/contexts/_o64HCfN1EeGUsuEuz3OuUg/resources/com.ibm.rqm.planning.VersionedTestCase/_fXwlwPauEee80bay3j65vA
> </uri>
>       </binding>
>     </result>
> ...
> ```
> How can I use rdflib (or something more appropriate to parse this into
> something I can iterate on?
>
> I tried using an XMLResult, but I'm not clear what its constructor expects
> its source object to be - something that can be read? In any case, it
> doesn't accept a string.
>
> I could just use XML, but I was hoping to eventually find an easy way to
> convert this result set into a DataFrame.
>
>
> --
> http://github.com/RDFLib
> ---
> You received this message because you are subscribed to the Google Groups
> "rdflib-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rdflib-dev/c3f1b728-57cf-43cc-a324-5f600a89b592%40googlegroups.com
> <https://groups.google.com/d/msgid/rdflib-dev/c3f1b728-57cf-43cc-a324-5f600a89b592%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
http://github.com/RDFLib
--- 
You received this message because you are subscribed to the Google Groups 
"rdflib-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rdflib-dev/CAKZ-WGcUwjVGDdCik4P%3DdHboKAjbS0XGEpBM%3DJ8auUPWVaViZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to