forked from D-Net/dnet-hadoop
added set of same type of entries -url cf hb- before creating extras to have them distinct
This commit is contained in:
parent
004bf225cb
commit
1566fd590e
|
@ -19,6 +19,9 @@ public class Mapper implements Serializable {
|
|||
final CatalogueEntry out = new CatalogueEntry();
|
||||
Optional<Qualifier> ort = Optional.ofNullable(input.getResulttype());
|
||||
List<KeyValue> externals = new ArrayList<>();
|
||||
Set<String> urlSet = new HashSet<>();
|
||||
Set<String> cfSet = new HashSet<>();
|
||||
Set<String> hbSet = new HashSet<>();
|
||||
if (ort.isPresent()) {
|
||||
switch (ort.get().getClassid()) {
|
||||
case "publication":
|
||||
|
@ -43,13 +46,13 @@ public class Mapper implements Serializable {
|
|||
eu.dnetlib.dhp.schema.oaf.Software is = (eu.dnetlib.dhp.schema.oaf.Software) input;
|
||||
Optional
|
||||
.ofNullable(is.getCodeRepositoryUrl())
|
||||
.ifPresent(value -> externals.add(KeyValue.newInstance("url", value.getValue())));
|
||||
.ifPresent(value -> urlSet.add(value.getValue()));
|
||||
Optional
|
||||
.ofNullable(is.getDocumentationUrl())
|
||||
.ifPresent(
|
||||
value -> value
|
||||
.stream()
|
||||
.map(v -> externals.add(KeyValue.newInstance("url", v.getValue()))));
|
||||
.map(v -> urlSet.add(v.getValue())));
|
||||
|
||||
Optional
|
||||
.ofNullable(is.getProgrammingLanguage())
|
||||
|
@ -80,7 +83,7 @@ public class Mapper implements Serializable {
|
|||
.ofNullable(input.getCollectedfrom())
|
||||
.ifPresent(
|
||||
value -> value
|
||||
.forEach(v -> externals.add(KeyValue.newInstance("collected from", v.getValue()))));
|
||||
.forEach(v -> cfSet.add(v.getValue())));
|
||||
|
||||
Optional
|
||||
.ofNullable(input.getContributor())
|
||||
|
@ -124,13 +127,12 @@ public class Mapper implements Serializable {
|
|||
|
||||
Optional
|
||||
.ofNullable(v.getHostedby())
|
||||
.ifPresent(hb -> externals.add(KeyValue.newInstance("hosted by", hb.getValue())));
|
||||
.ifPresent(hb -> hbSet.add(hb.getValue()));
|
||||
|
||||
final HashSet<String> urlSet = new HashSet<>();
|
||||
Optional
|
||||
.ofNullable(v.getUrl())
|
||||
.ifPresent(u -> u.forEach(url -> urlSet.add(url)));
|
||||
urlSet.forEach(url -> externals.add(KeyValue.newInstance("url", url)));
|
||||
|
||||
|
||||
}));
|
||||
|
||||
|
@ -180,6 +182,10 @@ public class Mapper implements Serializable {
|
|||
.newInstance("subject", s.getQualifier().getClassid() + ":" + s.getValue()))));
|
||||
externals.add(KeyValue.newInstance("resource type", input.getResourcetype().getClassid()));
|
||||
|
||||
cfSet.forEach(cf -> externals.add(KeyValue.newInstance("collected from", cf)));
|
||||
hbSet.forEach(hb -> externals.add(KeyValue.newInstance("hosted by", hb)));
|
||||
urlSet.forEach(url -> externals.add(KeyValue.newInstance("url", url)));
|
||||
|
||||
out.setExtras(externals);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue