1
votes

I try to query a marklogic server (version 8) via their sparql endpoint and the sparqlrepository from rdf4j(2.1.4) but the marklogic endpoint seems to not accept these sparql queries.

Code example:

String sparqlEndpoint = "http://url/v1/graphs/sparql";
SPARQLRepository repo = new SPARQLRepository(sparqlEndpoint);
repo.initialize();
repo.getConnection().hasStatement(null, null, null, false);

This leads to the following error:

"errorResponse":{"statusCode":400, "status":"Bad Request", "messageCode":"REST-UNSUPPORTEDPARAM", "message":"REST-UNSUPPORTEDPARAM: (err:FOER0000) Endpoint does not support query parameter: invalid parameters: queryLn, infer for request"}}

Any suggestions?

2

2 Answers

4
votes

MarkLogic does not accept the parameter called queryLn (Query language).

The languages are SARQL and StructuredQueries and use different parameters to pass the two languages.

Please refer to the documentation here: https://docs.marklogic.com/REST/GET/v1/graphs/sparql

I suggest you find a way to suppress the queryLn parameter in your code making the call..

1
votes

As explained in the answer by David Ennis, the problem is that RDF4J's SPARQL endpoint client sends several parameters in its requests that are not part of the W3C SPARQL 1.1 Protocol; they are part of the RDF4J REST API (an extension of the SPARQL Protocol) instead.

While most SPARQL endpoint implementations simply ignore parameters that are not part of the standard (or log a warning), MarkLogic implements a stricter policy and just flat out refuses to answer such requests.

A solution in your case is to upgrade to RDF4J 2.2. Improvement #721, which is about making sure that only standards-compliant parameters are sent to non-RDF4J SPARQL endpoints, was implemented in this new release, and (assuming MarkLogic is otherwise standards-compliant) this should fix the problem in communicating with your MarkLogic endpoint.