Skip to main content

Extensible linter and quality pipeline for RDF, SKOS, OWL and RDFS vocabularies

Project description

semanticlint

semanticlint

Extensible linter and quality pipeline for RDF, SKOS, OWL and RDFS vocabularies.

PyPI version CI Coverage Ruff License


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

pip install semanticlint

Quick start

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

Writing a custom check

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)

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).

Project details


Download files

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

Source Distribution

semanticlint-0.4.0.tar.gz (79.4 kB view details)

Uploaded Source

Built Distribution

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

semanticlint-0.4.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file semanticlint-0.4.0.tar.gz.

File metadata

  • Download URL: semanticlint-0.4.0.tar.gz
  • Upload date:
  • Size: 79.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for semanticlint-0.4.0.tar.gz
Algorithm Hash digest
SHA256 0a1a65d3cb687c3bb53cedb0aae8ac906b97e1c6d936b4253b77652b5346b3b9
MD5 e7b7e3369f3195f229d8589a5151b5e4
BLAKE2b-256 1dafb62398970ae9c29db4e5a8a20eeecc5ff82a410348b9de523d6ef6fa6ec2

See more details on using hashes here.

Provenance

The following attestation bundles were made for semanticlint-0.4.0.tar.gz:

Publisher: publish.yml on gbelbe/semanticlint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file semanticlint-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: semanticlint-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for semanticlint-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d37ffeef1de10f72275ae776278db73ffb0aeda49c0873b86c433c7e8080d2c
MD5 99d5da22ffc6f1e55900f039221583da
BLAKE2b-256 ea2045bd89abc34a7ae1aae839f469bb0398d7119e771aa834158757c2f3d061

See more details on using hashes here.

Provenance

The following attestation bundles were made for semanticlint-0.4.0-py3-none-any.whl:

Publisher: publish.yml on gbelbe/semanticlint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page