forked from D-Net/dnet-hadoop
added filter
This commit is contained in:
parent
5f98ea74a9
commit
25d5663d97
|
@ -10,12 +10,12 @@ import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
||||||
import eu.dnetlib.dhp.schema.oaf.*;
|
import eu.dnetlib.dhp.schema.oaf.*;
|
||||||
import eu.dnetlib.dhp.utils.DHPUtils;
|
import eu.dnetlib.dhp.utils.DHPUtils;
|
||||||
|
|
||||||
|
@ -65,24 +65,28 @@ public class IdentifierFactory implements Serializable {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
StructuredProperty pid = null;
|
StructuredProperty pid = null;
|
||||||
if(entity.getPid() != null ) {
|
if (entity.getPid() != null) {
|
||||||
pid = entity.getPid()
|
pid = entity
|
||||||
|
.getPid()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(s -> s.getQualifier()!= null && "doi".equalsIgnoreCase(s.getQualifier().getClassid()))
|
.filter(s -> s.getQualifier() != null && "doi".equalsIgnoreCase(s.getQualifier().getClassid()))
|
||||||
.filter(IdentifierFactory::pidFilter)
|
.filter(IdentifierFactory::pidFilter)
|
||||||
.findAny().orElse(null);
|
.findAny()
|
||||||
|
.orElse(null);
|
||||||
} else {
|
} else {
|
||||||
if (entity.getInstance()!= null) {
|
if (entity.getInstance() != null) {
|
||||||
pid = entity.getInstance()
|
pid = entity
|
||||||
|
.getInstance()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(i -> i.getPid()!= null)
|
.filter(i -> i.getPid() != null)
|
||||||
.flatMap(i -> i.getPid().stream())
|
.flatMap(i -> i.getPid().stream())
|
||||||
.filter(IdentifierFactory::pidFilter)
|
.filter(IdentifierFactory::pidFilter)
|
||||||
.findAny().orElse(null);
|
.findAny()
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pid!= null)
|
if (pid != null)
|
||||||
return idFromPid(entity, pid, true);
|
return idFromPid(entity, pid, true);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,6 +196,8 @@ object DoiBoostMappingUtil {
|
||||||
//Case empty publication
|
//Case empty publication
|
||||||
if (publication == null)
|
if (publication == null)
|
||||||
return false
|
return false
|
||||||
|
if (publication.getId == null || publication.getId.isEmpty)
|
||||||
|
return false
|
||||||
|
|
||||||
//Case publication with no title
|
//Case publication with no title
|
||||||
if (publication.getTitle == null || publication.getTitle.size == 0)
|
if (publication.getTitle == null || publication.getTitle.size == 0)
|
||||||
|
|
Loading…
Reference in New Issue