Datasets:

Languages:
English
DOI:
License:
arminmehrabian commited on
Commit
7bb20cb
·
1 Parent(s): 79ce32b

Update dataset and dataset card for NASA Knowledge Graph v1.1.0

Browse files
Files changed (4) hide show
  1. README.md +468 -80
  2. graph.cypher +2 -2
  3. graph.graphml +2 -2
  4. graph.json +2 -2
README.md CHANGED
@@ -12,18 +12,48 @@ tags:
12
 
13
  # NASA Knowledge Graph Dataset
14
 
15
- ## 🚀 **Update Notice**
16
- **Version v1.1.0 - Updated on: 2025-02-19**
17
 
18
- This is the updated version of the NASA Knowledge Graph Dataset, reflecting new datasets, publications, and relationships as of February 2025. This version includes improved node connectivity, updated embeddings, and refined dataset linking.
19
 
20
- ---
21
 
22
- ## Dataset Summary
23
-
24
- The **NASA Knowledge Graph Dataset** is an expansive graph-based dataset designed to integrate and interconnect information about satellite datasets, scientific publications, instruments, platforms, projects, data centers, and science keywords. This knowledge graph focuses on datasets managed by NASA's Distributed Active Archive Centers (DAACs), along with datasets from 184+ data providers worldwide, including government agencies and academic institutions.
25
 
26
- The graph bridges scientific publications with the datasets they reference, enabling advanced analyses such as discovering influential datasets, understanding research trends, and exploring scientific collaborations.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  ---
29
 
@@ -31,16 +61,17 @@ The graph bridges scientific publications with the datasets they reference, enab
31
 
32
  Each file in the dataset has a SHA-256 checksum to verify its integrity:
33
 
34
- | File Name | SHA-256 Checksum |
35
- |----------------|---------------------------------------------------------------------------|
36
- | `graph.cypher` | `6aef9d433ea1179f0b006e9c402ca48d487e78cb193d4535e920d61c078cbae3` |
37
- | `graph.graphml`| `3b653606e7ed6ee5e4367d2b4e8c4800240e1c9dc9520eec5803a2f3204ebe5a` |
38
- | `graph.json` | `8d49fc801f87cb43dfdadb3dc77a6e1b2b1e7e8044b46883f398b69a71dd3ac4` |
39
 
40
  ### Verification
41
 
42
- To verify file integrity, calculate the SHA-256 checksum and compare it with the provided hashes:
43
 
 
44
  ```python
45
  import hashlib
46
 
@@ -50,119 +81,476 @@ def calculate_sha256(filepath):
50
  for byte_block in iter(lambda: f.read(4096), b""):
51
  sha256_hash.update(byte_block)
52
  return sha256_hash.hexdigest()
53
-
54
- print(calculate_sha256("graph.json"))
55
  ```
56
 
57
- ---
58
 
59
- ## Dataset Statistics
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
- ### Total Counts
 
62
 
63
- | Type | Count |
64
- |----------------------|-----------|
65
- | **Total Nodes** | 145,047 |
66
- | **Total Relationships** | 406,444 |
67
 
68
- ### Node Label Counts
 
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  | Node Label | Count |
71
  |-------------------|----------|
72
- | Publication | 134,724 |
73
- | Dataset | 6,817 |
74
- | ScienceKeyword | 1,609 |
75
- | Instrument | 897 |
76
- | Platform | 451 |
77
- | Project | 352 |
78
  | DataCenter | 197 |
 
 
 
 
 
79
 
80
- ### Relationship Label Counts
81
-
82
  | Relationship Label | Count |
83
  |---------------------------|-----------|
84
  | CITES | 208,429 |
85
  | HAS_APPLIEDRESEARCHAREA | 119,695 |
86
- | USES_DATASET | 25,814 |
87
- | HAS_SCIENCEKEYWORD | 21,559 |
88
- | HAS_PLATFORM | 10,393 |
89
- | HAS_DATASET | 9,830 |
90
- | OF_PROJECT | 6,375 |
91
  | HAS_INSTRUMENT | 2,526 |
 
 
92
  | HAS_SUBCATEGORY | 1,823 |
 
 
93
 
94
- ---
95
 
96
- ## Dataset Structure
97
 
98
- The knowledge graph consists of seven main node types representing different entities within NASA's ecosystem:
99
 
100
- 1. **Dataset:** Satellite datasets managed by NASA DAACs and other providers.
101
- 2. **Publication:** Research publications referencing datasets.
102
- 3. **ScienceKeyword:** Keywords classifying datasets and publications.
103
- 4. **Instrument:** Instruments used for data collection.
104
- 5. **Platform:** Satellites and airborne platforms hosting instruments.
105
- 6. **Project:** NASA projects associated with datasets.
106
- 7. **DataCenter:** DAACs and other data providers.
107
 
108
- **Relationships:** Nodes are connected by relationships such as `CITES`, `USES_DATASET`, `HAS_PLATFORM`, and `HAS_SCIENCEKEYWORD`.
 
 
109
 
110
- ---
111
 
112
- ## Data Formats
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
 
114
- The dataset is available in three formats:
 
 
115
 
116
- 1. **JSON:** Hierarchical format suitable for APIs and web applications.
117
- 2. **GraphML:** XML-based format compatible with graph analysis tools.
118
- 3. **Cypher:** Cypher commands to recreate the graph structure.
119
 
120
- ### Loading the Dataset
121
 
122
- **Using Cypher:**
123
  ```cypher
124
- // Import GraphML
125
- CALL apoc.import.graphml("graph.graphml", {readLabels: true});
126
  ```
127
 
128
- **Using Python (Neo4j Driver):**
129
- ```python
130
- from neo4j import GraphDatabase
 
 
 
 
 
 
131
 
132
- def load_data():
133
- uri = "bolt://localhost:7687"
134
- auth = ("neo4j", "password")
135
- driver = GraphDatabase.driver(uri, auth=auth)
 
 
 
136
 
137
- with driver.session() as session:
138
- session.run("CALL apoc.import.json('graph.json')")
139
- driver.close()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
- load_data()
142
  ```
143
 
144
  ---
145
 
146
  ## Citation
147
 
148
- **NASA Goddard Earth Sciences Data and Information Services Center (GES-DISC).** (2025). *Knowledge Graph of NASA Earth Observations Satellite Datasets and Related Research Publications* [Data set]. DOI: [10.57967/hf/3463](https://doi.org/10.57967/hf/3463)
 
 
149
 
150
  ### BibTeX
151
  ```bibtex
152
- @misc{nasa_knowledge_graph_2025,
153
- author = {NASA Goddard Earth Sciences Data and Information Services Center (GES-DISC)},
154
- title = {NASA Knowledge Graph Dataset (Version 2.0)},
155
- year = 2025,
156
- url = {https://huggingface.co/datasets/nasa-gesdisc/nasa-eo-knowledge-graph},
157
- doi = {10.57967/hf/3463},
158
- publisher = {Hugging Face}
159
  }
160
  ```
161
 
162
- ---
 
 
 
 
 
 
163
 
164
- ## Contact
165
- For inquiries, please contact:
166
  - Armin Mehrabian: [[email protected]](mailto:[email protected])
167
  - Irina Gerasimov: [[email protected]](mailto:[email protected])
168
  - Kendall Gilbert: [[email protected]](mailto:[email protected])
 
12
 
13
  # NASA Knowledge Graph Dataset
14
 
15
+ ## Dataset Summary
 
16
 
17
+ The **NASA Knowledge Graph Dataset** is an expansive graph-based dataset designed to integrate and interconnect information about satellite datasets, scientific publications, instruments, platforms, projects, data centers, and science keywords. This knowledge graph is particularly focused on datasets managed by NASA's Distributed Active Archive Centers (DAACs), which are NASA's data repositories responsible for archiving and distributing scientific data. In addition to NASA DAACs, the graph includes datasets from 184 data providers worldwide, including various government agencies and academic institutions.
18
 
19
+ The primary goal of the NASA Knowledge Graph is to bridge scientific publications with the datasets they reference, facilitating deeper insights and research opportunities within NASA's scientific and data ecosystem. By organizing these interconnections within a graph structure, this dataset enables advanced analyses, such as discovering influential datasets, understanding research trends, and exploring scientific collaborations.
20
 
21
+ ---
 
 
22
 
23
+ ## What's Changed (v1.1.0) - Feb 25th, 2025
24
+
25
+ ### 1. Node Changes
26
+ - **Total Nodes:** Increased from 135,764 to 145,678 (+9,914)
27
+ - **New Node Counts:**
28
+ - **Dataset:** Increased from 6,390 to 6,821 (+431)
29
+ - **DataCenter:** Increased from 184 to 197 (+13)
30
+ - **Instrument:** Increased from 867 to 897 (+30)
31
+ - **Platform:** Increased from 442 to 451 (+9)
32
+ - **Project:** Increased from 333 to 351 (+18)
33
+ - **Publication:** Increased from 125,939 to 135,352 (+9,413)
34
+ - **ScienceKeyword:** Remained the same at 1,609
35
+
36
+ ### 2. Relationship Changes
37
+ - **Total Relationships:** Increased from 365,857 to 406,515 (+40,658)
38
+ - **Updated Relationship Counts:**
39
+ - **CITES:** Decreased from 208,670 to 208,429 (-241)
40
+ - **HAS_APPLIED_RESEARCH_AREA:** Increased from 89,039 to 119,695 (+30,656)
41
+ - **HAS_DATASET:** Increased from 9,017 to 9,834 (+817)
42
+ - **HAS_INSTRUMENT:** Increased from 2,469 to 2,526 (+57)
43
+ - **HAS_PLATFORM:** Increased from 9,884 to 10,398 (+514)
44
+ - **HAS_SCIENCEKEYWORD:** Increased from 20,436 to 21,571 (+1,135)
45
+ - **HAS_SUBCATEGORY:** Remained the same at 1,823
46
+ - **OF_PROJECT:** Increased from 6,049 to 6,378 (+329)
47
+ - **USES_DATASET:** Increased from 18,470 to 25,861 (+7,391)
48
+
49
+ ### 3. Property Changes
50
+ - **Removed Properties:**
51
+ - `pagerank_global`
52
+ - `fastrp_embedding_with_labels`
53
+ - **Added Properties:**
54
+ - `pagerank_publication_dataset` (Float) for `Dataset` and `Publication` nodes
55
+
56
+ These changes reflect the addition of new datasets, publications, and relationships, alongside the streamlined properties to improve data efficiency and analysis potential.
57
 
58
  ---
59
 
 
61
 
62
  Each file in the dataset has a SHA-256 checksum to verify its integrity:
63
 
64
+ | File Name | SHA-256 Checksum |
65
+ |----------------------------|---------------------------------------------------------------------------|
66
+ | `graph.cypher` | `99710792de412ce1977f1172d0458de1b0ea3d387e33adcd32adbec63c2238c1` |
67
+ | `graph.graphml` | `00f2848602104c073a97ca65ff7d3e10c5bdddcc1fe5ede69cb21d4bfbbe8a89` |
68
+ | `graph.json` | `bb415c8579c31b2ec80cc83dedc5660ead6be2f5f2fcd3c162433ec73d6f5280` |
69
 
70
  ### Verification
71
 
72
+ To verify the integrity of each file, calculate its SHA-256 checksum and compare it with the hashes provided above.
73
 
74
+ You can use the following Python code to calculate the SHA-256 checksum:
75
  ```python
76
  import hashlib
77
 
 
81
  for byte_block in iter(lambda: f.read(4096), b""):
82
  sha256_hash.update(byte_block)
83
  return sha256_hash.hexdigest()
 
 
84
  ```
85
 
 
86
 
87
+ ## Dataset Structure
88
+
89
+ ### Nodes and Properties
90
+
91
+ The knowledge graph consists of seven main node types, each representing a different entity within NASA's ecosystem:
92
+
93
+ ## Dataset Structure
94
+
95
+ ### Nodes and Properties
96
+
97
+ #### 1. Dataset
98
+
99
+ - **Description**: Represents satellite datasets, particularly those managed by NASA DAACs, along with datasets from other governmental and academic data providers. These nodes contain metadata and attributes specific to each dataset.
100
+ - **Properties**:
101
+ - `globalId` (String): Unique identifier for the dataset.
102
+ - `doi` (String): Digital Object Identifier.
103
+ - `shortName` (String): Abbreviated name of the dataset.
104
+ - `longName` (String): Full name of the dataset.
105
+ - `abstract` (String): Brief summary of the dataset.
106
+ - `cmrId` (String): Common Metadata Repository ID.
107
+ - `daac` (String): Distributed Active Archive Center associated with the dataset.
108
+ - `temporalFrequency` (String): Frequency of data collection (e.g., daily, monthly).
109
+ - `temporalExtentStart` (Date): Start date of the dataset's temporal coverage.
110
+ - `temporalExtentEnd` (Date): End date of the dataset's temporal coverage.
111
+ - `nwCorner` (Geo-Coordinate): Northwest corner coordinate of spatial coverage.
112
+ - `seCorner` (Geo-Coordinate): Southeast corner coordinate of spatial coverage.
113
+ - `landingPageUrl` (URL): Webpage link to the dataset.
114
+ - `pagerank_publication_dataset` (Float): PageRank score based on dataset-publication influence.
115
+
116
+ #### 2. Publication
117
+
118
+ - **Description**: This node type captures publications that reference or use datasets, particularly those from NASA DAACs and other included data providers. By linking datasets and publications, this node type enables analysis of scientific impact and research usage of NASA’s datasets.
119
+ - **Properties**:
120
+ - `globalId` (String): Unique identifier for the publication.
121
+ - `DOI` (String): Digital Object Identifier.
122
+ - `title` (String): Title of the publication.
123
+ - `abstract` (String): Summary of the publication's content.
124
+ - `authors` (List<String>): List of authors.
125
+ - `year` (Integer): Year of publication.
126
+ - `pagerank_publication_dataset` (Float): PageRank score based on publication-dataset influence.
127
+
128
+ #### 3. ScienceKeyword
129
+
130
+ - **Description**: Represents scientific keywords used to classify datasets and publications. Keywords provide topical context and aid in identifying research trends and related areas.
131
+ - **Properties**:
132
+ - `globalId` (String): Unique identifier.
133
+ - `name` (String): Name of the science keyword.
134
+
135
+ #### 4. Instrument
136
+
137
+ - **Description**: Instruments used in data collection, often mounted on platforms like satellites. Instruments are linked to the datasets they help generate.
138
+ - **Properties**:
139
+ - `globalId` (String): Unique identifier.
140
+ - `shortName` (String): Abbreviated name.
141
+ - `longName` (String): Full name.
142
+
143
+ #### 5. Platform
144
+
145
+ - **Description**: Platforms, such as satellites or airborne vehicles, that host instruments for data collection.
146
+ - **Properties**:
147
+ - `globalId` (String): Unique identifier.
148
+ - `shortName` (String): Abbreviated name.
149
+ - `longName` (String): Full name.
150
+ - `Type` (String): Type of platform.
151
+
152
+ #### 6. Project
153
+
154
+ - **Description**: NASA projects associated with datasets, often indicating a funding source or collaborative initiative for data collection and research.
155
+ - **Properties**:
156
+ - `globalId` (String): Unique identifier.
157
+ - `shortName` (String): Abbreviated name.
158
+ - `longName` (String): Full name.
159
+
160
+ #### 7. DataCenter
161
+
162
+ - **Description**: Represents data centers, primarily NASA DAACs, as well as other data providers in academia and government who manage and distribute datasets.
163
+ - **Properties**:
164
+ - `globalId` (String): Unique identifier.
165
+ - `shortName` (String): Abbreviated name.
166
+ - `longName` (String): Full name.
167
+ - `url` (URL): Website of the data center.
168
+
169
+ ### Relationships
170
+
171
+ The knowledge graph includes several relationship types that define how nodes are interconnected.
172
+
173
+ #### 1. HAS_DATASET
174
+
175
+ - **Description**: Connects a `DataCenter` to its `Dataset(s)`.
176
+ - **Properties**: None.
177
+
178
+ #### 2. OF_PROJECT
179
+
180
+ - **Description**: Links a `Dataset` to a `Project`.
181
+ - **Properties**: None.
182
+
183
+ #### 3. HAS_PLATFORM
184
+
185
+ - **Description**: Associates a `Dataset` with a `Platform`.
186
+ - **Properties**: None.
187
+
188
+ #### 4. HAS_INSTRUMENT
189
+
190
+ - **Description**: Connects a `Platform` to an `Instrument`.
191
+ - **Properties**: None.
192
+
193
+ #### 5. HAS_SCIENCEKEYWORD
194
+
195
+ - **Description**: Links a `Dataset` to a `ScienceKeyword`.
196
+ - **Properties**: None.
197
+
198
+ #### 6. HAS_SUBCATEGORY
199
 
200
+ - **Description**: Defines hierarchical relationships between `ScienceKeyword` nodes.
201
+ - **Properties**: None.
202
 
203
+ #### 7. CITES
 
 
 
204
 
205
+ - **Description**: Represents citation relationships between `Publication` nodes, indicating how research builds on previous work.
206
+ - **Properties**: None.
207
 
208
+ #### 8. HAS_APPLIED_RESEARCH_AREA
209
+
210
+ - **Description**: Associates a `Publication` with a `ScienceKeyword`.
211
+ - **Properties**: None.
212
+ ```
213
+
214
+ ## Statistics
215
+
216
+ # Data Statistics
217
+
218
+ ## Total Counts
219
+ | Type | Count |
220
+ |----------------------|---------|
221
+ | **Total Nodes** | 145,678 |
222
+ | **Total Relationships** | 406,515 |
223
+
224
+ ## Node Label Counts
225
  | Node Label | Count |
226
  |-------------------|----------|
227
+ | Dataset | 6,821 |
 
 
 
 
 
228
  | DataCenter | 197 |
229
+ | Project | 351 |
230
+ | Platform | 451 |
231
+ | Instrument | 897 |
232
+ | ScienceKeyword | 1,609 |
233
+ | Publication | 135,352 |
234
 
235
+ ## Relationship Label Counts
 
236
  | Relationship Label | Count |
237
  |---------------------------|-----------|
238
  | CITES | 208,429 |
239
  | HAS_APPLIEDRESEARCHAREA | 119,695 |
240
+ | HAS_DATASET | 9,834 |
 
 
 
 
241
  | HAS_INSTRUMENT | 2,526 |
242
+ | HAS_PLATFORM | 10,398 |
243
+ | HAS_SCIENCEKEYWORD | 21,571 |
244
  | HAS_SUBCATEGORY | 1,823 |
245
+ | OF_PROJECT | 6,378 |
246
+ | USES_DATASET | 25,861 |
247
 
 
248
 
249
+ ## Data Formats
250
 
251
+ The Knowledge Graph Dataset is available in three formats:
252
 
253
+ ### 1. JSON
 
 
 
 
 
 
254
 
255
+ - **File**: `graph.json`
256
+ - **Description**: A hierarchical data format representing nodes and relationships. Each node includes its properties, such as `globalId`, `doi`, and `pagerank_global`.
257
+ - **Usage**: Suitable for web applications and APIs, and for use cases where hierarchical data structures are preferred.
258
 
259
+ #### Loading the JSON Format
260
 
261
+ To load the JSON file into a graph database using Python and multiprocessing you can using the following script:
262
+
263
+ ```python
264
+ import json
265
+ from tqdm import tqdm
266
+ from collections import defaultdict
267
+ from multiprocessing import Pool, cpu_count
268
+ from neo4j import GraphDatabase
269
+
270
+ # Batch size for processing
271
+ BATCH_SIZE = 100
272
+
273
+ # Neo4j credentials (replace with environment variables or placeholders)
274
+ NEO4J_URI = "bolt://<your-neo4j-host>:<port>" # e.g., "bolt://localhost:7687"
275
+ NEO4J_USER = "<your-username>"
276
+ NEO4J_PASSWORD = "<your-password>"
277
+
278
+
279
+ def ingest_data(file_path):
280
+ # Initialize counters and label trackers
281
+ node_label_counts = defaultdict(int)
282
+ relationship_label_counts = defaultdict(int)
283
+ node_count = 0
284
+ relationship_count = 0
285
+
286
+ with open(file_path, "r") as f:
287
+ nodes = []
288
+ relationships = []
289
+
290
+ # Read and categorize nodes and relationships, and count labels
291
+ for line in tqdm(f, desc="Reading JSON Lines"):
292
+ obj = json.loads(line.strip())
293
+ if obj["type"] == "node":
294
+ nodes.append(obj)
295
+ node_count += 1
296
+ for label in obj["labels"]:
297
+ node_label_counts[label] += 1
298
+ elif obj["type"] == "relationship":
299
+ relationships.append(obj)
300
+ relationship_count += 1
301
+ relationship_label_counts[obj["label"]] += 1
302
+
303
+ # Print statistics
304
+ print("\n=== Data Statistics ===")
305
+ print(f"Total Nodes: {node_count}")
306
+ print(f"Total Relationships: {relationship_count}")
307
+ print("\nNode Label Counts:")
308
+ for label, count in node_label_counts.items():
309
+ print(f" {label}: {count}")
310
+ print("\nRelationship Label Counts:")
311
+ for label, count in relationship_label_counts.items():
312
+ print(f" {label}: {count}")
313
+ print("=======================")
314
+
315
+ # Multiprocess node ingestion
316
+ print("Starting Node Ingestion...")
317
+ node_batches = [nodes[i : i + BATCH_SIZE] for i in range(0, len(nodes), BATCH_SIZE)]
318
+ with Pool(processes=cpu_count()) as pool:
319
+ list(
320
+ tqdm(
321
+ pool.imap(ingest_nodes_batch, node_batches),
322
+ total=len(node_batches),
323
+ desc="Ingesting Nodes",
324
+ )
325
+ )
326
+
327
+ # Multiprocess relationship ingestion
328
+ print("Starting Relationship Ingestion...")
329
+ relationship_batches = [
330
+ relationships[i : i + BATCH_SIZE]
331
+ for i in range(0, len(relationships), BATCH_SIZE)
332
+ ]
333
+ with Pool(processes=cpu_count()) as pool:
334
+ list(
335
+ tqdm(
336
+ pool.imap(ingest_relationships_batch, relationship_batches),
337
+ total=len(relationship_batches),
338
+ desc="Ingesting Relationships",
339
+ )
340
+ )
341
+
342
+
343
+ def ingest_nodes_batch(batch):
344
+ with GraphDatabase.driver(NEO4J_URI, auth=(NEO4J_USER, NEO4J_PASSWORD)) as driver:
345
+ with driver.session() as session:
346
+ for node in batch:
347
+ try:
348
+ label = node["labels"][0] # Assumes a single label per node
349
+ query = f"""
350
+ MERGE (n:{label} {{globalId: $globalId}})
351
+ SET n += $properties
352
+ """
353
+ session.run(
354
+ query,
355
+ globalId=node["properties"]["globalId"],
356
+ properties=node["properties"],
357
+ )
358
+ except Exception as e:
359
+ print(
360
+ f"Error ingesting node with globalId {node['properties']['globalId']}: {e}"
361
+ )
362
+
363
+
364
+ def ingest_relationships_batch(batch):
365
+ with GraphDatabase.driver(NEO4J_URI, auth=(NEO4J_USER, NEO4J_PASSWORD)) as driver:
366
+ with driver.session() as session:
367
+ for relationship in batch:
368
+ try:
369
+ rel_type = relationship[
370
+ "label"
371
+ ] # Use the label for the relationship
372
+ query = f"""
373
+ MATCH (start {{globalId: $start_globalId}})
374
+ MATCH (end {{globalId: $end_globalId}})
375
+ MERGE (start)-[r:{rel_type}]->(end)
376
+ """
377
+ session.run(
378
+ query,
379
+ start_globalId=relationship["start"]["properties"]["globalId"],
380
+ end_globalId=relationship["end"]["properties"]["globalId"],
381
+ )
382
+ except Exception as e:
383
+ print(
384
+ f"Error ingesting relationship with label {relationship['label']}: {e}"
385
+ )
386
+
387
+
388
+ if __name__ == "__main__":
389
+ # Path to the JSON file
390
+ JSON_FILE_PATH = "<path-to-your-graph.json>"
391
+
392
+ # Run the ingestion process
393
+ ingest_data(JSON_FILE_PATH)
394
+
395
+ ```
396
+
397
+ ### 2. GraphML
398
 
399
+ - **File**: `graph.graphml`
400
+ - **Description**: An XML-based format well-suited for complex graph structures and metadata-rich representations.
401
+ - **Usage**: Compatible with graph visualization and analysis tools, including Gephi, Cytoscape, and databases that support GraphML import.
402
 
403
+ #### Loading the GraphML Format
 
 
404
 
405
+ To import the GraphML file into a graph database with APOC support, use the following command:
406
 
 
407
  ```cypher
408
+ CALL apoc.import.graphml("path/to/graph.graphml", {readLabels: true})
 
409
  ```
410
 
411
+ ### 3. Cypher
412
+
413
+ - **File**: `graph.cypher`
414
+ - **Description**: A series of Cypher commands to recreate the knowledge graph structure.
415
+ - **Usage**: Useful for recreating the graph in any Cypher-compatible graph database.
416
+
417
+ #### Loading the Cypher Format
418
+
419
+ To load the Cypher script, execute it directly using a command-line interface for your graph database:
420
 
421
+ ```bash
422
+ neo4j-shell -file path/to/graph.cypher
423
+ ```
424
+
425
+ ### 4. Loading the Knowledge Graph into PyTorch Geometric (PyG)
426
+
427
+ This knowledge graph can be loaded into PyG (PyTorch Geometric) for further processing, analysis, or model training. Below is an example script that shows how to load the JSON data into a PyG-compatible `HeteroData` object.
428
 
429
+ The script first reads the JSON data, processes nodes and relationships, and then loads everything into a `HeteroData` object for use with PyG.
430
+
431
+ ```python
432
+ import json
433
+ import torch
434
+ from torch_geometric.data import HeteroData
435
+ from collections import defaultdict
436
+
437
+ # Load JSON data from file
438
+ file_path = "path/to/graph.json" # Replace with your actual file path
439
+ graph_data = []
440
+ with open(file_path, "r") as f:
441
+ for line in f:
442
+ try:
443
+ graph_data.append(json.loads(line))
444
+ except json.JSONDecodeError as e:
445
+ print(f"Error decoding JSON line: {e}")
446
+ continue
447
+
448
+ # Initialize HeteroData object
449
+ data = HeteroData()
450
+
451
+ # Mapping for node indices per node type
452
+ node_mappings = defaultdict(dict)
453
+
454
+ # Temporary storage for properties to reduce concatenation cost
455
+ node_properties = defaultdict(lambda: defaultdict(list))
456
+ edge_indices = defaultdict(lambda: defaultdict(list))
457
+
458
+ # Process each item in the loaded JSON data
459
+ for item in graph_data:
460
+ if item['type'] == 'node':
461
+ node_type = item['labels'][0] # Assuming first label is the node type
462
+ node_id = item['id']
463
+ properties = item['properties']
464
+
465
+ # Store the node index mapping
466
+ node_index = len(node_mappings[node_type])
467
+ node_mappings[node_type][node_id] = node_index
468
+
469
+ # Store properties temporarily by type
470
+ for key, value in properties.items():
471
+ if isinstance(value, list) and all(isinstance(v, (int, float)) for v in value):
472
+ node_properties[node_type][key].append(torch.tensor(value, dtype=torch.float))
473
+ elif isinstance(value, (int, float)):
474
+ node_properties[node_type][key].append(torch.tensor([value], dtype=torch.float))
475
+ else:
476
+ node_properties[node_type][key].append(value) # non-numeric properties as lists
477
+
478
+ elif item['type'] == 'relationship':
479
+ start_type = item['start']['labels'][0]
480
+ end_type = item['end']['labels'][0]
481
+ start_id = item['start']['id']
482
+ end_id = item['end']['id']
483
+ edge_type = item['label']
484
+
485
+ # Map start and end node indices
486
+ start_idx = node_mappings[start_type][start_id]
487
+ end_idx = node_mappings[end_type][end_id]
488
+
489
+ # Append to edge list
490
+ edge_indices[(start_type, edge_type, end_type)]['start'].append(start_idx)
491
+ edge_indices[(start_type, edge_type, end_type)]['end'].append(end_idx)
492
+
493
+ # Finalize node properties by batch processing
494
+ for node_type, properties in node_properties.items():
495
+ data[node_type].num_nodes = len(node_mappings[node_type])
496
+ for key, values in properties.items():
497
+ if isinstance(values[0], torch.Tensor):
498
+ data[node_type][key] = torch.stack(values)
499
+ else:
500
+ data[node_type][key] = values # Keep non-tensor properties as lists
501
+
502
+ # Finalize edge indices in bulk
503
+ for (start_type, edge_type, end_type), indices in edge_indices.items():
504
+ edge_index = torch.tensor([indices['start'], indices['end']], dtype=torch.long)
505
+ data[start_type, edge_type, end_type].edge_index = edge_index
506
+
507
+ # Display statistics for verification
508
+ print("Nodes and Properties:")
509
+ for node_type in data.node_types:
510
+ print(f"\nNode Type: {node_type}")
511
+ print(f"Number of Nodes: {data[node_type].num_nodes}")
512
+ for key, value in data[node_type].items():
513
+ if key != 'num_nodes':
514
+ if isinstance(value, torch.Tensor):
515
+ print(f" - {key}: {value.shape}")
516
+ else:
517
+ print(f" - {key}: {len(value)} items (non-numeric)")
518
+
519
+ print("\nEdges and Types:")
520
+ for edge_type in data.edge_types:
521
+ edge_index = data[edge_type].edge_index
522
+ print(f"Edge Type: {edge_type} - Number of Edges: {edge_index.size(1)} - Shape: {edge_index.shape}")
523
 
 
524
  ```
525
 
526
  ---
527
 
528
  ## Citation
529
 
530
+ Please cite the dataset as follows:
531
+
532
+ **NASA Goddard Earth Sciences Data and Information Services Center (GES-DISC).** (2024). *Knowledge Graph of NASA Earth Observations Satellite Datasets and Related Research Publications* [Data set]. DOI: [10.57967/hf/3463](https://doi.org/10.57967/hf/3463)
533
 
534
  ### BibTeX
535
  ```bibtex
536
+ @misc {nasa_goddard_earth_sciences_data_and_information_services_center__(ges-disc)_2024,
537
+ author = { {NASA Goddard Earth Sciences Data and Information Services Center (GES-DISC)} },
538
+ title = { nasa-eo-knowledge-graph },
539
+ year = 2024,
540
+ url = { https://huggingface.co/datasets/nasa-gesdisc/nasa-eo-knowledge-graph },
541
+ doi = { 10.57967/hf/3463 },
542
+ publisher = { Hugging Face }
543
  }
544
  ```
545
 
546
+ ## References
547
+ For details on the process of collecting these publications, please refer to:
548
+
549
+ Gerasimov, I., Savtchenko, A., Alfred, J., Acker, J., Wei, J., & KC, B. (2024). *Bridging the Gap: Enhancing Prominence and Provenance of NASA Datasets in Research Publications.* Data Science Journal, 23(1). DOI: [10.5334/dsj-2024-001](https://doi.org/10.5334/dsj-2024-001)
550
+
551
+
552
+ For any questions or further information, please contact:
553
 
 
 
554
  - Armin Mehrabian: [[email protected]](mailto:[email protected])
555
  - Irina Gerasimov: [[email protected]](mailto:[email protected])
556
  - Kendall Gilbert: [[email protected]](mailto:[email protected])
graph.cypher CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6aef9d433ea1179f0b006e9c402ca48d487e78cb193d4535e920d61c078cbae3
3
- size 297709550
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99710792de412ce1977f1172d0458de1b0ea3d387e33adcd32adbec63c2238c1
3
+ size 306363047
graph.graphml CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3b653606e7ed6ee5e4367d2b4e8c4800240e1c9dc9520eec5803a2f3204ebe5a
3
- size 320845858
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00f2848602104c073a97ca65ff7d3e10c5bdddcc1fe5ede69cb21d4bfbbe8a89
3
+ size 332522909
graph.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8d49fc801f87cb43dfdadb3dc77a6e1b2b1e7e8044b46883f398b69a71dd3ac4
3
- size 1504091353
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb415c8579c31b2ec80cc83dedc5660ead6be2f5f2fcd3c162433ec73d6f5280
3
+ size 1558420753