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

updating getContainerIdsWithTitle logic #2730 #2741

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions import/index_java/src/org/tuefind/index/TueFindBiblio.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
*/

class IssueInfo {
public String volume_, issue_, pages_, year_, month_;
public String volume_, issue_, pages_, year_, month_, parentId_, title_;

public IssueInfo() { }

Expand All @@ -63,6 +63,8 @@ public IssueInfo(final Record record) {
for (final Subfield subfield_ : dataField_.getSubfields('g')) {
if (subfield_ != null && !subfield_.getData().isEmpty()) {
final String[] subfield_content = subfield_.getData().split(":");
this.parentId_ = getPPNFromWSubfield(dataField_);
this.title_ = getFirstNonEmptySubfield(dataField_, 't', 'a').getData();

if (subfield_content[0].equals("volume"))
this.volume_ = subfield_content[1];
Expand Down Expand Up @@ -90,6 +92,9 @@ public IssueInfo(final Record record) {
for (final VariableField variableField : record.getVariableFields("936")) {
final DataField dataField_ = (DataField) variableField;
if (dataField_.getIndicator1() == 'u' && dataField_.getIndicator2() == 'w') {
this.parentId_ = getPPNFromWSubfield(dataField_);
this.title_ = getFirstNonEmptySubfield(dataField_, 't', 'a').getData();

if ((dataField_.getSubfield('d') != null) && (!dataField_.getSubfield('d').getData().isEmpty()))
this.volume_ = dataField_.getSubfield('d').getData();
else {
Expand Down Expand Up @@ -663,7 +668,18 @@ String getPPNFromWSubfield(final DataField field) {
public Set<String> getContainerIdsWithTitles(final Record record) {
final Set<String> containerIdsTitlesAndOptionalVolumes = new TreeSet<>();

for (final String tag : new String[] { "773", "800", "810", "830" }) {
IssueInfo issue_info_773_or_936(getIssueInfo(record));

Choose a reason for hiding this comment

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

I think it's OK to use the simpler variable name issue_info here instead of issue_info_773_or_996. Which tags the function used is just an implementation detail that can change at any time and then we would have to change all variable names so better just change it now and use a short one.


if(issue_info_773_or_936 != null){
if(issue_info_773_or_936.parentId_ != null){
containerIdsTitlesAndOptionalVolumes.add(issue_info_773_or_936.parentId_ + (char)0x1F + issue_info_773_or_936.title_ +(char) 0x1F + (issue_info_773_or_936.volume_ == null ? "": issue_info_773_or_936.volume_));

return containerIdsTitlesAndOptionalVolumes;
}

}

for (final String tag : new String[] { "800", "810", "830" }) {
for (final VariableField variableField : record.getVariableFields(tag)) {
final DataField field = (DataField) variableField;
final Subfield titleSubfield = getFirstNonEmptySubfield(field, 't', 'a');
Expand Down