Gzipped http post support

Does Stardog 5.0.3 support gzipped POST requests?
I’m trying to load data with “Content-Encoding: gzip” without success.

What behavior are you seeing? Are there errors in your stardog.log?

Hi Stephen,

I’m getting a 400 with message “{“message”:“Lexical error at line 1, column 1. Encountered: “31” (31), after : “””,“code”:“MalformedQuery”}” for this request WITH Content-Encoding: gzip. Without gzip encoding the request returns 200.

POST http://localhost:5820/base_testing/update HTTP/1.1
Content-type: application/sparql-update
Content-encoding: gzip

INSERT DATA {
GRAPH { <http://xmlns.com/foaf/0.1/123> <http://www.w3.org/2000/01/rdf-schema#type> <http://xmlns.com/foaf/0.1/person> }}

Server log:

ERROR 2018-03-05 11:56:26,929 [XNIO-1 task-4] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(223): An exception was handled by the server: Lexical error at line 1, column 1. Encountered: “31” (31), after : “”

I’m not sure why without gzip it returns 200, as the query is malformed. You have the GRAPH keyword, however there’s no graph specified. You either need to specify a graph:

INSERT DATA { GRAPH <http://my.graph/> { <urn:x> <urn:y> <urn:z> } }

or remove the keyword:

INSERT DATA { <urn:x> <urn:y> <urn:z> }

I removed the empty graph and I’m getting the same error. It seems as if it’s not unzipping the request before performing the query. Just a general question is stardog 5.0.3 supposed to handle encoded gzip post request?

Yes, the server is supposed to handle gzip-encoding, however upon further examination it does appear that it’s only handling it for RDF data payloads, and not for SPARQL queries. Do you have a use case that would require a gzipped query to be sent?

I would like to send an INSERT DATA query of 200k triples to Stardog using a standard SPARQL client. I know that I can use the Stardog client for this but it would mean that I will have to package the client together with the application. Will gzip-encoding for SPARQL queries be supported in the future?

We will continue to look into supporting gzip for queries, however there are more efficient ways available to you right now that DO accept gzipped data. You can use either our HTTP API or the SPARQL Graph Store Protocol to bulk add RDF data to your db.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.