Revision 49752
Added by Sandro La Bruzzo over 6 years ago
modules/dnet-dli/trunk/src/test/java/eu/dnetlib/resolver/DLIParserTest.java | ||
---|---|---|
42 | 42 |
*/ |
43 | 43 |
|
44 | 44 |
@Ignore |
45 |
@RunWith(SpringJUnit4ClassRunner.class) |
|
46 |
@ContextConfiguration(classes = { ConfigurationTestConfig.class}) |
|
45 |
//@RunWith(SpringJUnit4ClassRunner.class)
|
|
46 |
//@ContextConfiguration(classes = { ConfigurationTestConfig.class})
|
|
47 | 47 |
public class DLIParserTest extends DLIAbstractTest{ |
48 | 48 |
|
49 | 49 |
private static final Log log = LogFactory.getLog(DLIParserTest.class); |
... | ... | |
103 | 103 |
|
104 | 104 |
@Test |
105 | 105 |
public void testScholixParser() throws IOException { |
106 |
final InputStream resourceAsStream = getClass().getResourceAsStream("/eu/dnetlib/dli/parser/InputRecordScholix.xml");
|
|
106 |
final InputStream resourceAsStream = getClass().getResourceAsStream("/eu/dnetlib/dli/parser/ieda.xml");
|
|
107 | 107 |
|
108 | 108 |
String str = IOUtils.toString(resourceAsStream); |
109 | 109 |
ScholixResolverParser parser = new ScholixResolverParser(); |
modules/dnet-dli/trunk/src/test/resources/eu/dnetlib/dli/parser/ieda.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<oai:record xmlns:oai="http://www.openarchives.org/OAI/2.0/" |
|
3 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri" |
|
4 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
|
5 |
<oai:header> |
|
6 |
<dri:objIdentifier>r3d100010578::00242d65303876b062a9447ba88f0fa5</dri:objIdentifier> |
|
7 |
<dri:recordIdentifier>10.1594/IEDA/100239::10.2136/vzj2010.0133</dri:recordIdentifier> |
|
8 |
<dri:dateOfCollection>2017-03-29T11:33:51.486+02:00</dri:dateOfCollection> |
|
9 |
<dri:repositoryId>ieda_UmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZXMvUmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZVR5cGU= |
|
10 |
</dri:repositoryId> |
|
1 |
<oai:record xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
2 |
xmlns:dr="http://www.driver-repository.eu/namespace/dr" |
|
3 |
xmlns:prov="http://www.openarchives.org/OAI/2.0/provenance" |
|
4 |
xmlns="http://namespace.openaire.eu/" |
|
5 |
xmlns:scholix="http://www.scholix.org" |
|
6 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
7 |
xmlns:oaf="http://namespace.dnet.eu/oaf" |
|
8 |
xmlns:oai="http://www.openarchives.org/OAI/2.0/"> |
|
9 |
<oai:header xmlns:dri="http://www.driver-repository.eu/namespace/dri"> |
|
10 |
<dri:objIdentifier>r3d100010578::00f68ffa3a22be24efc1f88a791ad849</dri:objIdentifier> |
|
11 |
<dri:recordIdentifier>10.1594/IEDA/320688::http://hdl.handle.net/1957/29381</dri:recordIdentifier> |
|
12 |
<dri:dateOfCollection>2017-10-31T10:07:38.056+01:00</dri:dateOfCollection> |
|
13 |
<dri:repositoryId>ieda_UmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZXMvUmVwb3NpdG9yeVNlcnZpY2VSZXNvdXJjZVR5cGU=</dri:repositoryId> |
|
11 | 14 |
<dri:datasourceprefix>r3d100010578</dri:datasourceprefix> |
12 | 15 |
</oai:header> |
13 |
<oai:metadata> |
|
14 |
<csvRecord> |
|
15 |
<column isID="true" name="ID">10.1594/IEDA/100239::10.2136/vzj2010.0133</column> |
|
16 |
<column name="DOI">10.1594/IEDA/100239</column> |
|
17 |
<column name="REPO">ECL</column> |
|
18 |
<column name="RELATION">IsCitedBy</column> |
|
19 |
<column name="TYPEPID">DOI</column> |
|
20 |
<column name="PIDREL">10.2136/vzj2010.0133</column> |
|
21 |
</csvRecord> |
|
22 |
</oai:metadata> |
|
23 |
<oai:about> |
|
24 |
<provenance xmlns="http://www.openarchives.org/OAI/2.0/provenance" |
|
25 |
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/provenance http://www.openarchives.org/OAI/2.0/provenance.xsd"> |
|
26 |
<originDescription xmlns="" altered="true" harvestDate="2017-03-29T11:33:51.486+02:00"> |
|
27 |
<baseURL>file%3A%2F%2F%2Fvar%2Flib%2Fdli%2Fieda.tsv</baseURL> |
|
28 |
<identifier/> |
|
29 |
<datestamp/> |
|
30 |
<metadataNamespace/> |
|
31 |
</originDescription> |
|
32 |
</provenance> |
|
33 |
</oai:about> |
|
16 |
<metadata> |
|
17 |
<link xmlns="http://www.scholix.org"> |
|
18 |
<linkProvider> |
|
19 |
<name>IEDA</name> |
|
20 |
<identifiers> |
|
21 |
<identifier>dli_________::r3d100010578</identifier> |
|
22 |
<schema>DNet-identifier</schema> |
|
23 |
</identifiers> |
|
24 |
</linkProvider> |
|
25 |
<relashionship> |
|
26 |
<name/> |
|
27 |
<schema>datacite</schema> |
|
28 |
<inverseRelashionship>related</inverseRelashionship> |
|
29 |
</relashionship> |
|
30 |
<source> |
|
31 |
<identifier> |
|
32 |
<identifier/> |
|
33 |
<schema>doi</schema> |
|
34 |
</identifier> |
|
35 |
<objectType> |
|
36 |
<type>dataset</type> |
|
37 |
</objectType> |
|
38 |
</source> |
|
39 |
<target> |
|
40 |
<identifier> |
|
41 |
<identifier/> |
|
42 |
<schema/> |
|
43 |
</identifier> |
|
44 |
</target> |
|
45 |
</link> |
|
46 |
</metadata> |
|
47 |
<oaf:about> |
|
48 |
<oaf:datainfo> |
|
49 |
<oaf:collectedFrom completionStatus="incomplete" id="dli_________::r3d100010578" name="IEDA"/> |
|
50 |
<oaf:completionStatus>incomplete</oaf:completionStatus> |
|
51 |
<oaf:provisionMode>collected</oaf:provisionMode> |
|
52 |
</oaf:datainfo> |
|
53 |
</oaf:about> |
|
34 | 54 |
</oai:record> |
modules/dnet-dli/trunk/src/main/java/eu/dnetlib/resolver/parser/ScholixResolverParser.java | ||
---|---|---|
37 | 37 |
|
38 | 38 |
final VTDNav vn = vg.getNav(); |
39 | 39 |
final AutoPilot ap = new AutoPilot(vn); |
40 |
ap.declareXPathNameSpace("dri", "http://www.driver-repository.eu/namespace/dri"); |
|
41 | 40 |
|
42 |
final String resolvedDate = VtdUtilityParser.getSingleValue(ap, vn, "//dri:resolvedDate"); |
|
41 |
|
|
42 |
final String resolvedDate = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='resolvedDate']"); |
|
43 | 43 |
parsedObject.setResolvedDate(resolvedDate); |
44 | 44 |
|
45 |
//final String datasourcePrefix = VtdUtilityParser.getSingleValue(ap, vn, "//dri:datasourceprefix"); |
|
46 |
ap.declareXPathNameSpace("oaf", "http://namespace.dnet.eu/oaf"); |
|
47 | 45 |
|
48 |
final String completionStatus = VtdUtilityParser.getSingleValue(ap, vn, "//oaf:completionStatus"); |
|
49 |
//final String provisionMode = VtdUtilityParser.getSingleValue(ap, vn, "//oaf:provisionMode"); |
|
50 | 46 |
|
47 |
|
|
48 |
final String completionStatus = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='completionStatus']"); |
|
49 |
|
|
50 |
|
|
51 | 51 |
List<VtdUtilityParser.Node> provenances = |
52 |
VtdUtilityParser.getTextValuesWithAttributes(ap, vn, "//oaf:collectedFrom", Arrays.asList("completionStatus", "id", "name"));
|
|
52 |
VtdUtilityParser.getTextValuesWithAttributes(ap, vn, "//*[local-name()='collectedFrom']", Arrays.asList("completionStatus", "id", "name"));
|
|
53 | 53 |
|
54 | 54 |
|
55 |
ap.declareXPathNameSpace("scholix", "http://www.scholix.org"); |
|
56 | 55 |
|
57 |
final String sourcePid = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:source/identifier/identifier"); |
|
58 |
final String sourcePidTye = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:source/identifier/schema"); |
|
59 |
final String sourceType = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:source/objectType/type"); |
|
60 | 56 |
|
61 |
final String sourcePublisherId = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:source/publisher//identifier"); |
|
62 |
final String sourcePublisher = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:source/publisher/name"); |
|
57 |
final String sourcePid = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='source']/*[local-name()='identifier']/*[local-name()='identifier']"); |
|
58 |
final String sourcePidTye = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='source']/*[local-name()='identifier']/*[local-name()='schema']"); |
|
59 |
final String sourceType = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='source']/*[local-name()='objectType']/*[local-name()='type']"); |
|
63 | 60 |
|
61 |
final String sourcePublisherId = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='source']/*[local-name()='publisher']//*[local-name()='identifier']"); |
|
62 |
final String sourcePublisher = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='source']/*[local-name()='publisher']/*[local-name()='name']"); |
|
64 | 63 |
|
64 |
|
|
65 | 65 |
if (StringUtils.isEmpty(sourcePid) || StringUtils.isEmpty(sourcePidTye)) { |
66 | 66 |
return null; |
67 | 67 |
} |
... | ... | |
91 | 91 |
if (!StringUtils.isEmpty(sourceType)) |
92 | 92 |
parsedObject.setType(ObjectType.valueOf(sourceType)); |
93 | 93 |
|
94 |
final String sourceTitle = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:source/title");
|
|
94 |
final String sourceTitle = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='source']/*[local-name()='title']");
|
|
95 | 95 |
|
96 |
final List<String> creators = VtdUtilityParser.getTextValue(ap, vn, "//scholix:source//scholix:creatorName");
|
|
96 |
final List<String> creators = VtdUtilityParser.getTextValue(ap, vn, "//*[local-name()='source']//*[local-name()='creatorName']");
|
|
97 | 97 |
|
98 | 98 |
if (!StringUtils.isEmpty(sourceTitle)) |
99 | 99 |
parsedObject.setTitles(Arrays.asList(sourceTitle)); |
... | ... | |
110 | 110 |
parsedObject.setAuthors(sourceCreators); |
111 | 111 |
} |
112 | 112 |
|
113 |
parsedObject.setDate(VtdUtilityParser.getSingleValue(ap, vn, "//scholix:link/scholix:publicationDate"));
|
|
113 |
parsedObject.setDate(VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='link']/*[local-name()='publicationDate']"));
|
|
114 | 114 |
|
115 |
final String targetPid = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:target/identifier/identifier");
|
|
116 |
final String targetPidTye = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:target/identifier/schema");
|
|
117 |
final String targetType = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:target/objectType/type");
|
|
115 |
final String targetPid = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='target']/*[local-name()='identifier']/*[local-name()='identifier']");
|
|
116 |
final String targetPidTye = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='target']/*[local-name()='identifier']/*[local-name()='schema']");
|
|
117 |
final String targetType = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='target']/*[local-name()='objectType']/*[local-name()='type']");
|
|
118 | 118 |
|
119 | 119 |
|
120 | 120 |
if (StringUtils.isEmpty(targetPid) || StringUtils.isEmpty(targetPidTye)) { |
... | ... | |
122 | 122 |
} |
123 | 123 |
|
124 | 124 |
|
125 |
final String relationType = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:relashionship/name");
|
|
126 |
final String inverseRelationSemantic = VtdUtilityParser.getSingleValue(ap, vn, "//scholix:relashionship/inverseRelashionship");
|
|
125 |
final String relationType = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='relashionship']/*[local-name()='name']");
|
|
126 |
final String inverseRelationSemantic = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='relashionship']/*[local-name()='inverseRelashionship']");
|
|
127 | 127 |
|
128 | 128 |
|
129 | 129 |
final List<ObjectRelation> relations = new ArrayList<>(); |
modules/dnet-dli/trunk/src/main/java/eu/dnetlib/resolver/mdstore/plugin/DLIRecordResolver.java | ||
---|---|---|
44 | 44 |
public String resolve(final String inputRecord) { |
45 | 45 |
|
46 | 46 |
final DLIResolvedObject inputObject = (DLIResolvedObject) parser.parse(inputRecord); |
47 |
if (inputObject != null && StringUtils.isNoneBlank(inputObject.getResolvedDate()))
|
|
47 |
if (inputObject==null)
|
|
48 | 48 |
return null; |
49 |
if (StringUtils.isNoneBlank(inputObject.getResolvedDate())) |
|
50 |
return null; |
|
49 | 51 |
|
50 |
if (inputObject != null && !StringUtils.isBlank(inputObject.getPid())) {
|
|
52 |
if (!StringUtils.isBlank(inputObject.getPid())) { |
|
51 | 53 |
log.debug("trying to resolve " + inputObject.getPid()); |
52 | 54 |
} |
53 | 55 |
|
modules/dnet-dli/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/TransformationRuleDSResources/pubmed_transform.xml | ||
---|---|---|
23 | 23 |
<xsl:copy-of select="//*[local-name()='header']"/> |
24 | 24 |
<metadata> |
25 | 25 |
<oaf:pid type="doi"> |
26 |
<xsl:attribute name="type"><xsl:value-of select="//*[local-name()='localIdentifier']/@type"/></xsl:attribute>
|
|
27 |
<xsl:value-of select="//*[local-name()='localIdentifier']"/>
|
|
26 |
<xsl:attribute name="type"><xsl:value-of select="normalize-space(//*[local-name()='localIdentifier']/@type)"/></xsl:attribute>
|
|
27 |
<xsl:value-of select="normalize-space(//*[local-name()='dliObject']/*[local-name()='localIdentifier'])"/>
|
|
28 | 28 |
</oaf:pid> |
29 | 29 |
<xsl:for-each select="//*[local-name()='title']"> |
30 | 30 |
<dc:title><xsl:value-of select="."/></dc:title> |
Also available in: Unified diff
fixed NPE