-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
76 lines (53 loc) · 2.18 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from pickle import TRUE
from xml.etree.ElementTree import tostring
from ReadingDataSet import ReadingDataSet
from keys import keys
from InitializingNodesAndEdges import InitializeNodesAndEdges
from nodes_edges_df import nodes_edges_dfs
dataSet = ReadingDataSet()
# Dictionary containing all dataframes
All_dfs = dataSet.All_dfs
# print(f"Df Keys: {All_dfs}")
key = keys(All_dfs)
# Dictionary indicating the column of each table that represents the primary key
All_pks = key.primaryKeyGetter()
print(f"Primary Keys: {All_pks}")
print('-------------------------')
# Dictionary indicating the column of each table that represents the foreign key and the referenced table name
All_fks = key.foreignKeyGetter()
print(f"Foreign Keys: {All_fks}")
print('-------------------------')
# Dictionary indicating which tables references the table
All_ref_ins = key.ref_in
print(f"Ref In Keys: {All_ref_ins}")
print('-------------------------')
initializingNodesAndEdges = InitializeNodesAndEdges(All_dfs, All_fks)
nodes = initializingNodesAndEdges.nodes
print(f"Nodes: {nodes}")
print('-------------------------')
edges = initializingNodesAndEdges.edges
print(f"Edges: {edges}")
print('-------------------------')
properties = initializingNodesAndEdges.properties
print(f"Properties: {properties}")
print('-------------------------')
# True to output nodes table and edges table as a normal graph
# False to output nodes table and edges table but edges are nodes
# initialize_nodes_edges_df = nodes_edges_dfs(nodes, edges, properties, All_pks, All_fks, All_ref_ins, All_dfs, True)
# nodesTable = initialize_nodes_edges_df.nodesTable
# print("Nodes Table: ")
# print(nodesTable)
# print('-------------------------')
# edgesTable = initialize_nodes_edges_df.edgesTable
# print("Edges Table: ")
# print(edgesTable)
# print('-------------------------')
initialize_nodes_edges_df = nodes_edges_dfs(nodes, edges, properties, All_pks, All_fks, All_ref_ins, All_dfs, False)
nodes_df = initialize_nodes_edges_df.nodes_df_edges_as_nodes
print(" ")
print(nodes_df)
print('-------------------------')
edges_df = initialize_nodes_edges_df.edges_df_edges_as_nodes
print("Edges DF: ")
print(edges_df)
print('-------------------------')