Datasets:

Languages:
English
DOI:
License:
arminmehrabian's picture
Update READM for version v1.0.1
87308e5 verified
metadata
license: apache-2.0
language:
  - en
tags:
  - NASA
  - Earth
  - Satellite
  - Knowledge Graph
  - Machine Learning

NASA Knowledge Graph Dataset

Dataset Summary

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.

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.

Data Integrity

Each file in the dataset has a SHA-256 checksum to verify its integrity:

File Name SHA-256 Checksum
graph.cypher d78f7b166a86be3ceec16db75a1575dac95249af188b1d2e2adab7388a8e654a
graph.graphml a781e358b338a181db5081a50127325febab67dcb283cb4124c877bf06de439e
graph.json 4794fd070953b3544ba3c841f13155f1cf8a1ca9abd1b240bbfaf482ce2cde32

Verification

To verify the integrity of each file, calculate its SHA-256 checksum and compare it with the hashes provided above.

You can use the following Python code to calculate the SHA-256 checksum:

import hashlib

def calculate_sha256(filepath):
    sha256_hash = hashlib.sha256()
    with open(filepath, "rb") as f:
        for byte_block in iter(lambda: f.read(4096), b""):
            sha256_hash.update(byte_block)
    return sha256_hash.hexdigest()

Dataset Structure

Nodes and Properties

The knowledge graph consists of seven main node types, each representing a different entity within NASA's ecosystem:

1. Dataset

  • 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.
  • Properties:
    • globalId (String): Unique identifier for the dataset.
    • doi (String): Digital Object Identifier.
    • shortName (String): Abbreviated name of the dataset.
    • longName (String): Full name of the dataset.
    • abstract (String): Brief summary of the dataset.
    • cmrId (String): Common Metadata Repository ID.
    • daac (String): Distributed Active Archive Center associated with the dataset.
    • temporalFrequency (String): Frequency of data collection (e.g., daily, monthly).
    • temporalExtentStart (Date): Start date of the dataset's temporal coverage.
    • temporalExtentEnd (Date): End date of the dataset's temporal coverage.
    • nwCorner (Geo-Coordinate): Northwest corner coordinate of spatial coverage.
    • seCorner (Geo-Coordinate): Southeast corner coordinate of spatial coverage.
    • landingPageUrl (URL): Webpage link to the dataset.
    • pagerank_global (Float): PageRank score calculated using the natural graph direction.
    • fastrp_embedding_with_labels (List): FastRP embedding vector considering node labels.

2. Publication

  • 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.
  • Properties:
    • globalId (String): Unique identifier for the publication.
    • DOI (String): Digital Object Identifier.
    • title (String): Title of the publication.
    • abstract (String): Summary of the publication's content.
    • authors (List): List of authors.
    • year (Integer): Year of publication.
    • pagerank_global (Float): PageRank score.
    • fastrp_embedding_with_labels (List): FastRP embedding vector.

3. ScienceKeyword

  • Description: Represents scientific keywords used to classify datasets and publications. Keywords provide topical context and aid in identifying research trends and related areas.
  • Properties:
    • globalId (String): Unique identifier.
    • name (String): Name of the science keyword.
    • pagerank_global (Float): PageRank score.
    • fastrp_embedding_with_labels (List): FastRP embedding vector.

4. Instrument

  • Description: Instruments used in data collection, often mounted on platforms like satellites. Instruments are linked to the datasets they help generate.
  • Properties:
    • globalId (String): Unique identifier.
    • shortName (String): Abbreviated name.
    • longName (String): Full name.
    • pagerank_global (Float): PageRank score.
    • fastrp_embedding_with_labels (List): FastRP embedding vector.

5. Platform

  • Description: Platforms, such as satellites or airborne vehicles, that host instruments for data collection.
  • Properties:
    • globalId (String): Unique identifier.
    • shortName (String): Abbreviated name.
    • longName (String): Full name.
    • Type (String): Type of platform.
    • pagerank_global (Float): PageRank score.
    • fastrp_embedding_with_labels (List): FastRP embedding vector.

6. Project

  • Description: NASA projects associated with datasets, often indicating a funding source or collaborative initiative for data collection and research.
  • Properties:
    • globalId (String): Unique identifier.
    • shortName (String): Abbreviated name.
    • longName (String): Full name.
    • pagerank_global (Float): PageRank score.
    • fastrp_embedding_with_labels (List): FastRP embedding vector.

7. DataCenter

  • Description: Represents data centers, primarily NASA DAACs, as well as other data providers in academia and government who manage and distribute datasets.
  • Properties:
    • globalId (String): Unique identifier.
    • shortName (String): Abbreviated name.
    • longName (String): Full name.
    • url (URL): Website of the data center.
    • pagerank_global (Float): PageRank score.
    • fastrp_embedding_with_labels (List): FastRP embedding vector.

Relationships

The knowledge graph includes several relationship types that define how nodes are interconnected.

1. HAS_DATASET

  • Description: Connects a DataCenter to its Dataset(s).
  • Properties: None.

2. OF_PROJECT

  • Description: Links a Dataset to a Project.
  • Properties: None.

3. HAS_PLATFORM

  • Description: Associates a Dataset with a Platform.
  • Properties: None.

4. HAS_INSTRUMENT

  • Description: Connects a Platform to an Instrument.
  • Properties: None.

5. HAS_SCIENCEKEYWORD

  • Description: Links a Dataset to a ScienceKeyword.
  • Properties: None.

6. HAS_SUBCATEGORY

  • Description: Defines hierarchical relationships between ScienceKeyword nodes.
  • Properties: None.

7. CITES

  • Description: Represents citation relationships between Publication nodes, indicating how research builds on previous work.
  • Properties: None.

8. HAS_APPLIED_RESEARCH_AREA

  • Description: Associates a Publication with a ScienceKeyword.
  • Properties: None.

Statistics

Data Statistics

Total Counts

Type Count
Total Nodes 135,764
Total Relationships 365,857

Node Label Counts

Node Label Count
Dataset 6,390
DataCenter 184
Project 333
Platform 442
Instrument 867
ScienceKeyword 1,609
Publication 125,939

Relationship Label Counts

Relationship Label Count
HAS_DATASET 9,017
OF_PROJECT 6,049
HAS_PLATFORM 9,884
HAS_INSTRUMENT 2,469
HAS_SUBCATEGORY 1,823
HAS_SCIENCEKEYWORD 20,436
CITES 208,670
HAS_APPLIED_RESEARCH_AREA 89,039
USES_DATASET 18,470

Data Formats

The Knowledge Graph Dataset is available in three formats:

1. JSON

  • File: graph.json
  • Description: A hierarchical data format representing nodes and relationships. Each node includes its properties, such as globalId, doi, and pagerank_global.
  • Usage: Suitable for web applications and APIs, and for use cases where hierarchical data structures are preferred.

Loading the JSON Format

To load the JSON file into a graph database using Python and multiprocessing you can using the following script:

import json
from tqdm import tqdm
from collections import defaultdict
from multiprocessing import Pool, cpu_count
from neo4j import GraphDatabase

# Batch size for processing
BATCH_SIZE = 100

# Neo4j credentials (replace with environment variables or placeholders)
NEO4J_URI = "bolt://<your-neo4j-host>:<port>"  # e.g., "bolt://localhost:7687"
NEO4J_USER = "<your-username>"
NEO4J_PASSWORD = "<your-password>"


def ingest_data(file_path):
    # Initialize counters and label trackers
    node_label_counts = defaultdict(int)
    relationship_label_counts = defaultdict(int)
    node_count = 0
    relationship_count = 0

    with open(file_path, "r") as f:
        nodes = []
        relationships = []

        # Read and categorize nodes and relationships, and count labels
        for line in tqdm(f, desc="Reading JSON Lines"):
            obj = json.loads(line.strip())
            if obj["type"] == "node":
                nodes.append(obj)
                node_count += 1
                for label in obj["labels"]:
                    node_label_counts[label] += 1
            elif obj["type"] == "relationship":
                relationships.append(obj)
                relationship_count += 1
                relationship_label_counts[obj["label"]] += 1

    # Print statistics
    print("\n=== Data Statistics ===")
    print(f"Total Nodes: {node_count}")
    print(f"Total Relationships: {relationship_count}")
    print("\nNode Label Counts:")
    for label, count in node_label_counts.items():
        print(f"  {label}: {count}")
    print("\nRelationship Label Counts:")
    for label, count in relationship_label_counts.items():
        print(f"  {label}: {count}")
    print("=======================")

    # Multiprocess node ingestion
    print("Starting Node Ingestion...")
    node_batches = [nodes[i : i + BATCH_SIZE] for i in range(0, len(nodes), BATCH_SIZE)]
    with Pool(processes=cpu_count()) as pool:
        list(
            tqdm(
                pool.imap(ingest_nodes_batch, node_batches),
                total=len(node_batches),
                desc="Ingesting Nodes",
            )
        )

    # Multiprocess relationship ingestion
    print("Starting Relationship Ingestion...")
    relationship_batches = [
        relationships[i : i + BATCH_SIZE]
        for i in range(0, len(relationships), BATCH_SIZE)
    ]
    with Pool(processes=cpu_count()) as pool:
        list(
            tqdm(
                pool.imap(ingest_relationships_batch, relationship_batches),
                total=len(relationship_batches),
                desc="Ingesting Relationships",
            )
        )


def ingest_nodes_batch(batch):
    with GraphDatabase.driver(NEO4J_URI, auth=(NEO4J_USER, NEO4J_PASSWORD)) as driver:
        with driver.session() as session:
            for node in batch:
                try:
                    label = node["labels"][0]  # Assumes a single label per node
                    query = f"""
                    MERGE (n:{label} {{globalId: $globalId}})
                    SET n += $properties
                    """
                    session.run(
                        query,
                        globalId=node["properties"]["globalId"],
                        properties=node["properties"],
                    )
                except Exception as e:
                    print(
                        f"Error ingesting node with globalId {node['properties']['globalId']}: {e}"
                    )


def ingest_relationships_batch(batch):
    with GraphDatabase.driver(NEO4J_URI, auth=(NEO4J_USER, NEO4J_PASSWORD)) as driver:
        with driver.session() as session:
            for relationship in batch:
                try:
                    rel_type = relationship[
                        "label"
                    ]  # Use the label for the relationship
                    query = f"""
                    MATCH (start {{globalId: $start_globalId}})
                    MATCH (end {{globalId: $end_globalId}})
                    MERGE (start)-[r:{rel_type}]->(end)
                    """
                    session.run(
                        query,
                        start_globalId=relationship["start"]["properties"]["globalId"],
                        end_globalId=relationship["end"]["properties"]["globalId"],
                    )
                except Exception as e:
                    print(
                        f"Error ingesting relationship with label {relationship['label']}: {e}"
                    )


if __name__ == "__main__":
    # Path to the JSON file
    JSON_FILE_PATH = "<path-to-your-graph.json>"

    # Run the ingestion process
    ingest_data(JSON_FILE_PATH)

2. GraphML

  • File: graph.graphml
  • Description: An XML-based format well-suited for complex graph structures and metadata-rich representations.
  • Usage: Compatible with graph visualization and analysis tools, including Gephi, Cytoscape, and databases that support GraphML import.

Loading the GraphML Format

To import the GraphML file into a graph database with APOC support, use the following command:

CALL apoc.import.graphml("path/to/graph.graphml", {readLabels: true})

3. Cypher

  • File: graph.cypher
  • Description: A series of Cypher commands to recreate the knowledge graph structure.
  • Usage: Useful for recreating the graph in any Cypher-compatible graph database.

Loading the Cypher Format

To load the Cypher script, execute it directly using a command-line interface for your graph database:

neo4j-shell -file path/to/graph.cypher

4. Loading the Knowledge Graph into PyTorch Geometric (PyG)

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.

The script first reads the JSON data, processes nodes and relationships, and then loads everything into a HeteroData object for use with PyG.

import json
import torch
from torch_geometric.data import HeteroData
from collections import defaultdict

# Load JSON data from file
file_path = "path/to/graph.json"  # Replace with your actual file path
graph_data = []
with open(file_path, "r") as f:
    for line in f:
        try:
            graph_data.append(json.loads(line))
        except json.JSONDecodeError as e:
            print(f"Error decoding JSON line: {e}")
            continue

# Initialize HeteroData object
data = HeteroData()

# Mapping for node indices per node type
node_mappings = defaultdict(dict)

# Temporary storage for properties to reduce concatenation cost
node_properties = defaultdict(lambda: defaultdict(list))
edge_indices = defaultdict(lambda: defaultdict(list))

# Process each item in the loaded JSON data
for item in graph_data:
    if item['type'] == 'node':
        node_type = item['labels'][0]  # Assuming first label is the node type
        node_id = item['id']
        properties = item['properties']

        # Store the node index mapping
        node_index = len(node_mappings[node_type])
        node_mappings[node_type][node_id] = node_index

        # Store properties temporarily by type
        for key, value in properties.items():
            if isinstance(value, list) and all(isinstance(v, (int, float)) for v in value):
                node_properties[node_type][key].append(torch.tensor(value, dtype=torch.float))
            elif isinstance(value, (int, float)):
                node_properties[node_type][key].append(torch.tensor([value], dtype=torch.float))
            else:
                node_properties[node_type][key].append(value)  # non-numeric properties as lists

    elif item['type'] == 'relationship':
        start_type = item['start']['labels'][0]
        end_type = item['end']['labels'][0]
        start_id = item['start']['id']
        end_id = item['end']['id']
        edge_type = item['label']

        # Map start and end node indices
        start_idx = node_mappings[start_type][start_id]
        end_idx = node_mappings[end_type][end_id]

        # Append to edge list
        edge_indices[(start_type, edge_type, end_type)]['start'].append(start_idx)
        edge_indices[(start_type, edge_type, end_type)]['end'].append(end_idx)

# Finalize node properties by batch processing
for node_type, properties in node_properties.items():
    data[node_type].num_nodes = len(node_mappings[node_type])
    for key, values in properties.items():
        if isinstance(values[0], torch.Tensor):
            data[node_type][key] = torch.stack(values)
        else:
            data[node_type][key] = values  # Keep non-tensor properties as lists

# Finalize edge indices in bulk
for (start_type, edge_type, end_type), indices in edge_indices.items():
    edge_index = torch.tensor([indices['start'], indices['end']], dtype=torch.long)
    data[start_type, edge_type, end_type].edge_index = edge_index

# Display statistics for verification
print("Nodes and Properties:")
for node_type in data.node_types:
    print(f"\nNode Type: {node_type}")
    print(f"Number of Nodes: {data[node_type].num_nodes}")
    for key, value in data[node_type].items():
        if key != 'num_nodes':
            if isinstance(value, torch.Tensor):
                print(f"  - {key}: {value.shape}")
            else:
                print(f"  - {key}: {len(value)} items (non-numeric)")

print("\nEdges and Types:")
for edge_type in data.edge_types:
    edge_index = data[edge_type].edge_index
    print(f"Edge Type: {edge_type} - Number of Edges: {edge_index.size(1)} - Shape: {edge_index.shape}")

Citation

Please cite the dataset as follows:

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

BibTeX

@misc {nasa_goddard_earth_sciences_data_and_information_services_center__(ges-disc)_2024,
    author       = { {NASA Goddard Earth Sciences Data and Information Services Center (GES-DISC)} },
    title        = { nasa-eo-knowledge-graph },
    year         = 2024,
    url          = { https://huggingface.co/datasets/nasa-gesdisc/nasa-eo-knowledge-graph },
    doi          = { 10.57967/hf/3463 },
    publisher    = { Hugging Face }
}

References

For details on the process of collecting these publications, please refer to:

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

For any questions or further information, please contact: