Skip to content

Commit

Permalink
Allow use of Qlever endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Adafede committed Nov 22, 2023
1 parent e448fa6 commit 25543fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions update/common.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import requests

WD_URL = "https://query.wikidata.org/sparql"
QLEVER_URL = "https://qlever.cs.uni-freiburg.de/api/wikidata"


def wd_sparql_to_csv(query: str) -> str:
def wd_sparql_to_csv(query: str, url: str = WD_URL) -> str:
return requests.get(
WD_URL, params={"query": query}, headers={"Accept": "text/csv"}
url, params={"query": query}, headers={"Accept": "text/csv"}
).text


Expand Down
2 changes: 1 addition & 1 deletion update/download_taxonomy_parenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from io import StringIO
from pathlib import Path

from update.common import remove_wd_entity_prefix, wd_sparql_to_csv
from update.common import remove_wd_entity_prefix, wd_sparql_to_csv, QLEVER_URL

query_taxa = """
SELECT DISTINCT ?taxon ?taxon_name ?taxon_rank ?parent WITH {
Expand Down

0 comments on commit 25543fa

Please sign in to comment.