dnet-hadoop/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/graph/scholexplorer/ScholexplorerParserTest.java

39 lines
1.2 KiB
Java
Raw Normal View History

2020-02-19 10:07:08 +01:00
package eu.dnetlib.dhp.graph.scholexplorer;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import eu.dnetlib.dhp.graph.scholexplorer.parser.DatasetScholexplorerParser;
import eu.dnetlib.dhp.schema.oaf.Oaf;
2020-03-13 09:13:20 +01:00
import eu.dnetlib.scholexplorer.relation.RelationMapper;
2020-02-19 10:07:08 +01:00
import org.apache.commons.io.IOUtils;
2020-03-26 14:08:29 +01:00
import org.junit.jupiter.api.Test;
2020-02-19 10:07:08 +01:00
import java.util.List;
public class ScholexplorerParserTest {
@Test
2020-03-13 09:13:20 +01:00
public void testDataciteParser() throws Exception {
2020-02-19 10:07:08 +01:00
String xml = IOUtils.toString(this.getClass().getResourceAsStream("dmf.xml"));
DatasetScholexplorerParser p = new DatasetScholexplorerParser();
2020-03-13 09:13:20 +01:00
List<Oaf> oaves = p.parseObject(xml, RelationMapper.load());
2020-02-19 10:07:08 +01:00
ObjectMapper m = new ObjectMapper();
m.enable(SerializationFeature.INDENT_OUTPUT);
oaves.forEach(oaf -> {
try {
System.out.println(m.writeValueAsString(oaf));
System.out.println("----------------------------");
} catch (JsonProcessingException e) {
}
});
}
}