This directory contains nanopublication-related files including:
- Nanopub wave files (.trig format)
- Hypothesis mapping files
- Scripts for processing and canonicalizing nanopublications
waves/: Complete set of nanopublication wave files (np_levin_nanopubs_wave*.trig, 19 files including waves A-R)npi-waves/: Subset of wave files with different structure (10 files, appears to be alternative/processed versions)waves_fixed/: Fixed/canonicalized versions of wave files (empty)*.trig: Hypothesis mapping files and other nanopub files
Note: The batch publisher defaults to publishing waves/ only (the complete set). Use --include npi-waves/ if you want to publish those files as well, but they appear to be duplicates/alternatives of files already in waves/.
np_canonicalize_slash_uris.py: Canonicalize nanopubs and normalize graph IRIsnanopub_restructure.py: Restructure nanopublication filesplanform_to_nanopubs.py: Convert PlanformDB data to nanopublications
publish_all_nanopubs.py: Batch script to sign and publish all nanopublication filespublish_batch.sh: Convenient wrapper script for batch publishing
npornp_utils.py: Command-line utilities for nanopub operationscheck <file.trig>- Check if a nanopub is validmktrusty <file.trig> [-o output]- Create trusty URI versionsign <file.trig> [-o output]- Sign a nanopubpublish <file.trig>- Publish a nanopub
np_hypothesis_mappings_A_to_Q.trig: Hypothesis mappingshypothesis_mappings_A_to_Q.trig: Alternative hypothesis mappings format
Before publishing, you need to install the nanopub library and set up your profile:
pip install nanopub rdflib
python3 -m nanopub setup --newkeys # Interactive setup - generates RSA keys and asks for ORCIDImportant: Use the --newkeys flag to automatically generate RSA keys. The setup will:
- Ask for your ORCID iD (e.g.,
https://orcid.org/0000-0000-0000-0000) - Ask for your name
- Generate RSA keys automatically
- Store configuration in
~/.nanopub/
Note: Make sure your virtual environment is activated before running the setup command.
See SETUP_GUIDE.md for detailed setup instructions and troubleshooting.
Important Notes:
-
Bulk uploading is not officially supported by nanopub registries by design. The batch publishing script publishes one nanopub at a time with delays between publications. For future bulk publishing needs, consider setting up your own Registry node.
-
Production server restrictions: The production registry (
registry.petapico.org) may have stricter validation or reject publications that the test server accepts. If you encounter HTTP 400 errors on production, try:- Publishing to the test server first (
--test) - Checking if the nanopub URI already exists (duplicate)
- Contacting the registry administrators about specific rejection reasons
- Publishing manually one at a time to identify problematic nanopubs
- Publishing to the test server first (
-
Only signed nanopubs are accepted: All nanopubs must be signed before publishing. The script handles this automatically.
To sign and publish all nanopublication files:
# Preview what would be published (dry-run)
./publish_batch.sh --dry-run
# Publish to TEST server first (recommended)
./publish_batch.sh --test
# Publish to PRODUCTION (be careful!)
./publish_batch.sh --prod # Default: Petapico
./publish_batch.sh --prod-kp # KnowledgePixels production
./publish_batch.sh --prod-petapico # Petapico production
./publish_batch.sh --prod-trusty # TrustyURI production
# Publish only npi-waves files
./publish_batch.sh --test --include npi-waves/
# Test with first 5 files
./publish_batch.sh --test --limit 5Or use the Python script directly:
python3 publish_all_nanopubs.py --publish test --include npi-waves/ waves/The script will:
- Find all publishable .trig files in npi-waves/ and other directories
- Skip files already listed in a manifest
- Sign each nanopublication (only signed nanopubs are accepted)
- Publish each nanopublication one at a time with delays between requests
- Track published files in separate manifests for test and production
To generate and publish nanopubs from PlanformDB:
# Generate .trig files only
python3 planform_to_nanopubs.py --db planformDB_2.5.0.edb --out ./planform_nanopubs
# Generate and publish to test server
python3 planform_to_nanopubs.py --db planformDB_2.5.0.edb --out ./planform_nanopubs --publish test --limit 10Then use the batch publisher to publish all generated files:
python3 publish_all_nanopubs.py --publish test --include planform_nanopubs/The np script provides convenient utilities for working with nanopubs:
# Check if a nanopub file is valid
./np check file.trig
# Create trusty URI version
./np mktrusty file.trig -o trusty/file.trig
# Sign a nanopub (produces signed.file.trig)
./np sign trusty/file.trig
# Check signed nanopub
./np check signed.file.trig
# Publish a nanopub
./np publish signed.file.trigOr use the Python script directly:
python3 np_utils.py check file.trig
python3 np_utils.py mktrusty file.trig -o trusty/file.trig
python3 np_utils.py sign trusty/file.trig
python3 np_utils.py publish signed.file.trigSee individual script files for detailed usage instructions and documentation.