Hi Stephen,

There’s not really enough information in the error you’ve given below for me to 
work out your problem. It looks like your posted text is cut-off.

I’m assuming you get no error when parsing the ontology itself, i.e. this line:

> g.parse('definitions/HR_Reference_Ontology.xml')
> 

The way you’ve posed the query to the graph is correct:

> qres = g.query(qbank)  
> 

The loop loos correct too:

> for row in qres:
> 
>     print(row)
> 
So, it looks like the only issue you have is that there’s an error with your 
SPARQL query. If you can post your query here, perhaps we can have a look at 
it. Just note though, actually working through your SPARQL query is a little 
off-topic for rdflid questions as it’s really about SPARQL, not the rdflib 
library.

Regards,

Nick





> On 20 Feb 2020, at 2:10 am, Stephen H. Kim <[email protected]> wrote:
> 
> pls help :(
> 
> On Wednesday, February 19, 2020 at 10:59:43 AM UTC-5, Stephen H. Kim wrote:
> Hi,
> 
>  
> 
> I am basically trying to have a giant text file with SPARQL code line by 
> line. I want the transformation to be invoked into the graph line by line as 
> well and run the transformation.
> 
> So far, I didnt have any luck. i've been reading up the documentation and 
> modyfing my code accordingly but doc does not seem to mention invoking a 
> separate file for SPARQL queries.... 
> 
>  
> 
>  
> 
>  
> 
> Here is the code I have been working on:
> 
>  
> 
>  
> 
> import os
> 
> with open('/cs/samirage/stephen/querystringtest.rq', 'r') as qbank:
> 
>     qbank = qbank.read()
> 
>  
> 
> g = rdflib.Graph()
> 
> g.parse('definitions/HR_Reference_Ontology.xml')
> 
>  
> 
>  
> 
> qres = g.query(qbank)  
> 
>  
> 
> ## ParseException: Expected end of text (at char 32), (line:3, col:1) instead 
> of 
> 
>  
> 
>  
> 
> for row in qres:
> 
>     print(row)
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> not sure if it is clear from the code, but i am trying to invoke the SPARQL 
> code iteratively with the for loop, which will run the SPARQL queries into 
> the graph.  
> 
> qbank is the file with SPARQL querie and the .xml is the graph model. 
> 
> 
> -- 
> http://github.com/RDFLib <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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rdflib-dev/3b8319fe-a6f2-47c6-8ae2-f348dac28fd1%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/rdflib-dev/3b8319fe-a6f2-47c6-8ae2-f348dac28fd1%40googlegroups.com?utm_medium=email&utm_source=footer>.

______________________________________________________________________________________
        
Dr Nicholas Car
Data Systems Architect
SURROUND Australia Pty Ltd      
Address P.O. Box 86, Mawson, Canberra ACT 2607
Phone  +61 477 560 177 
<tel:+61+414+99+55+43?utm_source=WiseStamp&utm_medium=email&utm_term=&utm_content=&utm_campaign=signature>
Email  [email protected]
Website  https://surroundaustralia.com
Enhancing Intelligence Within Organisations
delivering evidence that connects decisions to outcomes





-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/rdflib-dev/68155AF1-CD99-4B49-938B-F72CC68C81D4%40surroundaustralia.com.

Reply via email to