Skip to content

Instantly share code, notes, and snippets.

@rdmpage
Last active August 29, 2015 14:27
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/4df5af75d42e0f963e5d to your computer and use it in GitHub Desktop.
Save rdmpage/4df5af75d42e0f963e5d to your computer and use it in GitHub Desktop.
== Taxonomy tester - taxa with same basionym
This test asks whether there are multiple taxa with the same basionym. Logically this should not occur.
This example uses the legume genrra Poissonia and Coursetia.
//hide
//setup
//output
[source,cypher]
----
CREATE
// taxa
(gbif2933915:taxon { name:"Poissonia", rank:"GENUS", uninomial:"Poissonia", authorship:"Baillon, 1870", accordingTo:"IRMNG Homonym List", hasParentheses:"false", year:"1870"}),
(gbif2933915)-[:HASPARENT]->(gbif5386),
(gbif5630483:taxon { name:"Poissonia weberbaueri", rank:"SPECIES", genusPart:"Poissonia", epithet:"weberbaueri", authorship:"Lavin (Harms)", accordingTo:"International Plant Names Index", hasParentheses:"false"}),
(gbif5630483)-[:HASPARENT]->(gbif2933915),
(gbif5629609:taxon { name:"Poissonia heterantha", rank:"SPECIES", genusPart:"Poissonia", epithet:"heterantha", authorship:"Lavin (Griseb.)", accordingTo:"International Plant Names Index", hasParentheses:"false"}),
(gbif5629609)-[:HASPARENT]->(gbif2933915),
// Coursetia
(gbif2959244:taxon { name:"Coursetia", rank:"GENUS", uninomial:"Coursetia", authorship:"DC.", accordingTo:"The Catalogue of Life, 3rd January 2011", hasParentheses:"false"}),
(gbif2959244)-[:HASPARENT]->(gbif5386),
(gbif2959395:taxon { name:"Coursetia heterantha", rank:"SPECIES", genusPart:"Coursetia", epithet:"heterantha", authorship:"Lavin (Griseb.)", accordingTo:"The Catalogue of Life, 3rd January 2011", hasParentheses:"false"}),
(gbif2959395)-[:HASPARENT]->(gbif2959244),
(gbif2959402:taxon { name:"Coursetia weberbaueri", rank:"SPECIES", genusPart:"Coursetia", epithet:"weberbaueri", authorship:"Harms", accordingTo:"The Catalogue of Life, 3rd January 2011", hasParentheses:"false"}),
(gbif2959402)-[:HASPARENT]->(gbif2959244),
// taxonomic names
(ipni20012728_1:taxonName { name:"Poissonia heterantha"}),
(ipni520610_1:taxonName { name:"Tephrosia heterantha"}),
(ipni944651_1:taxonName { name:"Coursetia heterantha"}),
(ipni275207_2:taxonName { name:"Coursetia heterantha"}),
(ipni20012729_1:taxonName { name:"Poissonia weberbaueri"}),
(ipni487377_1:taxonName { name:"Coursetia weberbaueri"}),
// nomenclatural synonyms
(ipni20012728_1)-[:hasBasionym]->(ipni520610_1),
// self loop
(ipni520610_1)-[:hasBasionym]->(ipni520610_1),
(ipni944651_1)-[:hasBasionym]->(ipni520610_1),
(ipni20012729_1)-[:hasBasionym]->(ipni487377_1),
// self loop
(ipni487377_1)-[:hasBasionym]->(ipni487377_1),
// taxa to names
// Poissonia heterantha
(gbif5629609)-[:hasName]->(ipni20012728_1),
(gbif2959395)-[:hasName]->(ipni275207_2),
// Poissonia weberbaueri
(gbif5630483)-[:hasName]->(ipni20012729_1),
// Coursetia weberbaueri
(gbif2959402)-[:hasName]->(ipni487377_1),
// add this manually because IPNI has two records for Coursetia heterantha, and GBIF has mapped to the "wrong one" (sigh)
(gbif2959395)-[:hasName]->(ipni944651_1)
----
// graph
== Test that no taxa have same basionym
This next query should return an empty result
[source,cypher]
----
match (taxon1)-[:hasName]->(name1)-[:hasBasionym]->(basionym) ,
(taxon2)-[:hasName]->(name2)-[:hasBasionym]->(basionym)
return taxon1.name, taxon2.name, name1.name, name2.name, basionym.name
----
//table
The query is not empty, so we have a problem. In this example, the taxa Poissonia heterantha and Poissonia weberbaueri are objective synonyms of Coursetia heterantha and Coursetia weberbaueri, so GBIF should have one or other of these taxa, but not both.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment