Metadata-Version: 2.4
Name: semanticlint
Version: 0.2.0
Summary: Extensible linter and quality pipeline for RDF, SKOS, OWL and RDFS vocabularies
Project-URL: Homepage, https://github.com/gbelbe/semanticlint
Project-URL: Repository, https://github.com/gbelbe/semanticlint
Project-URL: Issues, https://github.com/gbelbe/semanticlint/issues
License: MIT License
        
        Copyright (c) 2026 Gaetan Belbeoc'h
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: pyshacl>=0.25
Requires-Dist: pyyaml>=6.0
Requires-Dist: rdflib>=7.0
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: coverage[toml]>=7.0; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-bdd>=7.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=9.0; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
Description-Content-Type: text/markdown

<p align="center">
  <img src="logo.svg" alt="semanticlint" width="80"/>
</p>

<h1 align="center">semanticlint</h1>

<p align="center">
  Extensible linter and quality pipeline for RDF, SKOS, OWL and RDFS vocabularies.
</p>

<p align="center">
  <a href="https://pypi.org/project/semanticlint/"><img src="https://img.shields.io/pypi/v/semanticlint" alt="PyPI version"/></a>
  <a href="https://github.com/gbelbe/semanticlint/actions"><img src="https://github.com/gbelbe/semanticlint/actions/workflows/ci.yml/badge.svg" alt="CI"/></a>
  <a href="https://codecov.io/gh/gbelbe/semanticlint"><img src="https://codecov.io/gh/gbelbe/semanticlint/graph/badge.svg" alt="Coverage"/></a>
  <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"/></a>
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"/></a>
</p>

---

## Features

- **Stage 1 — Lint**: syntax validation for Turtle, RDF/XML, N-Triples, JSON-LD
- **Stage 2 — Integrity**: SKOS integrity conditions (W3C), OWL consistency, RDFS checks
- **Stage 3 — Quality**: label coverage, definition coverage, hierarchy metrics
- **Auto-detection**: identifies SKOS / OWL / RDFS / RDF vocabulary types automatically
- **Extensible**: add custom checks with a single class and `@CheckRegistry.register`
- **Configurable**: `onto-ci.yml` alongside your vocabulary files controls which stages run

## Installation

```bash
pip install semanticlint
```

## Quick start

```bash
semanticlint check my-taxonomy.ttl
semanticlint check vocabularies/ --select SKO --ignore SKO003
```

## Writing a custom check

```python
from semanticlint import Check, CheckRegistry, VocabType, Severity, Violation
from rdflib import RDF
from rdflib.namespace import SKOS

@CheckRegistry.register
class CamelCaseConceptCheck(Check):
    id          = "CUS001"
    description = "Concept local names should be CamelCase"
    severity    = Severity.WARNING
    applies_to  = VocabType.SKOS

    def run(self, graph, config):
        violations = []
        for concept in graph.subjects(RDF.type, SKOS.Concept):
            local = str(concept).split("#")[-1].split("/")[-1]
            if not local[0].isupper():
                violations.append(Violation(self.id, f"{local} is not CamelCase", self.severity, concept))
        return violations
```

## Configuration (`onto-ci.yml`)

```yaml
version: 1
sources: ["*.ttl", "vocabularies/**/*.ttl"]

select: ["RDF", "SKO", "QUA"]
ignore: []

quality:
  min_label_coverage: 1.0
  min_definition_coverage: 0.5
  languages: ["en"]

plugins:
  - my_project.custom_checks
```

## License

MIT — logo is public domain (W3C RDF logo via Wikimedia Commons).
