private YId convert(String mediatype, String value, boolean book) { switch (mediatype) { case PRINT: return new YId(book ? IdSchemaIds.EXT_SCHEME_ISBN : IdSchemaIds.EXT_SCHEME_ISSN, value); case ELECTRONIC: return new YId(book ? IdSchemaIds.EXT_SCHEME_EISBN : IdSchemaIds.EXT_SCHEME_EISSN, value); } return null; }
private static String extractIssnsStr(List<YId> ids) { StringBuilder issns = new StringBuilder(); for(YId id: ids ) { if (id.getScheme().equals(YConstants.EXT_SCHEME_ISSN)){ issns.append(id.getValue()); issns.append(YElementToZentralBlattConverter.SUGGESTED_MULTIVALUE_FIELD_SEPARATOR); } } String issnsStr = issns.toString(); return issnsStr; }
/** * Takes all ISSNs in yelement and fixes up formatting. * * @param yelement */ private void reformatIssns(YElement yelement) { for (YId id : yelement.getIds()) { if (id.getScheme().equals(YConstants.EXT_SCHEME_ISSN)) { String formattedIssn = ZentralBlattConverterTools.formatIssn(id.getValue()); id.setValue(formattedIssn); } } }
protected void fillRelations(YElement yElement, List<YExportable> referedElements, Map<String, List<StringWithAttributes>> ret) { // relation element for (YRelation yRelation : yElement.getRelations()) { if (yRelation.getTarget() != null) { if (!ret.containsKey(E_RELATION)) { ret.put(E_RELATION, new ArrayList<StringWithAttributes>()); } ret.get(E_RELATION).add(new StringWithAttributes(yRelation.getTarget().getValue())); } } }
addName(y.name(YLanguage.NoLinguisticContent, surname, YConstants.NM_SURNAME)). addName(y.name(YLanguage.NoLinguisticContent, forenames, YConstants.NM_FORENAMES)). setIdentity(new YId(YConstants.EXT_SCHEME_YADDA,kl.personid).getValue()). setPerson(true);; ycl.add(yct); .setId(new YId(YConstants.EXT_SCHEME_YADDA,kl.docid).getValue()); .setId(new YId(YConstants.EXT_SCHEME_YADDA,kl.docid).getValue());
private static void updateYElementIdsWithZblIds(YElement ye, YElement zblye) { for (YId i : zblye.getIds()) if (ye.getId(i.getScheme()) == null) ye.addId(i); }
private String getRelationId(YRelation relation){ if(relation.getTarget()!=null) return relation.getTarget().getValue(); else return ""; }
if(ye.getId(i.getScheme())==null) ye.addId(i); for(YTagList tl : zblye.getTagLists())
@Override protected boolean enhanceMetadata(MatchResult result, YElement metadata) { // FIXME: Scheme for urn? metadata.addId(new YId("urn", result.group(1))); return true; }
/** * Removes expected ISSNs from text and adds to list of issns * * @param text * @param issns * @return filtered text (with expected ISSNs removed) */ public String filterExpectedIssns(String text, List<String> issns) { for (YId yExpectedIssn : jrnlPossibleIds) { String expectedIssn = yExpectedIssn.getValue(); String formattedExpectedIssn = ZentralBlattConverterTools.formatIssn(expectedIssn); // System.out.println("[filterExpectedIssns] next expectedIssn="+expectedIssn+" formattedExpectedIssn="+formattedExpectedIssn+" text="+text); if (text.contains(expectedIssn)) { text = text.replaceAll(expectedIssn, ""); // System.out.println("[filterExpectedIssns] adding next expectedIssn="+expectedIssn); issns.add(expectedIssn); } if (text.contains(formattedExpectedIssn)) { text = text.replaceAll(formattedExpectedIssn, ""); // System.out.println("[filterExpectedIssns] adding next expectedIssn="+expectedIssn); issns.add(expectedIssn); } } // for return ZentralBlattConverterTools.trimSeparators(text, SE_SEPARATORS); }
if(ye.getId(i.getScheme())==null) ye.addId(i); for(YTagList tl : zblye.getTagLists())
private String resolveId(YId yId) { switch (yId.getScheme()) { case IdSchemaIds.EXT_SCHEME_DOI: return resourceIdResolver.byDOI(yId.getValue()); case IdSchemaIds.EXT_SCHEME_ISBN: return resourceIdResolver.byISBN(yId.getValue()); case IdSchemaIds.EXT_SCHEME_ISSN: return resourceIdResolver.byISSN(yId.getValue()); case IdSchemaIds.EXT_SCHEME_EISSN: return resourceIdResolver.byISSN(yId.getValue()); default: return yId.getValue(); } }
@Override protected boolean enhanceMetadata(MatchResult result, YElement metadata) { metadata.addId(new YId(YConstants.EXT_SCHEME_ISSN, result.group(1))); return true; } }
private String _getTitleElementId(AbstractElementInfo<?> abstractElement, String relationType){ List<YRelation> relations = abstractElement.getRelations(); for(YRelation relation: relations){ if(relationType.equals(relation.getType())){ return relation.getTarget().getValue(); } } return ""; }
private static String extractIssnsStr(List<YId> ids) { StringBuilder issns = new StringBuilder(); for (YId id : ids) { if (id == null) { continue; } if (id.getScheme().equals(YConstants.EXT_SCHEME_ISSN)) { if (id.getValue() == null) { continue; } String issnVal = id.getValue().trim(); if (issnVal.length() > 0) { issns.append(issnVal); issns.append(YElementToZentralBlattConverter.SUGGESTED_MULTIVALUE_FIELD_SEPARATOR); } } } String issnsStr = issns.toString(); return issnsStr; }
@Override protected boolean enhanceMetadata(MatchResult result, YElement metadata) { metadata.addId(new YId(YConstants.EXT_SCHEME_DOI, result.group(1))); return true; } }
protected void fillRelations(HtmlMetaHeaders metadata, YElement yElement) { for (YRelation yRelation : yElement.getRelations()) { if (yRelation.getTarget() != null) { metadata.addMetadataName(DC_NAMESPACE + SEPARATOR + DublinCoreStrings.E_RELATION, yRelation.getTarget().getValue()); } } }
@Override void compare(YElement expected, YElement actual, EvalResult result) { Map<String, YId> actYIdMap = new HashMap<String, YId>(); for (YId yid : actual.getIds()) { String scheme = yid.getScheme(); actYIdMap.put(scheme, yid); } for (YId yid : expected.getIds()) { String scheme = yid.getScheme(); if (actYIdMap.containsKey(scheme)) { if (yid.getValue().equals(actYIdMap.get(scheme).getValue())) { result.append(scheme, ResultStatus.RECOGNIZED, 1); } else { result.append(scheme, ResultStatus.FAILED, 1); } actYIdMap.remove(scheme); } else { result.append(scheme, ResultStatus.FAILED, 1); } } for (String scheme : actYIdMap.keySet()) { result.append(scheme, ResultStatus.REDUNDANT, 1); } } },