Skip to content

Instantly share code, notes, and snippets.

@kozo2
Last active June 13, 2016 12:45
Show Gist options
  • Select an option

  • Save kozo2/ecc4312f3dcc00418a5514b7bf517e1e to your computer and use it in GitHub Desktop.

Select an option

Save kozo2/ecc4312f3dcc00418a5514b7bf517e1e to your computer and use it in GitHub Desktop.
biohack16
from SPARQLWrapper import SPARQLWrapper, JSON
#sparql = SPARQLWrapper("http://sparql.uniprot.org/")
sparql = SPARQLWrapper("http://sparql.uniprot.org/sparql/")
sparql.setQuery("""
PREFIX up:<http://purl.uniprot.org/core/>
SELECT ?taxon
FROM <http://sparql.uniprot.org/taxonomy/>
WHERE
{
?taxon a up:Taxon .
}
""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
print(results['results']['bindings'])
@kozo2

kozo2 commented Jun 13, 2016

Copy link
Copy Markdown
Author

@JervenBolleman Sorry my reply is late.
Thank you very much.
New endpoint works well for Python SPARQLWrapper package.
I replaced
"http://sparql.uniprot.org/" to "http://sparql.uniprot.org/sparql/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment