本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.getIds()
方法的一些代码示例,展示了YElement.getIds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.getIds()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:getIds
暂无
代码示例来源:origin: pl.edu.icm.yadda/yadda-cli
static String getNmjr(YElement el) {
List<String> ids=el.getIds("bwmeta1.id-class.SpringerImport");
for (String id:ids) {
String[] parts=id.split("/");
if (parts.length>=2) {
return parts[parts.length-2]+"/"+parts[parts.length-1];
} else if (parts.length>0) {
return parts[parts.length-1];
}
}
return null;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-cli
static String getDOI(YElement el) {
List<String> ids=el.getIds(IdSchemaIds.EXT_SCHEME_DOI);
if (!ids.isEmpty()) {
return ids.get(0).toUpperCase(Locale.US);
}
return null;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private String extracjIssnsFromJournal(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);
String issnsStr = extractIssnsStr(journal.getIds());
return issnsStr;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
public static String retrieveYElementZblId(YElement ye) {
String mainZblExtId = null;
for (YId yi : ye.getIds()) {
if (YConstants.EXT_SCHEME_ZBL.equals(yi.getScheme())) {
mainZblExtId = yi.getValue();
break;
}
}
return mainZblExtId;
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
@Override
public final String generate(YElement element) {
List<String> ids = element.getIds(getScheme());
if (!ids.isEmpty()) {
String id = ids.get(0);
String prefix = StringUtils.isBlank(getPrefix()) ? StringUtils.EMPTY : (getPrefix() + "-");
String normalized = Normalizer.normalize(id, Form.NFC);
String trimmed = normalized.replaceAll("[^a-zA-Z0-9]", "");
String lowercase = trimmed.toLowerCase();
return prefix + lowercase;
}
return null;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
/**
* Adds next ISSN number safely (checking if it is not already added).
*
* @param yelement
* @param issn
*/
private void appendNextIssn(YElement yelement, String issn) {
YId id = new YId(YConstants.EXT_SCHEME_ISSN, issn);
YId formattedId = new YId(YConstants.EXT_SCHEME_ISSN, ZentralBlattConverterTools.formatIssn(issn));
// make sure that is not already added from other field
if (!yelement.getIds().contains(id) && !yelement.getIds().contains(formattedId)) {
yelement.addId(id);
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
protected void fillIdentifiers(YElement yElement, List<YExportable> referedElements, Map<String, List<StringWithAttributes>> ret) {
// identifier element
ret.put(E_IDENTIFIER, new ArrayList<StringWithAttributes>());
ret.get(E_IDENTIFIER).add(new StringWithAttributes(yElement.getId()));
for (YId yId : yElement.getIds()) {
StringWithAttributes id = new StringWithAttributes(yId.getValue());
id.getAttributes().put("scheme", yId.getScheme());
ret.get(E_IDENTIFIER).add(id);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
@Override
protected String buildLink(ElementMetadata metadata) {
YElement element = (YElement) metadata.getContent();
Map<String, String> parameters = new HashMap<String, String>();
for (YId id : element.getIds()) {
parameters.put(id.getScheme(), id.getValue());
}
for (String requiredParameter : requiredParameters) {
if (!parameters.containsKey(requiredParameter)) {
return null;
}
}
return StrSubstitutor.replace(pattern, parameters);
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
private static void updateYElementIdsWithZblIds(YElement ye, YElement zblye) {
for (YId i : zblye.getIds())
if (ye.getId(i.getScheme()) == null)
ye.addId(i);
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
public static void copyDataToAncestor(YElement ele, YAncestor anc) {
for (YName nam : ele.getNames()) {
anc.addName(nam);
}
for (YId id : ele.getIds()) {
anc.addId(id);
}
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
/**
* 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);
}
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
public static void copyDataToAncestor(YElement ele, YAncestor anc) {
anc.getNames().addAll(ele.getNames());
anc.getIds().addAll(ele.getIds());
anc.getDates().addAll(ele.getDates());
anc.setIdentity(ele.getId());
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
protected void extractSeriesMetadata(YElement parent, CrossrefIdGenerator generator, YElement element, SeriesMetadata seriesMetadata) {
List<YName> seriesNames = convertTitles(seriesMetadata.getTitles());
List<YId> seriesIds = new ArrayList<>();
seriesIds.addAll(convertIssns(seriesMetadata.getIssns()));
if (StringUtils.isNotBlank(seriesMetadata.getCoden())) {
seriesIds.add(new YId(IdSchemaIds.EXT_SCHEME_CODEN, seriesMetadata.getCoden()));
}
element.getIds().addAll(seriesIds);
element.getNames().addAll(seriesNames);
String id = generator.generateBookSeriesId(element.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_ISSN), getDefaultName(element));
element.setId(id);
element.addStructure(buildStructureFromParent(parent, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, HierarchyWithLevelIds.EXT_LEVEL_BOOK_SERIES));
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
private ElementAncestors<YElement> setJournalIdsInOrigSequence(ElementAncestors<YElement> yElemAncest) throws ModelDataSourceException {
Ancestor journal = yElemAncest.getAncestors().getAncestorAtLevel(YaddaIdConstants.ID_LEVEL_JOURNAL_JOURNAL);
if (journal != null) {
YElement journalYElem= dataSourcesFactory.getYCatalogDataSource().getElementById(journal.getExtid());
// Keep ids original order, it decides on citation styling @see YElemToCSLItemConverter
LinkedHashMap<String, String> idsSorted = new LinkedHashMap<>();
for (YId yId : journalYElem.getIds()) {
idsSorted.put(yId.getScheme(), yId.getValue());
}
journal.setAdditionalIdentifiers(idsSorted);
}
return yElemAncest;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
protected YStructure buildStructureFromParent(YElement parent, String hierarchy, String currentLevel) {
YStructure structure = new YStructure(hierarchy);
YCurrent current = new YCurrent(currentLevel);
structure.setCurrent(current);
if (parent != null) {
YStructure parentStructure = parent.getStructure(hierarchy);
structure.getAncestors().addAll(parentStructure.getAncestors());
YAncestor ancestor = new YAncestor(parentStructure.getCurrent().getLevel(), parent.getId());
ancestor.getNames().addAll(parent.getNames());
ancestor.getIds().addAll(parent.getIds());
structure.addAncestor(ancestor);
}
return structure;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement buildBookFromBookSetMetadata(BookSetMetadata bookSetMetadata, YElement parent, CrossrefIdGenerator generator) {
YElement bookElement = new YElement();
bookElement.addStructure(buildStructureFromParent(parent, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, HierarchyWithLevelIds.EXT_LEVEL_BOOK_BOOK));
bookElement.getNames().addAll(convertTitles(bookSetMetadata.getTitles()));
bookElement.getContributors().addAll(convert(bookSetMetadata.getContributors(), bookElement));
bookElement.getDates().addAll(convertDates(bookSetMetadata.getPublicationDates()));
bookElement.getRelations().addAll(convertCitationList(bookSetMetadata.getCitationList()));
bookElement.getIds().addAll(convertIsbns(bookSetMetadata.getIsbns()));
if (bookSetMetadata.getDoiData() != null) {
bookElement.getIds().add(new YId(IdSchemaIds.EXT_SCHEME_DOI, bookSetMetadata.getDoiData().getDoi()));
}
String id = generator.generateBookId(bookElement.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_DOI),
bookElement.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_ISBN), bookElement.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_EISBN),
getDefaultName(bookElement));
bookElement.setId(id);
return bookElement;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement buildBookFromBookSeriesMetadata(BookSeriesMetadata bookSeriesMetadata, YElement parent, CrossrefIdGenerator generator) {
YElement bookElement = new YElement();
bookElement.addStructure(buildStructureFromParent(parent, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, HierarchyWithLevelIds.EXT_LEVEL_BOOK_BOOK));
bookElement.getNames().addAll(convertTitles(bookSeriesMetadata.getTitles()));
bookElement.getContributors().addAll(convert(bookSeriesMetadata.getContributors(), bookElement));
bookElement.getDates().addAll(convertDates(bookSeriesMetadata.getPublicationDates()));
bookElement.getRelations().addAll(convertCitationList(bookSeriesMetadata.getCitationList()));
bookElement.getIds().addAll(convertIsbns(bookSeriesMetadata.getIsbns()));
if (bookSeriesMetadata.getDoiData() != null) {
bookElement.getIds().add(new YId(IdSchemaIds.EXT_SCHEME_DOI, bookSeriesMetadata.getDoiData().getDoi()));
}
String id = generator.generateBookId(bookElement.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_DOI),
bookElement.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_ISBN), bookElement.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_EISBN),
getDefaultName(bookElement));
bookElement.setId(id);
return bookElement;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
public static void updateYRelationWithZblIds(YRelation relye, YElement zblye) {
YAttribute ya = new YAttribute(YConstants.TG_CATEGORY, "");
for (YId i : zblye.getIds()) {
if (i.getScheme().equals(YConstants.EXT_SCHEME_ISSN)) {
ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ISSN, i.getValue()));
} else if (i.getScheme().equals(YConstants.EXT_SCHEME_ISBN)) {
ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ISBN, i.getValue()));
} else if (i.getScheme().equals(YConstants.EXT_SCHEME_ZBL)) {
ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ZBL, i.getValue()));
} else if (i.getScheme().equals(YConstants.EXT_SCHEME_ZBL)) {
ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ZBL, i.getValue()));
}
}
relye.addAttribute(ya);
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
@Override
public YElement process(Book book, YElement parent, CrossrefIdGenerator generator) {
BookSetMetadata bookSetMetadata = book.getBookSetMetadata();
YElement element = new YElement();
SetMetadata setMetadata = bookSetMetadata.getSetMetadata();
List<YName> setNames = convertTitles(setMetadata.getTitles());
element.getIds().addAll(convertIsbns(setMetadata.getIsbns()));
element.getNames().addAll(setNames);
String id = generator.generateBookSetId(element.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_ISBN), getDefaultName(element));
element.setId(id);
element.addStructure(buildStructureFromParent(parent, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, HierarchyWithLevelIds.EXT_LEVEL_BOOK_SERIES));
if (StringUtils.isNotBlank(bookSetMetadata.getLanguage())) {
element.addLanguage(YLanguage.byCode(bookSetMetadata.getLanguage()));
}
return element;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement buildChapterElementFromPaper(ConferencePaper conferencePaper, YElement parent, CrossrefIdGenerator generator) {
YElement chapterElement = new YElement();
YStructure structure = buildStructureFromParent(parent, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, HierarchyWithLevelIds.EXT_LEVEL_BOOK_CHAPTER);
chapterElement.addStructure(structure);
chapterElement.getNames().addAll(convertTitles(conferencePaper.getTitles()));
chapterElement.getContributors().addAll(convert(conferencePaper.getContributors(), chapterElement));
chapterElement.getDates().addAll(convertDates(conferencePaper.getPublicationDates()));
chapterElement.getRelations().addAll(convertCitationList(conferencePaper.getCitationList()));
if (conferencePaper.getDoiData() != null) {
chapterElement.getIds().add(new YId(IdSchemaIds.EXT_SCHEME_DOI, conferencePaper.getDoiData().getDoi()));
}
updatePages(conferencePaper.getPages(), structure.getCurrent());
String id = generator.generateBookPartId(parent.getId(), "chapter", chapterElement.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_DOI),
getDefaultName(chapterElement));
chapterElement.setId(id);
return chapterElement;
}
内容来源于网络,如有侵权,请联系作者删除!