@Test public void studiesForSource() throws IOException { CypherQuery source = new ReportController().studies("a source", null); assertThat(source.getVersionedQuery(), is(CYPHER_VERSION + "START report = node:reports(source={source}) " + "WHERE exists(report.title) " + "RETURN report.citation as study_citation, report.externalId as study_url, report.doi as study_doi, report.source as study_source_citation, report.nInteractions as number_of_interactions, report.nTaxa as number_of_distinct_taxa, report.nStudies as number_of_studies, report.nSources as number_of_sources, report.nTaxaNoMatch as number_of_distinct_taxa_no_match SKIP 0 LIMIT 1024")); assertThat(source.getParams().get("source"), is("a source")); CypherTestUtil.validate(source); }
@RequestMapping(value = "/reports/studies", method = RequestMethod.GET) @ResponseBody public CypherQuery studies(@RequestParam(required = false) final String source, final HttpServletRequest request) throws IOException { String cypherQuery = "START report = node:reports(" + (StringUtils.isBlank(source) ? "'source:*'" : "source={source}") + ") " + " WHERE exists(report.title) " + " RETURN report.citation as " + ResultField.STUDY_CITATION + ", report.externalId as " + ResultField.STUDY_URL + ", report.doi as " + ResultField.STUDY_DOI + ", report.source as " + ResultField.STUDY_SOURCE_CITATION + ", report.nInteractions as " + ResultField.NUMBER_OF_INTERACTIONS + ", report.nTaxa as " + ResultField.NUMBER_OF_DISTINCT_TAXA + ", report.nStudies as " + ResultField.NUMBER_OF_STUDIES + ", report.nSources as " + ResultField.NUMBER_OF_SOURCES + ", report.nTaxaNoMatch as " + ResultField.NUMBER_OF_DISTINCT_TAXA_NO_MATCH; Map<String, String> params = StringUtils.isBlank(source) ? CypherQueryBuilder.EMPTY_PARAMS : new HashMap<String, String>() {{ put("source", source); }}; return CypherQueryBuilder.createPagedQuery(request, new CypherQuery(cypherQuery, params, CypherUtil.CYPHER_VERSION_2_3)); }
ReportController { @RequestMapping(value = "/reports/studies", method = RequestMethod.GET) @ResponseBody public CypherQuery studies(@RequestParam(required = false) final String source, final HttpServletRequest request) throws IOException { String cypherQuery = "START report = node:reports(" + (StringUtils.isBlank(source) ? "'source:*'" : "source={source}") + ") " + " WHERE exists(report.title) " + " RETURN report.citation as " + ResultField.STUDY_CITATION + ", report.externalId as " + ResultField.STUDY_URL + ", report.doi as " + ResultField.STUDY_DOI + ", report.source as " + ResultField.STUDY_SOURCE_CITATION + ", report.nInteractions as " + ResultField.NUMBER_OF_INTERACTIONS + ", report.nTaxa as " + ResultField.NUMBER_OF_DISTINCT_TAXA + ", report.nStudies as " + ResultField.NUMBER_OF_STUDIES + ", report.nSources as " + ResultField.NUMBER_OF_SOURCES + ", report.nTaxaNoMatch as " + ResultField.NUMBER_OF_DISTINCT_TAXA_NO_MATCH; Map<String, String> params = StringUtils.isBlank(source) ? CypherQueryBuilder.EMPTY_PARAMS : new HashMap<String, String>() {{ put("source", source); }}; return CypherQueryBuilder.createPagedQuery(request, new CypherQuery(cypherQuery, params, CypherUtil.CYPHER_VERSION_2_3)); } }
ReportController { @RequestMapping(value = "/reports/studies", method = RequestMethod.GET) @ResponseBody public CypherQuery studies(@RequestParam(required = false) final String source, final HttpServletRequest request) throws IOException { String cypherQuery = "START report = node:reports(" + (StringUtils.isBlank(source) ? "'source:*'" : "source={source}") + ") " + " WHERE exists(report.title) " + " RETURN report.citation as " + ResultField.STUDY_CITATION + ", report.externalId as " + ResultField.STUDY_URL + ", report.doi as " + ResultField.STUDY_DOI + ", report.source as " + ResultField.STUDY_SOURCE_CITATION + ", report.nInteractions as " + ResultField.NUMBER_OF_INTERACTIONS + ", report.nTaxa as " + ResultField.NUMBER_OF_DISTINCT_TAXA + ", report.nStudies as " + ResultField.NUMBER_OF_STUDIES + ", report.nSources as " + ResultField.NUMBER_OF_SOURCES + ", report.nTaxaNoMatch as " + ResultField.NUMBER_OF_DISTINCT_TAXA_NO_MATCH; Map<String, String> params = StringUtils.isBlank(source) ? CypherQueryBuilder.EMPTY_PARAMS : new HashMap<String, String>() {{ put("source", source); }}; return CypherQueryBuilder.createPagedQuery(request, new CypherQuery(cypherQuery, params, CypherUtil.CYPHER_VERSION_2_3)); }  }
ReportController { @RequestMapping(value = "/reports/studies", method = RequestMethod.GET) @ResponseBody public CypherQuery studies(@RequestParam(required = false) final String source, final HttpServletRequest request) throws IOException { String cypherQuery = "START report = node:reports(" + (StringUtils.isBlank(source) ? "'source:*'" : "source={source}") + ") " + " WHERE exists(report.title) " + " RETURN report.citation as " + ResultField.STUDY_CITATION + ", report.externalId as " + ResultField.STUDY_URL + ", report.doi as " + ResultField.STUDY_DOI + ", report.source as " + ResultField.STUDY_SOURCE_CITATION + ", report.nInteractions as " + ResultField.NUMBER_OF_INTERACTIONS + ", report.nTaxa as " + ResultField.NUMBER_OF_DISTINCT_TAXA + ", report.nStudies as " + ResultField.NUMBER_OF_STUDIES + ", report.nSources as " + ResultField.NUMBER_OF_SOURCES + ", report.nTaxaNoMatch as " + ResultField.NUMBER_OF_DISTINCT_TAXA_NO_MATCH; Map<String, String> params = StringUtils.isBlank(source) ? CypherQueryBuilder.EMPTY_PARAMS : new HashMap<String, String>() {{ put("source", source); }}; return CypherQueryBuilder.createPagedQuery(request, new CypherQuery(cypherQuery, params, CypherUtil.CYPHER_VERSION_2_3)); }  @RequestMapping(value = "/reports/studies", method = RequestMethod.GET) @ResponseBody CypherQuery studies(@RequestParam(required = false) final String source, final HttpServletRequest request); @RequestMapping(value = "/dataset", method = RequestMethod.GET) @ResponseBody CypherQuery dataset(final HttpServletRequest request); @RequestMapping(value = "/source", method = RequestMethod.GET) @ResponseBody CypherQuery sourceRoot(final HttpServletRequest request); @RequestMapping(value = "/source/{org}", method = RequestMethod.GET) @ResponseBody CypherQuery sourceOrg(
        @PathVariable("org") final String org,
        final HttpServletRequest request); @RequestMapping(value = "/source/{org}/{name}", method = RequestMethod.GET) @ResponseBody CypherQuery sourceOrgName(
        @PathVariable("org") final String org,
        @PathVariable("name") final String name,
        final HttpServletRequest request); @RequestMapping(value = "/reports/sources", method = RequestMethod.GET) @ResponseBody CypherQuery sources(@RequestParam(required = false) final String sourceId,
                               final HttpServletRequest request); @RequestMapping(value = "/reports/collections", method = RequestMethod.GET) @ResponseBody CypherQuery collections(); }
ReportController { @RequestMapping(value = "/reports/studies", method = RequestMethod.GET) @ResponseBody public CypherQuery studies(@RequestParam(required = false) final String source, final HttpServletRequest request) throws IOException { String cypherQuery = "START report = node:reports(" + (StringUtils.isBlank(source) ? "'source:*'" : "source={source}") + ") " + " WHERE exists(report.title) " + " RETURN report.citation as " + ResultField.STUDY_CITATION + ", report.externalId as " + ResultField.STUDY_URL + ", report.doi as " + ResultField.STUDY_DOI + ", report.source as " + ResultField.STUDY_SOURCE_CITATION + ", report.nInteractions as " + ResultField.NUMBER_OF_INTERACTIONS + ", report.nTaxa as " + ResultField.NUMBER_OF_DISTINCT_TAXA + ", report.nStudies as " + ResultField.NUMBER_OF_STUDIES + ", report.nSources as " + ResultField.NUMBER_OF_SOURCES + ", report.nTaxaNoMatch as " + ResultField.NUMBER_OF_DISTINCT_TAXA_NO_MATCH; Map<String, String> params = StringUtils.isBlank(source) ? CypherQueryBuilder.EMPTY_PARAMS : new HashMap<String, String>() {{ put("source", source); }}; return CypherQueryBuilder.createPagedQuery(request, new CypherQuery(cypherQuery, params, CypherUtil.CYPHER_VERSION_2_3)); }  @RequestMapping(value = "/reports/studies", method = RequestMethod.GET) @ResponseBody CypherQuery studies(@RequestParam(required = false) final String source, final HttpServletRequest request); @RequestMapping(value = "/dataset", method = RequestMethod.GET) @ResponseBody CypherQuery dataset(final HttpServletRequest request); @RequestMapping(value = "/source", method = RequestMethod.GET) @ResponseBody CypherQuery sourceRoot(final HttpServletRequest request); @RequestMapping(value = "/source/{org}", method = RequestMethod.GET) @ResponseBody CypherQuery sourceOrg(
        @PathVariable("org") final String org,
        final HttpServletRequest request); @RequestMapping(value = "/source/{org}/{name}", method = RequestMethod.GET) @ResponseBody CypherQuery sourceOrgName(
        @PathVariable("org") final String org,
        @PathVariable("name") final String name,
        final HttpServletRequest request); @RequestMapping(value = "/reports/sources", method = RequestMethod.GET) @ResponseBody CypherQuery sources(@RequestParam(required = false) final String sourceId,
                               final HttpServletRequest request); @RequestMapping(value = "/reports/collections", method = RequestMethod.GET) @ResponseBody CypherQuery collections();  }