Python Client - NASA-PDS/product_relationships GitHub Wiki

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'])