Skip to content

fix: edit wikidata.py to make it work(especially for ./examples/01_prepare_data/wikidata_knowledge_graph.ipynb)#2311

Open
LioneWang wants to merge 2 commits into
recommenders-team:stagingfrom
LioneWang:main
Open

fix: edit wikidata.py to make it work(especially for ./examples/01_prepare_data/wikidata_knowledge_graph.ipynb)#2311
LioneWang wants to merge 2 commits into
recommenders-team:stagingfrom
LioneWang:main

Conversation

@LioneWang

@LioneWang LioneWang commented Apr 27, 2026

Copy link
Copy Markdown

Description

Related Issues

References

Checklist:

  • I have followed the contribution guidelines and code style for this project.
  • I have added tests covering my contributions.
  • I have updated the documentation accordingly.
  • I have signed the commits, e.g. git commit -s -m "your commit message".
  • This PR is being made to staging branch AND NOT TO main branch.

@ds-wook

ds-wook commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Hi! Just a quick note — PRs shouldn’t be opened against the main branch. Could you please submit it to the staging branch instead?

For reference, please see the contributing guide:
https://github.com/recommenders-team/recommenders/blob/main/CONTRIBUTING.md

@miguelgfierro miguelgfierro changed the base branch from main to staging May 3, 2026 05:52

API_URL_WIKIPEDIA = "https://en.wikipedia.org/w/api.php"
API_URL_WIKIDATA = "https://query.wikidata.org/sparql"
WIKIDATA_API_URL = "https://www.wikidata.org/w/api.php"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WIKIDATA_API_URL = "https://www.wikidata.org/w/api.php"
API_URL_WIKIPEDIA = "https://www.wikidata.org/w/api.php"
API_URL_WIKIDATA = "https://query.wikidata.org/sparql"

better to keep the same name for consistency. And we can't erase the sparql endpoint, otherwise the rest of the tests will fail: python -m pytest tests/data_validation/recommenders/datasets/test_wikidata.py -v

try:
response = session.get(API_URL_WIKIPEDIA, params=params)
response.raise_for_status() # Raise HTTPError for bad responses
response = session.get(WIKIDATA_API_URL, params=params)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
response = session.get(WIKIDATA_API_URL, params=params)
response = session.get(API_URL_WIKIPEDIA, params=params)

As mentioned above, better to keep the name for consistency

@miguelgfierro

Copy link
Copy Markdown
Collaborator

there are some errors:

(596 durations < 0.005s hidden.  Use -vv to show these durations.)
=========================== short test summary info ============================
FAILED tests/data_validation/recommenders/datasets/test_wikidata.py::test_query_entity_links
FAILED tests/data_validation/recommenders/datasets/test_wikidata.py::test_read_linked_entities
FAILED tests/data_validation/recommenders/datasets/test_wikidata.py::test_query_entity_description

FYI @LioneWang

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants