@Test public void buildNodeMap() throws IOException { ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(getClass().getResourceAsStream("mangal-node.json")); JsonNode singleNode = jsonNode.get(0); Map<String, Map<String, String>> nodeMap = new TreeMap<>(); DatasetImporterForMangal.appendNodeToMap(singleNode, nodeMap); assertThat(nodeMap.containsKey("6445"), Is.is(true)); assertThat(nodeMap.get("6445").get("original_name"), Is.is("mollusks")); }
public static void appendNodeToMap(JsonNode singleNode, Map<String, Map<String, String>> nodeMap) { TreeMap<String, String> props = new TreeMap<>(); if (hasNonEmptyValueFor(singleNode, "original_name")) { props.put("original_name", singleNode.get("original_name").asText()); } nodeMap.put(singleNode.get("id").asText(), props); }
DatasetImporterForMangal extends DatasetImporterWithListener { public static void appendNodeToMap(JsonNode singleNode, Map<String, Map<String, String>> nodeMap) { TreeMap<String, String> props = new TreeMap<>(); if (hasNonEmptyValueFor(singleNode, "original_name")) { props.put("original_name", singleNode.get("original_name").asText()); } nodeMap.put(singleNode.get("id").asText(), props); } }
DatasetImporterForMangal extends DatasetImporterWithListener { public static void appendNodeToMap(JsonNode singleNode, Map<String, Map<String, String>> nodeMap) { TreeMap<String, String> props = new TreeMap<>(); if (hasNonEmptyValueFor(singleNode, "original_name")) { props.put("original_name", singleNode.get("original_name").asText()); } nodeMap.put(singleNode.get("id").asText(), props); } DatasetImporterForMangal(ParserFactory parserFactory, NodeFactory nodeFactory); }
DatasetImporterForMangal extends DatasetImporterWithListener { public static void appendNodeToMap(JsonNode singleNode, Map<String, Map<String, String>> nodeMap) { TreeMap<String, String> props = new TreeMap<>(); if (hasNonEmptyValueFor(singleNode, "original_name")) { props.put("original_name", singleNode.get("original_name").asText()); } nodeMap.put(singleNode.get("id").asText(), props); } DatasetImporterForMangal(ParserFactory parserFactory, NodeFactory nodeFactory); static URI getPagedUrl(String urlEndpoint, int page, int limit); static void retrievePagedResource(ResourceService resourceService, NodeListener listener, int pageSize, int pageNumber, String urlEndpoint); static boolean handlePagedResults(NodeListener listener, InputStream resource, int limit); static void appendNodeToMap(JsonNode singleNode, Map<String, Map<String, String>> nodeMap); static boolean hasNonEmptyValueFor(JsonNode jsonNode, String key); static void appendReferenceToMap(JsonNode aReference, Map<String, Map<String, String>> refMap); static void appendNetworkToMap(JsonNode singleNode,
                                          Map<String, Map<String, String>> networkMap,
                                          Map<String, Map<String, String>> datasetMap
    ); static void appendDatasetToMap(JsonNode aDataset, Map<String, Map<String, String>> datasetMap, Map<String, Map<String, String>> refMap); static Map<String, String> parseInteraction(JsonNode singleInteraction, Map<String, Map<String, String>> nodeMap, Map<String, Map<String, String>> networkMap); static void addNameLabel(Map<String, Map<String, String>> nodeMap, JsonNode singleInteraction, Map<String, String> interaction, String nodeLabel, String nameLabel); @Override void importStudy(); }
DatasetImporterForMangal extends DatasetImporterWithListener { public static void appendNodeToMap(JsonNode singleNode, Map<String, Map<String, String>> nodeMap) { TreeMap<String, String> props = new TreeMap<>(); if (hasNonEmptyValueFor(singleNode, "original_name")) { props.put("original_name", singleNode.get("original_name").asText()); } nodeMap.put(singleNode.get("id").asText(), props); } DatasetImporterForMangal(ParserFactory parserFactory, NodeFactory nodeFactory); static URI getPagedUrl(String urlEndpoint, int page, int limit); static void retrievePagedResource(ResourceService resourceService, NodeListener listener, int pageSize, int pageNumber, String urlEndpoint); static boolean handlePagedResults(NodeListener listener, InputStream resource, int limit); static void appendNodeToMap(JsonNode singleNode, Map<String, Map<String, String>> nodeMap); static boolean hasNonEmptyValueFor(JsonNode jsonNode, String key); static void appendReferenceToMap(JsonNode aReference, Map<String, Map<String, String>> refMap); static void appendNetworkToMap(JsonNode singleNode,
                                          Map<String, Map<String, String>> networkMap,
                                          Map<String, Map<String, String>> datasetMap
    ); static void appendDatasetToMap(JsonNode aDataset, Map<String, Map<String, String>> datasetMap, Map<String, Map<String, String>> refMap); static Map<String, String> parseInteraction(JsonNode singleInteraction, Map<String, Map<String, String>> nodeMap, Map<String, Map<String, String>> networkMap); static void addNameLabel(Map<String, Map<String, String>> nodeMap, JsonNode singleInteraction, Map<String, String> interaction, String nodeLabel, String nameLabel); @Override void importStudy(); static final String MANGAL_API_ENDPOINT; static final Map<String, InteractType> INTERACTION_TYPE_MAP; }