Skip to content

Python library, command line tool, specification, and example policies developed in the Software CaRD project.

License

Notifications You must be signed in to change notification settings

softwarepub/software-card-policies

Repository files navigation

Software CaRD Policies

This repository contains the software_card_policies Python library as well as the associated command line program software-card-validate and example policies. The software was written as part of the Software CaRD project.

software-card-validate

A command line program that validates a given metadata file using a set of configurable policies.

The selection of policies can be configured via config.toml. Policies can be loaded using any of the protocols supported by RDFlib's Graph.parse method (e.g. local files, http, ...). All of the given policies are loaded and unioned into one RDF graph.

Policies can be implemented in a configurable fashion by defining an sc:Parameter and using it in place of a literal or list. See description-parameterizable.ttl and licenses-parameterizable.ttl as examples. The string specified as sc:parameterConfigPath is used to look up the desired value for the parameter in the config file.

Installation

python -m venv venv
source venv/bin/activate
python -m pip install -e .

Run

Run the program:

software-card-validate examples/data/hermes.ttl

This will validate hermes.ttl using the policies defined in config.toml and print a validation report to the screen. If run in debug mode (with --debug), the report is more verbose, and the following files are written to the current working directory:

  • debug-input-data.ttl: the input data
  • debug-shapes-processed.ttl: the parameterized and combined policies
  • debug-validation-report.ttl: the detailed SHACL validation report (sh:ValidationReport)

Documentation

To build the documentation, install the package including the docs extra:

python -m pip install -e .[docs]

Then run Sphinx via the predefined task:

task docs-build  # build the docs
task docs-clean  # delete the built docs

To view the docs in the browser, run

python -m http.server -b 127.0.0.1 -d docs/_build/html

Then follow the link http://127.0.0.1:8000/.

Acknowledgments

Software CaRD (ZT-I-PF-3-080) is funded by the Initiative and Networking Fund of the Helmholtz Association in the framework of the Helmholtz Metadata Collaboration.

About

Python library, command line tool, specification, and example policies developed in the Software CaRD project.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published