aligned orcid result typologies with openaire vocabulary

This commit is contained in:
Enrico Ottonello 2021-02-25 15:02:10 +01:00
parent 975823b968
commit d43ea88caf
3 changed files with 28 additions and 28 deletions

View File

@ -4,6 +4,7 @@ package eu.dnetlib.doiboost.orcidnodoi;
import static eu.dnetlib.dhp.common.SparkSessionSupport.runWithSparkSession; import static eu.dnetlib.dhp.common.SparkSessionSupport.runWithSparkSession;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;

View File

@ -106,20 +106,12 @@ public class PublicationToOaf implements Serializable {
public static final String PID_TYPES = "dnet:pid_types"; public static final String PID_TYPES = "dnet:pid_types";
public Oaf generatePublicationActionsFromJson(final String json) { public Oaf generatePublicationActionsFromJson(final String json) {
try { if (parsedPublications != null) {
if (parsedPublications != null) { parsedPublications.add(1);
parsedPublications.add(1);
}
JsonElement jElement = new JsonParser().parse(json);
JsonObject jObject = jElement.getAsJsonObject();
return generatePublicationActionsFromDump(jObject);
} catch (Throwable t) {
logger.error("creating publication: " + t.getMessage());
if (errorsGeneric != null) {
errorsGeneric.add(1);
}
return null;
} }
JsonElement jElement = new JsonParser().parse(json);
JsonObject jObject = jElement.getAsJsonObject();
return generatePublicationActionsFromDump(jObject);
} }
public Oaf generatePublicationActionsFromDump(final JsonObject rootElement) { public Oaf generatePublicationActionsFromDump(final JsonObject rootElement) {
@ -217,6 +209,13 @@ public class PublicationToOaf implements Serializable {
if (StringUtils.isNotBlank(type)) { if (StringUtils.isNotBlank(type)) {
publication.setResourcetype(mapQualifier(type, type, "dnet:dataCite_resource", "dnet:dataCite_resource")); publication.setResourcetype(mapQualifier(type, type, "dnet:dataCite_resource", "dnet:dataCite_resource"));
Map<String, String> publicationType = typologiesMapping.get(type);
if ((publicationType == null || publicationType.isEmpty()) && errorsInvalidType != null) {
errorsInvalidType.add(1);
logger.error("publication_type_not_found: " + type);
return null;
}
final String typeValue = typologiesMapping.get(type).get("value"); final String typeValue = typologiesMapping.get(type).get("value");
cobjValue = typologiesMapping.get(type).get("cobj"); cobjValue = typologiesMapping.get(type).get("cobj");
final Instance instance = new Instance(); final Instance instance = new Instance();
@ -260,10 +259,16 @@ public class PublicationToOaf implements Serializable {
if (authors != null && authors.size() > 0) { if (authors != null && authors.size() > 0) {
publication.setAuthor(authors); publication.setAuthor(authors);
} else { } else {
if (errorsNotFoundAuthors != null) { if (authors == null) {
errorsNotFoundAuthors.add(1); Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(rootElement);
throw new RuntimeException("not_valid_authors: " + json);
} else {
if (errorsNotFoundAuthors != null) {
errorsNotFoundAuthors.add(1);
}
return null;
} }
return null;
} }
String classValue = getDefaultResulttype(cobjValue); String classValue = getDefaultResulttype(cobjValue);
publication publication

View File

@ -1,19 +1,9 @@
{ {
"reference-entry": {"cobj":"0013", "value": "Part of book or chapter of book"},
"report": {"cobj":"0017", "value": "Report"}, "report": {"cobj":"0017", "value": "Report"},
"dataset": {"cobj":"0021", "value": "Dataset"},
"journal-article": {"cobj":"0001", "value": "Article"}, "journal-article": {"cobj":"0001", "value": "Article"},
"reference-book": {"cobj":"0002", "value": "Book"},
"other": {"cobj":"0020", "value": "Other ORP type"}, "other": {"cobj":"0020", "value": "Other ORP type"},
"proceedings-article": {"cobj":"0004", "value": "Conference object"},
"standard": {"cobj":"0038", "value": "Other literature type"},
"book-part": {"cobj":"0002", "value": "Book"},
"monograph": {"cobj":"0002", "value": "Book"},
"report-series": {"cobj":"0017", "value": "Report"},
"book": {"cobj":"0002", "value": "Book"}, "book": {"cobj":"0002", "value": "Book"},
"book-chapter": {"cobj":"0013", "value": "Part of book or chapter of book"}, "book-chapter": {"cobj":"0013", "value": "Part of book or chapter of book"},
"peer-review": {"cobj":"0015", "value": "Review"},
"book-section": {"cobj":"0013", "value": "Part of book or chapter of book"},
"book-review": {"cobj":"0015", "value": "Review"}, "book-review": {"cobj":"0015", "value": "Review"},
"conference-abstract": {"cobj":"0004", "value": "Conference object"}, "conference-abstract": {"cobj":"0004", "value": "Conference object"},
"conference-paper": {"cobj":"0004", "value": "Conference object"}, "conference-paper": {"cobj":"0004", "value": "Conference object"},
@ -21,7 +11,7 @@
"data-set": {"cobj":"0021", "value": "Dataset"}, "data-set": {"cobj":"0021", "value": "Dataset"},
"dictionary-entry": {"cobj":"0038", "value": "Other literature type"}, "dictionary-entry": {"cobj":"0038", "value": "Other literature type"},
"disclosure": {"cobj":"0038", "value": "Other literature type"}, "disclosure": {"cobj":"0038", "value": "Other literature type"},
"dissertation": {"cobj":"0006", "value": "Doctoral thesis"}, "dissertation-thesis": {"cobj":"0006", "value": "Doctoral thesis"},
"edited-book": {"cobj":"0002", "value": "Book"}, "edited-book": {"cobj":"0002", "value": "Book"},
"encyclopedia-entry": {"cobj":"0038", "value": "Other literature type"}, "encyclopedia-entry": {"cobj":"0038", "value": "Other literature type"},
"lecture-speech": {"cobj":"0010", "value": "Lecture"}, "lecture-speech": {"cobj":"0010", "value": "Lecture"},
@ -37,5 +27,9 @@
"supervised-student-publication": {"cobj":"0001", "value": "Article"}, "supervised-student-publication": {"cobj":"0001", "value": "Article"},
"technical-standard": {"cobj":"0038", "value": "Other literature type"}, "technical-standard": {"cobj":"0038", "value": "Other literature type"},
"website": {"cobj":"0020", "value": "Other ORP type"}, "website": {"cobj":"0020", "value": "Other ORP type"},
"working-paper": {"cobj":"0014", "value": "Research"} "working-paper": {"cobj":"0014", "value": "Research"},
"annotation": {"cobj":"0018", "value": "Annotation"},
"physical-object": {"cobj":"0028", "value": "PhysicalObject"},
"preprint": {"cobj":"0016", "value": "Preprint"},
"software": {"cobj":"0029", "value": "Software"}
} }