16 |
16 |
*/
|
17 |
17 |
public class PMCCitationCollapser extends OriginCollapser<CitationEnvelope, Citation> {
|
18 |
18 |
|
19 |
|
private final String ORIGIN_PMC_INGESTION = "pmc_ingestion";
|
20 |
|
private final String ORIGIN_CERMINE = "cermine";
|
|
19 |
private final String ORIGIN_INGESTED = "ingested";
|
|
20 |
private final String ORIGIN_MATCHED = "matched";
|
21 |
21 |
|
22 |
22 |
@Override
|
23 |
23 |
protected List<Citation> collapseBetweenOrigins(Map<String, List<Citation>> objects) {
|
... | ... | |
26 |
26 |
} else if (objects.size()==2) {
|
27 |
27 |
// important note: identifying cermine matches by referenceText
|
28 |
28 |
Map<String,Citation> cermineCitationsMap = new HashMap<String, Citation>();
|
29 |
|
for (Citation currentCermineCitation : objects.get(ORIGIN_CERMINE)) {
|
|
29 |
for (Citation currentCermineCitation : objects.get(ORIGIN_MATCHED)) {
|
30 |
30 |
if (currentCermineCitation.getEntry()!=null &&
|
31 |
31 |
currentCermineCitation.getEntry().getRawText()!=null) {
|
32 |
32 |
cermineCitationsMap.put(
|
... | ... | |
35 |
35 |
}
|
36 |
36 |
}
|
37 |
37 |
List<Citation> results = new ArrayList<Citation>();
|
38 |
|
for (Citation currentPmcCitation : objects.get(ORIGIN_PMC_INGESTION)) {
|
|
38 |
for (Citation currentPmcCitation : objects.get(ORIGIN_INGESTED)) {
|
39 |
39 |
if (currentPmcCitation.getEntry()!=null &&
|
40 |
40 |
currentPmcCitation.getEntry().getRawText()!=null) {
|
41 |
41 |
Citation merged = merge(currentPmcCitation,
|
... | ... | |
54 |
54 |
} else {
|
55 |
55 |
// we need to be strict to conduct collapsing process properly
|
56 |
56 |
throw new RuntimeException("only two origins are supported: " +
|
57 |
|
ORIGIN_PMC_INGESTION + " and " + ORIGIN_CERMINE +
|
|
57 |
ORIGIN_INGESTED + " and " + ORIGIN_MATCHED +
|
58 |
58 |
" got: " + objects.keySet());
|
59 |
59 |
}
|
60 |
60 |
}
|
#577 renaming origins to matched and ingested