Skip to content

Instantly share code, notes, and snippets.

@rdmpage
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdmpage/4a53f02c1b7fff9710c9 to your computer and use it in GitHub Desktop.
Save rdmpage/4a53f02c1b7fff9710c9 to your computer and use it in GitHub Desktop.
== Taxonomy tester - genus names should match species name
This test compares the generic name of a species with that of the genus it is placed in. These should be the same, but often aren't, signalling a problem, such as a homonym, synonym, or spelling mistake.
This example uses the butterfly genus Forsterinaria Gray, 1973, see http://bionames.org/search/Forsterinaria, which is a replacement name for the genus Haywardina Forster, 1964, see http://biostor.org/reference/77525. GBIF has Forsterinaria http://bionames.org/taxa/gbif/3257628 but the species names are labelled with Haywardina (which it also has in its classification, http://www.gbif.org/species/1894033 ).
//hide
//setup
//output
[source,cypher]
----
CREATE
(gbif3257628:taxon { name:"Forsterinaria", rank:"GENUS", uninomial:"Forsterinaria"}),
(gbif3257628)-[:HASPARENT]->(gbif7017),
(gbif5128151:taxon { name:"Haywardina vastata", rank:"SPECIES", genusPart:"Haywardina", epithet:"vastata"}),
(gbif5128151)-[:HASPARENT]->(gbif3257628),
(gbif5128146:taxon { name:"Haywardina neonympha", rank:"SPECIES", genusPart:"Haywardina", epithet:"neonympha"}),
(gbif5128146)-[:HASPARENT]->(gbif3257628),
(gbif5128141:taxon { name:"Haywardina morima", rank:"SPECIES", genusPart:"Haywardina", epithet:"morima"}),
(gbif5128141)-[:HASPARENT]->(gbif3257628),
(gbif5128154:taxon { name:"Haywardina fabiana", rank:"SPECIES", genusPart:"Haywardina", epithet:"fabiana"}),
(gbif5128154)-[:HASPARENT]->(gbif3257628),
(gbif5128150:taxon { name:"Haywardina eusebia", rank:"SPECIES", genusPart:"Haywardina", epithet:"eusebia"}),
(gbif5128150)-[:HASPARENT]->(gbif3257628)
----
// graph
== Test that genus names match
This next query should return an empty result, because logically the genus part of a species name matches the genus the species are placed in.
[source,cypher]
----
MATCH (s)-[:HASPARENT]->(g)
WHERE s.rank = "SPECIES" and s.genusPart <> g.uninomial
RETURN s.name, s.genusPart, g.uninomial
----
//table
The query is not empty, so we have a problem. In this example, these species names need to be updated to have the new genus name Forsterinaria, rather than the homonym Haywardina.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment