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

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

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

YName.getType介绍

暂无

代码示例

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

private static List<YName> filterNamesOfType(List<YName> names, String type) {
  List<YName> selected = new ArrayList<YName>();
  for (YName n: names) {
    if (n.getType().equals(type)) {
      selected.add(n);
    }
  }
  return selected;
}

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

private List<YName> removeTitles() {
  List<YName> yNames = new ArrayList<>();
  for (YName yName : safe(article.getNames())) {
    if(!yName.getType().equals(YConstants.NM_CANONICAL) && !yName.getType().equals(YConstants.NM_ALTERNATIVE)) {
      yNames.add(yName);
    }
  }
  return yNames;
}

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

private Map<String, FilteredString> buildFilteredStrings(List<YName> nameList) {
  Map<String, FilteredString> result = new HashMap<>();
  for (YName name : nameList) {
    result.put(name.getType(), buildFilteredString(name.getRichText()));
  }
  return result;
}

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

public static List<String> alternativeNames(final AbstractNDA<?> named) {
  final List<String> result = new ArrayList<String>();
  final String defaultName = defaultName(named);
  for (final YName name : named.getNames()) {
    if (isMainOrAlternativeName(name.getType())) {
      final String text = text(name);
      if (StringUtils.isNotBlank(text) && !text.equals(defaultName)) {
        result.add(text);
      }
    }
  }
  return result;
}

代码示例来源: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 selectContributors(List<YContributor> contribs) {
  if (contribs == null || contribs.size() == 0) {
    return null;
  }
  StringBuilder text = new StringBuilder();
    
  for (YContributor contrib : contribs) {
    text.append("contributor:"+contrib.getRole());
    for(YName name : contrib.getNames()){
      text.append(YElementToZentralBlattConverter.SUGGESTED_MULTIVALUE_FIELD_SEPARATOR2+name.getType()+":"+name.getText());
    }
    text.append(YElementToZentralBlattConverter.SUGGESTED_MULTIVALUE_FIELD_SEPARATOR);
  }
  return text.toString();
}

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

private List<String> transformNames(List<YName> namesInSingleLanguage) {
  List<String> result = new LinkedList<>();
  String superTitle = null;
  String title = null;
  String subTitle = null;
  for (YName yName : namesInSingleLanguage) {
    if (superTitle == null && NameTypes.NM_SUPERTITLE.equals(yName.getType())) {
      superTitle = YModelUtils.yRichTextToIndexString(yName.getRichText());
    } else if (title == null && NameTypes.NM_CANONICAL.equals(yName.getType())) {
      title = YModelUtils.yRichTextToIndexString(yName.getRichText());
    } else if (subTitle == null && NameTypes.NM_SUBTITLE.equals(yName.getType())) {
      subTitle = YModelUtils.yRichTextToIndexString(yName.getRichText());
    } else {
      result.add(YModelUtils.yRichTextToIndexString(yName.getRichText()));
    }
  }
  final String join = Joiner.on(" ").skipNulls().join(superTitle, title, subTitle);
  if(StringUtils.isNotBlank(join)){
    result.add(join.trim());
  }
  return result;
}

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

protected List<Statements> processPerson(YPerson item) {
    List<Statements> retL = new LinkedList<Statements>();
    
    if(!item.getNames().isEmpty()){
      Statements s = new Statements();
      s.setSubject(RelConstants.NS_PERSON+item.getId());
      LinkedList<PredicateAndObject> pao = new LinkedList<PredicateAndObject>();
      for(YName name : item.getNames()){
        if(name.getType().equals("canonical"))
          pao.add(new PredicateAndObject(RelConstants.RL_NAME,name.getText()));
        else if(name.getType().equals("forenames")){
          pao.add(new PredicateAndObject(RelConstants.RL_FORENAMES,name.getText().replace("[ \\\"]", "")));
        }
        else if(name.getType().equals("surname")){
          pao.add(new PredicateAndObject(RelConstants.RL_SURNAME,name.getText().replace("[ \\\"]", "") ));
        }                    
      }
      s.setContinuations(pao);
      retL.add(s);
    }else;
    
    return retL;
  }
}

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

protected List<Statements> processPerson(YPerson item) {
    List<Statements> retL = new LinkedList<Statements>();
    
    if(!item.getNames().isEmpty()){
      Statements s = new Statements();
      s.setSubject(RelConstants.NS_PERSON+item.getId());
      LinkedList<PredicateAndObject> pao = new LinkedList<PredicateAndObject>();
      for(YName name : item.getNames()){
        if(name.getType().equals("canonical"))
          pao.add(new PredicateAndObject(RelConstants.RL_NAME,name.getText()));
        else if(name.getType().equals("forenames")){
          pao.add(new PredicateAndObject(RelConstants.RL_FORENAMES,name.getText().replace("[ \\\"]", "")));
        }
        else if(name.getType().equals("surname")){
          pao.add(new PredicateAndObject(RelConstants.RL_SURNAME,name.getText().replace("[ \\\"]", "") ));
        }                    
      }
      s.setContinuations(pao);
      retL.add(s);
    }else;
    
    return retL;
  }
}

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

if("canonical".equals(yn.getType())){
  cname = yn.getText().trim();
}else if("forename".equals(yn.getType())){
  fname = fname + " " + yn.getText();
  for(String s : yn.getText().split(" "))
}else if("forenames".equals(yn.getType())){
  fname = fname + " " + yn.getText();
  for(String s : yn.getText().split(" "))
}else if("surname".equals(yn.getType())){
  sname = yn.getText().trim();
  sname = NameProceeder.unifySurname(sname);

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

protected List<Statements> processPerson(YPerson item) {
    List<Statements> retL = new LinkedList<Statements>();
    
    if(!item.getNames().isEmpty()){
      Statements s = new Statements();
      s.setSubject(RelConstants.NS_PERSON+item.getId());
      LinkedList<PredicateAndObject> pao = new LinkedList<PredicateAndObject>();
      for(YName name : item.getNames()){
        if(name.getType().equals("canonical"))
          pao.add(new PredicateAndObject(RelConstants.RL_NAME,NameProceeder.unifyCanonical(name.getText())));
        else if(name.getType().equals("forenames")){
          pao.add(new PredicateAndObject(RelConstants.RL_FORENAMES,NameProceeder.unifyForenames(name.getText())));
        }
        else if(name.getType().equals("surname")){
          pao.add(new PredicateAndObject(RelConstants.RL_SURNAME,NameProceeder.unifySurname(name.getText())));
        }                    
      }
      s.setContinuations(pao);
      retL.add(s);
    }else;
    
    return retL;
  }
}

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

private Map<String, List<LocalizedString>> prepareTypedNames(YElement element,
    IFilteringContext filteringContext) {
  Map<String, List<LocalizedString>> result = new HashMap<String, List<LocalizedString>>();
  for (YName name : element.getNames()) {
      String lang = languageDictionary.getShortDescription(name.getLanguage().getShortCode());
      String text = detailsFilter.filter(YRTHelper.toXmlFragment(name.getRichText()),
          InputType.RICH_TEXT, filteringContext);
      LocalizedString ls = new LocalizedString(lang, text);
      
      List<LocalizedString> list;
      String type = name.getType();
      if (!result.containsKey(type)) {
        list = new ArrayList<LocalizedString>();
        result.put(type, list);
      } else {
        list = result.get(type);
      }
      list.add(ls);
  }
  return result;
}

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

@Override
public void parseMetadata(YElement element, PublicationMeta pm, YLanguage defaultLanguage, List<YElement> ancestors) {
  String partNumber = element.getStructures().get(0).getCurrent().getPosition();
  if(StringUtils.isNotBlank(partNumber)){
    String id = ancestors.get(ancestors.size() - 1).getId() + "-p-" + partNumber;
    id = WileyUtils.processId(id);
    element.setId(id);
  }
  if (element.getNames().size() == 1) {
    YName name = YModelUtils.fetchDefaultName(element);
    if(StringUtils.equals(NameTypes.NM_ALTERNATIVE, name.getType()) && StringUtils.isNotBlank(partNumber)){
      name.setText(BaseYModelUtils.buildRichText(name.getText() + StringUtils.SPACE + partNumber));
    }
    name.setType(NameTypes.NM_CANONICAL);
  }
}

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

private Object prepareTitles(List<YName> names, YName defaultName, IFilteringContext filteringContext) {
  List<LocalizedString> res = new ArrayList<LocalizedString>();
  if (names != null)
    for (YName name : names) {
      if (defaultName != name && YNameAndYDescriptionSorter.isMainOrAlternativeName(name.getType())) {
        String lang = languageDictionary.getShortDescription(name.getLanguage().getShortCode());
        res.add(new LocalizedString(lang, detailsFilter.filter(YRTHelper.toXmlFragment(name.getRichText()),
            InputType.RICH_TEXT, filteringContext)));
      }
    }
  return res;
}

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

if (yName.getType().equals(YConstants.NM_FORENAME)) {

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

protected List<LocalizedString> prepareTitles(YElement element, IFilteringContext filteringContext) {
  YName oneName = element.getDefaultName();
  List<LocalizedString> res = new ArrayList<LocalizedString>();
  for (YName name : element.getNames()) {
    if (name != oneName && YNameAndYDescriptionSorter.isMainOrAlternativeName(name.getType())) {
      String lang = languageDictionary.getShortDescription(name.getLanguage().getShortCode());
      res.add(new LocalizedString(lang, detailsFilter.filter(
          YRTHelper.toXmlFragment(name.getRichText()),
          InputType.RICH_TEXT, filteringContext)));
    }
  }
  return res;
}

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

ArrayList<YName> outZblNames = new ArrayList<YName>();
for(YName n : zblc.getNames()){
  if ("canonical".equals(n.getType())){
    n.setText(NameProceeder.unifyCanonical(n.getText()));
  }else if ("forenames".equals(n.getType())){
    n.setText(NameProceeder.unifyForenames(n.getText()));
  }else if ("forename".equals(n.getType())){
    n.setText(NameProceeder.unifyForenames(n.getText()));
  }else if ("surname".equals(n.getType())){
    n.setText(NameProceeder.unifySurname(n.getText()));
ArrayList<YName> outZblNames = new ArrayList<YName>();
for(YName n : nc.getNames()){
  if ("canonical".equals(n.getType())){
    n.setText(NameProceeder.unifyCanonical(n.getText()));
  }else if ("forenames".equals(n.getType())){
    n.setText(NameProceeder.unifyForenames(n.getText()));
  }else if ("forename".equals(n.getType())){
    n.setText(NameProceeder.unifyForenames(n.getText()));
  }else if ("surname".equals(n.getType())){
    n.setText(NameProceeder.unifySurname(n.getText()));
    if ("surname".equals(name.getType()))
      sname = name.getText();

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

String cname = null;
for(YName name : nc.getNames()){
  if("canonical".equals(name.getType())) cname = name.getText();
  else if("forenames".equals(name.getType())) fname = name.getText();
  else if("surname".equals(name.getType())) sname = name.getText();

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

String cname = null;
for(YName name : nc.getNames()){
  if("canonical".equals(name.getType())) cname = name.getText();
  else if("forenames".equals(name.getType())) fname = name.getText();
  else if("surname".equals(name.getType())) sname = name.getText();

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

public static void updateYRelationWithZblNames(YRelation relye, YElement zblye) {
  for (YName n : zblye.getNames()) {
    YAttribute ya = new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_NAME, "");
    ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_LANGUAGE, n.getLanguage().getName()));
    ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TYPE, n.getType()));
    ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_VALUE, n.getText()));
    relye.addAttribute(ya);
  }
}

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

ya = new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_NAME,"");
ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_LANGUAGE,n.getLanguage().getName()));
ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TYPE,n.getType()));
ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_VALUE,n.getText()));
relye.addAttribute(ya);

相关文章