Search in sources :

Example 36 with TaxonImpl

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

the class LinkerTermMatcherTest method exactMatchMedicagoSativa.

@Test
public // see //see https://github.com/jhpoelen/eol-globi-data/issues/249
void exactMatchMedicagoSativa() throws NodeFactoryException, PropertyEnricherException {
    Taxon nbnTaxon = new TaxonImpl("Medicago sativa", "NBN:NBNSYS0000013971");
    nbnTaxon.setPath("Biota | Plantae | Tracheophyta | Magnoliopsida | Fabales | Fabaceae | Medicago | Medicago sativa");
    nbnTaxon.setPathNames("Unranked | Kingdom | Phylum | Class | Order | Family | Genus | Species");
    taxonIndex.getOrCreateTaxon(nbnTaxon);
    final Taxon taxonCreated = taxonIndex.getOrCreateTaxon(new TaxonImpl("Medicago sativa L.", null));
    assertThat(taxonCreated.getName(), is("Medicago sativa L."));
    new LinkerTermMatcher(getGraphDb()).link();
    Collection<String> ids = LinkerTestUtil.assertHasOther(taxonCreated.getName(), 7, taxonIndex, RelTypes.SAME_AS);
    assertThat(ids, hasItem("ITIS:183623"));
    assertThat(ids, hasItem("NCBI:3879"));
    assertThat(ids, not(hasItem("NCBI:56066")));
}
Also used : Taxon(org.eol.globi.domain.Taxon) TaxonImpl(org.eol.globi.domain.TaxonImpl) Test(org.junit.Test)

Example 37 with TaxonImpl

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

the class LinkerTermMatcherTest method exactMatchMonodelphisAmericana.

@Test
public void exactMatchMonodelphisAmericana() throws NodeFactoryException, PropertyEnricherException {
    final Taxon taxonCreated = taxonIndex.getOrCreateTaxon(new TaxonImpl("Monodelphis americana", null));
    assertThat(taxonCreated.getName(), is("Monodelphis americana"));
    new LinkerTermMatcher(getGraphDb()).link();
    Collection<String> ids = LinkerTestUtil.assertHasOther(taxonCreated.getName(), 5, taxonIndex, RelTypes.SAME_AS);
    assertThat(ids, hasItems("ITIS:552569", "NCBI:694061", "IRMNG:11060619", "GBIF:2439970", "OTT:446727"));
}
Also used : Taxon(org.eol.globi.domain.Taxon) TaxonImpl(org.eol.globi.domain.TaxonImpl) Test(org.junit.Test)

Example 38 with TaxonImpl

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

the class ReportGeneratorTest method createStudy.

protected Study createStudy(Study study1) throws NodeFactoryException {
    Study study = nodeFactory.getOrCreateStudy(study1);
    Specimen monkey = nodeFactory.createSpecimen(study, new TaxonImpl("Monkey"));
    monkey.ate(nodeFactory.createSpecimen(study, new TaxonImpl("Banana")));
    monkey.ate(nodeFactory.createSpecimen(study, new TaxonImpl("Banana")));
    monkey.ate(nodeFactory.createSpecimen(study, new TaxonImpl("Banana")));
    TaxonImpl apple = new TaxonImpl("Apple", "some:id");
    apple.setPath("some | path");
    monkey.ate(nodeFactory.createSpecimen(study, apple));
    return study;
}
Also used : Study(org.eol.globi.domain.Study) Specimen(org.eol.globi.domain.Specimen) TaxonImpl(org.eol.globi.domain.TaxonImpl)

Example 39 with TaxonImpl

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

the class LinkerTermMatcherTest method threeTaxa.

@Test
public void threeTaxa() throws NodeFactoryException, PropertyEnricherException {
    taxonIndex.getOrCreateTaxon(new TaxonImpl("Homo sapiens", null));
    taxonIndex.getOrCreateTaxon(new TaxonImpl("Ariopsis felis", null));
    taxonIndex.getOrCreateTaxon(new TaxonImpl("Canis lupus", null));
    new LinkerTermMatcher(getGraphDb()).link();
    LinkerTestUtil.assertHasOther("Homo sapiens", 5, taxonIndex, RelTypes.SAME_AS);
    LinkerTestUtil.assertHasOther("Homo sapiens", 0, taxonIndex, RelTypes.SIMILAR_TO);
    LinkerTestUtil.assertHasOther("Canis lupus", 6, taxonIndex, RelTypes.SAME_AS);
    LinkerTestUtil.assertHasOther("Canis lupus", 0, taxonIndex, RelTypes.SIMILAR_TO);
    LinkerTestUtil.assertHasOther("Ariopsis felis", 8, taxonIndex, RelTypes.SAME_AS);
    LinkerTestUtil.assertHasOther("Ariopsis felis", 0, taxonIndex, RelTypes.SIMILAR_TO);
}
Also used : TaxonImpl(org.eol.globi.domain.TaxonImpl) Test(org.junit.Test)

Example 40 with TaxonImpl

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

the class LinkerTermMatcherTest method hasSeaLifeBaseLinks.

@Test
public void hasSeaLifeBaseLinks() throws NodeFactoryException, PropertyEnricherException {
    taxonIndex.getOrCreateTaxon(new TaxonImpl("Enhydra lutris", null));
    new LinkerTermMatcher(getGraphDb()).link();
    Collection<String> ids = LinkerTestUtil.assertHasOther("Enhydra lutris", 8, taxonIndex, RelTypes.SAME_AS);
    assertThat(ids, hasItem("FBC:SLB:SpecCode:69195"));
}
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