Skip to content

Python Client

Eugene edited this page Nov 10, 2020 · 1 revision

SPARQLWrapper

Installation

pip install SPARQLWrapper

Query Apache Jena Fuseki Server

from SPARQLWrapper import SPARQLWrapper, JSON

sparql = SPARQLWrapper("http://localhost:3030/t1")

sparql.setQuery("""
SELECT *
WHERE {
  ?id <pds:search_name> "bennu".
}
""")

sparql.setReturnFormat(JSON)
response = sql.queryAndConvert()
for res in response:
    print(res['id']['value'])

Clone this wiki locally