Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

KG Analysis Tool

A command-line tool for analyzing SPARQL endpoints, specifically designed for the NFDI4Earth Knowledge Graph and its metrics collection.

Features

  • Run SPARQL queries from files
  • Execute predefined metric queries
  • Save query results in JSON
  • Configurable SPARQL endpoint, request timeout & directory of reports via environment variables
  • Supports query parameters and templates

Installation

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate

# Install in development mode
pip install -e .

Usage

Environment Variables

# Required
export SPARQL_ENDPOINT="https://sparql.knowledgehub.nfdi4earth.de"

# Optional
export SPARQL_TIMEOUT=120  # in seconds
export REPORTS_DIR="./reports/metrics"

CLI Commands

Run a single query:

kg-analysis query -q path/to/query.rq

Request/Calculate all metrics:

kg-analysis metrics

License

This project is published under the Apache License 2.0, see file LICENSE.

Related Projects

Contributors: Ralf Klammer