gpt4 book ai didi

pl.edu.icm.model.bwmeta.y.YDescription类的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 14:24:40 27 4
gpt4 key购买 nike

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

YDescription介绍

暂无

代码示例

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

/**
 * Creates a description given its language, text and type.
 * If the text is empty or null, does not create a description but returns null.
 * 
 * @param lang language of the description
 * @param text text of the description, may be null
 * @param type type of the description
 * @return created description, or null if text was empty or null
 */
public YDescription description(YLanguage lang, YRichText text, String type) {
  if (empty(text)) return null;
  return new YDescription(lang, text, type);
}

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

protected void convertDescription(YElement yElement, BibEntry bibEntry) {
  List<YDescription> descriptions = yElement.getDescriptions();
  for (YDescription description : descriptions) {
    if (description.getType().equals(YConstants.DS_ABSTRACT)) {
      bibEntry.setField(BibEntry.FIELD_ABSTRACT, description.getText());
    }
    if (description.getType().equals(YConstants.DS_NOTE)) {
      bibEntry.setField(BibEntry.FIELD_NOTE, description.getText());
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

protected List<LocalizedString> getDescription(YInstitution element,
    IFilteringContext filteringContext, String type) {
  List<LocalizedString> result = new ArrayList<LocalizedString>();
  
  for (YDescription description : element.getDescriptions()) {
    if (type.equals(description.getType())) {
      result.add(new LocalizedString(languageDictionary.getShortDescription(
        description.getLanguage().getShortCode()),
        detailsFilter.filter(YRTHelper.toXmlFragment(description.getRichText()), InputType.RICH_TEXT,
        filteringContext)));
    }
  }
  
  return result;
}

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

private YDescription createDescription(String descriptionType, YLanguage yLanguage, Abstract abs) {
  String abstractContent = abs.getAbstractContent();
  YRichText richText = BaseYModelUtils.buildRichText(abstractContent);
  YDescription desc = new YDescription();
  desc.setLanguage(yLanguage);
  desc.setType(descriptionType);
  desc.setText(richText);
  return desc;
}

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

public void convertDescription(BibEntry source, YElement yElement) {
  //note
  String note = source.getFirstFieldValue(BibEntry.FIELD_NOTE);
  if (note != null) {
    yElement.addDescription(new YDescription().setType(YConstants.DS_NOTE).setText(note));
  }
  //abstract
  String abstractField = source.getFirstFieldValue(BibEntry.FIELD_ABSTRACT);
  if (abstractField != null) {
    yElement.addDescription(new YDescription().setType(YConstants.DS_ABSTRACT).setText(abstractField));
  }
}

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

/**
 * accomplished
 */
private void parseDescriptions() {
  if(!in_item.getDescriptions().isEmpty()){
    int descriptionid = 0;
    for(YDescription yd : in_item.getDescriptions()){
      descriptionid++;
      Statements s_desc = new Statements();statements.add(s_desc);
      s_desc.setSubject(RelConstants.NS_DESCRIPTION+in_item.getId()+"/"+descriptionid);
      LinkedList<PredicateAndObject> paos_description = new LinkedList<PredicateAndObject>();
      paos_description.add(new PredicateAndObject(RelConstants.RL_LANGUAGE, yd.getLanguage().getName()));
      paos_description.add(new PredicateAndObject(RelConstants.RL_TYPE, yd.getType()));
      paos_description.add(new PredicateAndObject(RelConstants.RL_TEXT, yd.getText()));				
      paos_doc.add(new PredicateAndObject(RelConstants.RL_HAS_DESCRIPTION , RelConstants.NS_DESCRIPTION+in_item.getId()+"/"+descriptionid));
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

if (description.getLanguage().getShortCode().equals(lang)) {
  YRichText yRichText = description.getRichText();
  if(isSimple(yRichText)){
    page.setContent(description.getText());
  } else {
    String text = YRTHelper.toXmlFragmentWithoutNamespaces(yRichText);

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

/**
 * Selects most apropriate (English if available) description.
 * 
 * @param descriptions
 *            list of available descriptions
 * @return best found description or null if list is empty
 */
protected static String selectBestDescription(List<YDescription> descriptions) {
  if (descriptions == null || descriptions.size() == 0) {
    return null;
  }
  for (YDescription description : descriptions) { // Search for English version
    if (description.getLanguage().equals(YLanguage.English)) {
      return description.getText();
    }
  }
  return descriptions.get(0).getText();
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

protected YDescription convert(Abstract abs) {
  YDescription description = new YDescription();
  if (StringUtils.isNotBlank(abs.getLang())) {
    description.setLanguage(YLanguage.byCode(abs.getLang()));
  }
  final List<Part> parts;
  if (!abs.getPS().isEmpty()) {
    parts = convertToParts(abs.getPS());
  } else if (!abs.getSecs().isEmpty()) {
    parts = convertToParts(abs.getSecs());
  } else {
    return null;
  }
  YRichText richText = new YRichText(parts);
  description.setText(richText);
  return description;
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

private boolean notEmpty(YDescription ydescription){
  return (ydescription != null && ydescription.getText() != null);
}

代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core

private LocalizedString convertIntoLocalizedStringFrom(YDescription description){
  return new LocalizedString(getLangCodeFor(description.getLanguage()), YRTHelper.toXmlFragmentWithoutNamespaces(description.getRichText()));
}

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

public static boolean acceptableDescription(YDescription yDescription) {
  return StringUtils.isBlank(yDescription.getType()) || ACCEPTED_DESCRIPTION_TYPES.contains(yDescription.getType());
}

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

if (YConstants.DS_ABSTRACT.equals(description.getType())) {
  try {
    LanguageEnum lang = LanguageEnum.fromValue(description.getLanguage().getShortCode());
    if (lang != null) {
      languagesList.getLanguage().add(lang);
    logArticleWarning(yArticle.getId(), "abstract language {} can not be converted to polindex language", description.getLanguage().getShortCode());

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

public static boolean acceptableDescription(YDescription yDescription, YLanguage language) {
  if (language == null) {
    return acceptableDescription(yDescription);
  } else {
    return yDescription.getLanguage().equals(language) && acceptableDescription(yDescription);
  }
}

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

public static String getDefaultDescriptionString(AbstractNDA<?> element, YLanguage language) {
  final YDescription defaultDescription = getDefaultDescription(element, language);
  if (defaultDescription != null) {
    return yRichTextToString(defaultDescription.getRichText());
  } else {
    return "";
  }
}

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

entry.getValue().setType(DescriptionTypes.DS_ABSTRACT);

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

/**
 * accomplished
 */
private void parseDescriptions() {
  if(!in_item.getDescriptions().isEmpty()){
    int descriptionid = 0;
    for(YDescription yd : in_item.getDescriptions()){
      descriptionid++;
      Statements s_desc = new Statements();statements.add(s_desc);
      s_desc.setSubject(RelConstants.NS_DESCRIPTION+in_item.getId()+"#"+descriptionid);
      LinkedList<PredicateAndObject> paos_description = new LinkedList<PredicateAndObject>();
      paos_description.add(new PredicateAndObject(RelConstants.RL_LANGUAGE, yd.getLanguage().getName()));
      paos_description.add(new PredicateAndObject(RelConstants.RL_TYPE, yd.getType()));
      paos_description.add(new PredicateAndObject(RelConstants.RL_TEXT, yd.getText()));				
      paos_doc.add(new PredicateAndObject(RelConstants.RL_HAS_DESCRIPTION , RelConstants.NS_DESCRIPTION+in_item.getId()+"#"+descriptionid));
    }
  }
}

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

@Override
protected boolean enhanceMetadata(BxDocument document, YElement metadata) {
  String text = "";
  for (BxPage page : filterPages(document)) {
    for (BxZone zone : filterZones(page)) {
      String[] lines = zone.toText().split("\n");
      for (String line : lines) {
        if (line.toLowerCase().startsWith("keywords")
          || line.toLowerCase().startsWith("key words")) {
          break;
        }
        text += "\n" + line;
      }
    }
   }
  text = text.trim();
  if (!text.isEmpty()) {
    Matcher matcher = PREFIX.matcher(text);
    if (matcher.find()) {
      text = text.substring(matcher.end()).trim();
    }
    metadata.addDescription(new YDescription().setType(YConstants.DS_ABSTRACT).setText(text));
    return true;
  }
  return false;
}

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

private String extractTextFromYElement(final YElement yElement) throws IOException {
  final String sep = " ";
  final YLanguage lang = YLanguage.Polish;
  StringBuilder builder = new StringBuilder();
  for (YName data : yElement.getNames()) {
    if(lang.equals(data.getLanguage())){
      builder.append(data.getText());
      builder.append(sep);
    }
  }
  for (YDescription data : yElement.getDescriptions()) {
    if(lang.equals(data.getLanguage())){
      builder.append(data.getText());
      builder.append(sep);
    }
  }
  
  for(FilteredContentEntry<?> plainTextFile:ResourceDisplayUtilsImpl.fetchPlainTextContentEntries(yElement)){
    if(plainTextFile.getSource() instanceof YContentFile){
      YContentFile file = (YContentFile)plainTextFile.getSource();
      ElementContent elementContent = repositoryFacade.fetchContent(yElement.getId(), file.getLocations().get(0));
      
      builder.append(IOUtils.toString(elementContent.getStream()));
      builder.append(sep);
    }
  }
  return builder.toString().trim();
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

protected void fillDescriptions(YElement yElement, List<YExportable> referedElements, Map<String, List<StringWithAttributes>> ret) {
  //      description element
  if (!yElement.getDescriptions().isEmpty()) {
    ret.put(E_DESCRIPTION, new ArrayList<StringWithAttributes>());
  }
  for (YDescription yDescription : yElement.getDescriptions()) {
    ret.get(E_DESCRIPTION).add(new StringWithAttributes(yDescription.getText()));
  }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com