本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.addStructure()
方法的一些代码示例,展示了YElement.addStructure()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.addStructure()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:addStructure
暂无
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
public void addEmptyStructureToYElement(YElement yelement) {
YStructure articleStructure = new YStructure();
// TODO // czy nie trzeba wiecej nic ustawiac?
articleStructure.setHierarchy(YConstants.EXT_HIERARCHY_JOURNAL);
yelement.addStructure(articleStructure);
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
public YElement extractStructure(ArticleEditForm form, YElement articleElement) {
List<YStructure> journalStructs = setNonJournalStructsAndGetJournalStructs(articleElement);
YStructure journalStruct = createJournalStructWithAncestors(form, journalStructs);
addCurrent(journalStruct, form);
articleElement.addStructure(journalStruct);
return articleElement;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
public static YStructure getOrCreateJournalStructure(YElement element) {
YStructure structure = element.getStructure(YConstants.EXT_HIERARCHY_JOURNAL);
if (structure == null) {
structure = new YStructure(YConstants.EXT_HIERARCHY_JOURNAL);
structure.setCurrent(new YCurrent(YConstants.EXT_LEVEL_JOURNAL_ARTICLE));
element.addStructure(structure);
}
return structure;
}
代码示例来源: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.synat/synat-portal-core
private void appendStructure(ResourceData resource, YElement yElement) {
final String hierarchy = ResourceDataConstants.MAP_TYPE_TO_HIERARCHY.get(resource.getType());
final String current = ResourceDataConstants.MAP_TYPE_TO_CURRENT.get(resource.getType());
YStructure structure = new YStructure(hierarchy);
final AncestorData pages = extractAncestorFromHierarchyData(resource, ResourceDataConstants.ANCESTOR_LEVEL_NAME_PAGES);
final String position = pages == null ? StringUtils.EMPTY : StringUtils.defaultString(pages.getName());
structure.setCurrent(new YCurrent(current).setPosition(position));
final Collection<YAncestor> ancestors = mapHierarchyToAncestors(resource.getType(), resource.getHierarchy());
if (CollectionUtils.isNotEmpty(ancestors)) {
structure.setAncestors(ancestors);
}
yElement.addStructure(structure);
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
public List<YElement> create(PublicationMeta meta, String hierarchyId, YLanguage defaultLanguage, List<YElement> ancestors) {
List<YElement> elements = new ArrayList<YElement>();
List<YElement> localAncestors = new ArrayList<>(ancestors);
StructureBuilder builder = this.getSynchronized(builders::get, this::registerBuilder, hierarchyId);
for (YStructure structure = builder.build(meta, localAncestors); structure != null; structure = builder.build(meta, localAncestors)) {
YElement element = new YElement();
element.addStructure(structure);
elements.add(element);
Collection<PublicationMetadataParser> parsers = this.<String, Collection<PublicationMetadataParser>> getSynchronized(mappedParsers::get,
this::registerParsers, structure.getCurrent().getLevel());
for (PublicationMetadataParser parser : parsers) {
YLanguage pmLanguage = YLanguage.byCode(meta.getXmlLang(), defaultLanguage);
parser.parseMetadata(element, meta, pmLanguage, localAncestors);
}
localAncestors.add(element);
}
return elements;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement buildVolumeElementFromSeries(ProceedingsSeriesMetadata proceedingsSeriesMetadata, YElement parent, CrossrefIdGenerator generator) {
YElement bookVolumeElement = new YElement();
bookVolumeElement.addStructure(buildStructureFromParent(parent, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, HierarchyWithLevelIds.EXT_LEVEL_BOOK_VOLUME));
bookVolumeElement.addName(new YName(proceedingsSeriesMetadata.getVolume()));
String id = generator.generateBookVolumeId(parent.getId(), proceedingsSeriesMetadata.getVolume());
bookVolumeElement.setId(id);
return bookVolumeElement;
}
代码示例来源: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 buildBookFromBookMetadata(BookMetadata bookMetadata, 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(bookMetadata.getTitles()));
bookElement.getContributors().addAll(convert(bookMetadata.getContributors(), bookElement));
bookElement.getDates().addAll(convertDates(bookMetadata.getPublicationDates()));
bookElement.getRelations().addAll(convertCitationList(bookMetadata.getCitationList()));
bookElement.getIds().addAll(convertIsbns(bookMetadata.getIsbns()));
if (bookMetadata.getDoiData() != null) {
bookElement.getIds().add(new YId(IdSchemaIds.EXT_SCHEME_DOI, bookMetadata.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 buildArticleElement(JournalArticle article, YElement parentElement, CrossrefIdGenerator generator) {
if (article == null) {
return null;
}
YStructure structure = buildStructureFromParent(parentElement, HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ARTICLE);
YElement element = new YElement();
element.addStructure(structure);
updatePages(article.getPages(), structure.getCurrent());
List<YName> elementTitles = convertTitles(article.getTitles().toArray(new Titles[0]));
element.getNames().addAll(elementTitles);
if (article.getContributors() != null) {
element.getContributors().addAll(convert(article.getContributors(), element));
}
element.getRelations().addAll(convertCitationList(article.getCitationList()));
element.getDates().addAll(convertDates(article.getPublicationDates()));
for (Abstract abs : article.getAbstracts()) {
element.getDescriptions().add(convert(abs));
}
String elementId = generator.generateJournalArticleId(article.getDoiData().getDoi());
element.setId(elementId);
return element;
}
代码示例来源: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.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;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement buildBookElementFromSeries(ProceedingsSeriesMetadata proceedingsSeriesMetadata, YElement parent, CrossrefIdGenerator generator) {
YElement bookElement = new YElement();
bookElement.addStructure(buildStructureFromParent(parent, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, HierarchyWithLevelIds.EXT_LEVEL_BOOK_BOOK));
bookElement.getNames().add(new YName(proceedingsSeriesMetadata.getProceedingsTitle()));
bookElement.getDates().addAll(convertDates(proceedingsSeriesMetadata.getPublicationDates()));
bookElement.getIds().addAll(convertIsbns(proceedingsSeriesMetadata.getIsbns()));
if (StringUtils.isNotBlank(proceedingsSeriesMetadata.getProceedingsSubject())) {
YName subject = new YName(proceedingsSeriesMetadata.getProceedingsSubject());
subject.setType(NameTypes.NM_SUBTITLE);
bookElement.addName(subject);
}
if (proceedingsSeriesMetadata.getDoiData() != null) {
bookElement.getIds().add(new YId(IdSchemaIds.EXT_SCHEME_DOI, proceedingsSeriesMetadata.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 buildVolumeElement(JournalIssue journalIssue, YElement parentElement, CrossrefIdGenerator generator) {
if (journalIssue == null || journalIssue.getJournalVolume() == null || journalIssue.getJournalVolume().getVolume() == null) {
return null;
}
String volume = journalIssue.getJournalVolume().getVolume();
YElement volumeElement = new YElement();
YStructure structure = buildStructureFromParent(parentElement, HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_VOLUME);
volumeElement.addStructure(structure);
volumeElement.addName(new YName(volume));
if (StringUtils.isBlank(journalIssue.getIssue())) {
volumeElement.getContributors().addAll(convert(journalIssue.getContributors(), volumeElement));
volumeElement.getDates().addAll(convertDates(journalIssue.getPublicationDates()));
}
String journalId = getAncestorId(structure, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_JOURNAL);
String yearId = getAncestorId(structure, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_YEAR);
String volumeId = generator.generateJournalVolumeId(yearId, journalId, volume);
volumeElement.setId(volumeId);
return volumeElement;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement buildIssueElement(JournalIssue journalIssue, YElement parentElement, CrossrefIdGenerator generator) {
if (journalIssue == null) {
return null;
}
String issue = journalIssue.getIssue();
if (issue == null) {
return null;
}
YElement issueElement = new YElement();
YStructure structure = buildStructureFromParent(parentElement, HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ISSUE);
issueElement.addStructure(structure);
issueElement.getContributors().addAll(convert(journalIssue.getContributors(), issueElement));
issueElement.getDates().addAll(convertDates(journalIssue.getPublicationDates()));
issueElement.addName(new YName(issue));
String journalId = getAncestorId(structure, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_JOURNAL);
String yearId = getAncestorId(structure, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_YEAR);
String volumeId = getAncestorId(structure, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_VOLUME);
String issueId = generator.generateJournalIssueId(volumeId, yearId, journalId, issue);
issueElement.setId(issueId);
return issueElement;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
@Override
public YElement process(Book book, YElement parent, CrossrefIdGenerator generator) {
BookSeriesMetadata bookSeriesMetadata = book.getBookSeriesMetadata();
String id = generator.generateBookVolumeId(parent.getId(), bookSeriesMetadata.getVolume());
YElement element = new YElement();
element.setId(id);
element.addName(new YName(bookSeriesMetadata.getVolume()));
YStructure structure = new YStructure(HierarchyWithLevelIds.EXT_HIERARCHY_BOOK);
YCurrent current = new YCurrent(HierarchyWithLevelIds.EXT_LEVEL_BOOK_VOLUME);
structure.setCurrent(current);
structure.getAncestors().addAll(parent.getStructure(HierarchyWithLevelIds.EXT_HIERARCHY_BOOK).getAncestors());
element.addStructure(structure);
return element;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
@Override
public YElement process(Book book, YElement parent, CrossrefIdGenerator generator) {
ContentItem contentItem = book.getContentItem();
YElement element = new YElement();
element.getNames().addAll(convertTitles(contentItem.getTitles()));
element.getRelations().addAll(convertCitationList(contentItem.getCitationList()));
element.getContributors().addAll(convert(contentItem.getContributors(), element));
element.getDates().addAll(convertDates(contentItem.getPublicationDates()));
String level = getContentItemLevel(contentItem.getComponentType());
YStructure structure = buildStructureFromParent(parent, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, level);
if(contentItem.getLevelSequenceNumber() != null){
structure.getCurrent().setPosition(contentItem.getLevelSequenceNumber().toString());
} else {
updatePages(contentItem.getPages(), structure.getCurrent());
}
element.addStructure(structure);
if (contentItem.getDoiData() != null) {
element.getIds().add(new YId(IdSchemaIds.EXT_SCHEME_DOI, contentItem.getDoiData().getDoi()));
}
String id = generator.generateBookPartId(parent.getId(), contentItem.getComponentType(), element.getFirstIdOrNullIfAny(IdSchemaIds.EXT_SCHEME_DOI),
element.getOneName() != null ? element.getOneName().getText() : null);
element.setId(id);
return element;
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-speech-to-text
private void prepareYElementFromApi(Video video, YElement yElement) throws ParseException {
yElement.addName(new YName(video.getSnippet().getTitle()));
yElement.addDescription(new YDescription(YLanguage.Undetermined, video.getSnippet().getDescription()
, DescriptionTypes.DS_SUMMARY));
prepareDate(video, yElement);
String license = video.getStatus().getLicense();
if(null != license && license.contains("creativeCommon")) {
yElement.addTagList(new YTagList().setType(YModelUtils.LICENSE).addValue("cc0"));
}
prepareContent(video, yElement);
List<String> tags = video.getSnippet().getTags();
if (CollectionUtils.isNotEmpty(tags)) {
yElement.addTagList(new YTagList().setType(TagTypes.TG_KEYWORD).setValues(tags));
}
YCurrent currentLevel = new YCurrent().setLevel(VideoConstants.VIDEO_CURRENT_LEVEL);
yElement.addStructure(new YStructure()
.setHierarchy(HierarchyWithLevelIds.EXT_HIERARCHY_PUBLICATION)
.setCurrent(currentLevel));
prepareAttributes(video, yElement);
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
/**
* Creates an element in the hierarchy specified by the <code>hierarchy</code> property.
*
* @param level level for the element in the hierarchy
* @param name name to use as the canonical name of the element
* @param parent parent for the element in the hierarchy
* @return the created element
*/
public YElement element(String level, YName name, YElement parent) {
YStructure ps = parent.getStructure(getHierarchy());
YStructure struct = new YStructure(getHierarchy()).setCurrent(new YCurrent(level));
if (ps != null)
struct
.setAncestors(ps.getAncestors())
.addAncestor(
new YAncestor(ps.getCurrent().getLevel(), parent.getId())
.addName(parent.getDefaultName()));
return new YElement(
generateId(EXT_PREFIX_ELEMENT, parent, name))
.addName(name)
.addStructure(struct);
}
内容来源于网络,如有侵权,请联系作者删除!