sparql with python - INSERT triple with apostrophe

时间:2015-10-03 15:23:47

标签: python sparql sparqlwrapper

我在执行sparql更新时遇到了一些麻烦。正如标题所说,问题是查询的第二个三元组中的撇号。这是错误:

Response: Error 400: Lexical error at line 20,column 229. Encountered " " (32) after: "s"

这是python中的代码:

from SPARQLWrapper import SPARQLWrapper


def Query(query):
    sparql=SPARQLWrapper("http://localhost:3030/ann/update")
    sparql.setQuery(query)
    sparql.method='POST'
    sparql.query()

query = """INSERT DATA {
           <http://www.example.com> a <http://purl.org/spar/fabio/Item>;
           rdfs:label 'Webpage's title'^^<http://www.w3.org/2000/01/rdf-schema#string>.
        }"""

Query(query)

关于如何做的任何想法?

0 个答案:

没有答案