@Test public void findSupportedInteractionTypes() throws IOException { String interactionTypes = new SchemaController().getInteractionTypes(null); ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(interactionTypes); for (JsonNode interactionType : jsonNode) { assertThat(interactionType.has("source"), is(true)); assertThat(interactionType.has("target"), is(true)); assertThat(interactionType.has("termIRI"), is(true)); } assertThat(jsonNode.has(CypherQueryBuilder.INTERACTION_HAS_PARASITE), is(true)); assertThat(jsonNode.has(CypherQueryBuilder.INTERACTION_PARASITE_OF), is(true)); assertThat(jsonNode.has(CypherQueryBuilder.INTERACTION_PREYED_UPON_BY), is(true)); assertThat(jsonNode.has(CypherQueryBuilder.INTERACTION_PREYS_ON), is(true)); assertThat(jsonNode.has(CypherQueryBuilder.INTERACTION_HAS_PATHOGEN), is(true)); assertThat(jsonNode.has(CypherQueryBuilder.INTERACTION_SYMBIONT_OF), is(true)); assertThat(jsonNode.has(CypherQueryBuilder.INTERACTION_INTERACTS_WITH), is(true)); assertThat(jsonNode.has(CypherQueryBuilder.INTERACTION_KILLS), is(true)); assertThat(jsonNode.has(CypherQueryBuilder.INTERACTION_KILLED_BY), is(true)); }
@RequestMapping(value = "/interactionTypes", method = RequestMethod.GET) @ResponseBody public String getInteractionTypes(HttpServletRequest request) throws IOException { Collection<InteractionTypeExternal> availableTypes = Arrays.asList(InteractionTypeExternal.values()); if (request != null) { if (StringUtils.isNotBlank(request.getParameter(ParamName.TAXON.getName()))) { CypherQuery cypherQuery = CypherQueryBuilder.buildInteractionTypeQuery(request.getParameterMap()); String interactionTypes = new ResultFormatterCSV().format(CypherUtil.executeRemote(cypherQuery)); String[] interactionType = StringUtils.replace(interactionTypes, "\"", "").split("\n"); availableTypes = new HashSet<InteractionTypeExternal>(); for (String type : interactionType) { InteractionTypeExternal value = CypherQueryBuilder.INTERACTION_TYPE_INTERNAL_EXTERNAL_MAP.get(type); if (value != null) { availableTypes.add(value); } } } } return "csv".equals(getRequestType(request)) ? interactionMapCsv(availableTypes) : interactionMapJson(availableTypes); }
SchemaController { @RequestMapping(value = "/interactionTypes", method = RequestMethod.GET) @ResponseBody public String getInteractionTypes(HttpServletRequest request) throws IOException { Collection<InteractionTypeExternal> availableTypes = Arrays.asList(InteractionTypeExternal.values()); if (request != null) { if (StringUtils.isNotBlank(request.getParameter(ParamName.TAXON.getName()))) { CypherQuery cypherQuery = CypherQueryBuilder.buildInteractionTypeQuery(request.getParameterMap()); String interactionTypes = new ResultFormatterCSV().format(CypherUtil.executeRemote(cypherQuery)); String[] interactionType = StringUtils.replace(interactionTypes, "\"", "").split("\n"); availableTypes = new HashSet<InteractionTypeExternal>(); for (String type : interactionType) { InteractionTypeExternal value = CypherQueryBuilder.INTERACTION_TYPE_INTERNAL_EXTERNAL_MAP.get(type); if (value != null) { availableTypes.add(value); } } } } return "csv".equals(getRequestType(request)) ? interactionMapCsv(availableTypes) : interactionMapJson(availableTypes); } }
SchemaController { @RequestMapping(value = "/interactionTypes", method = RequestMethod.GET) @ResponseBody public String getInteractionTypes(HttpServletRequest request) throws IOException { Collection<InteractionTypeExternal> availableTypes = Arrays.asList(InteractionTypeExternal.values()); if (request != null) { if (StringUtils.isNotBlank(request.getParameter(ParamName.TAXON.getName()))) { CypherQuery cypherQuery = CypherQueryBuilder.buildInteractionTypeQuery(request.getParameterMap()); String interactionTypes = new ResultFormatterCSV().format(CypherUtil.executeRemote(cypherQuery)); String[] interactionType = StringUtils.replace(interactionTypes, "\"", "").split("\n"); availableTypes = new HashSet<InteractionTypeExternal>(); for (String type : interactionType) { InteractionTypeExternal value = CypherQueryBuilder.INTERACTION_TYPE_INTERNAL_EXTERNAL_MAP.get(type); if (value != null) { availableTypes.add(value); } } } } return "csv".equals(getRequestType(request)) ? interactionMapCsv(availableTypes) : interactionMapJson(availableTypes); }  }
SchemaController { @RequestMapping(value = "/interactionTypes", method = RequestMethod.GET) @ResponseBody public String getInteractionTypes(HttpServletRequest request) throws IOException { Collection<InteractionTypeExternal> availableTypes = Arrays.asList(InteractionTypeExternal.values()); if (request != null) { if (StringUtils.isNotBlank(request.getParameter(ParamName.TAXON.getName()))) { CypherQuery cypherQuery = CypherQueryBuilder.buildInteractionTypeQuery(request.getParameterMap()); String interactionTypes = new ResultFormatterCSV().format(CypherUtil.executeRemote(cypherQuery)); String[] interactionType = StringUtils.replace(interactionTypes, "\"", "").split("\n"); availableTypes = new HashSet<InteractionTypeExternal>(); for (String type : interactionType) { InteractionTypeExternal value = CypherQueryBuilder.INTERACTION_TYPE_INTERNAL_EXTERNAL_MAP.get(type); if (value != null) { availableTypes.add(value); } } } } return "csv".equals(getRequestType(request)) ? interactionMapCsv(availableTypes) : interactionMapJson(availableTypes); }  @RequestMapping(value = "/interactionTypes", method = RequestMethod.GET) @ResponseBody String getInteractionTypes(HttpServletRequest request); @RequestMapping(value = "/interactionFields", method = RequestMethod.GET) @ResponseBody String getInteractionFields(HttpServletRequest request); @RequestMapping(value = "/prefixes", method = RequestMethod.GET) @ResponseBody String getPrefixes(HttpServletRequest request); }
SchemaController { @RequestMapping(value = "/interactionTypes", method = RequestMethod.GET) @ResponseBody public String getInteractionTypes(HttpServletRequest request) throws IOException { Collection<InteractionTypeExternal> availableTypes = Arrays.asList(InteractionTypeExternal.values()); if (request != null) { if (StringUtils.isNotBlank(request.getParameter(ParamName.TAXON.getName()))) { CypherQuery cypherQuery = CypherQueryBuilder.buildInteractionTypeQuery(request.getParameterMap()); String interactionTypes = new ResultFormatterCSV().format(CypherUtil.executeRemote(cypherQuery)); String[] interactionType = StringUtils.replace(interactionTypes, "\"", "").split("\n"); availableTypes = new HashSet<InteractionTypeExternal>(); for (String type : interactionType) { InteractionTypeExternal value = CypherQueryBuilder.INTERACTION_TYPE_INTERNAL_EXTERNAL_MAP.get(type); if (value != null) { availableTypes.add(value); } } } } return "csv".equals(getRequestType(request)) ? interactionMapCsv(availableTypes) : interactionMapJson(availableTypes); }  @RequestMapping(value = "/interactionTypes", method = RequestMethod.GET) @ResponseBody String getInteractionTypes(HttpServletRequest request); @RequestMapping(value = "/interactionFields", method = RequestMethod.GET) @ResponseBody String getInteractionFields(HttpServletRequest request); @RequestMapping(value = "/prefixes", method = RequestMethod.GET) @ResponseBody String getPrefixes(HttpServletRequest request);  }