Troubleshooting SPARQL rCurl queries in R

旧城冷巷雨未停 提交于 2021-02-20 02:35:27

问题


I'm doing a sparql query against an authenticated endpoint in R using the SPARQL library. The same query/endpoint/user works using the rrdf package. Unfortuantely, once I get the query working, I need to process the data in R and update the graph with the answers, which rrdf can't do.

Setting up a few variables first, the below query works using rrdf: sparql.remote(myEndpoint,myQuery,'rowvar',myUsername,myUserpwd)

Using SPARQL, this does not work: SPARQL(myEndpoint,myQuery,curl_args=c('username'=myUsername,'userpwd'=myUserpwd))

The error is Error: XML content does not seem to be XML: '' which I think means no document is coming back.

So, any tips on how to debug the curl call underneath all this?


回答1:


And the solution in this case was that the username parameter is not used in curl. The correct call is: SPARQL(myEndpoint,myQuery,curl_args=c('userpwd'=paste(myUsername,':',myUserpwd,sep='')))

Actually debugging it was done via calls to getURL from RCurl against the basic endpoint until I got something that worked. getURL(url=endpoint,userpwd="testusername:testpassword",verbose=TRUE)

Hope this helps someone.



来源:https://stackoverflow.com/questions/24401227/troubleshooting-sparql-rcurl-queries-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!