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

Issue/vivo 1908 #185

Merged
merged 7 commits into from
Aug 28, 2020
Merged

Conversation

brianjlowe
Copy link
Member

VIVO-1908:

What does this pull request do?

Uses the existing language-filtering mechanism for generating dropdown select lists with language-appropriate labels on editing forms (such as "organizer of event") where the URIs are in the select lists are harcoded in the form. Also adds a fallback mechanism to the manage webpages for individual form where language filtering is injected into a SPARQL query.

What's new?

See GeneratorUtil.java and ManageWebapagesForIndividualGenerator.java for the most substantive changes.
GeneratorUtil now has a method buildResourceAndLabelFieldOptions() that is very similar to the original method for building a list of constant field options. This new method uses a WebappDaoFactory, if available, to retrieve in-memory class labels, and an RDFService to retrieve labels for all other URIs. The individual editing forms supply the existing WebappDaoFactory and RDFService from the request, which already perform language filtering. The editing forms no longer build DESCRIBE queries where language filtering is injected.

ManageWebpagesForIndividual.java adds fallback languages to the SPARQL query that retrieves webpage links as well as the labels for the link types. Because this query involves GROUP BY, language filtering here cannot be handled by the RDFService-level filtering.

How should this be tested?

  • Create/navigate to a person. From the Service tab, select "organizer of event". Change the language selector, and note that event type labels in the dropdown continue to match the selected language. For more in-depth testing, add a new URI to the list in AddOrganizerRoleToPerson.java, create that class in VIVO and supply a label in only one language, and note that the class continues to appear in the dropdown even if a label is not available that matches your current language selection.
  • Go to the class hierarchy, select all classes, find "F1000 Link", and add a new subclass of that class. Supply a label in only one language. Navigate to a person. Open the manage webpages page (Rolodex) and enter a new webpage of the new type you just created. From the manage webpages page, change the language selector and note that the label for the new type continues to appear even if a label does not exist that matches the current language selection.

…nd use existing RDFService-based filtering for ConstantFieldOptions
…nd use existing RDFService-based filtering for ConstantFieldOptions
…nd use existing RDFService-based filtering for ConstantFieldOptions
…nd use existing RDFService-based filtering for ConstantFieldOptions
for(String resourceURI : resourceURIs) {
IRI iri = iriFactory.create(resourceURI);
if(iri.hasViolation(false)) {
log.debug("Not adding invalid URI " + resourceURI
Copy link
Member

Choose a reason for hiding this comment

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

Maybe elevate to info... or even warn?

Copy link
Member Author

Choose a reason for hiding this comment

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

Elevated to warn.

@@ -21,49 +22,28 @@ String getRoleType() {
/** Editor role involves hard-coded options for the "right side" of the role or activity. */
Copy link
Member

Choose a reason for hiding this comment

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

Does the "right side" in this comment refer to the values that have been removed? If so, the comment should probably be changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

It actually refers to the individual who is not the bearer of the role, but good catch.

I18n.bundle(vreq).text("select_type"),
"http://vivoweb.org/ontology/core#Grant",
"http://purl.obolibrary.org/obo/ERO_0000015" /* Human Study" */,
"http://vivoweb.org/ontology/core#Project", "Project",
Copy link
Member

Choose a reason for hiding this comment

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

Should "Project" be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep: now gone.

+ "} GROUP BY ?rank ?vcard ?link ?url ?typeLabel \n"
// UQAM-Linguistic-Management Add linguistic control on label
// Try full locale
+ " OPTIONAL { ?type rdfs:label ?typeLabelPrimary . \n"
Copy link
Member

@awoods awoods Aug 28, 2020

Choose a reason for hiding this comment

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

Nice SPARQL-Query!

ParameterizedSparqlString queryPstr = new ParameterizedSparqlString(
WEBPAGE_QUERY);
queryPstr.setLiteral("locale", locale.toString().replace("_", "-"));
queryPstr.setLiteral("language", locale.getLanguage().toString());
Copy link
Member

Choose a reason for hiding this comment

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

toString() is redundant here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed.

@awoods
Copy link
Member

awoods commented Aug 28, 2020

Some minor comments... functionality works as advertised.

…nd use existing RDFService-based filtering for ConstantFieldOptions
@awoods awoods merged commit f32dea3 into vivo-project:sprint-i18n Aug 28, 2020
roflinn pushed a commit that referenced this pull request Feb 10, 2021
* Layer uqam updates onto master (minus trailing whitespace)

* Update AddOrganizerRoleToPersonGenerator.java

Removed extraneous whitespace

* My whitespace (#153)

* Update AddPublicationToPersonGenerator.java

* Removed extraneous whitespace AND move RootUserPolicy.java from VIVO to Vitro

* Fixed whitespace in: AddAttendeeRoleToPersonGenerator.java

* Fixed indentations for AddOutreachProviderRoleToPersonGenerator.java

* Fixed indentations

* Removed extraneous whitespace (#158)

* Removed extraneous whitespace

* Fix bug introduced in cleaning up whitespace

* Tagging UQAM comments with the following tags

-Add-Feature
-Optimization
-Linguistic-Management
-Bug-Correction

* Update AddReviewerRoleToPersonGenerator.java

* Added an internationalization correction to be considered in the vivo-i18n-core that was forgotten when sprint-i18n was created.

* Fix typo in AddReviewerRoleToPersonGenerator

Resolves: https://jira.lyrasis.org/browse/VIVO-1774

* Fix typo in AddOutreachProviderRoleToPersonGenerator

Resolves: https://jira.lyrasis.org/browse/VIVO-1775

* Include language dependencies in build all of the time (#168)

Move "LocaleSelectionSetup" higher in the startup list so that the Vitro:RDFFilesLoader has the locale info available on its startup

Part of resolution to: https://jira.lyrasis.org/browse/VIVO-1836

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Made modifications to publicationToPersonUtils.js so that multilangua… (#170)

* Made modifications to publicationToPersonUtils.js so that multilanguage support will not break the javascript functionalty.

Co-authored-by: root <root@vivo-development.hs-mittweida.de>

Resolves: https://jira.lyrasis.org/browse/VIVO-1739

* Feature language en_CA (#169)

* Changing ontology extensions for n3 & assigning a base IRI to each
ontology

Co-authored-by: michelheonuqam <heon.michel@uqam.ca>
Co-authored-by: michelheon <heon@videotorn.ca>

Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1862

* i18n: title tag and headings in capability map are in english in french version (#173)

* added multi-language support for ticket VIVO-1846

* fixed swapped properties, added Capability map title to i18n

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1847

* Added i18n support for Capability Map control buttons, JIRA ticket VIVO-1846

* removed redundat files which are now available via Vitro- and VIVO-languages

* added i18n support for the capability map, ticket vivo-1892

* Revert non-function RDF changes (#180)

Related to: https://jira.lyrasis.org/browse/VIVO-1905

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Ensure 'other' in Individual->Teaching->advisees->type is translated

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1881

* [VIVO-1842] i18n: Added function js_string at i18n variables to handle quotes properly (#181)

* added js_string at i18n strings to handle quotes properly, ticket vivo-1842

Partial resolution for: https://jira.lyrasis.org/browse/VIVO-1842

* replace static headings with i18n values (#183)

Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1844

* added empty check for getCountry, fixing bug with spanish label (es), ticket vivo-1900 (#182)

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1900

* Issue/vivo 1908 (#185)

* Provide fallback language in language-filtered webpage SPARQL query and use existing RDFService-based filtering for ConstantFieldOptions

Resolves: https://jira.lyrasis.org/browse/VIVO-1906

* Fix bug of missing toString() (#187)

Related to: https://jira.lyrasis.org/browse/VIVO-1906

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Remove files replicated in i18n (#186)

Related to: https://jira.lyrasis.org/browse/VIVO-1917

* removed redundant vitroAnnotations, now in VIVO-languages, ticket vivo-1821

* Removed key.png from the template and replaced it with css sprite and… (#184)

* Removed key.png from the template and replaced it with css sprite and descriptions in plain text.
* * adding height to background images, hopefully fixing issues

Partial resolution for: https://jira.lyrasis.org/browse/VIVO-1902

* [VIVO-1915] i18n - removing language select for label management for individuals (#190)

* removed the language select for managing multi language labels fpr individuals, ticket vivo-1915

* modified ManageLabelsForPersonGenerator so that you can only add an langauge label if it is not already set, ticket vivo-1915

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1915

* - added i18n() to hardcoded values

* added i18n support to person's domain in capability map, ticket 1867

* [VIVO-1946] - Update ResearcherID description in vivo.owl (#188)

* Update ResearcherID description in vivo.owl

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1946

* [VIVO-1936] i18n: updated the language comment in runtime.properties (#203)

Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1936

Co-authored-by: Kampe <Benjamin.Kampe@tib.eu>

* [VIVO-1924] i18n: @en i18n properties are not loaded during first site startup. (#204)

* rearranged startup-listeners fixing bug with language files, ticket VIVO-1924

* Added a comment to prevent future bugs like this, ticket VIVO-1924

* fixed previous comment, ticket VIVO-1924

* Remove duplicate text from dropdown menus

* Minor checkstyle correction following: VIVO-1936 (#206)

Follow-on to: https://jira.lyrasis.org/browse/VIVO-1936

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* follow-up on vivo-1936 - restore default values in example-settings.xml (#210)

Co-authored-by: gneissone <mbgross@wustl.edu>

* [VIVO-1798] - Internationalize first and last name validation (#207)

* Internationalize first and last name validation

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1798

* adding collections process terms (#165)

* adding collections process terms

No JIRA :(

* Non-functional change to comment in example.applicationSetup.n3

Related to: https://jira.lyrasis.org/browse/VIVO-1741

* Update orcidConfirm.ftl (#199)

Fix i18n property used on ORCID confirmation step 2 button.
Related to https://jira.lyrasis.org/browse/VIVO-1945

* Fix external AGROVOC service URL

* URL fix for LCSH service

* Remove unnecessary pom.xml 'profile'

- Also, uncomment language overlays
   - Noting that this is not actually necessary, as any 'war' Maven dependencies are automatically overlayed:
   - https://maven.apache.org/plugins/maven-war-plugin/overlays.html

Co-authored-by: Andrew Woods <awoods@duraspace.org>
Co-authored-by: Nicolas D <46490666+nicalico@users.noreply.github.com>
Co-authored-by: UQAM-VIVO <heon.michel@uqam.ca>
Co-authored-by: matthiasluehr <60263380+matthiasluehr@users.noreply.github.com>
Co-authored-by: Michel Heon <heon@videotron.ca>
Co-authored-by: dofeldsc <dofeldsc@uos.de>
Co-authored-by: William Welling <wwelling@library.tamu.edu>
Co-authored-by: Brian Lowe <brianjlowe@gmail.com>
Co-authored-by: Matthias Lühr <luehr@hs-mittweida.de>
Co-authored-by: Ben <mbgross@wustl.edu>
Co-authored-by: Benjamin Kampe <benjamin@fehrmanns.net>
Co-authored-by: Kampe <Benjamin.Kampe@tib.eu>
Co-authored-by: Gross, Benjamin <benjamin.gross@clarivate.com>
Co-authored-by: diatomsRcool <annethessen@gmail.com>
Co-authored-by: L.O <53535673+lb-ov@users.noreply.github.com>
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.

2 participants