Skip to main content

schema-miner pro logo

PyPI - Version Pepy Total Downloads Maintained Yes MIT License Read the Docs

SCHEMA-MINERpro: Scientific Schema Mining and Ontology Grounding with LLMs

Schema-Miner is a command-line and Python package for mining scientific JSON schemas from process specifications and research literature. It supports a human-in-the-loop workflow for schema refinement and an ontology-grounding step that enriches schema fields with QUDT quantity and unit metadata.

Use this PyPI page for installation and CLI orientation. For the full workflow, figures, notebooks, and project background, see:

Installation

pip install schema-miner

Schema-Miner requires Python 3.12 or newer.

To install from source:

git clone https://github.com/sciknoworg/schema-miner.git
cd schema-miner
pip install -r requirements.txt

Minimal Configuration

Copy the example environment file and edit it:

cp .env.example .env

Required workflow settings:

LLM_PROVIDER = "SAIA"      # OPENAI, SAIA, OLLAMA, or HUGGINGFACE
LLM_MODEL = "qwen3-30b-a3b-instruct-2507"

PROCESS_NAME = "Atomic Layer Deposition"
PROCESS_DESCRIPTION = "Layer-by-layer thin film growth process."

STAGE1_SPECS_PATH = "data/stage1/process-description.pdf"
STAGE2_PAPERS_PATH = "data/stage2/"
STAGE3_PAPERS_PATH = "data/stage3/"
RESULTS_PATH = "results/my-run/"

Provider credentials:

Provider Set in .env
OpenAI LLM_PROVIDER=OPENAI, OPENAI_API_KEY
KISSKI SAIA / GWDG LLM_PROVIDER=SAIA, SAIA_API_KEY, SAIA_BASE_URL=https://chat-ai.academiccloud.de/v1
OpenRouter LLM_PROVIDER=SAIA, SAIA_API_KEY, SAIA_BASE_URL=https://openrouter.ai/api/v1
Ollama LLM_PROVIDER=OLLAMA, optional OLLAMA_BASE_URL
Hugging Face LLM_PROVIDER=HUGGINGFACE, HuggingFace_Access_Token, HUGGINGFACE_USE_LOCAL

CLI Quick Start

Run one workflow step at a time:

# Stage 1: generate an initial schema from the process specification
schema-miner --stage 1

# Stage 2: refine with a curated paper corpus and optional expert feedback
schema-miner --stage 2 --schema results/stage-1/<model>.json --papers 3

# Stage 3: finalize with a broader paper corpus
schema-miner --stage 3 --schema results/stage-2/<model>.json --papers all

# Ontology grounding: enrich the final schema with QUDT metadata
schema-miner --ontology-grounding agentic --schema results/stage-3/<model>.json

Common options:

Option Meaning
--stage 1 Initial schema mining from STAGE1_SPECS_PATH.
--stage 2 Preliminary refinement using STAGE2_PAPERS_PATH; requires --schema.
--stage 3 Final refinement using STAGE3_PAPERS_PATH; requires --schema.
--schema <path> Input JSON schema for stages 2, 3, or ontology grounding.
--expert-feedback <text-or-file> Optional feedback for stages 2 and 3.
`--papers <N all>`
--ontology-grounding prompt Prompt-based QUDT grounding.
--ontology-grounding agentic Agentic QUDT grounding with lexical and semantic lookup.

Generated schemas, intermediate outputs, grounded schemas, and logs are written under RESULTS_PATH.

CLI Usage Scenarios

Check the Installed CLI

schema-miner --help
schema-miner --version

Scenario 1: Initial Schema Mining

Use this when you have a process specification and want the first JSON schema.

Required .env values:

  • PROCESS_NAME
  • PROCESS_DESCRIPTION
  • STAGE1_SPECS_PATH
  • RESULTS_PATH
  • LLM provider and credentials

Run:

schema-miner --stage 1

The command reads STAGE1_SPECS_PATH and writes the initial schema to RESULTS_PATH.

Scenario 2: Preliminary Refinement

Use this when you have a Stage 1 schema and a small curated paper corpus.

Required inputs:

  • STAGE2_PAPERS_PATH in .env
  • --schema pointing to the Stage 1 JSON schema

Run one paper per batch:

schema-miner --stage 2 --schema results/stage-1/<model>.json

Run with inline expert feedback for the first batch:

schema-miner --stage 2 --schema results/stage-1/<model>.json \
    --expert-feedback "Add units for temperature and pressure fields."

Run with expert feedback from a file:

schema-miner --stage 2 --schema results/stage-1/<model>.json \
    --expert-feedback data/stage-2/reviews/<model>.txt

Run papers in fixed-size batches:

schema-miner --stage 2 --schema results/stage-1/<model>.json --papers 3

Run all curated papers in one batch:

schema-miner --stage 2 --schema results/stage-1/<model>.json --papers all

Scenario 3: Final Refinement

Use this when you have a Stage 2 schema and a broader validation/refinement corpus.

Required inputs:

  • STAGE3_PAPERS_PATH in .env
  • --schema pointing to the Stage 2 JSON schema

Run one paper per batch:

schema-miner --stage 3 --schema results/stage-2/<model>.json

Run with inline expert feedback:

schema-miner --stage 3 --schema results/stage-2/<model>.json \
    --expert-feedback "Ensure measurable properties use standard SI units."

Run with expert feedback from a file:

schema-miner --stage 3 --schema results/stage-2/<model>.json \
    --expert-feedback data/stage-3/reviews/<model>.txt

Run papers in fixed-size batches:

schema-miner --stage 3 --schema results/stage-2/<model>.json --papers 5

Run all broader-corpus papers in one batch:

schema-miner --stage 3 --schema results/stage-2/<model>.json --papers all

Scenario 4: Ontology Grounding

Use this when you have a final schema and want QUDT quantity/unit grounding.

Prompt-based grounding:

schema-miner --ontology-grounding prompt --schema results/stage-3/<model>.json

Agentic grounding:

schema-miner --ontology-grounding agentic --schema results/stage-3/<model>.json

Scenario 5: Provider-Specific Runs

The CLI command stays the same across providers; only .env changes.

KISSKI SAIA:

LLM_PROVIDER = "SAIA"
LLM_MODEL = "qwen3-30b-a3b-instruct-2507"
SAIA_API_KEY = "<your-saia-key>"
SAIA_BASE_URL = "https://chat-ai.academiccloud.de/v1"

OpenRouter:

LLM_PROVIDER = "SAIA"
LLM_MODEL = "qwen/qwen3-235b-a22b"
SAIA_API_KEY = "<your-openrouter-key>"
SAIA_BASE_URL = "https://openrouter.ai/api/v1"

Hugging Face local GPU:

LLM_PROVIDER = "HUGGINGFACE"
LLM_MODEL = "mistralai/Ministral-3-8B-Instruct-2512"
HuggingFace_Access_Token = "<your-huggingface-token>"
HUGGINGFACE_USE_LOCAL = True

Tutorial Notebooks

Notebook Inference mode
Hugging Face local GPU Local model
KISSKI SAIA Remote OpenAI-compatible API
OpenRouter Remote OpenAI-compatible API

Contact

Collaboration inquiries: Jennifer D'Souza, jennifer.dsouza [at] tib.eu.

Development questions or bug reports: open an issue or contact Sameer Sadruddin, sameer.sadruddin [at] tib.eu.

License

Schema-Miner is released under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

schema_miner-3.2.6.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schema_miner-3.2.6-py3-none-any.whl (53.4 kB view details)

Uploaded Python 3

File details

Details for the file schema_miner-3.2.6.tar.gz.

File metadata

  • Download URL: schema_miner-3.2.6.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.7

File hashes

Hashes for schema_miner-3.2.6.tar.gz
Algorithm Hash digest
SHA256 8fa48a87a1dcbe239bf3c7af06ba91acbab6d69eb927a7653998124224adf034
MD5 9de707b5d84d0768e9197b0f137f6344
BLAKE2b-256 9dd0909164801aead945e6d957629c146f4cc322e8332f83a81f3270481e0249

See more details on using hashes here.

File details

Details for the file schema_miner-3.2.6-py3-none-any.whl.

File metadata

  • Download URL: schema_miner-3.2.6-py3-none-any.whl
  • Upload date:
  • Size: 53.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.7

File hashes

Hashes for schema_miner-3.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6f27dcb0a45e6512e7cbb7c4c972b686b6d1d8b1756a195e59f7b7cdb29b3ac1
MD5 9ead5f180cc7e1fd8a49b4f4875aa7f4
BLAKE2b-256 4cb7576d15f6e5f1779540be30a9686928bd25afba2a274b18bd1c094b045b94

See more details on using hashes here.

Release history Release notifications | RSS feed

3.2.7

2 files

This release

3.2.6 This release

2 files

3.2.5

2 files

3.2.4

2 files

3.0.0

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page