Repository navigation
The proxy serves an ASK's boolean instead of failing to read it as rows - #98
Open
namedgraph wants to merge 1 commit into
Open
namedgraph wants to merge 1 commit into
namedgraph wants to merge 1 commit into
Conversation
The proxy decides what an upstream answered by its content type alone, and every SPARQL results type went to readEntity(ResultSetRewindable). An ASK answers with a boolean in the same types, and Jena refuses to read a boolean document as a result set:
ResultSetException: Not a ResultSet result
So a proxied ASK failed, against any remote endpoint and, since Core 5.0.6, against a Core endpoint too.
The results branch now reads Jena's SPARQLResult, the union over what a query returns, through Core's SPARQLResultProvider, which is registered here on the server and on the client. getResponse(SPARQLResult, StatusType) dispatches: a result set takes the existing response, a boolean a new getBooleanResponse, which offers only the result set media types a boolean can be written in - Jena has no boolean encoding in Thrift or Protobuf, and (X)HTML has no writer for one - with an entity tag from ResultSetUtils.hashBoolean.
Tests cover a boolean served as one, true and false tagged apart, Protobuf and HTML refused, and a result set unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
The Linked Data proxy picks how to read an upstream answer by its content type alone, and every SPARQL results type went to
readEntity(ResultSetRewindable.class). An ASK answers with a boolean in those same types, and Jena 6.1 refuses to read one as a result set:So any proxied ASK failed. That has always applied to remote endpoints, and since Core 5.0.6 it applies to Core endpoints too, now that they answer ASK with a real boolean (AtomGraph/Core#40).
What changes
ProxyRequestFilter: the results branch reads Jena'sSPARQLResultand hands it to a newgetResponse(SPARQLResult, StatusType). A result set goes on to the existinggetResponse(ResultSetRewindable, …), and a boolean goes to a newgetBooleanResponse.getBooleanResponseoffers only the result set media types a boolean can be written in, filtered bySPARQLResultProvider.isBooleanWriteable. Jena has no boolean encoding in Thrift or Protobuf, and (X)HTML has no writer for one, so those negotiate to 406. The entity tag comes fromResultSetUtils.hashBoolean.Application: registers Core'sSPARQLResultProvideron the server and on the client. The client registration is what lets the proxy read aSPARQLResult.Tests
ProxyRequestFilterTestgains four cases:mvn clean install: all 20 tests pass.LinkedDataHub has its own copy of this filter and gets the same fix separately, with an HTTP test that runs CONSTRUCT, SELECT and ASK through the proxy.
🤖 Generated with Claude Code