Skip to content

resource-watch/graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resource Watch Knowledge Graph

screen shot 2017-06-07 at 3 06 04 pm

Online Data browser

http://104.131.87.76:7474/browser/

Data model

Current node types

  • CONCEPT
  • DATASET

Current relationship types

  • RELATED_TO This is a generic relationship used whenever it's not possible to use one of the more specific types
  • TYPE_OF
  • PART_OF
  • LOCATED_AT
  • TAGGED_WITH
  • AFFECTS
  • IS_A
  • CAN_AFFECT
  • IS_INVOLVED_IN
  • IS_SIMILAR_TO

Current database schema

screen shot 2017-06-07 at 4 00 13 pm

Database creation

The knowledge graph of concepts is generated from the information stated in this Google Spreadsheet.

Step by step guide to import the Graph

  1. Download the aforementioned spreadsheet as a CSV file
  2. Upload it to the server using scp
  3. Copy it to the folder called import that is located inside the Neo4j installation
  4. Download the JSON file resulting from this request to the WRI API https://api.resourcewatch.org/dataset/?app=rw&includes=vocabulary
  5. Execute the JAVA program: [src/main/java/com/vizzuality/CreateDatasetTagCSV.java]
  6. Upload the resulting file to the server using scp
  7. Copy it to the folder called import that is located inside the Neo4j installation
  8. Execute the various Cypher statements included in the file: ImportDBCypher.txt

Steps 4-7 can be skipped in the case you're not interested in adding the screenshot of datasets and their tags as a proof of concept

Examples of queries

Get all concepts that are descendants of the term 'energy'

MATCH (n:CONCEPT)-[*]->(e:CONCEPT {id: 'energy'})
RETURN n,e

screen shot 2017-06-07 at 4 04 00 pm

Get all datasets tagged with water or any of the descendants of water

MATCH (d:DATASET)-[:TAGGED_WITH]->(c:CONCEPT)-[*]->(c2:CONCEPT)
WHERE c.id='water' OR c2.id='water'
RETURN d,c,c2

screen shot 2017-06-07 at 4 29 42 pm

Whole graph

MATCH p=()-[]-() return p

Not recommended for computers with performance problems

About

Resource Watch Knowledge Graph

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages