Search in sources :

Example 56 with TaxonImpl

use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.

the class ImageLinkerIT method linkSingleImage.

@Test
public void linkSingleImage() throws NodeFactoryException {
    Taxon taxon = taxonIndex.getOrCreateTaxon(new TaxonImpl("Homo sapiens", "EOL:327955"));
    taxonIndex.getOrCreateTaxon(new TaxonImpl("Whatevero whateverens", "EOL:8888888888"));
    assertNotNull(taxon);
    new ImageLinker(getGraphDb(), System.out).link();
    Taxon enrichedTaxon = taxonIndex.findTaxonById("EOL:327955");
    assertThat(enrichedTaxon.getThumbnailUrl(), containsString("http://media.eol.org/content/"));
    assertThat(enrichedTaxon.getExternalUrl(), is("http://eol.org/pages/327955"));
}
Also used : Taxon(org.eol.globi.domain.Taxon) TaxonImpl(org.eol.globi.domain.TaxonImpl) Test(org.junit.Test)

Example 57 with TaxonImpl

use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.

the class NonResolvingTaxonIndexTest method assertNotIndexed.

private final void assertNotIndexed(String magicValue) throws NodeFactoryException {
    Taxon taxon1 = new TaxonImpl(magicValue, null);
    taxon1.setPath(null);
    TaxonNode taxon = taxonService.getOrCreateTaxon(taxon1);
    assertThat(taxon, is(notNullValue()));
    assertThat(taxonService.findTaxonByName(magicValue), is(nullValue()));
}
Also used : TaxonNode(org.eol.globi.domain.TaxonNode) Taxon(org.eol.globi.domain.Taxon) TaxonImpl(org.eol.globi.domain.TaxonImpl)

Example 58 with TaxonImpl

use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.

the class NonResolvingTaxonIndexTest method findCloseMatch.

@Test
public final void findCloseMatch() throws NodeFactoryException {
    taxonService.getOrCreateTaxon(new TaxonImpl("Homo sapiens"));
    IndexHits<Node> hits = taxonService.findCloseMatchesForTaxonName("Homo sapiens");
    assertThat(hits.hasNext(), is(true));
    hits.close();
    hits = taxonService.findCloseMatchesForTaxonName("Homo saliens");
    assertThat(hits.hasNext(), is(true));
    hits = taxonService.findCloseMatchesForTaxonName("Homo");
    assertThat(hits.hasNext(), is(true));
    hits = taxonService.findCloseMatchesForTaxonName("homo sa");
    assertThat(hits.hasNext(), is(true));
}
Also used : TaxonImpl(org.eol.globi.domain.TaxonImpl) Node(org.neo4j.graphdb.Node) TaxonNode(org.eol.globi.domain.TaxonNode) Test(org.junit.Test)

Example 59 with TaxonImpl

use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.

the class NonResolvingTaxonIndexTest method createTaxonExternalIdIndex.

@Test
public final void createTaxonExternalIdIndex() throws NodeFactoryException {
    Taxon taxon1 = new TaxonImpl(null, "foo:123");
    taxon1.setPath(null);
    TaxonNode taxon = taxonService.getOrCreateTaxon(taxon1);
    assertThat(taxon, is(notNullValue()));
    assertThat(taxonService.findTaxonById("foo:123"), is(notNullValue()));
}
Also used : TaxonNode(org.eol.globi.domain.TaxonNode) Taxon(org.eol.globi.domain.Taxon) TaxonImpl(org.eol.globi.domain.TaxonImpl) Test(org.junit.Test)

Example 60 with TaxonImpl

use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.

the class NonResolvingTaxonIndexTest method findNoMatchNoName.

@Test
public final void findNoMatchNoName() throws NodeFactoryException {
    taxonService.getOrCreateTaxon(new TaxonImpl("some name", PropertyAndValueDictionary.NO_MATCH));
    assertNull(taxonService.findTaxonById(PropertyAndValueDictionary.NO_MATCH));
    taxonService.getOrCreateTaxon(new TaxonImpl(PropertyAndValueDictionary.NO_NAME));
    assertNull(taxonService.findTaxonByName(PropertyAndValueDictionary.NO_MATCH));
    assertNull(taxonService.findTaxonByName(PropertyAndValueDictionary.NO_NAME));
}
Also used : TaxonImpl(org.eol.globi.domain.TaxonImpl) Test(org.junit.Test)

Aggregations

TaxonImpl (org.eol.globi.domain.TaxonImpl)123 Specimen (org.eol.globi.domain.Specimen)59 Test (org.junit.Test)54 Taxon (org.eol.globi.domain.Taxon)42 StudyImpl (org.eol.globi.domain.StudyImpl)34 Study (org.eol.globi.domain.Study)32 Location (org.eol.globi.domain.Location)16 LocationImpl (org.eol.globi.domain.LocationImpl)15 TaxonNode (org.eol.globi.domain.TaxonNode)13 LabeledCSVParser (com.Ostermiller.util.LabeledCSVParser)12 IOException (java.io.IOException)11 TermImpl (org.eol.globi.domain.TermImpl)11 StringWriter (java.io.StringWriter)9 ArrayList (java.util.ArrayList)7 Date (java.util.Date)7 HashMap (java.util.HashMap)7 NonResolvingTaxonIndex (org.eol.globi.taxon.NonResolvingTaxonIndex)7 Map (java.util.Map)5 Node (org.neo4j.graphdb.Node)5 File (java.io.File)4