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

VCards in entry forms, list views, search indexing and visualization #4015

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

litvinovg
Copy link
Collaborator

@litvinovg litvinovg commented Oct 7, 2024

VIVO GitHub issue

Vitro PR

What does this pull request do?

Added option to store participants as VCards for authorships, editorships and project participants.
Added option in editorship entry form to select organization as editor.
Added search indexing extension to index VCard participants.
Support visualization of VCard co-authors

What's new?

Modified entry forms:

Created list view for presentation participant listViewConfig-relatedExternalSpeakerRole.xml
Applied list view for participant faux property PropertyConfig.n3

Modified editorship list view to support VCards listViewConfig-informationResourceInEditorship.xml and propStatement-informationResourceInEditorship.ftl

VCard visualization modifications:
Collaborator.java
CollaborationDataViewHelper.java
coAuthorPersonLevelD3.ftl
collaboratorToActivityCountTable.ftl

Added new properties configured in runtime.properties:
Maximum number of co-authors displayed on co-authors network.
visualization.coAuthorNetwork.maxCollaborators = 35
Prioritize co-authors stored as Persons in lists with VCard co-authors
visualization.coAuthorNetwork.personBoost = 0

How should this be tested?

This is deployed on https://vivo.tib.eu/vivorc
A description of what steps someone could take to:

  • Try adding/removing participants to a publication by using authors, editors faux property:
  • Add VCard participant
  • Add person
  • Select person from existing
  • Add organization
  • Select organization from existing
  • For each case verify that added participant is listed in related list view
  • Try adding participants to a project and presentations: vcard and real
  • In person co-author network verify that vcard co-authors are visible if "Include external co-authors" is checked
  • Search for VCard participants

Interested parties

@VIVO-project/vivo-committers

Reviewers' expertise

Candidates for reviewing this PR should have some of the following expertises:

  1. Java
  2. HTML, CSS, JavaScript
  3. FreeMarker
  4. SPARQL
  5. Natural language knowledge
    1. English
    2. German
    3. Spanish
    4. French
    5. Portuguese
    6. Russian
    7. Serbian

Reviewers' report template

General comment

A reviewer should provide here comments and suggestions for requested changes if any.

Testing

A reviewer should briefly describe here how it was tested

Code reviewing

A reviewer should briefly describe here which part was code reviewed

Copy link

@tawahle tawahle left a comment

Choose a reason for hiding this comment

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

In my opinion, an explanation for Vcard is required. Maybe something like this: "Please select VCARD only, when the person has not and is not supposed to have a profile in VIVO. Otherwise choose the type "Person"."

@litvinovg
Copy link
Collaborator Author

In my opinion, an explanation for Vcard is required. Maybe something like this: "Please select VCARD only, when the person has not and is not supposed to have a profile in VIVO. Otherwise choose the type "Person"."

@tawahle
I modified description text as you suggested. Also fixed presentation participant form and list view.
Changes were redeployed on https://vivo.tib.eu/vivorc
Please test it once again when you have time.

@litvinovg litvinovg requested a review from tawahle October 11, 2024 06:04
Copy link

@tawahle tawahle left a comment

Choose a reason for hiding this comment

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

Everything is working fine.

@litvinovg litvinovg requested a review from tawahle October 14, 2024 15:24
@chenejac chenejac self-requested a review October 17, 2024 11:18
Copy link
Contributor

@chenejac chenejac left a comment

Choose a reason for hiding this comment

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

@litvinovg thanks for the PR. Looks nice and works well. I have posted a couple of comments.

I am wondering whether we should add a middle class between VIVOBaseGenerator on side, and AddEditorsToInformationResourceGenerator and AddAuthorsToInformationResourceGenerator on the other side, to encapsulate shared code in that middle class (for instance it might be entitled AddContributorToInformationResourceGenerator).

uil-data:select_vcard_or_person.VIVO
rdf:type owl:NamedIndividual ;
rdf:type uil:UILabel ;
rdfs:label "Please select VCARD only, when the person doesn't have and is not supposed to have a profile in VIVO. Otherwise choose the type \"Person\"."@en-CA ;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can use here:

Please select external co-author, when the person doesn't have and is not supposed to have a profile in VIVO. Otherwise choose the type "Person"."

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe. In that case VCARD option should be changed accordingly on entry form pages. In any case I think we should change all the translations altogether when there is an agreement on how it should look like to avoid changing the same thing multiple times. It was already changed once in accordance with this comment #4015 (review)

Copy link
Member

Choose a reason for hiding this comment

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

As discussed in recent meetings, we should avoid mentioning vCards (not VCARDs or VCards) in UI messages. If we need this binary choice, I would suggest "add to coauthor's profile page" -- ideally with a checkbox rather than a dropdown. Checking would link/create a foaf:Person; unchecking would create a vCard. I haven't yet spun up this PR to see what the page looks like, but ideally we would allow the user to search for and link to an existing foaf:Person; if not found (or the search is not used), the form for entering the coauthor's name would just have a checkbox for "create profile page for coauthor" which would govern whether new a foaf:Person or vCard is created.

@litvinovg litvinovg requested a review from chenejac November 4, 2024 14:58

if (stmt.getObject().isLiteral()) {
switch (stmt.getPredicate().getURI()) {
case "http://www.w3.org/2006/vcard/ns#familyName":
Copy link
Contributor

Choose a reason for hiding this comment

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

These should already be constants somewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

Statement stmt = iter.nextStatement();

if (stmt.getObject().isLiteral()) {
switch (stmt.getPredicate().getURI()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This nesting can be reduced with a continue statement instead.

log.error(e, e);
}

if (!StringUtils.isEmpty(familyName)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use StringUtils.isNotEmpty?

// ----------------------------------------------------------------------

private static final String LOCATE_PARTNERS_WITHOUT_RESTRICTION = ""
+ "SELECT ?partner \n" //
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't there a way not to have all the SPARQL in code?

return givenName;
}

return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it possible to avoid the conditioning above by constructing the return value in the iteration?

Model model = ModelFactory.createDefaultModel();
rdfService.sparqlConstructQuery(sparqlConstruct, model);

StmtIterator iter = model.listStatements();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the StmtIterator be closed with try-with-resources?

rdf:type uil:UILabel ;
rdfs:label "Ne sélectionnez VCARD que si la personne n'a pas et n'est pas censée avoir un profil dans VIVO. Dans le cas contraire, choisissez le type \"Personne\"."@fr-CA ;
uil:hasApp "VIVO" ;
uil:hasKey "select_vcard_or_person" .
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing POSIX ending newline.

rdf:type uil:UILabel ;
rdfs:label "Izaberite samo VCARD, kada osoba nema i ne bi trebalo da ima profil u VIVO-u. U suprotnom izaberite tip \"Osoba\"."@sr-Latn-RS ;
uil:hasApp "VIVO" ;
uil:hasKey "select_vcard_or_person" .
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing POSIX ending newline.

@@ -4,16 +4,17 @@
<!-- See guidelines at https://wiki.lyrasis.org/display/VIVODOC112x/Custom+List+View+Configurations -->

<list-view-config>
<query-select>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
<query-select>
Copy link
Contributor

Choose a reason for hiding this comment

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

The extraneous white-space characters can be cleaned up.

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.

VIVO-926: Provide support for entering unknown co-authors as vcard:Individuals only
7 participants