use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class TaxonSearchImplIT method findCloseMatchesCommonNameFoxDutch.
@Test
public void findCloseMatchesCommonNameFoxDutch() throws IOException {
CypherQuery cypherQuery = new TaxonSearchImpl().findCloseMatchesForCommonAndScientificNames("vos", null);
CypherTestUtil.validate(cypherQuery, neo4j.getGraphDatabaseService());
String response = new CypherQueryExecutor(cypherQuery).execute(null);
assertThat(response, startsWith(COLUMN_PREFIX));
assertThat(response, StringContains.containsString("vos"));
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class TaxonSearchImplIT method ensureSingleMatch.
@Test
@Ignore
public void ensureSingleMatch() throws IOException {
CypherQuery cypherQuery = new TaxonSearchImpl().findCloseMatchesForCommonAndScientificNames("Ariopsis felis", null);
CypherTestUtil.validate(cypherQuery, neo4j.getGraphDatabaseService());
String response = new CypherQueryExecutor(cypherQuery).execute(null);
JsonNode jsonNode = new ObjectMapper().readTree(response);
assertThat(jsonNode.get("data").get(0).get(0).asText(), is("Ariopsis felis"));
assertThat(jsonNode.get("data").size(), is(1));
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class CypherHttpMessageConverterTest method optimizeQuerySVG2.
@Test
public void optimizeQuerySVG2() {
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 CypherHttpMessageConverterTest method optimizeQueryNonSVG.
@Test
public void optimizeQueryNonSVG() {
CypherHttpMessageConverter cypherHttpMessageConverter = new CypherHttpMessageConverter();
Stream<MediaType> nonSvg = cypherHttpMessageConverter.getSupportedMediaTypes().stream().filter(x -> !x.getSubtype().contains("svg+xml"));
nonSvg.forEach(x -> {
CypherQuery cypherQuery = CypherHttpMessageConverter.optimizeQueryForType(new CypherQuery("bla bal LIMIT 10"), new ResultFormatterFactory().create(x));
assertThat(cypherQuery.getQuery(), Is.is("bla bal LIMIT 10"));
});
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class CypherQueryExecutorIT method executeQuery.
@Test
public void executeQuery() throws IOException {
CypherQuery query = new CypherQuery("START sourceTaxon = node:taxonPaths('path:\\\"Homo sapiens\\\"') MATCH sourceTaxon<-[:CLASSIFIED_AS]-sourceSpecimen-[interaction:PREYS_UPON]->targetSpecimen-[:CLASSIFIED_AS]->targetTaxon, sourceSpecimen<-[collected_rel:COLLECTED]-study-[:IN_DATASET]->dataset RETURN sourceTaxon.name as source_taxon_name,interaction.label as interaction_type,collect(distinct(targetTaxon.name)) as target_taxon_name SKIP 0 LIMIT 1024");
String execute = new CypherQueryExecutor(query).execute(null);
assertThat(execute, containsString("columns"));
assertNotNull(new ObjectMapper().readTree(execute));
}
Aggregations