1
0
Fork 0

originalId with prefix

This commit is contained in:
Michele Artini 2021-05-06 15:34:48 +02:00
parent d4a30fabe3
commit d82071ba6c
1 changed files with 12 additions and 16 deletions

View File

@ -60,6 +60,8 @@ public class GenerateRorActionSetJob {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private static final String ROR_NS_PREFIX = "ror_________";
private static final List<KeyValue> ROR_COLLECTED_FROM = listKeyValues( private static final List<KeyValue> ROR_COLLECTED_FROM = listKeyValues(
"10|openaire____::993a7ae7a863813cf95028b50708e222", "ROR"); "10|openaire____::993a7ae7a863813cf95028b50708e222", "ROR");
@ -127,8 +129,8 @@ public class GenerateRorActionSetJob {
final Organization o = new Organization(); final Organization o = new Organization();
o.setId(String.format("20|ror_________::%s", DHPUtils.md5(r.getId()))); o.setId(String.format("20|%s::%s", ROR_NS_PREFIX, DHPUtils.md5(r.getId())));
o.setOriginalId(Arrays.asList(r.getId())); o.setOriginalId(Arrays.asList(String.format("%s::%s", ROR_NS_PREFIX, r.getId())));
o.setCollectedfrom(ROR_COLLECTED_FROM); o.setCollectedfrom(ROR_COLLECTED_FROM);
o.setPid(pids(r)); o.setPid(pids(r));
o.setDateofcollection(now.toString()); o.setDateofcollection(now.toString());
@ -154,9 +156,10 @@ public class GenerateRorActionSetJob {
o o
.setCountry( .setCountry(
qualifier( qualifier(
r.getCountry().getCountryCode(), r.getCountry().getCountryName(), r.getCountry().getCountryCode(), r
ModelConstants.DNET_COUNTRY_TYPE, .getCountry()
ModelConstants.DNET_COUNTRY_TYPE)); .getCountryName(),
ModelConstants.DNET_COUNTRY_TYPE, ModelConstants.DNET_COUNTRY_TYPE));
} else { } else {
o.setCountry(null); o.setCountry(null);
} }
@ -177,26 +180,19 @@ public class GenerateRorActionSetJob {
// skip // skip
} else { } else {
final Qualifier qualifier = qualifier( final Qualifier qualifier = qualifier(
type, type, type, type, ModelConstants.DNET_PID_TYPES, ModelConstants.DNET_PID_TYPES);
ModelConstants.DNET_PID_TYPES, ModelConstants.DNET_PID_TYPES);
if (all instanceof String) { if (all instanceof String) {
pids pids
.add( .add(structuredProperty(all.toString(), qualifier, ROR_DATA_INFO));
structuredProperty(
all.toString(), qualifier, ROR_DATA_INFO));
} else if (all instanceof Collection) { } else if (all instanceof Collection) {
for (final Object pid : (Collection<?>) all) { for (final Object pid : (Collection<?>) all) {
pids pids
.add( .add(structuredProperty(pid.toString(), qualifier, ROR_DATA_INFO));
structuredProperty(
pid.toString(), qualifier, ROR_DATA_INFO));
} }
} else if (all instanceof String[]) { } else if (all instanceof String[]) {
for (final String pid : (String[]) all) { for (final String pid : (String[]) all) {
pids pids
.add( .add(structuredProperty(pid, qualifier, ROR_DATA_INFO));
structuredProperty(
pid, qualifier, ROR_DATA_INFO));
} }
} else { } else {
log.warn("Invalid type for pid list: " + all.getClass()); log.warn("Invalid type for pid list: " + all.getClass());