# GraphQL query returns zero rows for named graphs

**URL:** https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703
**Category:** Support
**Created:** [April 26, 2022, 2:15pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703 "2022-04-26T14:15:30Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![R3000](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/r3000/32/358_2.png) [@R3000](https://community.stardog.com/u/R3000)
#### Post date: [April 26, 2022, 2:15pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/1 "2022-04-26T14:15:30Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/0/0c431215768c0f8acddfa32b8d19ac8a9b136cfa.png)

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

Thank you,  
Radu

---

<div class="post-metadata">

### Author: ![R3000](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/r3000/32/358_2.png) [@R3000](https://community.stardog.com/u/R3000)
#### Post date: [April 26, 2022, 5:09pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/2 "2022-04-26T17:09:03Z")

</div>

After watching this tutorial [Stardog Academy Fundamentals: GraphQL - YouTube](https://www.youtube.com/watch?v=K8TFAHEC3SA)

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/b/b29ef87d6afd7d32d6434a5eb0b03e58fde2c65a.jpeg)

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

---

<div class="post-metadata">

### Author: ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)
#### Post date: [April 26, 2022, 5:44pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/3 "2022-04-26T17:44:12Z")

</div>

Hi Radu,

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

```auto
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:

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

```

---

<div class="post-metadata">

### Author: ![R3000](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/r3000/32/358_2.png) [@R3000](https://community.stardog.com/u/R3000)
#### Post date: [April 26, 2022, 7:43pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/4 "2022-04-26T19:43:31Z")

</div>

Stephen,

Unfortunatelly I am still getting zero rows even after this:

```auto
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 ☹

- Why?

Thanks,  
Radu

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [May 6, 2022, 8:08am UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/5 "2022-05-06T08:08:10Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [May 13, 2022, 3:24am UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/6 "2022-05-13T03:24:16Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [May 18, 2022, 1:29pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/7 "2022-05-18T13:29:01Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [May 25, 2022, 12:11am UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/8 "2022-05-25T00:11:38Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [June 1, 2022, 7:09pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/9 "2022-06-01T19:09:42Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [June 11, 2022, 2:54pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/10 "2022-06-11T14:54:54Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [June 22, 2022, 2:13am UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/11 "2022-06-22T02:13:10Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [July 2, 2022, 10:21pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/12 "2022-07-02T22:21:19Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [July 14, 2022, 10:22am UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/13 "2022-07-14T10:22:59Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [July 25, 2022, 10:43pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/14 "2022-07-25T22:43:29Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [August 8, 2022, 4:18am UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/15 "2022-08-08T04:18:43Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [August 21, 2022, 11:44pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/16 "2022-08-21T23:44:08Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [September 4, 2022, 10:16pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/17 "2022-09-04T22:16:26Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [September 18, 2022, 5:40pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/18 "2022-09-18T17:40:18Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [October 2, 2022, 10:35pm UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/19 "2022-10-02T22:35:23Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)
#### Post date: [October 17, 2022, 3:12am UTC](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703/20 "2022-10-17T03:12:09Z")

</div>



[Next page](https://community.stardog.com/t/graphql-query-returns-zero-rows-for-named-graphs/3703.md?page=2)
