GraphQL query returns zero rows for named graphs

This query works fine for sample music tutorial that uses default graph

  • But how do I create a graphql query for querying a named graph in a graph database?

Thank you,
Radu

After watching this tutorial Stardog Academy Fundamentals: GraphQL - YouTube

I have used @prefix and @config and ns_ trick - still zero rows returning.

  • Any idea?

I really need a timely answer to this simple question.

Regards,
Radu

Hi Radu,

Passing a string into the @config(graph: ) directive will query the specified named graph:

query Foo
@prefix(tut: "http://stardog.com/tutorial/")
@config(graph: "http://stardog.com/tutorial/foobar")
{
    tut_Song {
        tut_name
    }
}

If I do a query explain (Show Plan) on it, I can see the graph in my SPARQL:

SPARQL:
SELECT *
FROM <http://stardog.com/tutorial/foobar>
{
?0 rdf:type tut:Song .
?0 tut:name ?1 .
}

Stephen,

Unfortunatelly I am still getting zero rows even after this:

query qName
@config(graph: "http://example.com/kg/")
@prefix(dco: "https://w3id.org/example/vocab#")
@prefix(rdfs: "http://www.w3.org/2000/01/rdf-schema#")
{
    dco_Author{
        rdfs_label
    }
}

But even more weird is that I copy and paste the generated sparql query from Show Plan and it works :frowning:

  • Why?

Thanks,
Radu