|
|
@ -6,9 +6,15 @@ import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
|
|
|
|
|
|
|
import eu.dnetlib.dhp.eosc.model.EoscInteroperabilityFramework;
|
|
|
|
import eu.dnetlib.dhp.eosc.model.EoscInteroperabilityFramework;
|
|
|
|
import eu.dnetlib.dhp.eosc.model.EoscResult;
|
|
|
|
import eu.dnetlib.dhp.eosc.model.EoscResult;
|
|
|
|
|
|
|
|
import eu.dnetlib.dhp.oa.graph.dump.eosc.SelectEoscResultsJobStep1;
|
|
|
|
import eu.dnetlib.dhp.oa.graph.dump.exceptions.CardinalityTooHighException;
|
|
|
|
import eu.dnetlib.dhp.oa.graph.dump.exceptions.CardinalityTooHighException;
|
|
|
|
import eu.dnetlib.dhp.oa.graph.dump.exceptions.NoAvailableEntityTypeException;
|
|
|
|
import eu.dnetlib.dhp.oa.graph.dump.exceptions.NoAvailableEntityTypeException;
|
|
|
|
import eu.dnetlib.dhp.oa.model.*;
|
|
|
|
import eu.dnetlib.dhp.oa.model.*;
|
|
|
@ -28,6 +34,7 @@ import eu.dnetlib.dhp.schema.common.ModelConstants;
|
|
|
|
import eu.dnetlib.dhp.schema.oaf.*;
|
|
|
|
import eu.dnetlib.dhp.schema.oaf.*;
|
|
|
|
|
|
|
|
|
|
|
|
public class ResultMapper implements Serializable {
|
|
|
|
public class ResultMapper implements Serializable {
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(ResultMapper.class);
|
|
|
|
|
|
|
|
|
|
|
|
public static <E extends eu.dnetlib.dhp.schema.oaf.OafEntity> Result map(
|
|
|
|
public static <E extends eu.dnetlib.dhp.schema.oaf.OafEntity> Result map(
|
|
|
|
E in, Map<String, String> communityMap, String dumpType)
|
|
|
|
E in, Map<String, String> communityMap, String dumpType)
|
|
|
@ -150,6 +157,10 @@ public class ResultMapper implements Serializable {
|
|
|
|
((GraphResult) out)
|
|
|
|
((GraphResult) out)
|
|
|
|
.setInstance(
|
|
|
|
.setInstance(
|
|
|
|
oInst.get().stream().map(ResultMapper::getGraphInstance).collect(Collectors.toList()));
|
|
|
|
oInst.get().stream().map(ResultMapper::getGraphInstance).collect(Collectors.toList()));
|
|
|
|
|
|
|
|
} else if (Constants.DUMPTYPE.EOSC.getType().equals(dumpType)) {
|
|
|
|
|
|
|
|
((EoscResult) out)
|
|
|
|
|
|
|
|
.setInstance(
|
|
|
|
|
|
|
|
oInst.get().stream().map(ResultMapper::getGraphInstance).collect(Collectors.toList()));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
((CommunityResult) out)
|
|
|
|
((CommunityResult) out)
|
|
|
|
.setInstance(
|
|
|
|
.setInstance(
|
|
|
@ -237,12 +248,15 @@ public class ResultMapper implements Serializable {
|
|
|
|
"EOSC IF in the result has cardinality greater than one. Change dump!");
|
|
|
|
"EOSC IF in the result has cardinality greater than one. Change dump!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (gei.size() == 1) {
|
|
|
|
if (gei.size() == 1) {
|
|
|
|
EoscInteroperabilityFramework eif = new EoscInteroperabilityFramework();
|
|
|
|
|
|
|
|
eif.setCode(gei.get(0).getCode());
|
|
|
|
EoscIfGuidelines ifra = gei.get(0);
|
|
|
|
eif.setLabel(gei.get(0).getLabel());
|
|
|
|
((EoscResult) out)
|
|
|
|
eif.setUrl(gei.get(0).getUrl());
|
|
|
|
.setEoscIF(
|
|
|
|
eif.setSemanticRelation(gei.get(0).getSemanticRelation());
|
|
|
|
EoscInteroperabilityFramework
|
|
|
|
((EoscResult) out).setEoscIF(eif);
|
|
|
|
.newInstance(
|
|
|
|
|
|
|
|
ifra.getCode(), ifra.getLabel(), ifra.getUrl(),
|
|
|
|
|
|
|
|
ifra.getSemanticRelation()));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!Constants.DUMPTYPE.COMPLETE.getType().equals(dumpType)) {
|
|
|
|
} else if (!Constants.DUMPTYPE.COMPLETE.getType().equals(dumpType)) {
|
|
|
|