Skip to content

Commit

Permalink
add association patterns re: [visiting] and [caught after visiting], …
Browse files Browse the repository at this point in the history
…as used in West Virginia Wesleyan College Katharine B. Gregg Orchid Pollinator Collection
  • Loading branch information
Jorrit Poelen committed Apr 6, 2023
1 parent 4757db1 commit 9ade5f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Expand Up @@ -35,8 +35,10 @@ public final class AssociatedTaxaUtil {
"^[Ff]rom",
"^[cC]lutching",
"^[rR]esting on",
"^[Vv]isiting",
"^[Cc]aught after [Vv]isiting",
"[Ff]eeding on")
+ ")([ ])(.*)");
+ ")([ ])([^;]+)");

public static List<Map<String, String>> expandIfNeeded(Map<String, String> properties) {
try {
Expand Down
Expand Up @@ -463,6 +463,28 @@ public void associatedTaxaRestingOn() {
assertThat(properties.get(0).get(INTERACTION_TYPE_NAME), is("resting on"));
}

@Test
public void associatedTaxaCaughtAfterVisiting() {
String associatedTaxa = "Caught after visiting Pogonia ophioglossoides; Calopgon tetrads on head and on two right rear legs";
List<Map<String, String>> properties = attemptParsingAssociationString(associatedTaxa);

assertThat(properties.size(), is(1));
assertThat(properties.get(0).get(TaxonUtil.TARGET_TAXON_NAME), is("Pogonia ophioglossoides"));
assertThat(properties.get(0).get(INTERACTION_TYPE_ID), is(nullValue()));
assertThat(properties.get(0).get(INTERACTION_TYPE_NAME), is("Caught after visiting"));
}

@Test
public void associatedTaxaVisiting() {
String associatedTaxa = "Visiting Pogonia ophioglossoides; no orchid pollen";
List<Map<String, String>> properties = attemptParsingAssociationString(associatedTaxa);

assertThat(properties.size(), is(1));
assertThat(properties.get(0).get(TaxonUtil.TARGET_TAXON_NAME), is("Pogonia ophioglossoides"));
assertThat(properties.get(0).get(INTERACTION_TYPE_ID), is(nullValue()));
assertThat(properties.get(0).get(INTERACTION_TYPE_NAME), is("Visiting"));
}

@Test
public void habitatParsing() {
String associatedTaxa = "Exposed siliceous rocks";
Expand Down

0 comments on commit 9ade5f8

Please sign in to comment.