Python RDF4J REST API更新返回500,“事务处理错误:java.util.concurrent.ExecutionException:java.lang.NullPointerException”

Python RDF4J REST API更新返回500,“事务处理错误:java.util.concurrent.ExecutionException:java.lang.NullPointerException”,python,rest,api,rdf4j,Python,Rest,Api,Rdf4j,我正在使用python查询RDF4J的RESTAPI,但我似乎无法让它像文档中描述的那样工作 我正在执行一个select语句,该语句工作正常,但当我尝试执行insert语句时,会出现以下错误: "500, 'Transaction handling error: java.util.concurrent.ExecutionException: java.lang.NullPointerException'" 要执行POST请求,我生成一个事务ID,然后执行实际的POST请求: # Genera

我正在使用python查询RDF4J的RESTAPI,但我似乎无法让它像文档中描述的那样工作

我正在执行一个select语句,该语句工作正常,但当我尝试执行insert语句时,会出现以下错误:

"500, 'Transaction handling error: java.util.concurrent.ExecutionException: java.lang.NullPointerException'"
要执行POST请求,我生成一个事务ID,然后执行实际的POST请求:

# Generate tranzaction ID
transaction_id = requests.post('http://localhost:8080/rdf4j-server/repositories/ProiectICVG/transactions')enter code here
transaction_id = transaction_id.headers['Location']
transaction_id = string.split(transaction_id, '/')
transaction_id = transaction_id[-1]

#Make the post request
return_data = requests.post('http://localhost:8080/rdf4j-server/repositories/ProiectICVG/transactions/'+transaction_id+'?action=UPDATE',
                         data={'Host': 'localhost',
                               'Content-Type': 'application/sparql-query',
                               'query': 'PREFIX : <http://proj.local#>\
                                        insert data {\
                                        graph :isIncidentGraph{\
                                        :INC005 :hasTtile "test".}'
                               })
print(return_data.status_code, return_data.content)

我真的很感谢你在这方面的帮助

你可以在@Jeen Broekstra发布的评论部分找到答案:

你在做一篇文章 文档说明您应该使用PUT:


不确定这是否解决了您的错误,但您正在写一篇文章,文档中说您应该使用PUT:Yep,就是这个。使用错误的请求。谢谢@JeenBroekstra
"C:\Python27\python.exe D:/xamp/cgi-bin/index.py
(500, 'Transaction handling error: java.util.concurrent.ExecutionException: java.lang.NullPointerException')

Process finished with exit code 0