vivo-project / VIVO

VIVO is an extensible semantic web application for research discovery and showcasing scholarly work
http://vivoweb.org
BSD 3-Clause "New" or "Revised" License
205 stars 127 forks source link

[Issue 3767] Replacement of language comparisons using '=' by the 'langMatches' (without whitespace changes) #3811

Closed ghost closed 1 year ago

ghost commented 1 year ago

Issue #3767 Problems associated with the use of sparqlContentTripleSource in the applicationSetup.n3 configuration file:

What does this pull request do?

This PR fixes the language context management issue in the Capability Map when using VIVO which uses AWS-Neptune TripleStore

What's new?

As described in the issue, VIVO's CapabilityMap using AWS-Neptune as a TripleStore is not working properly. The malfunction is related to the disfunction of the expertise search bar. The cause of this malfunction is that, unlike the other triple stores, the linguistic value of the tags is stored in lower case. For example: the term "Label"@en-CA is actually stored in AWS-Neptune as "Label"@en-ca. The solution is to modify the SPARQL queries in the Java code so that the filters process the language parameters regardless of case sensitivity.

Here is a code sample to be replaced

FILTER (LANG(?orgLabelSecondary) = '" + language + "') \n" +

Replacement code example

FILTER (langMatches(lang(?orgLabelSecondary), '" + language+"' ) ) \n"

How should this be tested?

VIVO installation using AWS-Neptune

  1. Installing AWS-Neptune To reproduce the BUG, it is absolutely necessary to install an instance of AWS-Neptune. The following documentation Setting up Neptune allows to install a Neptune instance.

    1. Installing VIVO (master branch)
      • Extract and compile VIVO
      • Install a VIVO-home according to the specifications indicated by VIVO's documentations:

Using web-based triple stores Fuseki as alternate triple store

  1. Run VIVO and load Sample Data After starting VIVO, you can download the sample data contained at: -VIVO Sample data Repo Upload files:

sample-data-i18n-de_DE.ttl sample-data-i18n-en_CA.ttl sample-data-i18n-en_US.ttl sample-data-i18n-fr_CA.ttl sample-data-i18n-fr_FR.ttl sample-data-i18n.ttl

  1. Observe the problem Browse the CapabilityMap and try to search for an expertise. You will see that it is not possible to perform a search.
  1. Evaluate the RP
    • Stop VIVO; extract the code from the PR, compile VIVO; and start VIVO
    • Browse the CapabilityMap and try to search for an expertise. You will see that it is possible to perform a search.

Additional Notes:

see also:

Interested parties

@VIVO-project/vivo-committers

michel-heon commented 1 year ago

Comment: for https://github.com/vivo-project/VIVO/compare/8a300025bb052023ad7fd6196b6b153adfff1fe7..28fa51ce3bc5fa2ef344f30ad942ea862bd12e18 (in VisualizationCaches.java file)

Replacing lines 275-279 with String orgLabel = qs.getLiteral("orgLabel").getString(); may cause a problem if getLiteral returns a null. This will generate a nullException for getString(). Is this really what we want? I think it would make more sense to return an empty string Same comment for the other lines of this type

ghost commented 1 year ago

@michel-heon I believe you are referring to changes already merged from https://github.com/vivo-project/VIVO/pull/3790. If you are able to produce a bug, could you create an issue with the comments and steps to reproduce?

Perhaps I am misunderstanding your comment. But this PR does make any changes in which you are showing in that compare link.

FYI, is your PR commit with undoing whitespace changes. If and when this is merged, your PR will be merged.