pl.edu.icm.model.bwmeta.y.YElement.getDates()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(15.6k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.getDates()方法的一些代码示例,展示了YElement.getDates()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.getDates()方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:getDates

YElement.getDates介绍

暂无

代码示例

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

/**
 * accomplished
 */
private void parseDates() {
  if(!in_item.getDates().isEmpty()){
    for(YDate yd : in_item.getDates()){
      if(yd.getYear()!=0)
        paos_doc.add(new PredicateAndObject(RelConstants.RL_YEAR, ""+yd.getYear()));
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

/**
 * accomplished
 */
private void parseDates() {
  if(!in_item.getDates().isEmpty()){
    for(YDate yd : in_item.getDates()){
      if(yd.getYear()!=0)
        paos_doc.add(new PredicateAndObject(RelConstants.RL_YEAR, ""+yd.getYear()));
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import

@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);
  
  return YElementsParsingToolbox.removeEmptyValues(selectBestDate(article.getDates()));
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

@Override
  void compare(YElement expected, YElement actual, EvalResult result) {
    List<YDate> expDates = expected.getDates();
    Map<String, YDate> actDatesMap = new HashMap<String, YDate>();
    for (YDate date : actual.getDates()) {
      String type = date.getType();
      actDatesMap.put(type, date);
    }
    for (YDate date : expDates) {
      String type = date.getType();
      if (actDatesMap.containsKey(type)) {
        if (date.equals(actDatesMap.get(type))) {
          result.append("Date - " + type, ResultStatus.RECOGNIZED, 1);
        } else {
          result.append("Date - " + type, ResultStatus.FAILED, 1);
        }
        actDatesMap.remove(type);
      } else {
        result.append("Date - " + type, ResultStatus.FAILED, 1);
      }
    }
    for (String type : actDatesMap.keySet()) {
      result.append("Date - " + type, ResultStatus.REDUNDANT, 1);
    }
  }
},

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import

@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);
  return YElementsParsingToolbox.removeEmptyValues(selectBestDate(article.getDates()));
}

代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct

@Override
public void parseMetadata(YElement element, PublicationMeta pm, YLanguage defaultLanguage, List<YElement> ancestors) {
  element.getDates().addAll(getDates(pm.getEventGroup()));
  for (YElement ancestor : ancestors) {
    for (YDate date : ancestor.getDates()) {
      if (element.getDate(date.getType()) == null) {
        element.addDate(date);
      }
    }
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

protected void fillDates(HtmlMetaHeaders metadata, YElement yElement) {
  for (YDate yDate : yElement.getDates()) {
    metadata.addMetadataName(DC_NAMESPACE + SEPARATOR + DublinCoreStrings.E_DATE, yDate.getText());
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct

@Override
protected void postProcessELements(List<YElement> elements) {
  Optional<YElement> chapterElement = getElementByPredicate(elements, this::hasChapterLevel);
  Optional<YElement> bookElement = getElementByPredicate(elements, this::hasBookLevel);
  if (chapterElement.isPresent() && bookElement.isPresent()) {
    for(YDate date:chapterElement.get().getDates()){
      if(bookElement.get().getDate(date.getType()) == null){
        bookElement.get().addDate(date);
      }
    }
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

public Map<String, YDate> extractDates(YElement yElement) {
  Map<String, YDate> dates = processYDates(yElement.getDates());
  dates.putAll(extractDatesFromHierarchy(yElement.getStructures()));
  return dates;
}

代码示例来源: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

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 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 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.synat/synat-portal-core

protected void fillPublicationDate(HtmlMetaHeaders metadata, YElement yElement) {
  for (YDate date : yElement.getDates()) {
    if (StringUtils.equals(DateTypes.DT_PUBLISHED, date.getType())) {
      String parsedDate = parseDate(date);
      if (parsedDate != null) {
        metadata.addMetadataName(WP_PUBLICATION_DATE, parseDate(date));
        return;
      }
    }
  }
  if (yElement.getStructure(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL) != null) {
    YAncestor yAncestor = yElement.getStructure(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL).getAncestor(HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_YEAR);
    if (yAncestor != null && yAncestor.getOneName() != null) {
      metadata.addMetadataName(WP_PUBLICATION_DATE, yAncestor.getOneName().getText());
    }
  }
}

代码示例来源: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 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 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

@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;
}

相关文章