Stored Procedures in Stardog

Good morning,

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.

Thanks in advance.

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

Never mind, I found the answer here:


Hi again,

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:

{"message":"The query binding 'ex:Ind_1' is a malformed Turtle value"}

If I use the full individual URI the query is done correctly:


Is there anyone from support team that can confirm if it is possible to use prefixes in param binding with the HTTP API ?

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.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.