gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-15 18:00:40 26 4
gpt4 key购买 nike

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

YRelation介绍

暂无

代码示例

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

private void appendBibliography(ResourceData resource, YElement yElement) {
  if (!resource.getBibliography().isEmpty()) {
    for (BibliographyReference bib : resource.getBibliography()) {
      YRelation relation = new YRelation();
      relation.setType(RelationTypes.RL_REFERENCE_TO);
      relation.addAttribute(ReferenceAttributeTypes.AT_REFERENCE_TEXT, bib.getText());
      if (StringUtils.isNotBlank(bib.getAssignedId())) {
        relation.setTarget(new YId(IdSchemaIds.EXT_SCHEME_YADDA, bib.getAssignedId()));
      }
      yElement.addRelation(relation);
    }
  }
}

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

public void updateElementExtLinks(org.jdom.Element ameta, YElement article) {
    List<org.jdom.Element> extLinks = JDOMHelper.getChildren(ameta, "ext-link");
    YRelation relation = new YRelation().setType(RelationTypes.RL_SAME_AS);
    for (org.jdom.Element extLink : extLinks) {
      String href = extLink.getAttributeValue("href", XLINK_NAMESPACE);

      if ("mr-item-id".equals(extLink.getAttributeValue("ext-link-type"))) {
        article.addId(new YId(IdSchemaIds.EXT_SCHEMA_MR, extLink.getTextTrim()));
        if (JDOMHelper.toNull(href) != null) {

          relation.addAttribute(JatsSpecificAttributeTypes.AT_NLM_ARTICLE_MR_URL, href);

        }
      } else if ("zbl-item-id".equals(extLink.getAttributeValue("ext-link-type"))) {
        article.addId(new YId(IdSchemaIds.EXT_SCHEME_ZBL, extLink.getTextTrim()));
        if (JDOMHelper.toNull(href) != null) {

          relation.addAttribute(JatsSpecificAttributeTypes.AT_NLM_ARTICLE_ZBL_URL, href);

        }
      }

    }
    if (relation.getAttributes().size() > 0) {
      article.addRelation(relation);
    }
  }
}

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

private String formatBibliographyText(YRelation relation) {
  String textAttr = relation.getOneAttributeSimpleValue(ReferenceAttributeTypes.AT_REFERENCE_TEXT);
  for (YAttribute authorAttr : relation.getAttributes(ReferenceAttributeTypes.AT_REFERENCE_PARSED_AUTHOR)) {
    String author = authorAttr.getValue();
    if (StringUtils.isNotBlank(author)) {
  String title = relation.getOneAttributeSimpleValue(ReferenceAttributeTypes.AT_REFERENCE_PARSED_TITLE);

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

private List<YRelation> addNewReferencesToRelations(List<ReferenceInfo> references, List<YRelation> yRelations) {
  int sequenceNumber = 0;
  for (ReferenceInfo reference : references) {
    YRelation relation = new YRelation();
    relation.setType(YConstants.RL_REFERENCE_TO);
    relation.addAttribute(YConstants.AT_REFERENCE_TEXT, reference.getText());
    relation.addAttribute(YConstants.AT_REFERENCE_NUMBER, Integer.toString(sequenceNumber));
    yRelations.add(relation);
    ++sequenceNumber;
  }
  return yRelations;
}

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

private static YRelation transformRelation(YRelation yr) {
  LinkedList<YAttribute> yal = new LinkedList<YAttribute>(); 
  for(YAttribute ya : yr.getAttributes()) yal.add(extractOneReferenceTextAttributeScNode(ya));
  yr.setAttributes(yal);
  return yr;
}

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

private String _getTitleElementId(AbstractElementInfo<?> abstractElement, String relationType){
  List<YRelation> relations = abstractElement.getRelations();
  for(YRelation relation: relations){
    if(relationType.equals(relation.getType())){
      return relation.getTarget().getValue();
    }
  }
  return "";
}

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

private void storeElementTextInAttribute(org.jdom.Element element, String elementName,
    YRelation relation, String attributeName) {
  String text = element.getChildTextTrim(elementName);
  if (text != null && !text.isEmpty()) {
    relation.addAttribute(attributeName, text);
  }
}

代码示例来源: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.yadda/yadda-analysis-impl

protected void enhanceRelationsInYElement(YElement ye, ZblBwMetaPathsGenerator zblPathGenerator) throws Exception {
  // sprawdź czy referencje głównego dokumentu mają id Zblattowe
  for (YRelation yr : ye.getRelations()) {
    if ("reference-to".equals(yr.getType()) || "related-to".equals(yr.getType())) {
      String extZblId = yr.getOneAttributeSimpleValue("reference-parsed-id-zbl");
      if (extZblId != null) {
        String zblId = mapExtZblToZbl(extZblId, zblPathGenerator.getExtZblToZblMappingFilePath());
        if (zblId != null) {
          List<YElement> zblyel = loadZblYElements(zblId, zblPathGenerator);
          if (zblyel.size() != 0)
            enhanceRelationElement(yr, zblyel);
        }
      }
    }
  }
}

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

parsed.setType(YConstants.RF_ARTICLE);
  parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_TYPE, YConstants.RF_ARTICLE);
  parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_TYPE, YConstants.RF_BOOK);
  parsed.setType(YConstants.RF_BOOK);
      ya.addAttribute(new YAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES, forename));
    } else ya.setValue("");
    parsed.addAttribute(ya);
if (titleNode != null) parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_TITLE, titleNode.getValue());
Node chapterNode = n.getFirstField("chapter");
if (chapterNode != null) parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_CHAPTER, chapterNode.getValue());
Node journalNode = n.getFirstField("journal");
if (journalNode != null) parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_JOURNAL, journalNode.getValue());
Node volumeNode = n.getFirstField("volume");
if (volumeNode != null) {
  parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_VOLUME, volumeNode.getValue().replaceAll("-", " - "));
  parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_ISSUE, numberNode.getValue().replaceAll("-", " - "));
if (yearNode != null) parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_YEAR, yearNode.getValue());
Node pagesNode = n.getFirstField("pages");
if (pagesNode != null) {
  if(sp!=null && ep!=null) parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_PAGES, sp+" - "+ep);
  else{
    if(sp!=null && ep==null) parsed.addAttribute(YConstants.AT_REFERENCE_PARSED_PAGES, sp);

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

public boolean updateWithAttribute(YRelation rel, Map<String, String> relfields, String attrName, String fieldName) {
  List<YAttribute> attrs = rel.getAttributes(attrName);
  if (attrs != null && attrs.size() > 0) {
    relfields.put(fieldName, attrs.get(0).getValue().trim());
    return true;
  }
  
  return false;
}

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

public List<ElementWithThumbnail<BriefElementData>> prepareReferences(List<YRelation> yRelationList, ElementType elementType) {
  BriefDataFactory bdf = new BriefDataFactory();
  List<BriefElementData> referencesList = new ArrayList<BriefElementData>();
  for (YRelation reference : yRelationList) {
    BriefElementData referenceMetadata = null;
    if (reference.getTarget() != null) {
      try {
        final String id = resolveId(reference.getTarget());
        referenceMetadata = repositoryFacade.fetchBriefElementData(id);
      } catch (NotFoundException e) {
        referenceMetadata = bdf.createPublicationData(reference, elementType);
      }
    }
    if (referenceMetadata == null) {
      referenceMetadata = bdf.createPublicationData(reference, elementType);
    }
    if (referenceMetadata instanceof ObjectDetails && ((ObjectDetails) referenceMetadata).getObjectType().equals(ElementType.JOURNAL)) {
      if (referenceMetadata instanceof PublicationData) {
        final String date = reference.getOneAttributeSimpleValue(ReferenceAttributeTypes.AT_REFERENCE_PARSED_DATE);
        if (StringUtils.isNotBlank(date)) {
          ((PublicationData) referenceMetadata).setDescription(date);
        } else {
          ((PublicationData) referenceMetadata).setDescription(StringUtils.EMPTY);
        }
      }
    }
    referencesList.add(referenceMetadata);
  }
  return thumbnailService.enrichWithThumbnailUrl(referencesList);
}

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

@Override
public EnrichedPayload<YElement> process(EnrichedPayload<YElement> input, ProcessContext ctx) throws Exception {
  for (YRelation relation : input.getObject().getRelations()) {
    String text = relation.getOneAttributeSimpleValue(YConstants.AT_REFERENCE_TEXT);
    BibEntry parsed = bibReferenceParser.parseBibReference(text);
      yAuthor.addAttribute(yForenames);
      relation.addAttribute(yAuthor);
      relation.addAttribute(yTitle);
      relation.addAttribute(yYear);
      relation.addAttribute(yJournal);
      relation.addAttribute(yVolume);
      relation.addAttribute(yIssue);
      relation.addAttribute(yPublisher);
      relation.addAttribute(yPages);
      relation.addAttribute(yLocation);

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

@Override
protected Object buildElementViewPart(YExportable exp,
    String[] elementTags, Map<String, Object> additionalParameters,
    IFilteringContext filteringContext) {
  YElement element = (YElement) exp;
  List<ViewReference> partModel = new LinkedList<ViewReference>();
  for (YRelation ref : element.getRelations(YConstants.RL_REFERENCE_TO)) {
    String id;
    if (ref.getTarget() != null) {
      id = detailsFilter.filter(ref.getTarget().getValue(),
          InputType.IDENTIFIER, filteringContext);
    } else {
      id = null;
    }
    
    YAttribute attribute = ref.getOneAttribute(YConstants.AT_REFERENCE_TEXT);
    String cite = getXMLFragmentFrom(attribute);
    
    partModel.add(new ViewReference(null,
        cite != null ? detailsFilter.filter(cite,
            InputType.RICH_TEXT, filteringContext) : null, id));
  }
  return partModel;
}

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

private boolean parseReferences(YRelation yr, int refno) throws YaddaException {
  if(YConstants.RL_REFERENCE_TO.equals(yr.getType())){
    paos_doc.add(new PredicateAndObject(RelConstants.RL_REFERENCES, RelConstants.NS_REFERENCE+in_item.getId().substring(0)+"/r"+refno));
    Statements s_ref = new Statements();s_ref.setSubject(RelConstants.NS_REFERENCE+in_item.getId().substring(0)+"/r"+refno);
    for(YAttribute ya : yr.getAttributes()){
      if(parseReferenceId(ya,paos_ref,refno));/*1*/
      else if(parseReferenceType(ya,paos_ref,refno));/*2*/

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

private String getRelationId(YRelation relation){
  if(relation.getTarget()!=null)
    return relation.getTarget().getValue();
  else
    return "";
}

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

private boolean parseComentary(YRelation yr) {
  if(YConstants.RL_COMMENTARY_TO.equals(yr.getType())){
    //TODO use this piece of information!
  }
  return false;
}

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

private String getConfName(YRelation yRelation) {
  if (yRelation.getOneAttributeSimpleValue(AT_REFERENCE_PARSED_TITLE) != null) {
    return yRelation.getOneAttributeSimpleValue(AT_REFERENCE_PARSED_TITLE);
  } else if (yRelation.getOneAttributeSimpleValue(AT_REFERENCE_TEXT) != null) {
    return yRelation.getOneAttributeSimpleValue(AT_REFERENCE_TEXT);
  }
  return null;
}

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

private YElement buildBookSeriesElement(SeriesMetadata seriesMetadata, YElement conferenceEventElement, CrossrefIdGenerator generator) {
  YElement element = new YElement();
  extractSeriesMetadata(null, generator, element, seriesMetadata);
  YRelation proceedingsRelation = new YRelation(RelationTypes.RL_PROCEEDINGS_OF, new YId(StringUtils.EMPTY, conferenceEventElement.getId()));
  element.getRelations().add(proceedingsRelation);
  return element;
}

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

public List<ReferenceInfo> getReferencesInfo(AbstractElementInfo<?>  abstractElementInfo){
  List<ReferenceInfo> referenceInfos = new ArrayList<ReferenceInfo>();
  
  Collection<YRelation> referencesTo = abstractElementInfo.getRelations(YConstants.RL_REFERENCE_TO);
  for(YRelation relation: referencesTo){
    String id = getRelationId(relation);
    YAttribute referanceText = relation.getOneAttribute(YConstants.AT_REFERENCE_TEXT);
    String text = getXMLFragmentFrom(referanceText);
    
    ReferenceInfo info = new ReferenceInfo(id, text);
    referenceInfos.add(info);
  }
  
  return referenceInfos;
}

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