Is there any way to store and launch queries with parameters? something like stored procedures?. I know there is an option to store fixed queries, but I want to save queries in the database and execute them passing parameters. Currently, I have to modify the query string changing the parameters in my app.
You can store queries with $variables in them and pass in values for them at query time. How are you wanting to do this (HTTP, Java, CLI, something else)?
I'm using node.js, could you give an example of the bind param for javascript or HTTP API?
I know the command using linux console:
stardog query -r -b p1=ex:Ind_1 -- Database StoredQueryName
I have realized that it is not possible to use prefixes to bind variables with the HTTP API, with CLI it is possible: stardog query -r -b p1=ex:Ind_1 -- Database StoredQueryName
But with HTTP API: http://localhost:5820/Database/query?query=StoredQueryName&$p1=ex:Ind_1
Returns: {"message":"The query binding 'ex:Ind_1' is a malformed Turtle value"}
If I use the full individual URI the query is done correctly:
No, the parameters passed to the HTTP API should be full IRIs at this point. CLI does an extra step to turn prefixed names into full IRIs before sending them to the server. We will look into making this change in the server.