Search in sources :

Example 86 with CypherQuery

use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.

the class TaxonSearchImplIT method findCloseMatchesScientificChineseCharacters.

@Test
public void findCloseMatchesScientificChineseCharacters() throws IOException {
    CypherQuery cypherQuery = new TaxonSearchImpl().findCloseMatchesForCommonAndScientificNames("Ariidae", null);
    CypherTestUtil.validate(cypherQuery, neo4j.getGraphDatabaseService());
    String response = new CypherQueryExecutor(cypherQuery).execute(null);
    assertThat(response, StringContains.containsString("印度尼西亚海鲶"));
}
Also used : CypherQuery(org.eol.globi.util.CypherQuery) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 87 with CypherQuery

use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.

the class TaxonSearchImplIT method findCloseMatchesCommonNameFoxFrenchType.

@Test
public void findCloseMatchesCommonNameFoxFrenchType() throws IOException {
    CypherQuery cypherQuery = new TaxonSearchImpl().findCloseMatchesForCommonAndScientificNames("reinard", null);
    CypherTestUtil.validate(cypherQuery, neo4j.getGraphDatabaseService());
    String response = new CypherQueryExecutor(cypherQuery).execute(null);
    assertThat(response, StringContains.containsString("Vulpes vulpes"));
    assertThat(response, StringContains.containsString("renard"));
}
Also used : CypherQuery(org.eol.globi.util.CypherQuery) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 88 with CypherQuery

use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.

the class TaxonSearchImplIT method nameSuggestions.

@Test
public void nameSuggestions() throws IOException {
    CypherQuery cypherQuery = new TaxonSearchImpl().findCloseMatchesForCommonAndScientificNames("homo zapiens", null);
    CypherTestUtil.validate(cypherQuery, neo4j.getGraphDatabaseService());
    String result = new CypherQueryExecutor(cypherQuery).execute(null);
    assertThat(result, containsString("Homo sapiens"));
}
Also used : CypherQuery(org.eol.globi.util.CypherQuery) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 89 with CypherQuery

use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.

the class TaxonSearchImplIT method findCloseMatchesUpperCase.

@Test
public void findCloseMatchesUpperCase() throws IOException {
    CypherQuery cypherQuery = new TaxonSearchImpl().findCloseMatchesForCommonAndScientificNames("King Mackerel", null);
    CypherTestUtil.validate(cypherQuery, neo4j.getGraphDatabaseService());
    String response = new CypherQueryExecutor(cypherQuery).execute(null);
    assertThat(response, StringContains.containsString("Scomberomorus cavalla"));
    assertThat(response, StringContains.containsString("king mackeral"));
}
Also used : CypherQuery(org.eol.globi.util.CypherQuery) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 90 with CypherQuery

use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.

the class TaxonSearchImplIT method findApidae.

@Test
public void findApidae() throws IOException {
    CypherQuery cypherQuery = new TaxonSearchImpl().findCloseMatchesForCommonAndScientificNames("Apidae", null);
    CypherTestUtil.validate(cypherQuery, neo4j.getGraphDatabaseService());
    String result = new CypherQueryExecutor(cypherQuery).execute(null);
    JsonNode json = new ObjectMapper().readTree(result);
    JsonNode data = json.get("data");
    JsonNode firstRow = data.get(0);
    JsonNode firstCell = firstRow.get(0);
    assertThat(firstCell.asText(), is("Apidae"));
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) CypherQuery(org.eol.globi.util.CypherQuery) Matchers.containsString(org.hamcrest.Matchers.containsString) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

CypherQuery (org.eol.globi.util.CypherQuery)109 Test (org.junit.Test)92 HashMap (java.util.HashMap)66 Matchers.containsString (org.hamcrest.Matchers.containsString)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 Map (java.util.Map)4 ResultField (org.eol.globi.server.util.ResultField)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 TreeMap (java.util.TreeMap)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 JsonNode (org.codehaus.jackson.JsonNode)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 InteractionTypeExternal (org.eol.globi.server.util.InteractionTypeExternal)1 ResultFormatterCSV (org.eol.globi.server.util.ResultFormatterCSV)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1