-
Notifications
You must be signed in to change notification settings - Fork 10
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
Feature: make the api use submission naturalLanguage to choose the default language to display #149
Conversation
ab88459
to
c57a7ad
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/multilingual-support-add-language-request-middleware #149 +/- ##
================================================================================================
+ Coverage 73.28% 73.37% +0.09%
================================================================================================
Files 53 53
Lines 2916 2926 +10
================================================================================================
+ Hits 2137 2147 +10
Misses 779 779
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…eware' into pr/sync-agroportal-bioportal
c57a7ad
to
9892e98
Compare
d9398ce
into
ncbo:feature/multilingual-support-add-language-request-middleware
@alexskr Addressing the issue with a default language per ontology (rather than a portal overall default language) will only address the problem partially. |
In other words, making the backend multilingual without making the UI multilingual is limited... mostly because it hides 90% of the advantages of having BioPortal multilingual if its not done in the UI. And UI/API have somehow to evolve in parallel especially for this kind of big evolution. |
We understand that the UI needs additional work for full multi-lingual support. However, I think that the API should serve expected content when API users make calls without specifying a language. If an ontology is primarily in German, then wouldn't it be expected to see the default output in German instead of blank entries? Alternatively, perhaps the default API behavior should be equivalent to lang=all. |
@alexskr I kind of agree with "If an ontology is primarily in German, then wouldn't it be expected to see the default output in German instead of blank entries?" And the list of the naturalLanguage values will need to be ordered (hence the UI too) so we now the first one is the primary. Implementing a "default" behviour at the level of the portal avoid relying on a property that is not necessarily filled in. |
Yes, this is realistic. @caufieldjh has already curated language tags for all of the ontologies in BioPortal. At this point we simply need to get the data from him and programmatically populate the
For clarification, the BioPortal Rails application has been modified to allow a user to select the language or languages for their ontology content. However, the language selector doesn't offer a way to order the languages. I haven't been involved in the multilingual support effort, so I may be missing some background. In my mind, the concepts of specifying the language of ontology content and specifying the preferred language for serving the ontology are two different things. The Rails application doesn't currently support the latter. I think an end user should be able to say that their ontology is available in English, French, and German, and separately be able to say that they want BioPortal to default to serving the French version (for example). |
Language tag table is here: https://docs.google.com/spreadsheets/d/1rYHzsSUNjjRpgD2LxxmvCvg13P-w5g-HvsUvk8VNNJ0/edit?usp=sharing |
Would it be possible to extract all language tags that are present in the ontology file automatically and fill in @jonquet how does AgroPortal construct the drop down language selector in the UI? |
It should be the responsibility of the ontology author to specify the language of the content of their ontology. If they encode it in the ontology source file, then yes - we could extract it at the time that we ingest the ontology. This would be part of the owlapi_wrapper code base, not this one. As a simple first step, we should move forward with programmatically incorporating the data that Harry provided.
It's not clear what you refer to here. Do you mean the language selector on the add / edit submission form? Or the language selector on the ontology summary pages? |
The ontology summary page in Agroportal lists all languages available in the ontology, and we can select one of those languages to view that ontology. That list is generated from somewhere, so my question to @jonquet is whether they manually added it to each ontology or if it was automatically generated. |
Eventually this should come. But this is another "module" at ontology aprsing time that we call "metadata generation" ... right now we are doing only "metadata extraction" (e.g., get owl:verisonInfo).
Right now we are manually populated by ontology developer or AgroPortal curator. |
@caufieldjh can you comment on how you have generated these values ? is this solid information (curated/evaluated) that we could use to populate the naturalLanguage property? how did you address the example question mentionned aboved to @alexskr ? |
Talking about this issue/behaviour the other day on the AgroPortal team meeting, we came to the point that indeed its ok (maybe even better) to have 2 metadata properties:
Plus, @caufieldjh values will populate the BioPortal userInterfacePreferredLanguage values which is less risky and can be "assumed" by BioPortal... So if you go head and implement this mechanism I think we could reuse it on our side too. |
would userInterfacePerferedLanguage be primarily used for the UI or API as well? Is there a downside to using an ordered list of languages for 'userInterfacePreferredLanguage` instead of a single value so that we have some sort of a fallback mechanism if a term or comment doesn't exist in the desired language? |
This is manually curated as many ontologies do not contain sufficient metadata to determine their primary language programmatically. I considered these features:
We see in cases like DCAT3 that language translations may be stored in comments and/or are incomplete across the ontology classes, or in this case, both. In these cases I did not include the languages beyond English in the annotation. |
I don't really understand this statement. Harry has clearly done a very thorough job of manually curating language tags for all of BioPortal's ontologies using a number of different criteria. I believe this data should absolutely be used to populate the MOD On the off chance that any of the |
I would like to understand better what is being proposed here. The meaning of this |
This PR is a follow-up of #148, and makes the API use the following order of priority when displaying values:
lang
orlanguage
are set.This is useful when a resource defines all its values in another language than the portal default (English), e.g MDRGER, has only german values so in the UI as by default we try to display the default portal language which is English, but they do not exist in this case, we display the generated ones at the parsing time (the last part of the URIs).
With this PR you can specify its natural language to be German, and they will display in the UI and API by default the German values, instead of the portal default language (English)