Dieses Repository bündelt:
- SHACL-Shapes (TTL) für das FID DK EDM Application Profile,
- einen Validator (Python-API und CLI) auf Basis von rdflib + pySHACL,
- einen Luigi-Task für Batch‑Validierung,
- sowie begleitende fachliche Dokumentation.
Die Projektseite: https://www.performing-arts.eu
Allgemeine Projektbeschreibung (de): http://www.ub.uni-frankfurt.de/projekte/theater.html
src/fiddk_validator/validator.py– Kernfunktionenvalidateundvalidate_to_files(ruft pySHACL auf, lädt RDF/Shapes, serialisiert Reports).src/fiddk_validator/cli.py,src/fiddk_validator/__main__.py– Kommandozeilen-Interface (python -m fiddk_validator).src/fiddk_validator/luigi_tasks.py– Luigi-TaskValidateRDFTaskfür Workflow/Batch.src/fiddk_validator/shapes/*.ttl– SHACL-Shapes fürAggregation,ProvidedCHO,WebResource,Person,Organization,Place,TimeSpan,Concept,Event.documentation/DataModel_FIDDK_de.md– Ausführliche Modellbeschreibung inkl. FIDDK‑Abweichungen/Erweiterungen.
- Python 3.10+
- Abhängigkeiten:
rdflib,pyshacl,luigi
- Entwicklung/Editable:
pip install -e .- Alternativ ohne Installation aus dem Repo heraus nutzen (setzt nur voraus, dass
srcimPYTHONPATHliegt).
- Mit mitgelieferten Shapes:
python -m fiddk_validator -d pfad/zur/daten.ttl -r build/shacl-report.ttl --inference rdfs- Mit eigenem Shapes‑Verzeichnis:
python -m fiddk_validator -d daten.ttl -s src/fiddk_validator/shapes -r build/report.ttl --report-format turtle-
Wichtige Optionen:
-d/--data: RDF-Daten-s/--shapes: SHACL-Datei oder -Verzeichnis (optional; Standard: eingepackte Shapes)-r/--report: Report-Datei (RDF)--data-format,--shapes-format,--report-format: explizite Formate (z. B.turtle,xml,json-ld)--inference:none|rdfs|owlrl(Standardrdfs)--no-text: unterdrückt zusätzlichen Text‑Report (.txt)
-
Exit‑Codes:
0bei Konformität,2bei Verstößen. Ausgabe: „Konform: ja/nein“.
- Beispielaufruf:
python -m luigi --module fiddk_validator.luigi_tasks ValidateRDFTask --data-path daten.ttl --report-path build/report.ttl --shacl-path src/fiddk_validator/shapes --inference rdfs --write-text-report True --fail-on-violation True- Parameter (Auszug):
data_path,shacl_path(optional),report_path,data_format/shacl_format/report_format(optional),inference(rdfs),advanced/debug(False),write_text_report(True),fail_on_violation(False/True).
validate(data_path, shacl_path=None, data_format=None, shacl_format=None, inference="rdfs", advanced=False, debug=False) -> (conforms: bool, results_graph: rdflib.Graph, results_text: str)validate_to_files(data_path, shacl_path, report_path, ..., write_text_report=True) -> bool
Schreibt RDF‑Report (Format aus Endung oder explizit) und optional.txt.
ProvidedCHO:edm:typegenau 1 (eine(r) vonTEXT/IMAGE/SOUND/VIDEO/3D); wennTEXT, dann mussdc:languagevorhanden sein;bibo:isbn/bibo:issnmit Formatprüfung; umfangreicherdau‑Rollen.Aggregation:edm:aggregatedCHO,edm:dataProvider,edm:providerjeweils 1; mindestens eines vonedm:isShownAtoderedm:isShownBy.WebResource:dc:formatprüft MIME‑Pattern;edm:rightsoptional (0..1 IRI).Person/Organization/Place/Concept:skos:prefLabelpro Sprach‑Tag eindeutig; zusätzlicher SPARQL‑Check für max. ein Label ohne Sprach‑Tag.TimeSpan:edm:begin/edm:endje max. 1 Literal; Anzeigeform viaskos:prefLabel.Event:edm:happenedAtundedm:occurredAtkönnen Literal oder IRI sein;foaf:depiction/foaf:homepagemax. 1 IRI.
- Fachliches Datenmodell und FIDDK‑Spezifika:
documentation/DataModel_FIDDK_de.md(inkl. Unterschiede zu EDM und FIDDK‑Erweiterungen).
- Änderungen an Shapes in
src/fiddk_validator/shapes/vornehmen und mit der CLI/Validator‑API testen. - Für automatisierte Validierung in Workflows eignet sich der Luigi‑Task.
- Pull Requests sind willkommen.
- Dev‑Abhängigkeiten inkl. pytest installieren:
pip install -e ".[dev]"
- Tests starten:
pytest -q
- Einzelnen Test ausführen:
pytest -q tests/test_validation_edm.py::test_valid_minimal_conforms