I was trying to send some queries to a GraphDB endpoint that allows for some additional URL parameters that impact the results that are actually being returned ("Include inferred data in results" & "Expand results over owl:sameAs").
Would it be possible to add support for additional URL parameters to the library?
I tried to turn this into a pull-request, yet my TypeScript is very limited and I didn't get to a solution where the tests were actually running, yet see below what changes in the Javascript I'm talking about.
...
/**
* A SparqlEndpointFetcher can send queries to SPARQL endpoints,
* and retrieve and parse the results.
*/
class SparqlEndpointFetcher {
constructor(args) {
args = args || {};
this.method = args.method || 'POST';
this.additionalUrlParams = args.additionalUrlParams || {};
this.fetchCb = args.fetch;
...
async fetchRawStream(endpoint, query, acceptHeader) {
let url = this.method === 'POST' ? endpoint : endpoint + '?query=' + encodeURIComponent(query);
// Initiate request
const headers = new Headers();
let body;
headers.append('Accept', acceptHeader);
if (this.method === 'POST') {
headers.append('Content-Type', 'application/x-www-form-urlencoded');
body = new URLSearchParams();
body.set('query', query);
for (const [key, value] of Object.entries(this.additionalUrlParams)) {
body.set(key, value);
}
headers.append('Content-Length', body.toString().length.toString());
} else {
const additionalUrlSearchParams = new URLSearchParams(this.additionalUrlParams)
url += `&${additionalUrlSearchParams.toString()}`;
}
return this.handleFetchCall(url, { headers, method: this.method, body });
}
...
I was trying to send some queries to a GraphDB endpoint that allows for some additional URL parameters that impact the results that are actually being returned ("Include inferred data in results" & "Expand results over owl:sameAs").
Would it be possible to add support for additional URL parameters to the library?
I tried to turn this into a pull-request, yet my TypeScript is very limited and I didn't get to a solution where the tests were actually running, yet see below what changes in the Javascript I'm talking about.