Spaces:
Sleeping
Sleeping
Download schema_and_load.gsql from Abhinaycodes/GraphRAG-Backend: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/Abhinaycodes/GraphRAG-Backend/resolve/main/schema_and_load.gsql
- Command line
-
hf download hf://spaces/Abhinaycodes/GraphRAG-Backend/schema_and_load.gsql
-
curl -L -o schema_and_load.gsql https://huggingface.co/spaces/Abhinaycodes/GraphRAG-Backend/resolve/main/schema_and_load.gsql
1.34 kB
| // TigerGraph GSQL Schema & Bulk Loader for Financial Graph | |
| // Run this in GraphStudio or via GSQL shell. | |
| // 1. Drop existing graph if necessary (Warning: this deletes data) | |
| // DROP GRAPH FinancialGraph | |
| // 2. Define Schema | |
| // We use a generalized 'Entity' vertex and 'RELATIONSHIP' edge | |
| // to dynamically handle the Gemini extraction output without strict schema limits. | |
| CREATE VERTEX Entity (PRIMARY_ID id STRING, entity_type STRING) WITH PRIMARY_ID_AS_ATTRIBUTE="true" | |
| CREATE DIRECTED EDGE RELATIONSHIP (FROM Entity, TO Entity, rel_type STRING) | |
| CREATE GRAPH FinancialGraph (Entity, RELATIONSHIP) | |
| // 3. Define Loading Job | |
| USE GRAPH FinancialGraph | |
| CREATE LOADING JOB load_financial_graph FOR GRAPH FinancialGraph { | |
| // IMPORTANT: Update these paths to where you saved your vertices.csv and edges.csv | |
| DEFINE FILENAME v_file = "ANY:/path/to/vertices.csv"; | |
| DEFINE FILENAME e_file = "ANY:/path/to/edges.csv"; | |
| // Load Vertices | |
| LOAD v_file TO VERTEX Entity VALUES(, ) | |
| USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double"; | |
| // Load Edges | |
| LOAD e_file TO EDGE RELATIONSHIP VALUES(, , ) | |
| USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double"; | |
| } | |
| // 4. Run the Loading Job (Uncomment and run after updating paths above) | |
| // RUN LOADING JOB load_financial_graph | |