private Set<String> getAffiliationsNamesFromAttributes(List<YAttribute> attributes) { Set<String> affNames = new HashSet<>(); for (YAttribute attribute : attributes) { String name = attribute.getValue(); if (StringUtils.isNotBlank(name)) { affNames.add(name); } } return affNames; } }
public boolean updateWithAttribute(YRelation rel, Map<String, String> relfields, String attrName, String fieldName) { List<YAttribute> attrs = rel.getAttributes(attrName); if (attrs != null && attrs.size() > 0) { relfields.put(fieldName, attrs.get(0).getValue().trim()); return true; } return false; }
public void updateWithAttribute(YAttribute src, Map<String, String> relfields, String attrName, String fieldName) { List<YAttribute> attrs = src.getAttributes(attrName); if (attrs != null && attrs.size() > 0) { relfields.put(fieldName, attrs.get(0).getValue().trim()); } }
public void updateWithAttribute(YRelation rel, Map<String, String> relfields, String attrName, String fieldName) { List<YAttribute> attrs = rel.getAttributes(attrName); if (attrs != null && attrs.size() > 0) { relfields.put(fieldName, attrs.get(0).getValue().trim()); } }
public void updateWithAttribute(YAttribute src, Map<String, String> relfields, String attrName, String fieldName) { List<YAttribute> attrs = src.getAttributes(attrName); if (attrs != null && attrs.size() > 0) { relfields.put(fieldName, attrs.get(0).getValue().trim()); } }
private void proceedReferenceAuthorZblFingerPrint(YAttribute ya, LinkedList<PredicateAndObject> pao) { for(YAttribute inner : ya.getAttributes()){ if(YConstants.AT_ZBL_AUTHOR_FINGERPRINT.equals(inner.getKey()) && !"-".equals(inner.getValue())){/*5.1*/ String zblfingerprint=inner.getValue(); pao.add(new PredicateAndObject(RelConstants.RL_IS_PERSON, RelConstants.NS_ZBL_PERSON + zblfingerprint)); } } }
public void updateWithAuthorFields(YRelation rel, Map<String, String> relfields, String fieldName) { List<YAttribute> attrs = rel.getAttributes(YConstants.AT_REFERENCE_PARSED_AUTHOR); if (attrs != null && attrs.size() > 0) { StringBuilder strb = new StringBuilder(); for (YAttribute au : attrs) { strb.append(au.getValue().trim()); strb.append(" & "); } // YAttribute auAttr = attrs.get(0); // updateWithAttribute(auAttr, relfields, // YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES, "af"); // updateWithAttribute(auAttr, relfields, // YConstants.AT_REFERENCE_PARSED_AUTHOR_SURNAME, "as"); relfields.put(fieldName.trim(), strb.toString().trim()); } }
public void updateWithAuthorFields(YRelation rel, Map<String, String> relfields, String fieldName) { List<YAttribute> attrs = rel.getAttributes(YConstants.AT_REFERENCE_PARSED_AUTHOR); if (attrs != null && attrs.size() > 0) { StringBuilder strb = new StringBuilder(); for (YAttribute au : attrs) { strb.append(au.getValue().trim()); strb.append(" & "); } // YAttribute auAttr = attrs.get(0); // updateWithAttribute(auAttr, relfields, // YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES, "af"); // updateWithAttribute(auAttr, relfields, // YConstants.AT_REFERENCE_PARSED_AUTHOR_SURNAME, "as"); relfields.put(fieldName.trim(), strb.toString().trim()); } }
/** * transplantation form RelationStatementBuilder * @param ya * @param paos_ref * @param refno * @param sb * @return * @throws YaddaException */ private boolean parseReferenceText(YAttribute ya, LinkedList<PredicateAndObject> paos_ref, int refno, StringBuffer sb) throws YaddaException { if(YConstants.AT_REFERENCE_TEXT.equals(ya.getKey())){/*3*/ sb.append(ya.getValue().toString()); paos_ref.add(new PredicateAndObject(RelConstants.RL_TEXT, ya.getValue().toString())); //further parsing of reference-parsed-text is done in parseReferences() method, //hence parsing here is not allowed return true; }else return false; }
private List<String> getAddresses(YInstitution inst, IFilteringContext fc) { List<String> result = new ArrayList<String>(); for (YAttribute attr : inst.getAttributes(YConstants.AT_CONTACT_LOCATION)) { result.add(detailsFilter.filter(attr.getValue(), InputType.RICH_TEXT, fc)); } return result; }
private static void proceedEmail(YContributor yc, LinkedList<PredicateAndObject> pao) { for(YAttribute ya : yc.getAttributes(YConstants.AT_CONTACT_EMAIL)) pao.add(new PredicateAndObject(RelConstants.RL_CONTACT_EMAIL,ya.getValue())); }
/** * transplantation form RelationStatementBuilder * @param ya * @param paos_ref * @param refno * @return */ private boolean parseReferenceText(YAttribute ya, LinkedList<PredicateAndObject> paos_ref, int refno) { if(YConstants.AT_REFERENCE_TEXT.equals(ya.getKey())){/*3*/ parseReferenceText(ya.getValue(), paos_ref, refno); return true; }else return false; }
@Override public String constructFieldValue(List<YElement> yelements) { List<YElement> articles = YElementsParsingToolbox.filterYElementsOfStructureLevel(yelements, YConstants.EXT_LEVEL_JOURNAL_ARTICLE); if (articles.size() == 0) { return null; } if (articles.size() > 1) { log.error("More than one article found in package of yelements!"); } YElement article = articles.get(0); List<YAttribute> attrs = article.getAttributes(YConstants.AT_ZBL_LANG_DESCRIPTION); if (attrs==null || attrs.size() == 0) { return null; } return YElementsParsingToolbox.removeEmptyValues(attrs.get(0).getValue()); }
@Override public String constructFieldValue(List<YElement> yelements) { List<YElement> journals = YElementsParsingToolbox.filterYElementsOfStructureLevel(yelements, YConstants.EXT_LEVEL_JOURNAL_JOURNAL); if (journals.size() == 0) { return null; } if (journals.size() > 1) { log.error("More than one journal found in package of yelements!"); } YElement journal = journals.get(0); List<YAttribute> fingerprints = journal.getAttributes(YConstants.AT_ZBL_JOURNAL_FINGERPRINT); for (YAttribute fingerprint : fingerprints) { if (fingerprint != null) { return (fingerprint.getValue()); } } return null; }
/** * accomplished * @param ya * @param paos_ref * @param refno * @param refid * @return */ private boolean parseReferenceId(YAttribute ya, LinkedList<PredicateAndObject> paos_ref, int refno) { if(YConstants.AT_REFERENCE_PARSED_ID_MR.equals(ya.getKey())){/*1.1*/ paos_ref.add(new PredicateAndObject(RelConstants.RL_IS_DOCUMENT, RelConstants.NS_MR_DOCUMENT+ ya.getValue())); return true; }else if(YConstants.AT_REFERENCE_PARSED_ID_ZBL.equals(ya.getKey())){/*1.2*/ paos_ref.add(new PredicateAndObject(RelConstants.RL_IS_DOCUMENT, RelConstants.NS_ZBL_DOCUMENT+ ya.getValue())); return true; }else if(YConstants.AT_REFERENCE_PARSED_ID_ISBN.equals(ya.getKey())){ paos_ref.add(new PredicateAndObject(RelConstants.RL_HAS_ISBN, RelConstants.NS_ISBN+ ya.getValue())); return true; }else return false; }
protected List<String> resolveAddresses(final YContributor contributor, final IFilteringContext filteringContext) { final List<String> addresses = new LinkedList<String>(); if (contributor.isInstitution()) { final YAttribute institution = contributor.getOneAttribute(YConstants.AT_INSTITUTION); if (institution != null) { for (final YAttribute address : institution.getAttributes(YConstants.AT_INSTITUTION_ADDRESS)) { addresses.add(detailsFilter.filter(address.getValue(), InputType.RICH_TEXT, filteringContext)); } } } return addresses; }
/** * accomplished * @param ya * @param paos_ref * @param refno * @return */ private boolean parseReferenceName(YAttribute ya, LinkedList<PredicateAndObject> paos_ref, int refno) { if(YConstants.AT_ENHANCED_FROM_ZBL_NAME.equals(ya.getKey())){/*8*/ for(YAttribute inner : ya.getAttributes()){ if(YConstants.AT_ENHANCED_FROM_ZBL_TYPE.equals(inner.getKey())){/*8.1*/ }else if(YConstants.AT_ENHANCED_FROM_ZBL_LANGUAGE.equals(inner.getKey())){/*8.2*/ }else if(YConstants.AT_ENHANCED_FROM_ZBL_VALUE.equals(inner.getKey())){/*8.3*/ paos_ref.add(new PredicateAndObject(RelConstants.RL_TITLE, inner.getValue())); } } return true; }else return false; }
/** * accomplished * @param ya * @param paos_ref * @param refno * @return */ private boolean parseReferenceName(YAttribute ya, LinkedList<PredicateAndObject> paos_ref, int refno) { if(YConstants.AT_ENHANCED_FROM_ZBL_NAME.equals(ya.getKey())){/*8*/ for(YAttribute inner : ya.getAttributes()){ if(YConstants.AT_ENHANCED_FROM_ZBL_TYPE.equals(inner.getKey())){/*8.1*/ }else if(YConstants.AT_ENHANCED_FROM_ZBL_LANGUAGE.equals(inner.getKey())){/*8.2*/ }else if(YConstants.AT_ENHANCED_FROM_ZBL_VALUE.equals(inner.getKey())){/*8.3*/ paos_ref.add(new PredicateAndObject(RelConstants.RL_TITLE, inner.getValue())); } } return true; }else return false; }
@SuppressWarnings("deprecation") public static void updateYRelationWithZblContributor(YRelation relye, YContributor c) { YAttribute ya = null; if (c.getOneName("canonical") != null) ya = new YAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR, c.getOneName("canonical").getText().toString()); if (c.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT).size() > 0) ya.addAttribute(YConstants.AT_ZBL_AUTHOR_FINGERPRINT, c.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT) .get(0).getValue()); if (c.getOneName("forenames") != null) ya.addAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES, c.getOneName("forenames").getText() .toString()); ya.addAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_SURNAME, c.getOneName("surname").getText().toString()); relye.addAttribute(ya); }
/** * Creates PublisherData using YElement * * @param yElement * metadata element used to create object */ public PublisherData createPublisherData(YContributor contributor) { PublisherData pd = new PublisherData(); populateBaseProperties(contributor, pd); if (contributor.getOneAttribute(CommonAttributeTypes.AT_CONTACT_URL) != null) { pd.setUrl(contributor.getOneAttribute(CommonAttributeTypes.AT_CONTACT_URL).getValue()); } final String email = contributor.getOneAttributeSimpleValue(CommonAttributeTypes.AT_CONTACT_EMAIL); if (StringUtils.isNotBlank(email)) { pd.setEmail(email); } return pd; }