Have you seen the SPARQLWrapper module in the rdflib family: https://github.com/rdflib/SPARQLWrapper?
The first example in the README iterates over a SELECT. Nick — Nicholas Car Data Systems Architect SURROUND Australia 0477 560 177 [email protected] > On 13 Jul 2019, at 5:09 am, 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. > 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/E4A08911-F718-47FE-B1F8-68F654400F1E%40surroundaustralia.com. For more options, visit https://groups.google.com/d/optout.
