Search in sources :

Example 1 with InteractTypeMapperFactoryImpl

use of org.eol.globi.util.InteractTypeMapperFactoryImpl in project eol-globi-data by jhpoelen.

the class DatasetImporterForPensoftIT method singleTableHostInColumnHeader.

@Test
public void singleTableHostInColumnHeader() throws IOException, TermLookupServiceException, StudyImporterException {
    final JsonNode tableObj = getTableObj();
    assertNotNull(tableObj);
    tableObj.get("article_doi");
    final JsonNode annotations = tableObj.get("annotations");
    for (JsonNode annotation : annotations) {
        final InteractTypeMapper interactTypeMapper = new InteractTypeMapperFactoryImpl().create();
        if (annotation.has("id")) {
            final InteractType interactType = interactTypeMapper.getInteractType(annotation.get("id").asText());
        }
        if (annotation.has("context")) {
            String verbatimInteraction = annotation.get("context").asText();
        }
        annotation.get("row");
        annotation.get("column");
        annotation.get("possition");
    }
    tableObj.get("caption");
    List<Map<String, String>> rowValues = new ArrayList<>();
    InteractionListener listener = new InteractionListener() {

        @Override
        public void on(Map<String, String> interaction) throws StudyImporterException {
            rowValues.add(interaction);
        }
    };
    parseRowsAndEnrich(tableObj, listener, getResourceServiceTest());
}
Also used : InteractType(org.eol.globi.domain.InteractType) InteractionListener(org.eol.globi.process.InteractionListener) InteractTypeMapperFactoryImpl(org.eol.globi.util.InteractTypeMapperFactoryImpl) ArrayList(java.util.ArrayList) InteractTypeMapper(org.eol.globi.util.InteractTypeMapper) JsonNode(com.fasterxml.jackson.databind.JsonNode) Map(java.util.Map) TreeMap(java.util.TreeMap) Test(org.junit.Test) TestUtil.getResourceServiceTest(org.eol.globi.data.TestUtil.getResourceServiceTest)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 TestUtil.getResourceServiceTest (org.eol.globi.data.TestUtil.getResourceServiceTest)1 InteractType (org.eol.globi.domain.InteractType)1 InteractionListener (org.eol.globi.process.InteractionListener)1 InteractTypeMapper (org.eol.globi.util.InteractTypeMapper)1 InteractTypeMapperFactoryImpl (org.eol.globi.util.InteractTypeMapperFactoryImpl)1 Test (org.junit.Test)1