Skip to content

Instantly share code, notes, and snippets.

@rdmpage
Last active August 29, 2015 14:26
Show Gist options
  • Save rdmpage/dae6d15551eda2d7ca12 to your computer and use it in GitHub Desktop.
Save rdmpage/dae6d15551eda2d7ca12 to your computer and use it in GitHub Desktop.
== Taxonomy tester - anachronistic species and genus names
This test compares the dates of species names and the genus name. If a name is a new combination then the author name is enclosed in parentheses. If a species is placed in a genus that was published after the species was described, then logically the name is a new combination. However in some cases GBIF has species names which violate this rule.
This example uses the butterfly genus Heliopyrgus
//hide
//setup
//output
[source,cypher]
----
CREATE
(gbif1950649:taxon { name:"Heliopyrgus", rank:"GENUS", uninomial:"Heliopyrgus", authorship:"Herrera, 1957", accordingTo:"The Catalogue of Life, 3rd January 2011", hasParentheses:"false", year:"1957"}),
(gbif1950649)-[:HASPARENT]->(gbif6953),
(gbif1950651:taxon { name:"Heliopyrgus willi", rank:"SPECIES", genusPart:"Heliopyrgus", epithet:"willi", authorship:"Plötz, 1884", accordingTo:"Interim Register of Marine and Nonmarine Genera", hasParentheses:"false", year:"1884"}),
(gbif1950651)-[:HASPARENT]->(gbif1950649),
(gbif4301886:taxon { name:"Heliopyrgus sublinea", rank:"SPECIES", genusPart:"Heliopyrgus", epithet:"sublinea", authorship:" (Schaus, 1902)", accordingTo:"Integrated Taxonomic Information System", hasParentheses:"true", year:"1902"}),
(gbif4301886)-[:HASPARENT]->(gbif1950649),
(gbif1950653:taxon { name:"Heliopyrgus nearchus", rank:"SPECIES", genusPart:"Heliopyrgus", epithet:"nearchus", authorship:"Edwards, 1882", accordingTo:"Interim Register of Marine and Nonmarine Genera", hasParentheses:"false", year:"1882"}),
(gbif1950653)-[:HASPARENT]->(gbif1950649),
(gbif1950656:taxon { name:"Heliopyrgus margarita", rank:"SPECIES", genusPart:"Heliopyrgus", epithet:"margarita", authorship:"Bell, 1937", accordingTo:"Interim Register of Marine and Nonmarine Genera", hasParentheses:"false", year:"1937"}),
(gbif1950656)-[:HASPARENT]->(gbif1950649),
(gbif1950654:taxon { name:"Heliopyrgus domicella", rank:"SPECIES", genusPart:"Heliopyrgus", epithet:"domicella", authorship:"Erichson, 1848", accordingTo:"The Catalogue of Life, 3rd January 2011", hasParentheses:"false", year:"1848"}),
(gbif1950654)-[:HASPARENT]->(gbif1950649),
(gbif6203771:taxon { name:"Heliopyrgus domicella willi", rank:"SUBSPECIES", genusPart:"Heliopyrgus", epithet:"willi", authorship:"Plötz, 1884", accordingTo:"The Catalogue of Life, 3rd January 2011", hasParentheses:"false", year:"1884"}),
(gbif6203771)-[:HASPARENT]->(gbif1950654),
(gbif7215372:taxon { name:"Heliopyrgus domicella domicella", rank:"SUBSPECIES", genusPart:"Heliopyrgus", epithet:"domicella", accordingTo:"Integrated Taxonomic Information System"}),
(gbif7215372)-[:HASPARENT]->(gbif1950654),
(gbif6203772:taxon { name:"Heliopyrgus domicella margarita", rank:"SUBSPECIES", genusPart:"Heliopyrgus", epithet:"margarita", authorship:"Bell, 1937", accordingTo:"The Catalogue of Life, 3rd January 2011", hasParentheses:"false", year:"1937"}),
(gbif6203772)-[:HASPARENT]->(gbif1950654),
(gbif1950655:taxon { name:"Heliopyrgus bellatrix", rank:"SPECIES", genusPart:"Heliopyrgus", epithet:"bellatrix", authorship:"Plötz, 1884", accordingTo:"Interim Register of Marine and Nonmarine Genera", hasParentheses:"false", year:"1884"}),
(gbif1950655)-[:HASPARENT]->(gbif1950649),
(gbif1950650:taxon { name:"Heliopyrgus americanus", rank:"SPECIES", genusPart:"Heliopyrgus", epithet:"americanus", authorship:"Blanchard, 1852", accordingTo:"The Catalogue of Life, 3rd January 2011", hasParentheses:"false", year:"1852"}),
(gbif1950650)-[:HASPARENT]->(gbif1950649),
(gbif1950652:taxon { name:"Heliopyrgus aconita", rank:"SPECIES", genusPart:"Heliopyrgus", epithet:"aconita", authorship:"Plötz, 1884", accordingTo:"Interim Register of Marine and Nonmarine Genera", hasParentheses:"false", year:"1884"}),
(gbif1950652)-[:HASPARENT]->(gbif1950649)
----
// graph
== Test that there are no anachronisms
This next query should return an empty result
[source,cypher]
----
MATCH
(species:taxon)-[:HASPARENT]->(genus:taxon)
WHERE species.year < genus.year AND species.hasParentheses = "false"
RETURN species.name, species.authorship, genus.authorship, species.accordingTo
----
//table
The query is not empty, so we have a problem. In this example, several species have anachronistic authorities (species names older than the genus name, but no parentheses).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment