本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.addName()
方法的一些代码示例,展示了YElement.addName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.addName()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:addName
暂无
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
@Override
protected boolean enhanceMetadata(BxZone zone, YElement metadata) {
metadata.addName(new YName(zone.toText().replaceAll("\n", " ")));
return true;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
@Override
protected boolean enhanceMetadata(BxZone zone, YElement metadata) {
if (zone.getLines().size() < 2) {
return false;
} else {
Iterator<BxLine> iterator = zone.getLines().iterator();
String firstLine = iterator.next().toText().toLowerCase();
if (types.contains(firstLine)) {
String text = iterator.next().toText();
while (iterator.hasNext()) {
text += " " + iterator.next().toText();
}
metadata.addName(new YName(text));
return true;
} else {
return false;
}
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
public void fillArticleInformation(YElement article, JSONObject message){
if (message.containsKey("title")) {
for (Object o : (JSONArray) message.get("title")) {
YName tit = new YName(o.toString());
article.addName(tit);
}
}
fillAuthorsInformation(article, message);
JSONArray tagList=(JSONArray)message.get("subject");
if (tagList!=null && tagList.size()>0) {
YTagList tl=new YTagList();
tl.setType(TagTypes.TG_KEYWORD);
for (Object o : (JSONArray) message.get("subject")) {
tl.addValue(o.toString());
}
article.addTagList(tl);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
@Override
public void parseMetadata(YElement element, PublicationMeta pm, YLanguage defaultLanguage, List<YElement> ancestors) {
Numbering volumeNumbering = WileyUtils.getNumbering(pm.getNumberingGroup(), WileyComponentConstants.NUMBERING_VOLUME);
String volNum = volumeNumbering.getNumber();
String volume = volumeNumbering.getvalue();
volNum = StringUtils.isNotBlank(volNum) ? volNum : volume;
String id = ancestors.get(ancestors.size() - 1).getId() + "-v-" + volNum;
id = WileyUtils.processId(id);
element.setId(id);
YName nam = new YName(volume);
nam.setSortKey(volNum);
element.addName(nam);
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-yadda
private YElement prepareYElement(String id, Properties prop) {
YElement yElement = new YElement();
yElement.setId(id);
if (!prop.getProperty("title").isEmpty()) {
yElement.addName(new YName(prepareProperty("title", prop)));
}
yElement.addDescription(new YDescription(YLanguage.Undetermined, prepareProperty("description", prop), DescriptionTypes.DS_SUMMARY));
if (!prop.getProperty("key-words").isEmpty()) {
List<String> tags = new ArrayList<String>(Arrays.asList(prepareProperty("key-words", prop).split(",")));
yElement.addTagList(new YTagList().setType(TagTypes.TG_KEYWORD).setValues(tags));
}
if (!prop.getProperty("supplier").isEmpty()) {
yElement.addAttribute("copyright-holder", prepareProperty("supplier", prop));
}
if (!prop.getProperty("duration").isEmpty()) {
yElement.addAttribute("duration", prepareProperty("duration", prop));
}
yElement.addLanguage(YLanguage.Undetermined);
return yElement;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private void updateIssue(ZentralBlattSoFieldParser.SoFieldData soData) {
if (soData.issue != null && soData.issue.length() > 0) {
YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_ISSUE); // TODO
// UID?
YName issueName = new YName(soData.issue);
yIssue.addName(issueName);
ancestor.setIdentity(yIssue.getId());
ancestor.addName(issueName);
yArticle.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor);
}
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private void updateYear(ZentralBlattSoFieldParser.SoFieldData soData, String pyYear) {
YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_YEAR); // TODO
// UID?
// soData.year is preferred
if (soData.year != null && soData.year.length() > 0) {
if (pyYear != null && pyYear.length() > 0 && !soData.year.equals(pyYear)) {
log.warn("soData.year:[{}] != year:[{}]", soData.year, pyYear);
}
YName yearName = new YName(soData.year);
yYear.addName(yearName);
ancestor.setIdentity(yYear.getId());
ancestor.addName(yearName);
yVolume.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor);
yIssue.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor);
yArticle.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor);
}
// pyYear is assumed to refer just to publication - not to journal
// itself
/*
* else if (pyYear != null && pyYear.length() > 0) { YName yearName =
* new YName(pyYear) ancestor.addName(yearName);
* yYear.addName(yearName); structure.addAncestor(ancestor); }
*/
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private void updateVolume(ZentralBlattSoFieldParser.SoFieldData soData) {
if (soData.volume != null && soData.volume.length() > 0) {
YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_VOLUME); // TODO
// UID?
YName volumeName = new YName(soData.volume);
yVolume.addName(volumeName);
ancestor.setIdentity(yVolume.getId());
ancestor.addName(volumeName);
yIssue.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor);
yArticle.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
@Override
public void parseMetadata(YElement element, PublicationMeta pm, YLanguage defaultLanguage, List<YElement> ancestors) {
Numbering issueNumbering = WileyUtils.getNumbering(pm.getNumberingGroup(), WileyComponentConstants.NUMBERING_ISSUE, WileyComponentConstants.NUMBERING_SUPPLEMENT);
String issueNumber = issueNumbering.getvalue();
String id = ancestors.get(ancestors.size() - 1).getId() + "-i-" + issueNumber;
id = WileyUtils.processId(id);
element.setId(id);
YName nam = new YName(issueNumber);
element.addName(nam);
if (pm.getCoverDate() != null) {
String coverDate = StringUtils.trim(pm.getCoverDate().getStartDate());
YDate date = WileyUtils.parseDate(coverDate, DateTypes.DT_COVER);
if (date != null) {
element.addDate(date);
}
}
element.getIds().addAll(doiParser.parseIds(pm));
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement buildJournalYearElement(Journal journal, YElement journalElement, CrossrefIdGenerator generator) {
if (journal.getJournalIssue() == null && journal.getJournalArticle() == null) {
return null;
}
List<YDate> dates = new ArrayList<>();
if (journal.getJournalIssue() != null) {
dates.addAll(convertDates(journal.getJournalIssue().getPublicationDates()));
}
if (journal.getJournalArticle() != null) {
dates.addAll(convertDates(journal.getJournalArticle().getPublicationDates()));
}
Integer year = getYear(dates);
if (year == null) {
return null;
}
YElement yearElement = new YElement();
YStructure structure = buildStructureFromParent(journalElement, HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_YEAR);
yearElement.addStructure(structure);
yearElement.addName(new YName(year.toString()));
yearElement.setId(generator.generateJournalYearId(journalElement.getId(), year.toString()));
return yearElement;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* Processes <code>journal-meta</code> metadata creating a journal element.
*
* @param jmeta the metadata element to extract journal info from
* @param parent parent element for the created element
* @return the created journal element
*/
private YElement processJournal(org.jdom.Element jmeta, YElement parent) {
org.jdom.Element jtitles = jmeta.getChild("journal-title-group");
List<org.jdom.Element> aids = jmeta.getChildren("journal-id");
YElement journal = y.element(EXT_LEVEL_JOURNAL_JOURNAL,
y.canonicalName(YLanguage.Undetermined, jtitles.getChildTextTrim("journal-title")),
parent).addName(y.name(YLanguage.Undetermined, jtitles.getChildTextTrim("abbrev-journal-title"), NM_ABBREVIATION)).addId(y.id(EXT_SCHEME_ISSN, jmeta.getChildTextTrim("issn")));
for (org.jdom.Element aid : aids) {
if ("eudml-id".equalsIgnoreCase(aid.getAttributeValue("journal-id-type"))) {
journal.addId(new YId(YConstants.EXT_SCHEMA_EUDML, aid.getText()));
} else {
journal.addId(new YId("bwmeta1.id-class." + aid.getAttributeValue("journal-id-type"), aid.getText()));
}
}
YName pname = y.canonicalName(YLanguage.Undetermined, getTextTrim(optDescendant(jmeta, "publisher", "publisher-name")));
journal.addContributor(new YContributor(CR_PUBLISHER, true).addName(pname));
return journal;
}
代码示例来源: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
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 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
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
/**
* Creates an element in the hierarchy.
*
* @param level hierarchy for the element
* @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
* @param id eudml id
* @return the created element
*/
public YElement element(String hierarchy, String level, YName name, YElement parent, String id) {
YStructure ps = parent==null ? null : parent.getStructure(hierarchy);
YStructure struct = new YStructure(hierarchy).setCurrent(new YCurrent(level));
List<String> issns = parent==null ? null : parent.getIds(IdSchemaIds.EXT_SCHEME_ISSN);
String issn = (issns==null || issns.isEmpty()) ? null : issns.get(0);
if (ps != null) {
YAncestor ancestor = new YAncestor(ps.getCurrent().getLevel(), parent.getId()).addName(parent.getDefaultName());
if (StringUtils.isNotEmpty(issn)) {
ancestor.addId(new YId(IdSchemaIds.EXT_SCHEME_ISSN, issn));
}
struct.setAncestors(ps.getAncestors()).addAncestor(ancestor);
}
return new YElement(id).addName(name).addStructure(struct);
}
代码示例来源: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.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);
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement initArticleinBookElement(org.jdom.Element ameta, YElement parent, NlmIdGenerator idGenerator) {
org.jdom.Element atitles = JDOMHelper.optDescendant(ameta, "title-group");
org.jdom.Element atitle = JDOMHelper.optDescendant(atitles, "article-title");
org.jdom.Element aabstract = JDOMHelper.getChild(ameta, "abstract");
Element articleId = JDOMHelper.getChildWithGivenAttributeValue(ameta, "article-id", "pub-id-type", "eudml-id");
String eudmlId=articleId==null?null:articleId.getValue();
String id=idGenerator.getBookArticleId(eudmlId);
YElement article = factory.element(NlmToYConstants.EXT_HIERARCHY_MBOOK_ARTICLE, NlmToYConstants.EXT_LEVEL_MBOOK_ARTICLE_ARTICLE,
y.canonicalName(JDOMHelper.getYLang(atitle), JDOMHelper.textOfElement(atitle)),
parent, id)
.addDescription(y.description(JDOMHelper.getYLang(aabstract),
JDOMHelper.textOfElement(aabstract), DescriptionTypes.DS_ABSTRACT))
.addLanguage(JDOMHelper.getYLang(ameta));
List<org.jdom.Element> trs = JDOMHelper.optChildren(atitles, "trans-title-group");
for (org.jdom.Element tr : trs) {
article.addName(y.name(JDOMHelper.getYLang(tr), JDOMHelper.textOfElement(JDOMHelper.getChild(tr, "trans-title")), NameTypes.NM_ALTERNATIVE));
}
return article;
}
内容来源于网络,如有侵权,请联系作者删除!