尝试将新条目插入Dydra SPARQL端点时,身份验证失败。使用select语句时,一切工作正常。你知道为什么吗?
from SPARQLWrapper import SPARQLWrapper, JSON
insert_query = """INSERT DATA
{
<http://dydra.com/cornelpaul/rout/sparql/personsRoot/__Python_User> foaf:name "__X__";
foaf:nick "Python_nick";
rdf:type foaf:Person.
}
"""
select_query = """SELECT ?persoana
WHERE {
?persoana rdf:type foaf:Person;
}
"""
dydra_api_key = "PZEI7LyVitRuvrVyqhnB"
sparql = SPARQLWrapper("https://dydra.com/cornelpaul/rout/sparql")
sparql.setReturnFormat(JSON)
sparql.setCredentials(dydra_api_key, dydra_api_key)
sparql.method = "POST"
# sparql.method = "GET"
sparql.setQuery(insert_query)
results = sparql.query().convert()
print(len(results["results"]["bindings"]))
for result in results["results"]["bindings"]:
print(result)