Skip to content

Release v3.3.3: run the full SHACL profile's SPARQL constraints on QLever - #38

Open
ecrum19 wants to merge 10 commits into
mainfrom
feature/shacl-sparql-on-qlever
Open

ecrum19 wants to merge 10 commits into
mainfrom
feature/shacl-sparql-on-qlever

Conversation

@ecrum19

@ecrum19 ecrum19 commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • SPARQL constraints on QLever. The full profile's sh:sparql constraints run once each over a QLever index of the graph, not once per focus node in pyshacl. $this is left unbound and the shape's target becomes a query pattern. The index is streamed from the input, including .nt.gz, together with the RDFS types pyshacl would infer. pyshacl still checks the node-local shapes in record batches. --shacl-sparql-engine pyshacl keeps the previous in-memory path.
  • Equivalent queries. Four VCF Core constraints are replaced by equivalent queries that scale: POS order, CHROM contiguity, duplicate record IDs, and field cardinality. Each is pinned to the published query by digest. Field cardinality runs one CHROM at a time.
  • Agreement constraints. vcf-rdfizer-agreement.shacl.ttl adds four constraints to the full profile: alleleKind, contigCount, forAllele and phasingStatus, each checked against its source text. The vendored vocabulary is unchanged.
  • Mutation harness. The test VCF is now sorted. A shape detection counts only when a mutation adds a violation its control does not have.
  • Docs. docs/validation.md and docs/shacl-engines.md, plus roadmap item 8, which covers the Rudof port and the haploid phase indicator.
  • Version bump to 3.3.3. Conversion output is unchanged.

Results (vcf-bench-3)

  • Fault injection: 113/113 with the full profile, on pyshacl and on QLever alike, mutation by mutation. VCF Core's shapes catch 10 of the 17 the queries miss, and the agreement constraints catch the other 7.
  • Complete HG005 VCF (657.4M triples): all 44 constraints ran with no violations, in a 47 min index build plus 131 min of queries, at a peak of 21.4 GB.
  • Known open issue: the converter writes a haploid GT as unphased, while VCF 4.4 defines it as implicitly phased. The expanded control therefore fails one check. The fix changes conversion, so it is deferred to the next release.

Test plan

  • python3 -m unittest test.test_shacl_sparql_unit test.test_shacl_default_unit test.test_shacl_gate_and_node_heap_unit passes (137 tests, 1 skipped).
  • Mutation harness run in the image, all four cells.
  • End-to-end runs on HG005 slices of 0.52M, 2.1M and 17.1M triples.
  • CI

🤖 Generated with Claude Code

ecrum19 and others added 6 commits November 24, 2026 16:05
pyshacl evaluated each sh:sparql constraint once per focus node, in memory, so
the full shape profile was validated whole and gated at 10M triples. The
validator now splits the shapes. pyshacl still validates everything else in
record batches, unchanged. Each SPARQL constraint runs once over the whole graph
on a QLever index of the graph, the vocabulary and the RDFS typing pyshacl would
infer, with $this unbound and the shape's target as a pattern.

Four published constraints grow faster than the graph in any engine (pairwise
and three-way record comparisons, and two cross products). Each is replaced by
a linear equivalent, pinned to the published query by digest. The vocabulary's
shapes are unchanged.

- --shacl-sparql-engine qlever (default) | pyshacl (the previous path)
- --shacl-profile full is no longer size-gated on QLever
- Equivalents checked per constraint with rdflib on every fault-injection
  graph and 300 random record arrangements
- Against pyshacl on the 115 fault-injection graphs: same verdict on all,
  identical results on 113 (rdflib's lenient string/number comparison)
- HG005 slices end to end: 40 constraints in 4 s (0.52M), 12 s (2.1M),
  121 s (17.1M), after a 3 s, 10 s and 75 s index build
- docs/shacl-engines.md and roadmap item 8: the Rudof evaluation, its issues,
  and porting it as future work

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m the index

- The fixture's records went chr20, chr21, chr20, so both ordering
  constraints of the full profile fired on the clean controls. Record 6 (chr20,
  800) is now record 3, and the mutation catalogue follows the renumbering.
- The mutation harness counted any full-profile failure as a detection, and
  never checked the controls. It now records each control's blocking results
  and counts a shape detection only when a mutation adds one. The expanded
  control still fails one check, the haploid phase indicator, which is
  documented as future work in docs/shacl-engines.md.
  VCF_RDFIZER_MUTATION_SHACL_ENGINE picks pyshacl or qlever.
- The two ordering equivalents assumed consecutive record indices. They are
  now exact under gaps and repeats (segments of one CHROM, and each CHROM's
  index range), and the random test generates both.
- The SHACL index reads the graph on stdin, each triple followed by its RDFS
  typing, so a gzip-compressed graph is indexed without a decoded copy or a
  typing file on disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…E result

Leaving -f out, which qlever-index's --help offers for stdin, fails an
assertion in the image's QLever build. Rerun of the mutation harness on the
sorted fixture: the full profile detects 10 of the 17 query-missed faults,
with pyshacl and on QLever alike, counted against the controls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…by CHROM

- vcf-rdfizer-agreement.shacl.ttl: SPARQL checks for the four derived values
  no VCF Core shape reads (alleleKind, contigCount, forAllele, phasingStatus).
  Each mirrors the converter's own rule and tests only what that rule always
  produces. They catch the seven faults the full profile missed, and neither
  control fails them. Not vendored: the VCF Core shapes are unchanged.
- The field-cardinality equivalent runs in parts, one per record CHROM plus
  records with none, because on the complete HG005 VCF graph it outgrew
  QLever's 20 GB. Each value belongs to one record, so the split is exact.
- outer_group skipped the rest of a line at a '#' inside an IRI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Group E detects 113/113 with the full profile on both paths, the agreement
checks catching the 7 faults VCF Core's shapes miss. All 44 SPARQL
constraints ran on the complete HG005 VCF graph (657.4M triples) in 131 min,
the two cardinality checks in 23 CHROM parts each, with no violations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A patch to SHACL validation. The full profile's SPARQL constraints now run
once each over a QLever index of the graph instead of once per focus node in
pyshacl, so the profile has no graph-size limit. pyshacl still checks the
node-local shapes in record batches, and --shacl-sparql-engine pyshacl keeps
the previous path. The full profile also gains four agreement constraints for
derived values no VCF Core shape reads. Nothing changes what a v3.3.2
conversion writes.

The conda sha256 stays a placeholder until the tag exists. Populate it with
`python3 scripts/release.py 3.3.3 --fetch-conda-sha256` after pushing v3.3.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Nov 25, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 91.82644% with 81 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/validation/validation_runner.py 71.75% 37 Missing ⚠️
src/validation/shacl_sparql.py 93.85% 22 Missing ⚠️
test/test_validation_mutation_unit.py 69.81% 16 Missing ⚠️
test/cross_engine_agreement.py 0.00% 5 Missing ⚠️
test/test_shacl_sparql_unit.py 99.76% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

ecrum19 and others added 4 commits November 25, 2026 14:21
A COTTAS endpoint that answered HTTP 200 with a body that is not SPARQL
Results JSON was reported with an empty reason, because the check printed
only the stderr file. It now prints the envelope's error and the end of the
body.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elias.crum/query-sparql-cottas 0.1.0 depends on Comunica's packages by
semver range, so a fresh image build picked up Comunica 5.5.0, released
2026-11-24. With it, a triple pattern inside an OPTIONAL with a FILTER is
left without a source ("requires an operation with source annotation"),
and the expanded preflight_sample_gt_inventory and Q5 queries fail on
COTTAS. The v3.3.2 image resolved every @comunica package to 5.4.0 and
passes.

docker/comunica-cottas pins that tree: package.json overrides each
@comunica package at the version the v3.3.2 image holds, and
package-lock.json fixes the rest. The image installs it with npm ci into
/opt/comunica-cottas and links the two binaries, because a global install
ignores overrides. Checked on vcf-bench-3: unpinned resolves 5.5.0 and
reproduces the CI failure, pinned resolves 5.4.0 and the cross-engine
check passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Roadmap item 9 collects what the v3.3.3 validation work found and left
alone so the paper's results stay reproducible: the haploid phase
indicator (with the agreement constraint that has to change with it), the
COTTAS engine's break with Comunica 5.5.0 and its temporary pin, the QLever
version string in reports, three changes to the published shapes, the Rudof
bugs, and pyshacl's node-local batches at complete-VCF scale. The
contigCount coverage gap now notes that the full profile catches it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants