private List<YRelation> toYRelations(final List<DocReference> references) { final List<YRelation> relationsFromMetadata = new ArrayList<YRelation>(); for (final DocReference reference : references) { final YRelation yRelation = new YRelation(); yRelation.setType(YConstants.RL_REFERENCE_TO); yRelation.addAttribute(YConstants.AT_REFERENCE_TEXT, reference.getText()); final List<DocId> hits = reference.getMatches(); if (hits != null && !hits.isEmpty()) { final DocId match = hits.get(0); yRelation.setTarget(new YId(match.getDomain(), match.getId())); if (hits.size() > 1) { log.info( "There are several documents matching reference {} of document {}. Presenting only first. All found:{}.", new Object[] { reference.getText(), id, hits }); } } relationsFromMetadata.add(yRelation); } return relationsFromMetadata; }
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); } } }
private void addTitleList(YElement element, List<TitleHistoryElement> titles, String relationType) { for (TitleHistoryElement titleHistoryElement : titles) { YRelation relation = new YRelation(); relation.setType(relationType); if (titleHistoryElement.getId() != null) { relation.setTarget(new YId(IdSchemaIds.EXT_SCHEME_YADDA, titleHistoryElement.getId())); } else if (titleHistoryElement.getIssn() != null) { relation.setTarget(new YId(IdSchemaIds.EXT_SCHEME_ISSN, titleHistoryElement.getIssn())); } String dateRange = titleHistoryElement.getDateRange(); if (StringUtils.isNotBlank(dateRange)) { relation.addAttribute(ReferenceAttributeTypes.AT_REFERENCE_PARSED_DATE, dateRange); } String title = titleHistoryElement.getTitleName(); if (StringUtils.isNotBlank(title)) { relation.addAttribute(ReferenceAttributeTypes.AT_REFERENCE_PARSED_TITLE, title); } element.addRelation(relation); } }
relation.setTarget(new YId(YConstants.EXT_SCHEMA_EUDML, eudmlId));
yr.setType(RelationTypes.RL_REFERENCE_TO); if (StringUtils.isNotBlank(rt.getPolindexId())) { yr.setTarget(new YId(IdSchemaIds.EXT_SCHEME_POLINDEX, rt.getPolindexId()));
relation.setTarget(new YId(IdSchemaIds.EXT_SCHEMA_EUDML, eudmlId));