@Test public void convert_WITH_FILTERED_REFERENCES() { eu.dnetlib.iis.metadataextraction.schemas.ReferenceMetadata inputReference1 = eu.dnetlib.iis.metadataextraction.schemas.ReferenceMetadata.newBuilder() .setPosition(1) .setBasicMetadata(eu.dnetlib.iis.metadataextraction.schemas.ReferenceBasicMetadata.newBuilder() .setTitle("First Reference Title") .setAuthors(Lists.newArrayList("author-id-3")) .setSource("Other Journal") .setPages(new Range("10", "11")) .setYear("2005") .build()) .setText("reference 1 raw text") .build(); eu.dnetlib.iis.metadataextraction.schemas.ReferenceMetadata inputReference2 = eu.dnetlib.iis.metadataextraction.schemas.ReferenceMetadata.newBuilder() .setPosition(2) .setBasicMetadata(eu.dnetlib.iis.metadataextraction.schemas.ReferenceBasicMetadata.newBuilder() .setTitle("Second Reference Title") .setAuthors(Lists.newArrayList("author-id-1", "author-id-4")) .setSource("Some Journal") .setPages(new Range("10", "23")) .setYear("2000") .build()) .setText("reference 2 raw text") .build(); ExtractedDocumentMetadataMergedWithOriginal inputDocument = ExtractedDocumentMetadataMergedWithOriginal.newBuilder() .setId("document-id") .setImportedAuthors(Lists.newArrayList()) .setReferences(Lists.newArrayList(inputReference1, inputReference2)) .setPublicationType(new PublicationType(true, false)) .build(); DocumentMetadata retDocumentMetadata = converter.convert(inputDocument, Sets.newHashSet(2)); assertEquals(1, retDocumentMetadata.getReferences().size()); ReferenceMetadata expectedReference1 = ReferenceMetadata.newBuilder() .setPosition(1) .setBasicMetadata(BasicMetadata.newBuilder() .setTitle("First Reference Title") .setAuthors(Lists.newArrayList("author-id-3")) .setJournal("Other Journal") .setPages("10-11") .setYear("2005") .build()) .setRawText("reference 1 raw text") .build(); assertEquals(expectedReference1, retDocumentMetadata.getReferences().get(0)); }
public DocumentMetadata convert(ExtractedDocumentMetadataMergedWithOriginal sourceDocument, Set<Integer> matchedReferencePositions) { Preconditions.checkNotNull(sourceDocument); DocumentMetadata destDocument = DocumentMetadata.newBuilder() .setId(sourceDocument.getId()) .setBasicMetadata(convertBasicMetadata(sourceDocument)) .setReferences(convertReferences(sourceDocument.getReferences(), matchedReferencePositions)) .build(); return destDocument; }
DocumentToCitationDocumentConverter { public DocumentMetadata convert(ExtractedDocumentMetadataMergedWithOriginal sourceDocument, Set<Integer> matchedReferencePositions) { Preconditions.checkNotNull(sourceDocument); DocumentMetadata destDocument = DocumentMetadata.newBuilder() .setId(sourceDocument.getId()) .setBasicMetadata(convertBasicMetadata(sourceDocument)) .setReferences(convertReferences(sourceDocument.getReferences(), matchedReferencePositions)) .build(); return destDocument; } }
DocumentToCitationDocumentConverter { public DocumentMetadata convert(ExtractedDocumentMetadataMergedWithOriginal sourceDocument, Set<Integer> matchedReferencePositions) { Preconditions.checkNotNull(sourceDocument); DocumentMetadata destDocument = DocumentMetadata.newBuilder() .setId(sourceDocument.getId()) .setBasicMetadata(convertBasicMetadata(sourceDocument)) .setReferences(convertReferences(sourceDocument.getReferences(), matchedReferencePositions)) .build(); return destDocument; }  }
DocumentToCitationDocumentConverter { public DocumentMetadata convert(ExtractedDocumentMetadataMergedWithOriginal sourceDocument, Set<Integer> matchedReferencePositions) { Preconditions.checkNotNull(sourceDocument); DocumentMetadata destDocument = DocumentMetadata.newBuilder() .setId(sourceDocument.getId()) .setBasicMetadata(convertBasicMetadata(sourceDocument)) .setReferences(convertReferences(sourceDocument.getReferences(), matchedReferencePositions)) .build(); return destDocument; }  DocumentMetadata convert(ExtractedDocumentMetadataMergedWithOriginal sourceDocument, Set<Integer> matchedReferencePositions); }
DocumentToCitationDocumentConverter { public DocumentMetadata convert(ExtractedDocumentMetadataMergedWithOriginal sourceDocument, Set<Integer> matchedReferencePositions) { Preconditions.checkNotNull(sourceDocument); DocumentMetadata destDocument = DocumentMetadata.newBuilder() .setId(sourceDocument.getId()) .setBasicMetadata(convertBasicMetadata(sourceDocument)) .setReferences(convertReferences(sourceDocument.getReferences(), matchedReferencePositions)) .build(); return destDocument; }  DocumentMetadata convert(ExtractedDocumentMetadataMergedWithOriginal sourceDocument, Set<Integer> matchedReferencePositions);  }