Revision 45965
Added by Sandro La Bruzzo about 7 years ago
modules/dnet-dli-domain/trunk/src/main/java/eu/dnetlib/data/transform/xml/DmfToHbaseXsltFunctions.java | ||
---|---|---|
108 | 108 |
|
109 | 109 |
//entity.addAllPid(Iterables.filter(pids, Predicates.notNull())); |
110 | 110 |
|
111 |
pids.forEach(pid -> entity.addExtension(DliProtos.typedIdentifier, pid)); |
|
111 |
pids.stream().map(DliToHbaseXsltFunctions::fixPid).forEach(pid -> entity.addExtension(DliProtos.typedIdentifier, pid));
|
|
112 | 112 |
|
113 | 113 |
PmfToHbaseXsltFunctions.addResolvedFrom(entity, about); |
114 | 114 |
|
modules/dnet-dli-domain/trunk/src/main/java/eu/dnetlib/data/transform/xml/DliToHbaseXsltFunctions.java | ||
---|---|---|
69 | 69 |
FieldTypeProtos.StructuredProperty.Builder identifier = FieldTypeProtos.StructuredProperty.newBuilder(); |
70 | 70 |
identifier.setQualifier(getSimpleQualifier(pidType, "dnet:pid_types")); |
71 | 71 |
identifier.setValue(pid.trim()); |
72 |
entity.addExtension(DliProtos.typedIdentifier, identifier.build());
|
|
72 |
entity.addExtension(DliProtos.typedIdentifier, fixPid(identifier.build()));
|
|
73 | 73 |
entity.setId(entityId); |
74 | 74 |
entity.setType(TypeProtos.Type.valueOf(type)); |
75 | 75 |
final DNGFProtos.DNGF oaf = DNGFProtos.DNGF.newBuilder().setEntity(entity).setKind(KindProtos.Kind.entity).build(); |
... | ... | |
78 | 78 |
} catch (Throwable e) { |
79 | 79 |
throw new RuntimeException(e); |
80 | 80 |
} |
81 |
|
|
82 | 81 |
} |
83 | 82 |
|
84 | 83 |
public static String createEntity( |
... | ... | |
188 | 187 |
} |
189 | 188 |
return null; |
190 | 189 |
} |
190 |
|
|
191 |
|
|
192 |
public static FieldTypeProtos.StructuredProperty fixPid(final FieldTypeProtos.StructuredProperty inputPid) { |
|
193 |
if (inputPid == null) { |
|
194 |
return null; |
|
195 |
} |
|
196 |
String pid = inputPid.getValue(); |
|
197 |
String pidType = inputPid.getQualifier().getClassid(); |
|
198 |
|
|
199 |
if (StringUtils.isBlank(pid) || StringUtils.isBlank(pidType)) { |
|
200 |
return null; |
|
201 |
} |
|
202 |
pidType = pidType.trim().toLowerCase(); |
|
203 |
pid = pid.trim().toLowerCase(); |
|
204 |
|
|
205 |
if ("doi".equals(pidType)) { |
|
206 |
pid = pid.replace("http://dx.doi.org/", "").replace("http://doi.org/", ""); |
|
207 |
} |
|
208 |
return getStructuredProperty(pid, pidType, pidType, inputPid.getQualifier().getSchemeid(), inputPid.getQualifier().getSchemename()); |
|
209 |
} |
|
191 | 210 |
} |
modules/dnet-dli-domain/trunk/src/main/java/eu/dnetlib/data/transform/xml/PmfToHbaseXsltFunctions.java | ||
---|---|---|
65 | 65 |
entity.setType(Type.publication).setId(resultId); |
66 | 66 |
entity.setDateoftransformation(StringUtils.isBlank(dateOfTransformation) ? "" : dateOfTransformation); |
67 | 67 |
entity.setDateofcollection(StringUtils.isBlank(dateOfCollection) ? "" : dateOfCollection); |
68 |
//entity.addAllPid(Iterables.filter(pids, Predicates.notNull())); |
|
69 |
pids.forEach(pid -> entity.addExtension(DliProtos.typedIdentifier, pid)); |
|
68 |
pids.stream().map(DliToHbaseXsltFunctions::fixPid).forEach(pid -> entity.addExtension(DliProtos.typedIdentifier, pid)); |
|
70 | 69 |
entity.setDateofcollection(dateOfCollection) |
71 | 70 |
.setDateoftransformation(dateOfTransformation).setOaiprovenance(getOAIProvenance(about)); |
72 | 71 |
entity.setPublication(publication); |
Also available in: Unified diff
Added fix of pid