forked from D-Net/dnet-hadoop
fix vocabulary lookup in mergeutils
This commit is contained in:
parent
8088943399
commit
07f267bb10
|
@ -16,6 +16,8 @@ import java.util.function.Function;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import eu.dnetlib.dhp.common.vocabulary.VocabularyGroup;
|
||||
import eu.dnetlib.dhp.schema.common.EntityType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
@ -23,10 +25,8 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
import com.github.sisyphsu.dateparser.DateParserUtils;
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import eu.dnetlib.dhp.common.vocabulary.VocabularyGroup;
|
||||
import eu.dnetlib.dhp.oa.merge.AuthorMerger;
|
||||
import eu.dnetlib.dhp.schema.common.AccessRightComparator;
|
||||
import eu.dnetlib.dhp.schema.common.EntityType;
|
||||
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
||||
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
||||
import eu.dnetlib.dhp.schema.oaf.*;
|
||||
|
@ -74,11 +74,16 @@ public class MergeUtils {
|
|||
if (!vocs.vocabularyExists(ModelConstants.DNET_RESULT_TYPOLOGIES)) {
|
||||
return (T) mergedResult;
|
||||
} else {
|
||||
final Qualifier expectedResultType = vocs
|
||||
.getSynonymAsQualifier(
|
||||
final Qualifier expectedResultType = vocs.lookupTermBySynonym(
|
||||
ModelConstants.DNET_RESULT_TYPOLOGIES,
|
||||
i.getInstancetype().getClassid());
|
||||
|
||||
if (Objects.isNull(expectedResultType)) {
|
||||
throw new IllegalArgumentException(
|
||||
"instance type not bound to any result type in dnet:result_typologies: " +
|
||||
i.getInstancetype().getClassid());
|
||||
}
|
||||
|
||||
// there is a clash among the result types
|
||||
if (!expectedResultType.getClassid().equals(mergedResult.getResulttype().getClassid())) {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue