Skip to content

Playground to experiment with methods to automatically create shacl shapes from various input sources

License

Notifications You must be signed in to change notification settings

Citizen-Knowledge-Graph/shacl-generator

Repository files navigation

Legal Text to SHACL Shape Mapper

This tool helps translate legal texts describing social benefit eligibility requirements into formal SHACL shapes. It provides a user-friendly interface for mapping legal requirements to SHACL constraints.

Features

  • Upload and view legal text documents
  • Upload and preview example SHACL shapes
  • Interactive mapping interface for creating SHACL constraints
  • Support for common SHACL constraint types
  • Preview generated SHACL shapes

Setup

  1. Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
# if only available at ~/.local/bin/poetry, link it globally: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
cd shacl_generator
  1. Install dependencies:
poetry install
  1. Run the application:
export OPENAI_API_KEY="..."
poetry run streamlit run app.py

Development

To add new dependencies:

poetry add package-name

To activate the virtual environment:

poetry shell

Code Quality Tools

The project uses several tools to maintain code quality:

  • Formatting: Run poetry run black . to format code
  • Import Sorting: Run poetry run isort . to sort imports
  • Linting: Run poetry run flake8 to check for code style issues
  • Type Checking: Run poetry run mypy . to check types
  • Testing: Run poetry run pytest to run tests

Usage

  1. Upload your legal text document (txt or pdf) using the sidebar
  2. Optionally upload an example SHACL shape for reference
  3. Use the mapping interface to:
    • Select relevant text from the legal document
    • Choose appropriate SHACL constraint types
    • Define constraint values
  4. Generate and preview the resulting SHACL shape

Requirements

  • Python 3.9+ (excluding 3.9.7)
  • Poetry for dependency management

About

Playground to experiment with methods to automatically create shacl shapes from various input sources

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages