Triply-Dev / YASGUI.YASQE-deprecated

Deprecated, see https://github.com/TriplyDB/Yasgui for the Yasgui monorepo
MIT License
73 stars 36 forks source link

Add ability to better modify SPARQL ajax calls #72

Closed LaurensRietveld closed 9 years ago

LaurensRietveld commented 9 years ago

Quoted from https://github.com/YASGUI/YASGUI/issues/72:

C) ability to add pre (and/or post) information to the SPARQL query. It would be nice if I could configure the following in yasgui-yasge/sparql.js

YASQE.getUrlArguments = function(yasqe, config) { var queryMode = yasqe.getQueryMode(); /\ bert - virtuoso specific **/ var data = [{ name: yasqe.getQueryMode(), //either 'update' or 'query' value: "define input:default-graph-exclude http://www.openlinksw.com/schemas/virtrdf#, http://localhost:8890/DAV/, http://www.w3.org/2002/07/owl#, http://localhost:8890/sparql, http://www.w3.org/ns/ldp# "+ yasqe.getValue() }];

Virtuoso allows some additional parametrization beyond the SPARQL syntax. In this case I can avoid to get the content of "system graphs".

LaurensRietveld commented 9 years ago

I've added a function YASQE.defaults.sparql.getQueryForAjax that enables you to modify the query string before sending it via ajax request. I'll add it to the YASGUI lib after doing some minor features requests @bertvannuffelen Does this solution suffice?

A related fyi: another option would have been to use YASQE.defaults.sparql.callbacks.beforeSend, that enables you to modify the complete ajax request before send. Not a very clean method for your scenario though, as the data object is already encoded to string

bertvannuffelen commented 9 years ago

Hi Laurens,

thanks for the effort. The function provides sufficient power and easiness for the suggested case. I will evaluate later.

Bert

LaurensRietveld commented 9 years ago

I'll close the ticket for now, but let me know if there are any problems