Skip to content

Instantly share code, notes, and snippets.

@gregoryking
gregoryking / pk_fk_detection_GitSchema.cypher
Last active July 13, 2023 12:32
Cypher based PK / FK detection - tested on GitScehma dataset
// Academic paper on Foreign Key Detection - First step includes calculating inclusions which even with SPIDER algorithm is computationally expensive and requires access to full table data.
// https://www.semanticscholar.org/paper/A-Machine-Learning-Approach-to-Foreign-Key-Rostin-Albrecht/691f6eeabbe00451567c9facc282ce9820e9792b
// Article on more lightweight approach - Based solely on column name analysis
// https://www.tonic.ai/blog/foreign-key-detection
// Data for testing efficacy of algorithms
// https://github.com/tdoehmen/gitschemas
// Quick pything snippet to transform download from the above from a large json map into array of maps
@gregoryking
gregoryking / neo4j_importer_cypher_script_2023-10-23.cypher
Created October 23, 2023 08:13
Sample "Generate Cypher script..." from Workspace: Import
:param {
// Define the file path root and the individual file names required for loading.
// https://neo4j.com/docs/operations-manual/current/configuration/file-locations/
file_path_root: 'file:///', // Change this to the folder your script can access the files at.
file_0: 'territories.csv',
file_1: 'regions.csv',
file_2: 'suppliers.csv',
file_3: 'shippers.csv',
file_4: 'products.csv',
file_5: 'categories.csv',