Skip to content

Commit

Permalink
attachment for series of grant numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
kermitt2 committed Aug 24, 2023
1 parent 3042bcf commit 0bae3a6
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,10 @@ public MutablePair<Element, MutableTriple<List<Funding>,List<Person>,List<Affili
curParagraphNodes.add(entity);

} else if (clusterLabel.equals(FUNDING_GRANT_NUMBER)) {
Funding previousFounding = null;
if (StringUtils.isNotBlank(funding.getGrantNumber())) {
if (funding.isValid()) {
previousFounding = funding;
fundings.add(funding);
// next funding object
funding = new Funding();
Expand All @@ -354,6 +356,13 @@ public MutablePair<Element, MutableTriple<List<Funding>,List<Person>,List<Affili
funding.appendGrantNumberLayoutTokens(tokens);
funding.addLayoutTokens(tokens);

// possibly copy funder from previous funding object (case of "factorization" of grant numbers)
if (previousFounding != null &&
previousFounding.getGrantNumber() != null &&
clusterContent.length() == previousFounding.getGrantNumber().length()) {
funding.setFunder(previousFounding.getFunder());
}

Element entity = teiElement("rs");
entity.addAttribute(new Attribute("type", "grantNumber"));
entity.appendChild(clusterContent);
Expand Down

0 comments on commit 0bae3a6

Please sign in to comment.