use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class TaxonSearchImplIT method findCloseMatchesShortPartialFields.
@Test
public void findCloseMatchesShortPartialFields() throws IOException {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
when(request.getParameterMap()).thenReturn(new HashMap<String, String[]>() {
{
put("field", new String[] { "taxon_external_id", "taxon_name" });
}
});
when(request.getParameter("limit")).thenReturn("10");
CypherQuery cypherQuery = new TaxonSearchImpl().findCloseMatchesForCommonAndScientificNames("Homo s", request);
CypherTestUtil.validate(cypherQuery, neo4j.getGraphDatabaseService());
String response = new CypherQueryExecutor(cypherQuery).execute(request);
assertThat(cypherQuery.getQuery(), StringContains.containsString("LIMIT 10"));
assertThat(response, StringContains.containsString("taxon_external_id"));
assertThat(response, StringContains.containsString("taxon_name"));
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class CypherHttpMessageConverterTest method optimizeQuerySVG.
@Test
public void optimizeQuerySVG() {
CypherQuery cypherQuery = CypherHttpMessageConverter.optimizeQueryForType(new CypherQuery("bla bal limit 10"), new ResultFormatterSVG());
assertThat(cypherQuery.getQuery(), Is.is("bla bal limit 1"));
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class ReportControllerTest method sources.
@Test
public void sources() throws IOException {
CypherQuery source = new ReportController().sources(null, null);
assertThat(source.getVersionedQuery(), is(CYPHER_VERSION + "START report = node:reports('sourceId:*') " + "RETURN report.citation as study_citation, " + "report.externalId as study_url, " + "report.doi as study_doi, " + "null 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, " + "report.sourceId as study_source_id " + "SKIP 0 " + "LIMIT 1024"));
assertThat(source.getParams().size(), is(0));
validate(source);
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class ReportControllerTest method studiesForSource.
@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"));
validate(source);
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class ReportControllerTest method distinctSourceOrg.
@Test
public void distinctSourceOrg() throws IOException {
CypherQuery source = new ReportController().sourceOrg("some", null);
assertThat(source.getVersionedQuery(), is(CYPHER_VERSION + "START dataset = node:datasets(namespace={namespace}), report = node:reports('sourceId:*') " + "WHERE ('globi:' + dataset.namespace) = report.sourceId " + "RETURN report.citation as study_citation, " + "report.externalId as study_url, " + "report.doi as study_doi, " + "dataset.citation 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, " + "report.sourceId as study_source_id, " + "dataset.doi as study_source_doi, " + "dataset.format as study_source_format, " + "dataset.archiveURI as study_source_archive_uri, " + "dataset.lastSeenAt as study_source_last_seen_at " + "SKIP 0 " + "LIMIT 1024"));
assertThat(source.getParams().get("namespace"), is("some"));
validate(source);
}
Aggregations