The Power of Graph Databases as Explored via an Alaskan Food Web

 

Most of us are familiar with databases on at least some basic level.  I maintain a database of plant and animals from Oregon just for my own interest. There are tables that have the scientific name of each species that can be compared or linked to several common names if such a species has multiple common names – as is often the case with common widespread and easily observed species. Those species are linked to other tables that have the geographic range of the species by counties and/or ecoregions, how common each species is, and what books are best to use for tracking each species. In all, there are probably about 9 tables that are linked to each other to track the data I want.  In my head, I can still manage the association of those tables to create queries for specific information if needed.  However, imagine a database that has 30, 60, or even more tables. Knowing how these are all linked would be extremely difficult, as would creating effective queries to search the database.  This is where graph databases come in handy.  These databases track the connections between tables (or nodes as they are called in this type of database) in assigned ways that provide more contextual information than relational databases do.  In a relational database you have 1-to-1, many-to-1, and 1-to many connections of slight variations.  However, that is about all the informational content a person has about the relations between the tables.  I recently explored the graph database system Neo4J to explore its use.  As someone interested in ecology, I could see where a graph database could be helpful in tracking the network of a food web.  For my example (seen above), I use several species of Alaskan flora and fauna.  Now, my graph database is quite simple and could probably be easily maintained as a set of related tables, but it was fun to see it as a graph database, and notice how complex some of the center interactions are. As more species are added along with their various interactions, it would easily become evident that a graph database is a great tool for tracking these interactions.

Building a graph database is quite easy. However, you do need to create a least one table, one with your set of interactions.

Here is my code:

CREATE (BaldEagle:Bird {name:’Haliaeetus leucocephalus’, type: ‘bird’, population:2})

CREATE (Salmon:Fish {name:’Oncorhynchus tshawytscha’, type: ‘fish’, population:1000})

CREATE (BrownBear:Mammal {name:’Ursa arctos’, type: ‘mammal’, population:.23})

CREATE (GosHawk:Bird {name:’Accipiter gentilis’, type: ‘bird’, population:.35})

CREATE (Willow:Plant {name:’Salix alaxensis’, type: ‘angiosperm’, population:500})

CREATE (Alder_Flycatcher:Bird {name:’Empidonax alnorum’, type: ‘bird’, population:20})

CREATE (Alder:Plant {name:’Alnus viridis’, type: ‘angisperm’, population:700})

CREATE (Beaver:Mammal {name:’Castor canadensis’, type: ‘mammal’, population:10})

CREATE (Mosquito:Insect {name:’Culiseta alaskaensis’, type: ‘insect’, population:30,000})

CREATE (Dandelion:Plant {name:’Taraxacum officinale’, type: ‘angiosperm’, population:2500})

CREATE (Caribou:Mammal {name:’Rangifer tarandus’, type: ‘mammal’, population:150})

CREATE (Wolf:Mammal {name:’Canis lupus’, type: ‘mammal’, population:.127})

CREATE (Mosquito)-[:Preys_upon]->(BrownBear)

CREATE (Mosquito)-[:Preys_upon]->(Beaver)

CREATE (Mosquito)-[:Preys_upon]->(Caribou)

CREATE (Wolf)-[:Preys_upon]->(Caribou)

CREATE (Wolf)-[:Preys_upon]->(Salmon)

CREATE (Wolf)-[:Preys_upon]->(Beaver)

CREATE (Beaver)-[:Grazes]->(Alder)

CREATE (Beaver)-[:Grazes]->(Willow)

CREATE (Mosquito)-[:Preys_upon]->(Wolf)

CREATE (Alder_Flycatcher)-[:Preys_upon]->(Mosquito)

CREATE (GosHawk)-[:Preys_upon]->(Alder_Flycatcher)

CREATE (BrownBear)-[:Preys_upon]->(Salmon)

CREATE (BaldEagle)-[:Preys_upon]->(Salmon)

CREATE (Salmon)-[:Preys_upon]->(Mosquito)

CREATE (Caribou)-[:Grazes]->(Dandelion)

CREATE (Caribou)-[:Grazes]->(Alder)

CREATE (Caribou)-[:Grazes]->(Willow)

MATCH p =(Mosquito)–>()

RETURN p

dpwalton@uoregon.edu

Science & Technology Outreach @DeyWalt on Twitter

You may also like...

4 Responses

  1. Betmate says:

    최고의 메이져 먹튀검증 이곳에서 즐기세요

  2. Betmate says:

    여기가바로 먹튀검증 배팅의성지

  3. Betmate says:

    에볼플레이 먹튀검증 안전노리터

  4. Betmate says:

    이용이유가생기는곳 먹튀검증 안전노리터 go

Leave a Reply

Your email address will not be published. Required fields are marked *