@Test(expected = NullPointerException.class) public void matchCitations_NULL_PICK_SINGLE_FUNCTION() { externalIdCitationMatcher.matchCitations(documentsMetadataRdd, "someIdType", null); }
public JavaRDD<Citation> matchCitations(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { Preconditions.checkNotNull(documents); Preconditions.checkNotNull(idType); Preconditions.checkNotNull(pickSingle); JavaPairRDD<String, String> externalIdToIdMapping = idMappingExtractor.extractIdMapping(documents, idType, pickSingle); JavaPairRDD<String, Citation> externalIdReferences = referencePicker.extractExternalIdReferences(documents, idType); JavaRDD<Citation> externalIdCitation = externalIdReferences.join(externalIdToIdMapping) .map(x -> { Citation partialCitation = x._2._1; String destinationDocumentId = x._2._2; return Citation.newBuilder(partialCitation) .setDestinationDocumentId(destinationDocumentId) .build(); }); return externalIdCitation; }
ExternalIdCitationMatcher implements Serializable { public JavaRDD<Citation> matchCitations(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { Preconditions.checkNotNull(documents); Preconditions.checkNotNull(idType); Preconditions.checkNotNull(pickSingle); JavaPairRDD<String, String> externalIdToIdMapping = idMappingExtractor.extractIdMapping(documents, idType, pickSingle); JavaPairRDD<String, Citation> externalIdReferences = referencePicker.extractExternalIdReferences(documents, idType); JavaRDD<Citation> externalIdCitation = externalIdReferences.join(externalIdToIdMapping) .map(x -> { Citation partialCitation = x._2._1; String destinationDocumentId = x._2._2; return Citation.newBuilder(partialCitation) .setDestinationDocumentId(destinationDocumentId) .build(); }); return externalIdCitation; } }
ExternalIdCitationMatcher implements Serializable { public JavaRDD<Citation> matchCitations(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { Preconditions.checkNotNull(documents); Preconditions.checkNotNull(idType); Preconditions.checkNotNull(pickSingle); JavaPairRDD<String, String> externalIdToIdMapping = idMappingExtractor.extractIdMapping(documents, idType, pickSingle); JavaPairRDD<String, Citation> externalIdReferences = referencePicker.extractExternalIdReferences(documents, idType); JavaRDD<Citation> externalIdCitation = externalIdReferences.join(externalIdToIdMapping) .map(x -> { Citation partialCitation = x._2._1; String destinationDocumentId = x._2._2; return Citation.newBuilder(partialCitation) .setDestinationDocumentId(destinationDocumentId) .build(); }); return externalIdCitation; }  }
ExternalIdCitationMatcher implements Serializable { public JavaRDD<Citation> matchCitations(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { Preconditions.checkNotNull(documents); Preconditions.checkNotNull(idType); Preconditions.checkNotNull(pickSingle); JavaPairRDD<String, String> externalIdToIdMapping = idMappingExtractor.extractIdMapping(documents, idType, pickSingle); JavaPairRDD<String, Citation> externalIdReferences = referencePicker.extractExternalIdReferences(documents, idType); JavaRDD<Citation> externalIdCitation = externalIdReferences.join(externalIdToIdMapping) .map(x -> { Citation partialCitation = x._2._1; String destinationDocumentId = x._2._2; return Citation.newBuilder(partialCitation) .setDestinationDocumentId(destinationDocumentId) .build(); }); return externalIdCitation; }  JavaRDD<Citation> matchCitations(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle); JavaRDD<Citation> matchCitations(JavaRDD<DocumentMetadata> documents, JavaPairRDD<String, String> referenceIdMappings, 
            String mainIdType, String referenceIdType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle); }
ExternalIdCitationMatcher implements Serializable { public JavaRDD<Citation> matchCitations(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { Preconditions.checkNotNull(documents); Preconditions.checkNotNull(idType); Preconditions.checkNotNull(pickSingle); JavaPairRDD<String, String> externalIdToIdMapping = idMappingExtractor.extractIdMapping(documents, idType, pickSingle); JavaPairRDD<String, Citation> externalIdReferences = referencePicker.extractExternalIdReferences(documents, idType); JavaRDD<Citation> externalIdCitation = externalIdReferences.join(externalIdToIdMapping) .map(x -> { Citation partialCitation = x._2._1; String destinationDocumentId = x._2._2; return Citation.newBuilder(partialCitation) .setDestinationDocumentId(destinationDocumentId) .build(); }); return externalIdCitation; }  JavaRDD<Citation> matchCitations(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle); JavaRDD<Citation> matchCitations(JavaRDD<DocumentMetadata> documents, JavaPairRDD<String, String> referenceIdMappings, 
            String mainIdType, String referenceIdType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle);  }