Revision 49184
Added by Sandro La Bruzzo over 6 years ago
ScholixResolverParser.java | ||
---|---|---|
4 | 4 |
import java.util.Arrays; |
5 | 5 |
import java.util.List; |
6 | 6 |
|
7 |
import com.sun.javafx.geom.Vec2d; |
|
8 | 7 |
import com.ximpleware.AutoPilot; |
9 | 8 |
import com.ximpleware.VTDGen; |
10 | 9 |
import com.ximpleware.VTDNav; |
11 | 10 |
import eu.dnetlib.data.transform.VtdUtilityParser; |
12 |
import eu.dnetlib.data.transform.VtdUtilityParser.Node; |
|
13 | 11 |
import eu.dnetlib.dli.resolver.model.*; |
14 | 12 |
|
13 |
import eu.dnetlib.pid.resolver.model.ObjectType; |
|
15 | 14 |
import org.apache.commons.lang3.StringUtils; |
16 | 15 |
import org.apache.commons.logging.Log; |
17 | 16 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
24 | 23 |
private static final Log log = LogFactory.getLog(ScholixResolverParser.class); |
25 | 24 |
|
26 | 25 |
@Override |
27 |
public ResolvedObject parseObject(final String record) {
|
|
26 |
public DLIResolvedObject parseObject(final String record) {
|
|
28 | 27 |
|
29 | 28 |
try { |
30 |
final ResolvedObject parsedObject = new ResolvedObject();
|
|
31 |
final VTDGen vg = new VTDGen();
|
|
29 |
final DLIResolvedObject parsedObject = new DLIResolvedObject();
|
|
30 |
final VTDGen vg = new VTDGen();
|
|
32 | 31 |
vg.setDoc(record.getBytes()); |
33 | 32 |
vg.parse(true); |
34 | 33 |
|
... | ... | |
63 | 62 |
return null; |
64 | 63 |
} |
65 | 64 |
|
66 |
final List<ObjectProvenance> provenanceList = new ArrayList<>();
|
|
67 |
if (provenances != null) {
|
|
65 |
final List<DLIObjectProvenance> provenanceList = new ArrayList<>();
|
|
66 |
if (provenances != null) {
|
|
68 | 67 |
provenances.forEach(it -> { |
69 |
final ObjectProvenance provenance = new ObjectProvenance();
|
|
70 |
provenance.setDatasourceId(it.getAttributes().get("id"));
|
|
68 |
final DLIObjectProvenance provenance = new DLIObjectProvenance();
|
|
69 |
provenance.setDatasourceId(it.getAttributes().get("id"));
|
|
71 | 70 |
provenance.setDatasource(it.getAttributes().get("name")); |
72 | 71 |
provenance.setCompletionStatus(it.getAttributes().get("completionStatus")); |
73 | 72 |
provenance.setPublisher(sourcePublisher); |
... | ... | |
123 | 122 |
final String inverseRelationSemantic = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:relashionship/inverseRelashionship"); |
124 | 123 |
|
125 | 124 |
|
126 |
final List<ObjectRelation> relations = new ArrayList<>();
|
|
125 |
final List<DLIObjectRelation> relations = new ArrayList<>();
|
|
127 | 126 |
|
128 |
ObjectRelation relation = new ObjectRelation();
|
|
129 |
relation.setCompletionStatus(CompletionStatus.incomplete.toString());
|
|
127 |
DLIObjectRelation relation = new DLIObjectRelation();
|
|
128 |
relation.setCompletionStatus(CompletionStatus.incomplete.toString());
|
|
130 | 129 |
relation.setRelationProvenance(parsedObject.getDatasourceProvenance()); |
131 | 130 |
relation.setRelationSemantics(relationType); |
132 | 131 |
relation.setInverseRelation(inverseRelationSemantic); |
Also available in: Unified diff
Refactored Pid resolver