JerryLife commited on
Commit
a63309e
·
1 Parent(s): 8e68522

Update readme

Browse files
Files changed (1) hide show
  1. README.md +705 -90
README.md CHANGED
@@ -1,104 +1,719 @@
1
  ---
2
  license: cc-by-4.0
3
  task_categories:
 
4
  - tabular-classification
5
  - tabular-regression
6
  language:
7
  - en
8
  tags:
9
- - chemistry
10
- - medical
11
- - finance
 
 
12
  size_categories:
13
  - 10B<n<100B
14
  ---
15
 
16
  # WikiDBGraph Dataset
17
 
18
- This document provides an overview of the datasets associated with the research paper on WikiDBGraph, a large-scale graph of interconnected relational databases.
19
-
20
- **Description:**
21
- WikiDBGraph is a novel, large-scale graph where each node represents a relational database, and edges signify identified correlations or similarities between these databases. It is constructed from 100,000 real-world-like databases derived from Wikidata. The graph is enriched with a comprehensive set of node (database) and edge (inter-database relationship) properties, categorized into structural, semantic, and statistical features.
22
-
23
- **Source:**
24
- WikiDBGraph is derived from the WikiDBs corpus (see below). The inter-database relationships (edges) are primarily identified using a machine learning model trained to predict database similarity based on their schema embeddings, significantly expanding upon the explicitly known links in the source data.
25
-
26
- **Key Characteristics:**
27
- * **Nodes:** 100,000 relational databases.
28
- * **Edges:** Millions of identified inter-database relationships (the exact number depends on the similarity threshold $\tau$ used for graph construction).
29
- * **Node Properties:** Include database-level structural details (e.g., number of tables, columns, foreign keys), semantic information (e.g., pre-computed embeddings, topic categories from Wikidata, community IDs), and statistical measures (e.g., database size, total rows, column cardinalities, column entropies).
30
- * **Edge Properties:** Include structural similarity (e.g., Jaccard index on table/column names, Graph Edit Distance based metrics), semantic relatedness (e.g., cosine similarity of embeddings, prediction confidence), and statistical relationships (e.g., KL divergence of shared column distributions).
31
-
32
- **Usage in this Research:**
33
- WikiDBGraph is the primary contribution of this paper. It is used to:
34
- * Demonstrate a methodology for identifying and representing inter-database relationships at scale.
35
- * Provide a rich resource for studying the landscape of interconnected databases.
36
- * Serve as a foundation for experiments in collaborative learning, showcasing its utility in feature-overlap and instance-overlap scenarios.
37
-
38
- **Availability:**
39
- * **Dataset (WikiDBGraph):** The WikiDBGraph dataset, including the graph structure (edge lists for various thresholds $\tau$) and node/edge property files, will be made publicly available. (Please specify the URL here, e.g., Zenodo, GitHub, or your project website).
40
- * **Code:** The code used for constructing WikiDBGraph from WikiDBs, generating embeddings, and running the experiments will be made publicly available. (Please specify the URL here, e.g., GitHub repository).
41
-
42
- **License:**
43
- * **WikiDBGraph Dataset:** Creative Commons Attribution 4.0 International (CC BY 4.0).
44
- * **Associated Code:** Apache License 2.0.
45
-
46
- **How to Use WikiDBGraph:**
47
- The dataset is provided as a collection of files, categorized as follows:
48
-
49
- **A. Graph Structure Files:**
50
- These files define the connections (edges) between databases (nodes) for different similarity thresholds ($\tau$).
51
- * **`filtered_edges_threshold_0.93.csv`**, **`filtered_edges_threshold_0.94.csv`**, **`filtered_edges_threshold_0.96.csv`**:
52
- * **Meaning:** CSV files representing edge lists. Each row typically contains a pair of database IDs that are connected at the specified similarity threshold.
53
- * **How to Load:** Use standard CSV parsing libraries (e.g., `pandas.read_csv()` in Python). These edge lists can then be used to construct graph objects in libraries like NetworkX (`nx.from_pandas_edgelist()`) or igraph.
54
- * **`filtered_edges_0.94_with_confidence.csv`**:
55
- * **Meaning:** An edge list in CSV format for $\tau=0.94$, which also includes the confidence score (similarity score) for each edge.
56
- * **How to Load:** Similar to other CSV edge lists, using `pandas`. The confidence score can be used as an edge weight.
57
- * **`graph_raw_0.93.dgl`**, **`graph_raw_0.94.dgl`**, **`graph_raw_0.96.dgl`**:
58
- * **Meaning:** These are graph objects serialized in the Deep Graph Library (DGL) format for different thresholds. They likely contain the basic graph structure (nodes and edges).
59
- * **How to Load `.dgl` files:** DGL provides functions to save and load graph objects. You would typically use:
60
- ```python
61
- import dgl
62
- # Example for loading a graph
63
- graphs, _ = dgl.load_graphs('graph_raw_0.94.dgl')
64
- g = graphs[0] # Typically, load_graphs returns a list of graphs
65
- ```
66
- * **`graph_with_properties_0.94.dgl`**:
67
- * **Meaning:** A DGL graph object for $\tau=0.94$ that includes node and/or edge properties directly embedded within the graph structure. This is convenient for direct use in DGL-based graph neural network models.
68
- * **How to Load:** Same as other `.dgl` files using `dgl.load_graphs()`. Node features can be accessed via `g.ndata` and edge features via `g.edata`.
69
-
70
- **B. Node Property Files:**
71
- These CSV files provide various features and metadata for each database node.
72
- * **`database_embeddings.pt`**:
73
- * **Meaning:** A PyTorch (`.pt`) file containing the pre-computed embedding vectors for each database. These are crucial semantic features.
74
- * **How to Load:** Use `torch.load('database_embeddings.pt')` in Python with PyTorch installed.
75
- * **`node_structural_properties.csv`**:
76
- * **Meaning:** Contains structural characteristics of each database (e.g., number of tables, columns, foreign key counts).
77
- * **`column_cardinality.csv`**:
78
- * **Meaning:** Statistics on the number of unique values (cardinality) for columns within each database.
79
- * **`column_entropy.csv`**:
80
- * **Meaning:** Entropy values calculated for columns within each database, indicating data diversity.
81
- * **`data_volume.csv`**:
82
- * **Meaning:** Information regarding the size or volume of data in each database (e.g., total rows, file size).
83
- * **`cluster_assignments_dim2_sz100_msNone.csv`**:
84
- * **Meaning:** Cluster labels assigned to each database after dimensionality reduction (e.g., t-SNE) and clustering (e.g., HDBSCAN).
85
- * **`community_assignment.csv`**:
86
- * **Meaning:** Community labels assigned to each database based on graph community detection algorithms (e.g., Louvain).
87
- * **`tsne_embeddings_dim2.csv`**:
88
- * **Meaning:** 2-dimensional projection of database embeddings using t-SNE, typically used for visualization.
89
- * **How to Load CSV Node Properties:** Use `pandas.read_csv()` in Python. The resulting DataFrames can be merged or used to assign attributes to nodes in a graph object.
90
-
91
- **C. Edge Property Files:**
92
- These CSV files provide features for the relationships (edges) between databases.
93
- * **`edge_embed_sim.csv`**:
94
- * **Meaning:** Contains the embedding-based similarity scores (EmbedSim) for connected database pairs. This might be redundant if confidence is in `filtered_edges_..._with_confidence.csv` but could be a global list of all pairwise similarities above a certain initial cutoff.
95
- * **`edge_structural_properties_GED_0.94.csv`**:
96
- * **Meaning:** Contains structural similarity metrics (potentially Graph Edit Distance or related measures) for edges in the graph constructed with $\tau=0.94$.
97
- * **How to Load CSV Edge Properties:** Use `pandas.read_csv()`. These can be used to assign attributes to edges in a graph object.
98
-
99
- **D. Other Analysis Files:**
100
- * **`distdiv_results.csv`**:
101
- * **Meaning:** Likely contains results from a specific distance or diversity analysis performed on the databases or their embeddings. The exact nature would be detailed in the paper or accompanying documentation.
102
- * **How to Load:** As a CSV file using `pandas`.
103
-
104
- Detailed instructions on the specific schemas of these CSV files, precise content of `.pt` and `.dgl` files, and example usage scripts will be provided in the code repository and full dataset documentation upon release.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-4.0
3
  task_categories:
4
+ - graph-ml
5
  - tabular-classification
6
  - tabular-regression
7
  language:
8
  - en
9
  tags:
10
+ - database-analysis
11
+ - graph-similarity
12
+ - federated-learning
13
+ - schema-matching
14
+ - wikidata
15
  size_categories:
16
  - 10B<n<100B
17
  ---
18
 
19
  # WikiDBGraph Dataset
20
 
21
+ WikiDBGraph is a comprehensive dataset for database graph analysis, containing structural and semantic properties of 100,000 Wikidata-derived databases. The dataset includes graph representations, similarity metrics, community structures, and various statistical properties designed for federated learning research and database schema matching tasks.
22
+
23
+ ## Dataset Overview
24
+
25
+ This dataset provides graph-based analysis of database schemas, enabling research in:
26
+ - **Database similarity and matching**: Finding structurally and semantically similar databases
27
+ - **Federated learning**: Training machine learning models across distributed database pairs
28
+ - **Graph analysis**: Community detection, connected components, and structural properties
29
+ - **Schema analysis**: Statistical properties of database schemas including cardinality, entropy, and sparsity
30
+
31
+ ### Statistics
32
+
33
+ - **Total Databases**: 100,000
34
+ - **Total Edges**: 17,858,194 (at threshold 0.94)
35
+ - **Connected Components**: 6,109
36
+ - **Communities**: 6,133
37
+ - **Largest Component**: 10,703 nodes
38
+ - **Modularity Score**: 0.5366
39
+
40
+ ## Dataset Structure
41
+
42
+ The dataset consists of 15 files organized into four categories:
43
+
44
+ ### 1. Graph Structure Files
45
+
46
+ #### `graph_raw_0.94.dgl`
47
+ DGL (Deep Graph Library) graph file containing the complete database similarity graph.
48
+
49
+ **Structure**:
50
+ - **Nodes**: 100,000 database IDs
51
+ - **Edges**: 17,858,194 pairs with similarity ≥ 0.94
52
+ - **Node Data**:
53
+ - `embedding`: 768-dimensional node embeddings (if available)
54
+ - **Edge Data**:
55
+ - `weight`: Edge similarity scores (float32)
56
+ - `gt_edge`: Ground truth edge labels (float32)
57
+
58
+ **Loading**:
59
+ ```python
60
+ import dgl
61
+ import torch
62
+
63
+ # Load the graph
64
+ graphs, _ = dgl.load_graphs('graph_raw_0.94.dgl')
65
+ graph = graphs[0]
66
+
67
+ # Access nodes and edges
68
+ num_nodes = graph.num_nodes() # 100000
69
+ num_edges = graph.num_edges() # 17858194
70
+
71
+ # Access edge data
72
+ src, dst = graph.edges()
73
+ edge_weights = graph.edata['weight']
74
+ edge_labels = graph.edata['gt_edge']
75
+
76
+ # Access node embeddings (if available)
77
+ if 'embedding' in graph.ndata:
78
+ node_embeddings = graph.ndata['embedding'] # shape: (100000, 768)
79
+ ```
80
+
81
+ #### `database_embeddings.pt`
82
+ PyTorch tensor file containing pre-computed 768-dimensional embeddings for all databases.
83
+
84
+ **Structure**:
85
+ - Tensor shape: `(100000, 768)`
86
+ - Data type: float32
87
+ - Embeddings generated using BGE (BAAI General Embedding) model
88
+
89
+ **Loading**:
90
+ ```python
91
+ import torch
92
+
93
+ embeddings = torch.load('database_embeddings.pt', weights_only=True)
94
+ print(embeddings.shape) # torch.Size([100000, 768])
95
+
96
+ # Get embedding for specific database
97
+ db_idx = 42
98
+ db_embedding = embeddings[db_idx]
99
+ ```
100
+
101
+ ### 2. Edge Files (Database Pair Relationships)
102
+
103
+ #### `filtered_edges_threshold_0.94.csv`
104
+ Main edge list with database pairs having similarity 0.94.
105
+
106
+ **Columns**:
107
+ - `src` (float): Source database ID
108
+ - `tgt` (float): Target database ID
109
+ - `similarity` (float): Cosine similarity score [0.94, 1.0]
110
+ - `label` (float): Ground truth label (0.0 or 1.0)
111
+ - `edge` (int): Edge indicator (always 1)
112
+
113
+ **Loading**:
114
+ ```python
115
+ import pandas as pd
116
+
117
+ edges = pd.read_csv('filtered_edges_threshold_0.94.csv')
118
+ print(f"Total edges: {len(edges):,}")
119
+
120
+ # Find highly similar pairs
121
+ high_sim = edges[edges['similarity'] >= 0.99]
122
+ print(f"Pairs with similarity ≥ 0.99: {len(high_sim):,}")
123
+ ```
124
+
125
+ **Example rows**:
126
+ ```
127
+ src tgt similarity label edge
128
+ 26218.0 44011.0 0.9896456 0.0 1
129
+ 26218.0 44102.0 0.9908572 0.0 1
130
+ ```
131
+
132
+ #### `edges_list_th0.6713.csv`
133
+ Extended edge list with lower similarity threshold (≥ 0.6713).
134
+
135
+ **Columns**:
136
+ - `src` (str): Source database ID (padded format, e.g., "00000")
137
+ - `tgt` (str): Target database ID (padded format)
138
+ - `similarity` (float): Cosine similarity score [0.6713, 1.0]
139
+ - `label` (float): Ground truth label
140
+
141
+ **Loading**:
142
+ ```python
143
+ import pandas as pd
144
+
145
+ edges = pd.read_csv('edges_list_th0.6713.csv')
146
+
147
+ # Database IDs are strings with leading zeros
148
+ print(edges['src'].head()) # "00000", "00000", "00000", ...
149
+
150
+ # Filter by similarity threshold
151
+ threshold = 0.90
152
+ filtered = edges[edges['similarity'] >= threshold]
153
+ ```
154
+
155
+ #### `edge_structural_properties_GED_0.94.csv`
156
+ Detailed structural properties for database pairs at threshold 0.94.
157
+
158
+ **Columns**:
159
+ - `db_id1` (int): First database ID
160
+ - `db_id2` (int): Second database ID
161
+ - `jaccard_table_names` (float): Jaccard similarity of table names [0.0, 1.0]
162
+ - `jaccard_columns` (float): Jaccard similarity of column names [0.0, 1.0]
163
+ - `jaccard_data_types` (float): Jaccard similarity of data types [0.0, 1.0]
164
+ - `hellinger_distance_data_types` (float): Hellinger distance between data type distributions
165
+ - `graph_edit_distance` (float): Graph edit distance between schemas
166
+ - `common_tables` (int): Number of common table names
167
+ - `common_columns` (int): Number of common column names
168
+ - `common_data_types` (int): Number of common data types
169
+
170
+ **Loading**:
171
+ ```python
172
+ import pandas as pd
173
+
174
+ edge_props = pd.read_csv('edge_structural_properties_GED_0.94.csv')
175
+
176
+ # Find pairs with high structural similarity
177
+ high_jaccard = edge_props[edge_props['jaccard_columns'] >= 0.5]
178
+ print(f"Pairs with ≥50% column overlap: {len(high_jaccard):,}")
179
+
180
+ # Analyze graph edit distance
181
+ print(f"Mean GED: {edge_props['graph_edit_distance'].mean():.2f}")
182
+ print(f"Median GED: {edge_props['graph_edit_distance'].median():.2f}")
183
+ ```
184
+
185
+ #### `distdiv_results.csv`
186
+ Distribution divergence metrics for database pairs.
187
+
188
+ **Columns**:
189
+ - `src` (int): Source database ID
190
+ - `tgt` (int): Target database ID
191
+ - `distdiv` (float): Distribution divergence score
192
+ - `overlap_ratio` (float): Column overlap ratio [0.0, 1.0]
193
+ - `shared_column_count` (int): Number of shared columns
194
+
195
+ **Loading**:
196
+ ```python
197
+ import pandas as pd
198
+
199
+ distdiv = pd.read_csv('distdiv_results.csv')
200
+
201
+ # Find pairs with low divergence (more similar distributions)
202
+ similar_dist = distdiv[distdiv['distdiv'] < 15.0]
203
+
204
+ # Analyze overlap patterns
205
+ high_overlap = distdiv[distdiv['overlap_ratio'] >= 0.3]
206
+ print(f"Pairs with ≥30% overlap: {len(high_overlap):,}")
207
+ ```
208
+
209
+ #### `all_join_size_results_est.csv`
210
+ Estimated join sizes for databases (cardinality estimation).
211
+
212
+ **Columns**:
213
+ - `db_id` (int): Database ID
214
+ - `all_join_size` (float): Estimated size of full outer join across all tables
215
+
216
+ **Loading**:
217
+ ```python
218
+ import pandas as pd
219
+
220
+ join_sizes = pd.read_csv('all_join_size_results_est.csv')
221
+
222
+ # Analyze join complexity
223
+ print(f"Mean join size: {join_sizes['all_join_size'].mean():.2f}")
224
+ print(f"Max join size: {join_sizes['all_join_size'].max():.2f}")
225
+
226
+ # Large databases (complex joins)
227
+ large_dbs = join_sizes[join_sizes['all_join_size'] > 1000]
228
+ ```
229
+
230
+ ### 3. Node Files (Database Properties)
231
+
232
+ #### `node_structural_properties.csv`
233
+ Comprehensive structural properties for each database schema.
234
+
235
+ **Columns**:
236
+ - `db_id` (int): Database ID
237
+ - `num_tables` (int): Number of tables in the database
238
+ - `num_columns` (int): Total number of columns across all tables
239
+ - `foreign_key_density` (float): Ratio of foreign keys to possible relationships
240
+ - `avg_table_connectivity` (float): Average number of connections per table
241
+ - `median_table_connectivity` (float): Median connections per table
242
+ - `min_table_connectivity` (float): Minimum connections for any table
243
+ - `max_table_connectivity` (float): Maximum connections for any table
244
+ - `data_type_proportions` (str): JSON string with data type distribution
245
+ - `data_types` (str): JSON string with count of each data type
246
+ - `wikidata_properties` (int): Number of Wikidata properties used
247
+
248
+ **Loading**:
249
+ ```python
250
+ import pandas as pd
251
+ import json
252
+
253
+ node_props = pd.read_csv('node_structural_properties.csv')
254
+
255
+ # Parse JSON columns
256
+ node_props['data_type_dist'] = node_props['data_type_proportions'].apply(
257
+ lambda x: json.loads(x.replace("'", '"'))
258
+ )
259
+
260
+ # Analyze database complexity
261
+ complex_dbs = node_props[node_props['num_tables'] > 10]
262
+ print(f"Databases with >10 tables: {len(complex_dbs):,}")
263
+
264
+ # Foreign key density analysis
265
+ print(f"Mean FK density: {node_props['foreign_key_density'].mean():.4f}")
266
+ ```
267
+
268
+ **Example row**:
269
+ ```
270
+ db_id: 88880
271
+ num_tables: 2
272
+ num_columns: 24
273
+ foreign_key_density: 0.0833
274
+ avg_table_connectivity: 1.5
275
+ data_type_proportions: {'string': 0.417, 'wikibase-entityid': 0.583}
276
+ ```
277
+
278
+ #### `data_volume.csv`
279
+ Storage size information for each database.
280
+
281
+ **Columns**:
282
+ - `db_id` (str/int): Database ID (may have leading zeros)
283
+ - `volume_bytes` (int): Total data volume in bytes
284
+
285
+ **Loading**:
286
+ ```python
287
+ import pandas as pd
288
+
289
+ volumes = pd.read_csv('data_volume.csv')
290
+
291
+ # Convert to more readable units
292
+ volumes['volume_mb'] = volumes['volume_bytes'] / (1024 * 1024)
293
+ volumes['volume_gb'] = volumes['volume_bytes'] / (1024 * 1024 * 1024)
294
+
295
+ # Find largest databases
296
+ top_10 = volumes.nlargest(10, 'volume_bytes')
297
+ print(top_10[['db_id', 'volume_gb']])
298
+ ```
299
+
300
+ ### 4. Column-Level Statistics
301
+
302
+ #### `column_cardinality.csv`
303
+ Distinct value counts for all columns.
304
+
305
+ **Columns**:
306
+ - `db_id` (str/int): Database ID
307
+ - `table_name` (str): Table name
308
+ - `column_name` (str): Column name
309
+ - `n_distinct` (int): Number of distinct values
310
+
311
+ **Loading**:
312
+ ```python
313
+ import pandas as pd
314
+
315
+ cardinality = pd.read_csv('column_cardinality.csv')
316
+
317
+ # High cardinality columns (potentially good as keys)
318
+ high_card = cardinality[cardinality['n_distinct'] > 100]
319
+
320
+ # Analyze cardinality distribution
321
+ print(f"Mean distinct values: {cardinality['n_distinct'].mean():.2f}")
322
+ print(f"Median distinct values: {cardinality['n_distinct'].median():.2f}")
323
+ ```
324
+
325
+ **Example rows**:
326
+ ```
327
+ db_id table_name column_name n_distinct
328
+ 6 scholarly_articles article_title 275
329
+ 6 scholarly_articles article_description 197
330
+ 6 scholarly_articles pub_med_id 269
331
+ ```
332
+
333
+ #### `column_entropy.csv`
334
+ Shannon entropy for column value distributions.
335
+
336
+ **Columns**:
337
+ - `db_id` (str): Database ID (padded format)
338
+ - `table_name` (str): Table name
339
+ - `column_name` (str): Column name
340
+ - `entropy` (float): Shannon entropy value [0.0, ∞)
341
+
342
+ **Loading**:
343
+ ```python
344
+ import pandas as pd
345
+
346
+ entropy = pd.read_csv('column_entropy.csv')
347
+
348
+ # High entropy columns (high information content)
349
+ high_entropy = entropy[entropy['entropy'] > 3.0]
350
+
351
+ # Low entropy columns (low diversity)
352
+ low_entropy = entropy[entropy['entropy'] < 0.5]
353
+
354
+ # Distribution analysis
355
+ print(f"Mean entropy: {entropy['entropy'].mean():.3f}")
356
+ ```
357
+
358
+ **Example rows**:
359
+ ```
360
+ db_id table_name column_name entropy
361
+ 00001 descendants_of_john_i full_name 3.322
362
+ 00001 descendants_of_john_i gender 0.881
363
+ 00001 descendants_of_john_i father_name 0.000
364
+ ```
365
+
366
+ #### `column_sparsity.csv`
367
+ Missing value ratios for all columns.
368
+
369
+ **Columns**:
370
+ - `db_id` (str): Database ID (padded format)
371
+ - `table_name` (str): Table name
372
+ - `column_name` (str): Column name
373
+ - `sparsity` (float): Ratio of missing values [0.0, 1.0]
374
+
375
+ **Loading**:
376
+ ```python
377
+ import pandas as pd
378
+
379
+ sparsity = pd.read_csv('column_sparsity.csv')
380
+
381
+ # Dense columns (few missing values)
382
+ dense = sparsity[sparsity['sparsity'] < 0.1]
383
+
384
+ # Sparse columns (many missing values)
385
+ sparse = sparsity[sparsity['sparsity'] > 0.5]
386
+
387
+ # Quality assessment
388
+ print(f"Columns with >50% missing: {len(sparse):,}")
389
+ print(f"Mean sparsity: {sparsity['sparsity'].mean():.3f}")
390
+ ```
391
+
392
+ **Example rows**:
393
+ ```
394
+ db_id table_name column_name sparsity
395
+ 00009 FamousPencilMoustacheWearers Name 0.000
396
+ 00009 FamousPencilMoustacheWearers Biography 0.000
397
+ 00009 FamousPencilMoustacheWearers ViafId 0.222
398
+ ```
399
+
400
+ ### 5. Clustering and Community Files
401
+
402
+ #### `community_assignment_0.94.csv`
403
+ Community detection results using Louvain algorithm.
404
+
405
+ **Columns**:
406
+ - `node_id` (int): Database ID
407
+ - `partition` (int): Community/partition ID
408
+
409
+ **Loading**:
410
+ ```python
411
+ import pandas as pd
412
+
413
+ communities = pd.read_csv('community_assignment_0.94.csv')
414
+
415
+ # Analyze community structure
416
+ community_sizes = communities['partition'].value_counts()
417
+ print(f"Number of communities: {len(community_sizes)}")
418
+ print(f"Largest community size: {community_sizes.max()}")
419
+
420
+ # Get databases in a specific community
421
+ community_1 = communities[communities['partition'] == 1]['node_id'].tolist()
422
+ ```
423
+
424
+ **Statistics**:
425
+ - Total communities: 6,133
426
+ - Largest community: 4,825 nodes
427
+ - Modularity: 0.5366
428
+
429
+ #### `cluster_assignments_dim2_sz100_msNone.csv`
430
+ Clustering results from dimensionality reduction (e.g., t-SNE, UMAP).
431
+
432
+ **Columns**:
433
+ - `db_id` (int): Database ID
434
+ - `cluster` (int): Cluster ID
435
+
436
+ **Loading**:
437
+ ```python
438
+ import pandas as pd
439
+
440
+ clusters = pd.read_csv('cluster_assignments_dim2_sz100_msNone.csv')
441
+
442
+ # Analyze cluster distribution
443
+ cluster_sizes = clusters['cluster'].value_counts()
444
+ print(f"Number of clusters: {len(cluster_sizes)}")
445
+
446
+ # Get databases in a specific cluster
447
+ cluster_9 = clusters[clusters['cluster'] == 9]['db_id'].tolist()
448
+ ```
449
+
450
+ ### 6. Analysis Reports
451
+
452
+ #### `analysis_0.94_report.txt`
453
+ Comprehensive text report of graph analysis at threshold 0.94.
454
+
455
+ **Contents**:
456
+ - Graph statistics (nodes, edges)
457
+ - Connected components analysis
458
+ - Community detection results
459
+ - Top components and communities by size
460
+
461
+ **Loading**:
462
+ ```python
463
+ with open('analysis_0.94_report.txt', 'r') as f:
464
+ report = f.read()
465
+ print(report)
466
+ ```
467
+
468
+ **Key Metrics**:
469
+ - Total Nodes: 100,000
470
+ - Total Edges: 17,858,194
471
+ - Connected Components: 6,109
472
+ - Largest Component: 10,703 nodes
473
+ - Communities: 6,133
474
+ - Modularity: 0.5366
475
+
476
+ ## Usage Examples
477
+
478
+ ### Example 1: Finding Similar Database Pairs
479
+
480
+ ```python
481
+ import pandas as pd
482
+
483
+ # Load edges with high similarity
484
+ edges = pd.read_csv('filtered_edges_threshold_0.94.csv')
485
+
486
+ # Find database pairs with similarity > 0.98
487
+ high_sim_pairs = edges[edges['similarity'] >= 0.98]
488
+ print(f"Found {len(high_sim_pairs)} pairs with similarity ≥ 0.98")
489
+
490
+ # Get top 10 most similar pairs
491
+ top_pairs = edges.nlargest(10, 'similarity')
492
+ for idx, row in top_pairs.iterrows():
493
+ print(f"DB {int(row['src'])} ↔ DB {int(row['tgt'])}: {row['similarity']:.4f}")
494
+ ```
495
+
496
+ ### Example 2: Analyzing Database Properties
497
+
498
+ ```python
499
+ import pandas as pd
500
+ import json
501
+
502
+ # Load node properties
503
+ nodes = pd.read_csv('node_structural_properties.csv')
504
+
505
+ # Find complex databases
506
+ complex_dbs = nodes[
507
+ (nodes['num_tables'] > 10) &
508
+ (nodes['num_columns'] > 100)
509
+ ]
510
+
511
+ print(f"Complex databases: {len(complex_dbs)}")
512
+
513
+ # Analyze data type distribution
514
+ for idx, row in complex_dbs.head().iterrows():
515
+ db_id = row['db_id']
516
+ types = json.loads(row['data_types'].replace("'", '"'))
517
+ print(f"DB {db_id}: {types}")
518
+ ```
519
+
520
+ ### Example 3: Loading and Analyzing the Graph
521
+
522
+ ```python
523
+ import dgl
524
+ import torch
525
+ import pandas as pd
526
+
527
+ # Load DGL graph
528
+ graphs, _ = dgl.load_graphs('graph_raw_0.94.dgl')
529
+ graph = graphs[0]
530
+
531
+ # Basic statistics
532
+ print(f"Nodes: {graph.num_nodes():,}")
533
+ print(f"Edges: {graph.num_edges():,}")
534
+
535
+ # Analyze degree distribution
536
+ in_degrees = graph.in_degrees()
537
+ out_degrees = graph.out_degrees()
538
+
539
+ print(f"Average in-degree: {in_degrees.float().mean():.2f}")
540
+ print(f"Average out-degree: {out_degrees.float().mean():.2f}")
541
+
542
+ # Find highly connected nodes
543
+ top_nodes = torch.topk(in_degrees, k=10)
544
+ print(f"Top 10 most connected databases: {top_nodes.indices.tolist()}")
545
+ ```
546
+
547
+ ### Example 4: Federated Learning Pair Selection
548
+
549
+ ```python
550
+ import pandas as pd
551
+
552
+ # Load edges and structural properties
553
+ edges = pd.read_csv('filtered_edges_threshold_0.94.csv')
554
+ edge_props = pd.read_csv('edge_structural_properties_GED_0.94.csv')
555
+
556
+ # Merge data
557
+ pairs = edges.merge(
558
+ edge_props,
559
+ left_on=['src', 'tgt'],
560
+ right_on=['db_id1', 'db_id2'],
561
+ how='inner'
562
+ )
563
+
564
+ # Select pairs for federated learning
565
+ # Criteria: high similarity + high column overlap + low GED
566
+ fl_candidates = pairs[
567
+ (pairs['similarity'] >= 0.98) &
568
+ (pairs['jaccard_columns'] >= 0.4) &
569
+ (pairs['graph_edit_distance'] <= 3.0)
570
+ ]
571
+
572
+ print(f"FL candidate pairs: {len(fl_candidates)}")
573
+
574
+ # Sample pairs for experiments
575
+ sample = fl_candidates.sample(n=100, random_state=42)
576
+ ```
577
+
578
+ ### Example 5: Column Statistics Analysis
579
+
580
+ ```python
581
+ import pandas as pd
582
+
583
+ # Load column-level statistics
584
+ cardinality = pd.read_csv('column_cardinality.csv')
585
+ entropy = pd.read_csv('column_entropy.csv')
586
+ sparsity = pd.read_csv('column_sparsity.csv')
587
+
588
+ # Merge on (db_id, table_name, column_name)
589
+ merged = cardinality.merge(entropy, on=['db_id', 'table_name', 'column_name'])
590
+ merged = merged.merge(sparsity, on=['db_id', 'table_name', 'column_name'])
591
+
592
+ # Find high-quality columns for machine learning
593
+ # Criteria: high cardinality, high entropy, low sparsity
594
+ quality_columns = merged[
595
+ (merged['n_distinct'] > 50) &
596
+ (merged['entropy'] > 2.0) &
597
+ (merged['sparsity'] < 0.1)
598
+ ]
599
+
600
+ print(f"High-quality columns: {len(quality_columns)}")
601
+ ```
602
+
603
+ ### Example 6: Community Analysis
604
+
605
+ ```python
606
+ import pandas as pd
607
+
608
+ # Load community assignments
609
+ communities = pd.read_csv('community_assignment_0.94.csv')
610
+ nodes = pd.read_csv('node_structural_properties.csv')
611
+
612
+ # Merge to get properties by community
613
+ community_props = communities.merge(
614
+ nodes,
615
+ left_on='node_id',
616
+ right_on='db_id'
617
+ )
618
+
619
+ # Analyze each community
620
+ for comm_id in community_props['partition'].unique()[:5]:
621
+ comm_data = community_props[community_props['partition'] == comm_id]
622
+ print(f"\nCommunity {comm_id}:")
623
+ print(f" Size: {len(comm_data)}")
624
+ print(f" Avg tables: {comm_data['num_tables'].mean():.2f}")
625
+ print(f" Avg columns: {comm_data['num_columns'].mean():.2f}")
626
+ ```
627
+
628
+ ## Applications
629
+
630
+ ### 1. Federated Learning Research
631
+ Use the similarity graph to identify database pairs for federated learning experiments. The high-similarity pairs (≥0.98) are ideal for horizontal federated learning scenarios.
632
+
633
+ ### 2. Schema Matching
634
+ Leverage structural properties and similarity metrics for automated schema matching and integration tasks.
635
+
636
+ ### 3. Database Clustering
637
+ Use embeddings and community detection results to group similar databases for analysis or optimization.
638
+
639
+ ### 4. Data Quality Assessment
640
+ Column-level statistics (cardinality, entropy, sparsity) enable systematic data quality evaluation across large database collections.
641
+
642
+ ### 5. Graph Neural Networks
643
+ The DGL graph format is ready for training GNN models for link prediction, node classification, or graph classification tasks.
644
+
645
+ ## Technical Details
646
+
647
+ ### Similarity Computation
648
+ - **Method**: BGE (BAAI General Embedding) model for semantic embeddings
649
+ - **Metric**: Cosine similarity
650
+ - **Thresholds**: Multiple thresholds available (0.6713, 0.94, 0.96)
651
+
652
+ ### Graph Construction
653
+ - **Nodes**: Database IDs (0 to 99,999)
654
+ - **Edges**: Database pairs with similarity above threshold
655
+ - **Edge weights**: Cosine similarity scores
656
+ - **Format**: DGL binary format for efficient loading
657
+
658
+ ### Community Detection
659
+ - **Algorithm**: Louvain method
660
+ - **Modularity**: 0.5366 (indicates well-defined communities)
661
+ - **Resolution**: Default parameter
662
+
663
+ ### Data Processing Pipeline
664
+ 1. Schema extraction from Wikidata databases
665
+ 2. Semantic embedding generation using BGE
666
+ 3. Similarity computation across all pairs
667
+ 4. Graph construction and filtering
668
+ 5. Property extraction and statistical analysis
669
+ 6. Community detection and clustering
670
+
671
+ ## Data Format Standards
672
+
673
+ ### Database ID Formats
674
+ - **Integer IDs**: Used in most files (0-99999)
675
+ - **Padded strings**: Used in some files (e.g., "00000", "00001")
676
+ - **Conversion**: `str(db_id).zfill(5)` for integer to padded string
677
+
678
+ ### Missing Values
679
+ - Numerical columns: May contain `NaN` or `-0.0`
680
+ - String columns: Empty strings or missing entries
681
+ - Sparsity column: Explicit ratio of missing values
682
+
683
+ ### Data Types
684
+ - `float32`: Similarity scores, weights, entropy
685
+ - `float64`: Statistical measures, ratios
686
+ - `int64`: Counts, IDs
687
+ - `string`: Names, identifiers
688
+
689
+ ## File Size Information
690
+
691
+ Approximate file sizes:
692
+ - `graph_raw_0.94.dgl`: ~2.5 GB
693
+ - `database_embeddings.pt`: ~300 MB
694
+ - `filtered_edges_threshold_0.94.csv`: ~800 MB
695
+ - `edge_structural_properties_GED_0.94.csv`: ~400 MB
696
+ - `node_structural_properties.csv`: ~50 MB
697
+ - Column statistics CSVs: ~20-50 MB each
698
+ - Other files: <10 MB each
699
+
700
+ ## Citation
701
+
702
+ If you use this dataset in your research, please cite:
703
+
704
+ ```bibtex
705
+ @article{wu2025wikidbgraph,
706
+ title={WikiDBGraph: Large-Scale Database Graph of Wikidata for Collaborative Learning},
707
+ author={Wu, Zhaomin and Wang, Ziyang and He, Bingsheng},
708
+ journal={arXiv preprint arXiv:2505.16635},
709
+ year={2025}
710
+ }
711
+ ```
712
+
713
+ ## License
714
+
715
+ This dataset is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
716
+
717
+ ## Acknowledgments
718
+
719
+ This dataset is derived from Wikidata and builds upon the WikiDBGraph system for graph-based database analysis and federated learning. We acknowledge the Wikidata community for providing the underlying data infrastructure.