String sname = a.getSurname(); String fname = a.getForenames(); String name = null; if (sname != null && !sname.trim().isEmpty()
private Tuple addDocumentMetatdataFields(DocumentMetadata metadata, Tuple output) throws ExecException { output.set(fieldNumberMap.get(C.KEY), metadata.getKey()); appendToOutput(output, C.TITLE, metadata.getBasicMetadata() .getTitleList()); appendToOutput(output, C.ABSTRACT_TEXT, metadata.getDocumentAbstractList()); List<String> al = new ArrayList<String>(); for (KeywordsList kl : metadata.getKeywordsList()) { for (String s : kl.getKeywordsList()) { al.add(removeAllPigUnfriendlySigns(s)); } } output.set(fieldNumberMap.get(C.KEYWORDS), listToDataBag(al)); List<String> authorKeys = new ArrayList<String>(); List<String> authorNames = new ArrayList<String>(); for (Author author : metadata.getBasicMetadata().getAuthorList()) { authorKeys.add(author.getKey()); authorNames.add(author.getName()); } output.set(fieldNumberMap.get(C.CONTRIBUTORS), listToDataBag(authorKeys, authorNames)); return output; }
private static String format(Writable key, DocumentWrapper documentWrapper) { StringBuilder sb = new StringBuilder(); sb.append("-------------------------------------------\n"); sb.append("key : ").append(key).append("\n"); sb.append("rowid : ").append(documentWrapper.getRowId()).append("\n"); sb.append("title0 : ").append(DocumentWrapperUtils.getMainTitle(documentWrapper.getDocumentMetadata())).append("\n"); sb.append("year : ").append(DocumentWrapperUtils.getPublicationYear(documentWrapper)).append("\n"); for (Author author : documentWrapper.getDocumentMetadata().getBasicMetadata().getAuthorList()) { sb.append(author.getPositionNumber()).append(". ").append(author.getName()).append(" ").append(author.getSurname()).append("\n"); } sb.append("\n"); return sb.toString(); }
for (DocumentProtos.Author author : doc.getBasicMetadata().getAuthorList()) { String surname; if (author.hasSurname()) { surname = author.getSurname(); } else { String fullname = author.getName(); Node authorNode = authorParser.parse(fullname); Node surnameNode; if (!author.hasPositionNumber()) { positionsCorrect = false; } else { int authorPosition = author.getPositionNumber() - 1; if (authorPosition < 0 || authorPosition >= resultByPositionNb.length || resultByPositionNb[authorPosition] != null) { positionsCorrect = false;
Author.Builder ab = Author.newBuilder(); if (lastname != null) { ab.setSurname(lastname);
for(Author a : bm.getAuthorList()){ try{ Author.Builder ab = Author.newBuilder(a); KeyValue.Builder kvb = KeyValue.newBuilder(); kvb.setProvenance(pb); kvb.setKey(CoansysModulesConstants.COANSYS_MODULE_ID_DISAMBIGUATION_AUTHOR); String clusterId = contribIdToPersonId.get(UUID.nameUUIDFromBytes(a.toByteArray()).toString()); if(clusterId == null){ StringBuilder errMsg = new StringBuilder(); if(dataExists){ clusterId = Constants.NO_CONTRIB_INFO_PREFIX +a.getKey(); errMsg.append("No disambiguation-author output for a contributor ").append(a.getKey()) .append(" from a document ").append(a.getDocId()); }else{ clusterId = Constants.NO_DOC_INFO_PREFIX+a.getKey(); .append(a.getDocId()); myAuthorList.add(ab.build()); }catch(Exception e){ LOGGER.warn("Problem with merging data for author with key: {}", a.getKey(), e); LOGGER.warn("This author object remains unchanged"); myAuthorList.add(a);
DocumentMetadata dm = DocumentMetadata.parseFrom(scannerResult.value()); for(Author a : dm.getBasicMetadata().getAuthorList()){ names.add(a.getForenames() + " " + a.getSurname());
String orcid = authorPattern.getExtId(0).getValue(); String doi = orcidDTO.getDoi(); String title = orcidDTO.getTitle(); basicMetadata.addTitle(twl); Author.Builder author = Author.newBuilder(authorPattern); author.setDocId(doi); author.setKey(doi_orcid);
for(KeyValue kv : a.getExtIdList()){ Tuple t = tf.newTuple(); t.append(a.getKey()); t.append(kv.getKey()); t.append(kv.getValue());
private void convertNames(Author contribution, SolrInputDocument doc) { String name = contribution.getName(); String surname = contribution.getSurname(); String forenames = contribution.getForenames(); if (!StringUtils.isBlank(surname)) { doc.setField(SolrIndexConstants.CONTRIBUTION_SURNAME_FIELD_NAME, surname); } if (!StringUtils.isBlank(forenames)) { doc.setField(SolrIndexConstants.CONTRIBUTION_FORENAMES_FIELD_NAME, forenames); } if (!StringUtils.isBlank(name)) { doc.setField(SolrIndexConstants.CONTRIBUTION_NAME_FIELD_NAME, name); } else if (!StringUtils.isBlank(forenames + surname)) { doc.setField(SolrIndexConstants.CONTRIBUTION_NAME_FIELD_NAME, forenames + " " + surname); } }
private void convertPersonIds(DocumentWrapper dw, SolrInputDocument doc) { List<Author> authors = dw.getDocumentMetadata().getBasicMetadata() .getAuthorList(); for (Author author : authors) { List<KeyValue> extIds = author.getExtIdList(); for (KeyValue extId : extIds) { if (extId .getKey() .equals(CoansysModulesConstants.COANSYS_MODULE_ID_DISAMBIGUATION_AUTHOR)) { doc.addField(SolrIndexConstants.DOC_PERSONID_FIELD_NAME, extId.getValue()); } } } } }
private void convertPosition(Author contribution, SolrInputDocument doc) { doc.setField(SolrIndexConstants.CONTRIBUTION_POSITION_FIELD_NAME, contribution.getPositionNumber()); }
/** * Returns the author of the publication that is on the given authorPosition. * Returns null if there is no author on the authorPosition. */ public static Author getAuthor(DocumentWrapper documentWrapper, int authorPosition) { List<Author> authors = getAuthors(documentWrapper); for (Author author : authors) { if (author.getPositionNumber()==authorPosition) { return author; } } return null; }
private void convertId(Author contribution, SolrInputDocument doc) { String id = contribution.getDocId() + "_" + contribution.getPositionNumber(); doc.setField(SolrIndexConstants.CONTRIBUTION_ID_FIELD_NAME, id); }
private void convertAuthors(DocumentWrapper dw, SolrInputDocument doc) { List<Author> authors = dw.getDocumentMetadata().getBasicMetadata() .getAuthorList(); for (Author author : authors) { doc.addField(SolrIndexConstants.DOC_AUTHOR_FIELD_NAME, author.getName()); } }
private void convertExtIds(Author contribution, SolrInputDocument doc) { List<KeyValue> extIds = contribution.getExtIdList(); for (KeyValue extId : extIds) { doc.addField(SolrIndexConstants.CONTRIBUTION_EXTID_FIELD_NAME, extId.getKey() + SolrIndexConstants.FIELD_VALUES_SEPARATOR + extId.getValue()); } }
protected Author buildAuthor(String orcId, String givenNames, String familyName) { Author.Builder author = Author.newBuilder(); author.setForenames(givenNames); author.setSurname(familyName); KeyValue.Builder extId = KeyValue.newBuilder(); extId.setKey("orcid-author-id"); extId.setValue(orcId); author.addExtId(extId); author.setKey(orcId); return author.build(); }