{"action":"created","issue":{"url":"https://api.github.com/repos/YASGUI/YASQE/issues/24","labels_url":"https://api.github.com/repos/YASGUI/YASQE/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/YASGUI/YASQE/issues/24/comments","events_url":"https://api.github.com/repos/YASGUI/YASQE/issues/24/events","html_url":"https://github.com/YASGUI/YASQE/issues/24","id":46359687,"number":24,"title":"Suggestion for variable insertion via VALUES (poor man's sparql templating ...)","user":{"login":"jneubert","id":2128921,"avatar_url":"https://avatars.githubusercontent.com/u/2128921?v=3","gravatar_id":"","url":"https://api.github.com/users/jneubert","html_url":"https://github.com/jneubert","followers_url":"https://api.github.com/users/jneubert/followers","following_url":"https://api.github.com/users/jneubert/following{/other_user}","gists_url":"https://api.github.com/users/jneubert/gists{/gist_id}","starred_url":"https://api.github.com/users/jneubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jneubert/subscriptions","organizations_url":"https://api.github.com/users/jneubert/orgs","repos_url":"https://api.github.com/users/jneubert/repos","events_url":"https://api.github.com/users/jneubert/events{/privacy}","received_events_url":"https://api.github.com/users/jneubert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2014-10-21T06:36:37Z","updated_at":"2015-06-22T08:07:25Z","closed_at":null,"body":"Thinking about what we discussed yesterday, and taking into account that general templating for sparql queries may be tricky, I wonder if the VALUES statement could be exploited for this.\r\n\r\nVALUES could be used by the author of a query to define defaults values for queries, which are meant to be overridden by users of this query, for example:\r\n```\r\n...\r\nFILTER ( lang(?label) = ?language )\r\n...\r\nVALUES ?language { \"en\" }\r\n```\r\nPerhaps, YASGE could support this, in offering a \"Edit values\" function, where for each VALUES parameter an editable field with the value is displayed, and the result is inserted into the query.\r\n\r\nThe more general case of the VALUES statement looks like this (http://www.w3.org/TR/sparql11-query/#inline-data):\r\n```\r\nVALUES (?x ?y) {\r\n  (:uri1 1)\r\n  (:uri2 UNDEF)\r\n}\r\n```\r\nso parsing would a bit more difficult, and values would have to be given in a grid of editable fields.\r\n\r\nThe advantage of such an approach would be that the author of a query can designate \"tweak here\" spots. Other variables, which should be bound during the execution of the query, would not be exposed. Thus, the inner working is not disturbed, and the default values - hopefully in combination with the variable names - can provide hints for the users on what to fill in.\r\n\r\nOf course, all of this can be achieved by custom coding - but it would make a nice and rather general feature too, wouldn't it?\r\n"},"comment":{"url":"https://api.github.com/repos/YASGUI/YASQE/issues/comments/114035210","html_url":"https://github.com/YASGUI/YASQE/issues/24#issuecomment-114035210","issue_url":"https://api.github.com/repos/YASGUI/YASQE/issues/24","id":114035210,"user":{"login":"osma","id":1132830,"avatar_url":"https://avatars.githubusercontent.com/u/1132830?v=3","gravatar_id":"","url":"https://api.github.com/users/osma","html_url":"https://github.com/osma","followers_url":"https://api.github.com/users/osma/followers","following_url":"https://api.github.com/users/osma/following{/other_user}","gists_url":"https://api.github.com/users/osma/gists{/gist_id}","starred_url":"https://api.github.com/users/osma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osma/subscriptions","organizations_url":"https://api.github.com/users/osma/orgs","repos_url":"https://api.github.com/users/osma/repos","events_url":"https://api.github.com/users/osma/events{/privacy}","received_events_url":"https://api.github.com/users/osma/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T08:07:25Z","updated_at":"2015-06-22T08:07:25Z","body":"I sense some potential confusion in this discussion as people arrive with various background expectations...\r\n\r\nI understand that @lisp, @bendiken and @jaw111 are talking about how to pass extra parameters to a SPARQL endpoint (Dydra in this case) alongside the actual query, to be incorporated into the query by the request processor, which is apparently more efficient than performing string manipulation on the query text.\r\n\r\n@jneubert on the other hand wants specific functionality in the YASQE tool: to be able to pass URL parameters to the web page where YASQE is embedded, so that YASQE can plug these parameters into the SPARQL query before it is sent to the endpoint in another HTTP request. This could be implemented in several ways, e.g. YASQE could perform intelligent string substitution on the query (using JavaScript that it is implemented in), for example by adding/modifying a VALUES clause. Or conceivably, if the endpoint supported something like what Dydra does, those parameters could be added as extra URL/POST parameters in the subsequent request to the endpoint - but since that is not standardized at the moment even in SPARQL 1.1, I wouldn't expect YASQE to rely on that any time soon.\r\n\r\nThe important distinction here is which HTTP request we are talking about. As I understand it, this issue is mainly about the request for the web page where YASQE is embedded, not the subsequent HTTP request to the SPARQL endpoint, though it will also be affected indirectly by the parameter substitution."}}