Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPARQL queries need checking for filtering for labels to use the UI language, not English hardcoded #1640

Open
egonw opened this issue Aug 29, 2021 · 4 comments
Labels
events events relevant to Scholia internationalization making Scholia usable in more languages

Comments

@egonw
Copy link
Collaborator

egonw commented Aug 29, 2021

Multiple SPARQL queries filter labels with the language hardcoded. This needs an i18n round to check them all. Example:

https://github.com/WDscholia/scholia/blob/master/scholia/app/templates/work_data.sparql#L38

@carlinmack carlinmack added the internationalization making Scholia usable in more languages label Aug 29, 2021
@carlinmack
Copy link
Collaborator

In total 43 sparql files need to be updated to use the UI language:

  1. author_events.sparql
  2. author_list-of-publications.sparql
  3. author_other-locations.sparql
  4. author_pages-per-year.sparql
  5. author_review-statistics.sparql
  6. author_timeline.sparql
  7. author_venue-statistics-chart.sparql
  8. author_venue-statistics.sparql
  9. authors_citations-per-publication-year.sparql
  10. authors_list-of-jointly-authored-works.sparql
  11. authors_works-per-publication-year.sparql
  12. award_locations-of-recipients.sparql
  13. chemical_class_recent-literature.sparql
  14. chemical_element_recent-literature.sparql
  15. chemical_recent-literature.sparql
  16. clinical-trial_data.sparql
  17. complex_articles-recent.sparql
  18. complex_participants.sparql
  19. country_locations-as-topics.sparql
  20. country_narrative-locations.sparql
  21. dataset_list-of-authors.sparql
  22. event_recent-publications.sparql
  23. event_series_recent-publications.sparql
  24. gene_variants.sparql
  25. organization_awards.sparql
  26. organization_page-production.sparql
  27. organization_recent-literature.sparql
  28. pathway_participants.sparql
  29. pathway_recent-articles.sparql
  30. project_recent-articles.sparql
  31. publisher_editor-photos.sparql
  32. publisher_editors.sparql
  33. publisher_journals.sparql
  34. taxon_parent-taxa.sparql
  35. taxon_tree.sparql
  36. topic_author-awards.sparql
  37. topic_earliest-published-works.sparql
  38. topic_recently-published-works.sparql
  39. topics_list-of-works.sparql
  40. venue_recently-published-works.sparql
  41. work_citation-graph.sparql
  42. work_data.sparql
  43. work_list-of-authors.sparql

@curibe
Copy link
Collaborator

curibe commented Aug 30, 2021

Hi @egonw @carlinmack. We are working on it in this PR #1609 by the way; however, I'm not sure about something:

We could put the cookie variable inside the filter lang (FILTER(LANG(?topic_label) = '{{ g.lang_code }}') ) but if there are cases where the label has no content in that language, it may return an empty value. In that case, an option would be to put [AUTO_LANGUAGE] instead of the cookie, as shown in the example of wikidata(https://www.wikidata.org/wiki/Wikidata:SPARQL_tutorial/en#FILTER).

This query works perfectly if you do it in the wikidata tool and select a language (query url) :

image

However, when querying the url and asked to return in json format, that field is not returned:

image

This causes that the field cannot be displayed in the table.

image

Maybe the translation with AUTO_LANGUAGE is done after the query? Maybe you know why this happens?

@Daniel-Mietchen
Copy link
Member

Not sure, so I asked here.

@lucaswerkmeister
Copy link
Contributor

AUTO_LANGUAGE is substituted by the https://query.wikidata.org/ UI before the query gets sent to the https://query.wikidata.org/sparql backend – what Blazegraph sees is e.g. SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". } (if the original query had "[AUTO_LANGUAGE],en" and the user interface language happens to be German). You should be able to add a similar line to the queries you send.

@Daniel-Mietchen Daniel-Mietchen added the events events relevant to Scholia label Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
events events relevant to Scholia internationalization making Scholia usable in more languages
Projects
None yet
Development

No branches or pull requests

5 participants