Skip to content

Instantly share code, notes, and snippets.

@ettorerizza
Last active August 12, 2024 14:38
Show Gist options
  • Save ettorerizza/db45122069dc47c82a06c1a0cb0daeeb to your computer and use it in GitHub Desktop.
Save ettorerizza/db45122069dc47c82a06c1a0cb0daeeb to your computer and use it in GitHub Desktop.
Yago sparql example in Python
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("https://linkeddata1.calcul.u-psud.fr/sparql")
sparql.setQuery("""
select *
where {
<http://yago-knowledge.org/resource/Elvis_Presley> ?property ?valueOrObject .
}
LIMIT 100""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
print(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment