This repository contains code and data for my article "How to build a Bayesian Knowledge Graph".
-
The scripts are for data flow between Google Sheets, Neo4j and OpenMarkov.
-
The source data folder contains the TSV downloaded from the Google Sheets for debugging purpose. The pgmx_output folder contains TSV files that are extracted from a pgmx file.
Neo4j Desktop
OpenMarkov
First, config the config.yaml to match your Google Sheets setup.
- Convert data from Google Sheets to a pgmx file
python google_to_pgmx.py [model_name] > [model].pgmx
For example:
python google_to_pgmx.py Asia > manmade_google.pgmx
- Convert data from Google Sheets to Neo4j
python tsv_to_neo4j.py
It generates a series of files in the ./neo4j folder.
- Other utility files.
pgmx_to_tsv.py is to parse a PGMX file and generate a node, a link and a potential TSV file. You use this script when you have modified data in OpenMarkov and want to overwrite the changes back into your TSV files.
And you can use upsert_tsv.py to upsert the new data into an old TSV file.
- Sixing Huang - Concept and Coding
This project is licensed under the MIT License - see the LICENSE file for details