Closed SarahKurek closed 3 years ago
@LuisMossburger Only one author is saved even if there are multiple authors for a book and it is in the data: sample ISBN: 9781942788331 only one author is shown: Nicole Forsgren. the rest of the authors of that book are: Kim, Gene and Humble, Jez. marcrel:aut has three entries -> 3 authors
`<?xml version="1.0"?> <rdf:RDF xmlns:bibo="http://purl.org/ontology/bibo/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:frbr="http://purl.org/vocab/frbr/core#" xmlns:isbd="http://iflastandards.info/ns/isbd/elements/" xmlns:marcrel="http://id.loc.gov/vocabulary/relators/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdagr1="http://rdvocab.info/Elements/" xmlns:rdau="http://rdaregistry.info/Elements/u/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
In AuthorRetriever.java why that in a for loop? authorList = persons;
public List<Author> extractAuthors(Document xmlMetadata) {
NodeList[] relevantPersons = {
xmlMetadata.getElementsByTagName("marcrel:aut"), // "authors"
xmlMetadata.getElementsByTagName("dcterms:contributor"), // "contributors"
xmlMetadata.getElementsByTagName("dcterms:creator"), // "creator"
xmlMetadata.getElementsByTagName("marcrel:cmp") // "creator"
};
NodeList authorList = null;
for (NodeList persons : relevantPersons) {
if (persons.getLength() > 0) {
authorList = persons; // TODO Luis please have a look at that
}
}
return makeAuthorList(authorList);
}
The for loop is used because we have cases (like this one here) where we have creators, authors, contributors etc. We have to make a priorization like librarians do. In "NodeList[] relevantPersons" all persons are saved based on their contribution type to the book. We then loop all contributionTypes and use only persons of one contribution type with the highest possible priority as the "primary authors" for the book.
It can well be that not all persons of a book are retrieved from the API and this is expected behavior. Librarians can mark multiple people as contributors, but may only mark one or two as the "primary" authors. For that matter we have implemented the priority "author" - "contributor" - "creator" - "composer". However, in this case you have found a bug nonetheless - we need a break statement inside the "if statement". Since you are creating a PR right now, would you mind using the code below and push that? :)
public List<Author> extractAuthors(Document xmlMetadata) {
NodeList[] relevantPersons = {
xmlMetadata.getElementsByTagName("marcrel:aut"), // "authors"
xmlMetadata.getElementsByTagName("dcterms:contributor"), // "contributors"
xmlMetadata.getElementsByTagName("dcterms:creator"), // "creator"
xmlMetadata.getElementsByTagName("marcrel:cmp") // "composer"
};
NodeList authorList = null;
for (NodeList persons : relevantPersons) {
if (persons.getLength() > 0) {
authorList = persons;
break;
}
}
return makeAuthorList(authorList);
}
The for loop is used because we have cases (like this one here) where we have creators, authors, contributors etc. We have to make a priorization like librarians do. In "NodeList[] relevantPersons" all persons are saved based on their contribution type to the book. We then loop all contributionTypes and use only persons of one contribution type with the highest possible priority as the "primary authors" for the book.
It can well be that not all persons of a book are retrieved from the API and this is expected behavior. Librarians can mark multiple people as contributors, but may only mark one or two as the "primary" authors. For that matter we have implemented the priority "author" - "contributor" - "creator" - "composer". However, in this case you have found a bug nonetheless - we need a break statement inside the "if statement". Since you are creating a PR right now, would you mind using the code below and push that? :)
public List<Author> extractAuthors(Document xmlMetadata) { NodeList[] relevantPersons = { xmlMetadata.getElementsByTagName("marcrel:aut"), // "authors" xmlMetadata.getElementsByTagName("dcterms:contributor"), // "contributors" xmlMetadata.getElementsByTagName("dcterms:creator"), // "creator" xmlMetadata.getElementsByTagName("marcrel:cmp") // "composer" }; NodeList authorList = null; for (NodeList persons : relevantPersons) { if (persons.getLength() > 0) { authorList = persons; break; } } return makeAuthorList(authorList); }
Ok I will do that.
As a user I want to add multiple authors to a book.