forked from D-Net/dnet-hadoop
fix to the mapper, and changed of the json for testing
This commit is contained in:
parent
3da12be81f
commit
33e2ebeaaa
|
@ -11,6 +11,7 @@ public class Constants {
|
|||
public static String DATASET_URL = "https://beta.risis.openaire.eu/search/dataset?datasetId=";
|
||||
public static String SOFTWARE_URL = "https://beta.risis.openaire.eu/search/software?softwareId=";
|
||||
public static String ORP_URL = "https://beta.risis.openaire.eu/search/other?orpId=";
|
||||
public static String DEFAULT_LICENCE_ID = "notspecified";
|
||||
public static final Map<String, String> accessRightsCoarMap = Maps.newHashMap();
|
||||
public static final Map<String, String> coarCodeLabelMap = Maps.newHashMap();
|
||||
public static final Map<String, String> gcatCatalogue = Maps.newHashMap();
|
||||
|
@ -34,11 +35,11 @@ public class Constants {
|
|||
|
||||
static {
|
||||
gcatCatalogue.put("OPEN", "OPEN");
|
||||
accessRightsCoarMap.put("RESTRICTED", "RESTRICTED");
|
||||
accessRightsCoarMap.put("OPEN SOURCE", "OPEN");
|
||||
accessRightsCoarMap.put("CLOSED", "CLOSED");
|
||||
accessRightsCoarMap.put("EMBARGO", "EMBARGO");
|
||||
accessRightsCoarMap.put("UNKNOWN", "UNKNOWN");
|
||||
accessRightsCoarMap.put("OTHER", "UNKNOWN");
|
||||
gcatCatalogue.put("RESTRICTED", "RESTRICTED");
|
||||
gcatCatalogue.put("OPEN SOURCE", "OPEN");
|
||||
gcatCatalogue.put("CLOSED", "CLOSED");
|
||||
gcatCatalogue.put("EMBARGO", "EMBARGO");
|
||||
gcatCatalogue.put("UNKNOWN", "UNKNOWN");
|
||||
gcatCatalogue.put("OTHER", "UNKNOWN");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,17 +44,13 @@ public class Mapper implements Serializable {
|
|||
externals.add(KeyValue.newInstance("result type", "dataset"));
|
||||
break;
|
||||
case "software":
|
||||
|
||||
eu.dnetlib.dhp.schema.oaf.Software is = (eu.dnetlib.dhp.schema.oaf.Software) input;
|
||||
Optional
|
||||
.ofNullable(is.getCodeRepositoryUrl())
|
||||
.ifPresent(value -> urlSet.add(value.getValue()));
|
||||
Optional
|
||||
.ofNullable(is.getDocumentationUrl())
|
||||
.ifPresent(
|
||||
value -> value
|
||||
.stream()
|
||||
.map(v -> urlSet.add(v.getValue())));
|
||||
.ifPresent(value -> value.forEach(v -> urlSet.add(v.getValue())));
|
||||
|
||||
Optional
|
||||
.ofNullable(is.getProgrammingLanguage())
|
||||
|
@ -71,6 +67,8 @@ public class Mapper implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
out.setLicence_id(Constants.DEFAULT_LICENCE_ID);
|
||||
|
||||
Optional
|
||||
.ofNullable(input.getAuthor())
|
||||
.ifPresent(
|
||||
|
@ -106,8 +104,7 @@ public class Mapper implements Serializable {
|
|||
.ofNullable(input.getDescription())
|
||||
.ifPresent(value ->
|
||||
|
||||
getDescription(out, externals, value)
|
||||
);
|
||||
getDescription(out, externals, value));
|
||||
|
||||
Optional
|
||||
.ofNullable(input.getEmbargoenddate())
|
||||
|
@ -181,6 +178,10 @@ public class Mapper implements Serializable {
|
|||
KeyValue
|
||||
.newInstance("subject", s.getQualifier().getClassid() + ":" + s.getValue()))));
|
||||
|
||||
Optional
|
||||
.ofNullable(input.getResourcetype())
|
||||
.ifPresent(value -> externals.add(KeyValue.newInstance("resource type", value.getClassname())));
|
||||
|
||||
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)));
|
||||
|
@ -200,5 +201,4 @@ public class Mapper implements Serializable {
|
|||
it.forEachRemaining(v -> externals.add(KeyValue.newInstance("description", v.getValue())));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue