Last active
August 12, 2024 14:38
-
-
Save ettorerizza/db45122069dc47c82a06c1a0cb0daeeb to your computer and use it in GitHub Desktop.
Yago sparql example in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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