you should define the dataset for the query: either by adding FROM NAMED stardog:context:local or by choosing that stardog:context:local in the graph drop-down list.
There's something strange with your IRIs: it should be stardog:context:local, not stardog:local. Maybe some of your graphs in the data use the reserved IRIs, or something like that. Can you execute
select * from named <tag:stardog:api:context:local> { graph ?g { ?s ?p ?o } }
using the command line interface (i.e. stardog query execute)?
OK, I have reproduced the issue and can explain what happens. In SPARQL, the set of graphs (default or named) that your query accesses consists of two parts:
the default part: the graphs that triple patterns outside of graph ?g { .. } match
the named part: the graphs that triple patterns inside graph ?g { .. } match.
the default part is defined using FROM. the named part is defined using FROM NAMED. Your query is correct: it uses graph ?g and thus defines the graphs using FROM NAMED. Stardog backend also handles it correctly, this is why CLI returns the expected results.
However, when you select stardog:context:all (or anything) in Studio's drop-down list, it defines the default scope using HTTP parameters (as defined in the SPARQL Protocol spec). That spec requires that if different datasets are specified in the query string and in the protocol request, then the latter takes precedence (see 2.1.4 in SPARQL 1.1 Protocol).
What this effectively means is that Stardog gets a query that is functionally equivalent to
it works because by default (that is, there're no FROM or FROM NAMED keywords in the query), the backend is free to choose the dataset. In Stardog the dataset depends on the value of the query.all.graphs database option. If you didn't change it, the dataset in this case would be tag:stardog:api:context:default for the default part and tag:stardog:api:context:named for the named part. I.e. the query is functionally equivalent to FROM <tag:stardog:api:context:default> FROM NAMED <tag:stardog:api:context:named>. For your query only FROM NAMED is relevant since the pattern is inside graph ?g.
Now your query defined the dataset: the default part is empty but the named part is <tag:stardog:api:context:named>. Only the latter is relevant and the query works again.
That's right: now since you removed graph ?g, the triple pattern matches data in the default part of the dataset. That is specified either in the query itself (that'd be FROM) or in the drop-down list. You chose the latter.
PREFIX stardog: <tag:stardog:api:context:>
SELECT *
FROM stardog:local
WHERE {
?s ?p ?o .
}
that should work too (from CLI or Studio wiithout selecting anything in the drop-down list).