2

I parse a database into an RDFlib graph. I now want to INSERT the triples from this graph into the GraphDB triple store. The code works fine when I execute it on an older version of GraphDB-Lite hosted on Sesame. However, I get an error while executing the same query on the now standalone GraphDB 7.0.0. The graph is partially parsed before the error is raised and the inserted triples do show up in the triple store.

This is part of the code:

graphdb_url = 'http://my.ip.address.here:7200/repositories/Test3/statements'
##Insert into Sesame
        for s,p,o in graph1:
            pprint.pprint ((s,p,o))
            queryStringUpload = 'INSERT DATA {%s %s %s}'  %(s,p,o)
            # queryStringUpload = 'DELETE WHERE {?s ?p ?o .}'
            # print queryStringUpload
            sparql = SPARQLWrapper(graphdb_url)
            sparql.method = 'POST'
            sparql.setQuery(queryStringUpload)
            sparql.query() 

Following is the error:

ARQLWrapper.SPARQLExceptions.QueryBadFormed: QueryBadFormed: a bad request has been sent to the endpoint, probably the sparql query is bad formed. 

Response:
MALFORMED QUERY: Lexical error at line 1, column 93.  Encountered: "/" (47), after : "purl.org"

What is causing the error and how do I resolve it?

1 Answer 1

5

It was a syntax error. I had URIs starting with http:/ instead of http:// in some places.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.