Specifying named graph in API request

Hello there :slight_smile:
staring with the usage of API calls to query my DB, I run into a problem:
an API call like
https://[my ID].stardog.cloud:5820/[my DB]/query?query=SELECT%20*WHERE%20%7B%20%20%20%20%3Fs%20%3Fp%20%3Fo%20.%7DLIMIT%201000
works in principle, but returns no results as I'm not using the default graph.
In Studio, I can simply choose the correct namespace via "Set Named Graph" next to the DB selector.
How can I specify that in the API call?
just adding &named-graph=[my graph name] does not seem to do the trick.

Hi Jasper,

Stardog implements the SPARQL 1.1 Protocol: SPARQL 1.1 Protocol so for your query the parameter would be default-graph-uri (see 2.1).

Best,
Pavel

2 Likes

This works, thank you!
Just have to make sure to have not only the graph name in the parameter but the complete path like tag:stardog:designer:[my graph]:model
which then looks like that in the URL

https://[my ID].stardog.cloud:5820/[my DB]/query?default-graph-uri=tag:stardog:designer:[my graph]:model&query=SELECT%20*WHERE%20%7B%20%20%20%20%3Fs%20%3Fp%20%3Fo%20.%7DLIMIT%201000
1 Like