pl.edu.icm.model.bwmeta.y.YAttribute.<init>()方法的使用及代码示例

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

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

YAttribute.<init>介绍

暂无

代码示例

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

private YAttribute extractEmailAttributes(PersonInfoViewObject personViewObject) {
  final String email = personViewObject.getEmail();
  if(StringUtils.isNotBlank(email))
    return new YAttribute(AttributeConstants.CONTACT_EMAIL, email);
  else
    return null;
}

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

protected void addNotNullAttribute(AbstractA<?> element, String key, String value) {
  if (value == null)
    return;
  element.addAttribute(new YAttribute(key, value));
}

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

private void addDocumentTypeAttribute(String typeShortName, List<YAttribute> yAttributes) {
  DocumentType type = DocumentType.getTypeByShortName(typeShortName);
  yAttributes.add(new YAttribute(CS.DOCUMENT_TYPE, type.getShortName()));
}

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

/**
 * Creates an attribute given its key and value. If the key or value is empty
 * or null, does not create an attribute but returns null.
 *
 * @param key attribute name
 * @param value attribute text value
 * @return created attribute, or null if either parameter was empty or null
 */
public YAttribute attribute(String key, String value) {
  if (empty(key) || empty(value)) return null;
  return new YAttribute(key, value);
}

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

public static void updateYRelationWithZblTags(YRelation relye, YElement zblye) {
  for (YTagList tl : zblye.getTagLists()) {
    YAttribute ya = new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TAG, "");
    ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TYPE, tl.getType()));
    ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_LANGUAGE, tl.getLanguage().getName()));
    for (String t : tl.getValues()) {
      ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_VALUE, t));
    }
    relye.addAttribute(ya);
  }
}

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

public static void updateYRelationWithZblIds(YRelation relye, YElement zblye) {
  YAttribute ya = new YAttribute(YConstants.TG_CATEGORY, "");
  for (YId i : zblye.getIds()) {
    if (i.getScheme().equals(YConstants.EXT_SCHEME_ISSN)) {
      ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ISSN, i.getValue()));
    } else if (i.getScheme().equals(YConstants.EXT_SCHEME_ISBN)) {
      ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ISBN, i.getValue()));
    } else if (i.getScheme().equals(YConstants.EXT_SCHEME_ZBL)) {
      ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ZBL, i.getValue()));
    } else if (i.getScheme().equals(YConstants.EXT_SCHEME_ZBL)) {
      ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ZBL, i.getValue()));
    }
  }
  relye.addAttribute(ya);
}

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

/**
 * Extracts <la> field from ZBL record.
 * 
 * @param src
 * @param yelement
 */
private void updateArticleLA(ZentralBlattRecord src, YElement yelement) {
  if (src.hasField("la")) {
    String laText = src.getField("la").trim();
          
    YAttribute attribute = new YAttribute(YConstants.AT_ZBL_LANG_DESCRIPTION, laText);
    yelement.addAttribute(attribute);
  }
}

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

public static void updateYRelationWithZblClassificationCodes(YRelation relye, YElement zblye) {
  YAttribute ya;
  ya = new YAttribute(YConstants.TG_CATEGORY, "");
  for (YCategoryRef r : zblye.getCategoryRefs()) {
    ya.addAttribute(new YAttribute(r.getClassification(), r.getCode()));
  }
  relye.addAttribute(ya);
}

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

public YRelation parse(String text) {
  Node n = parser.parse(text);
  if (n == null)
    return null;
  if (!"citation".equals(n.getName()))
    throw new IllegalStateException("Unexpected node name");
  
  YRelation yr = new YRelation(); 
  yr.addAttribute(new YAttribute(YConstants.AT_REFERENCE_TEXT,text));
  
  processReference(n, yr);
  
  return yr;
}

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

private List<YAttribute> processAttributes(String key, Object value) {
  List<YAttribute> attributes = new ArrayList<>();
  if(value instanceof String){
    YAttribute attribute = new YAttribute();
    attribute.setValue(value.toString());
    attribute.setKey(key);
    attributes.add(attribute);
  } else if(value instanceof List){
    for(Object object:((BasicDBList) value)){
      attributes.addAll(processAttributes(key, object));
    }
  } else if(value instanceof DBObject) {
    YAttribute attribute = getConverter().read(YAttribute.class, (DBObject) value);
    attribute.setKey(key);
    attributes.add(attribute);
  } 
  return attributes;
}

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

private static YAttribute extractOneReferenceTextAttributeScNode(YAttribute ya) {
  if(! ll.contains(ya.getKey())) return ya;
  for(Part p:ya.getRichValue().toParts()){
    if(p instanceof Node){
      if("sc".equals(((Node)p).getTag()))
        return new YAttribute(ya.getKey(),new YRichText(((Node)p).getParts().get(0).toString()));
    }else if(p instanceof Leaf)
        return new YAttribute(ya.getKey(),new YRichText(((Leaf)p).toPlainText()));
  }
    
  return ya;
}

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

private static YAttribute extractOneReferenceTextAttributeScNode(YAttribute ya) {
    if(! ll.contains(ya.getKey())) return ya;
    for(Part p:ya.getRichValue().toParts()){
      if(p instanceof Node){
        if("sc".equals(((Node)p).getTag()))
          return new YAttribute(ya.getKey(),new YRichText(((Node)p).getParts().get(0).toString()));
      }else if(p instanceof Leaf)
//            if(p.toPlainText()!=null && !p.toPlainText().matches("[\\s]+"))
          return new YAttribute(ya.getKey(),new YRichText(((Leaf)p).toPlainText()));
    }
      
    return ya;
  }
}

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

@Override
public DataResponse apply(YElement input) {
  ZipFile zipFile = processorState.getZipFile();
  ZipEntry lastEntry = processorState.getLastZipEntry();
  YAttribute attribute = new YAttribute(CommonExtractorContstants.SOURCE_ATTRIBUTE, zipFile.getName() + "/" + lastEntry.getName());
  input.getAttributes().add(attribute);
  DataResponse dataResponse = new DataResponse(input, dataResponseQualityComparator);
  for (YContentFile file : createIterable(input.getContents())) {
    String id = file.getId();
    String fileName = file.getLocations().get(0);
    ZipEntry entry = zipFile.getEntry(fileName);
    if (entry != null) {
      dataResponse.addContent(id, new ZipEntryResource(zipFile.getName(), entry));
    }
  }
  if(insertSource){
    dataResponse.addContent(CommonExtractorContstants.SOURCE_ATTRIBUTE, new ZipEntryResource(zipFile.getName(), lastEntry));
  }
  return dataResponse;
}

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

@SuppressWarnings("deprecation")
public static void updateYRelationWithZblContributor(YRelation relye, YContributor c) {
  YAttribute ya = null;
  if (c.getOneName("canonical") != null)
    ya = new YAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR, c.getOneName("canonical").getText().toString());
  if (c.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT).size() > 0)
    ya.addAttribute(YConstants.AT_ZBL_AUTHOR_FINGERPRINT, c.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT)
        .get(0).getValue());
  if (c.getOneName("forenames") != null)
    ya.addAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES, c.getOneName("forenames").getText()
        .toString());
  ya.addAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_SURNAME, c.getOneName("surname").getText().toString());
  relye.addAttribute(ya);
}

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

soData.jrnlFingerprint);
  attribute = new YAttribute(YConstants.AT_ZBL_JOURNAL_FINGERPRINT, seData.jrnlFingerprint);
} else if (soFingerprint) {
  attribute = new YAttribute(YConstants.AT_ZBL_JOURNAL_FINGERPRINT, soData.jrnlFingerprint);
} else { // seFingerprint
  attribute = new YAttribute(YConstants.AT_ZBL_JOURNAL_FINGERPRINT, seData.jrnlFingerprint);

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

public static boolean sanitizeCategoryRefs(YElement article) {
  if (article == null || article.getCategoryRefs().isEmpty())
    return false;
  
  boolean warning = false;
  List<YCategoryRef> cleanRefs = new ArrayList<YCategoryRef>();
  for (YCategoryRef ref : article.getCategoryRefs()) {
    if (ref == null || ref.getCode() == null || ref.getCode().trim().isEmpty())
      continue;
    ref.setCode(ref.getCode().trim());
    List<YCategoryRef> refs = sanitizeCategoryRef(ref);
    warning = warning || isChanged(ref, refs);
    cleanRefs.addAll(refs);
  }
  article.setCategoryRefs(cleanRefs);
  
  if (!warning)
    return false;
  YAttribute attr = article.getOneAttribute(Warnings.WARNINGS);
  if (attr == null) {
    attr = new YAttribute(Warnings.WARNINGS, (String) null);
    article.addAttribute(attr);
  }
  if (attr.getOneAttribute(Warnings.WARNINGS_CHECK_CATEGORY_REFS) == null)
    attr.addAttribute(Warnings.WARNINGS_CHECK_CATEGORY_REFS, "");
  
  return true;
}

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

String fingerprint = ai[i].trim();
if (fingerprint.length() > 1) { // e.g. "-" is filtered
  YAttribute attribute = new YAttribute(YConstants.AT_ZBL_AUTHOR_FINGERPRINT, fingerprint);
  ycontributor.addAttribute(attribute);
  updated = true;

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

issue.addId(new YId(IdSchemaIds.EXT_SCHEME_CEDRAM, aid.getText())); ///TODO sprawdzic, gdzie to jest uzywane i we wszstkich tych miejscach trzeba to zmienic
} else {
  issue.addAttribute(new YAttribute(aid.getAttributeValue("pub-id-type"), aid.getText()));

代码示例来源:origin: pl.edu.icm.synat/synat-process-common

private boolean addMetadataIfNeeded(HarvestingResult harvestingResult, YElement element) {
  boolean metadataModified = false;
  if (shouldAbstractBeAdded(harvestingResult, element)) {
    Node htmlNode = new Node(BaseYModelUtils.XHTML_NAMESPACE, BaseYModelUtils.HTML_TAG);
    htmlNode.addPart(new Leaf(StringUtils.trim(harvestingResult.getDesciption())));
    YRichText richText = new YRichText(Arrays.asList(htmlNode));
    YDescription newAbstract = new YDescription(YLanguage.Undetermined, richText, DescriptionTypes.DS_ABSTRACT);
    element.addDescription(newAbstract);
    metadataModified = true;
  }
  if (shouldImpactFactorBeAdded(harvestingResult, element)) {
    element.addAttribute(new YAttribute(YModelUtils.IMPACT_FACTOR, harvestingResult.getImpactFactor().toEngineeringString()));
    metadataModified = true;
  }
  if (shouldFrequencyBeAdded(harvestingResult, element)) {
    element.addAttribute(new YAttribute(YModelUtils.FREQUENCY, harvestingResult.getFrequency()));
    metadataModified = true;
  }
  List<YCategoryRef> refs = element.getCategoryRefs();
  if (shouldCategoryRefsBeAdded(harvestingResult, refs)) {
    refs.addAll(harvestingResult.getCategories());
    metadataModified = true;
  }
  if (shouldTitlesBeAdded(harvestingResult, element)) {
    metadataModified |= addTitleHistory(harvestingResult.getOtherTitles(), element);
  }
  return metadataModified;
}

相关文章