fix(distribution-probe): accept SPARQL results as JSON or XML#425
Merged
Conversation
A SELECT or ASK endpoint that answered in application/sparql-results+xml was wrongly classified as unreachable, because success required the response Content-Type to match the single Accept header we sent (application/sparql-results+json). A healthy endpoint then surfaced as a content-type violation and its body was never validated. SELECT/ASK probes now negotiate both serializations (Accept: application/sparql-results+json, application/sparql-results+xml;q=0.9) and treat either as success, validating the body with a lightweight structural check per serialization. This also aligns with publishers declaring SPARQL endpoints via dct:conformsTo rather than a media type.
ddeboer
added a commit
to netwerk-digitaal-erfgoed/dataset-register
that referenced
this pull request
Jun 2, 2026
Brings in ldelements/lde#425: a SPARQL endpoint that answers a SELECT/ASK query in application/sparql-results+xml (not just +json) is now treated as reachable, fixing the spurious "HTTP 200 OK" content-type violation seen when validating SPARQL distributions. In-range bump (packages/core declares ^0.1.4), so only the lockfile changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When probing a SPARQL endpoint,
SparqlProbeResult.isSuccess()required the responseContent-Typeto start with the singleAcceptheader we send for SELECT/ASK queries (application/sparql-results+json). An endpoint that answers inapplication/sparql-results+xml– a perfectly valid SPARQL Query Results serialization – was therefore classified as a failure even on an HTTP 200, and its body was never validated.Downstream (e.g. the Dataset Register), that healthy endpoint surfaced as a spurious content-type violation (“HTTP 200 OK”).
This also matters because publishers are asked to declare SPARQL endpoints via
dct:conformsTo, not a media type, so success must not hinge on a declared or negotiated serialization.Change
Accept: application/sparql-results+json, application/sparql-results+xml;q=0.9.SparqlProbeResultnow carriesacceptedContentTypes(a list). The constructor still accepts a singlestringand normalizes it, so existing consumers remain source-compatible.Tests
resultselement, XML ASK valid/invalid, non-SPARQL XML, the negotiatedAcceptheader, and single-string constructor normalization.@lde/distribution-probesuite passes (37 tests);pipelineanddistribution-monitortypecheck cleanly against the widened API.