# Error on query against multiple virtual graphs

**URL:** <https://community.stardog.com/t/error-on-query-against-multiple-virtual-graphs/3051>\
**Category:** Bug\
**Created:** [May 19, 2021, 5:13pm UTC](https://community.stardog.com/t/error-on-query-against-multiple-virtual-graphs/3051 "2021-05-19T17:13:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkatsumi](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@mkatsumi](https://community.stardog.com/u/mkatsumi)\
**Post date:** [May 19, 2021, 5:13pm UTC](https://community.stardog.com/t/error-on-query-against-multiple-virtual-graphs/3051/1 "2021-05-19T17:13:19Z")

</div>

Hello,  
I am trying to run a SPARQL query against multiple virtual graphs.  
I am able to get the expected results if I use the union operator, as in the following:

> SELECT \*  
> WHERE {  
> {  
> GRAPH virtual://aiw {  
> ?a ?b ?c.  
> }  
> }  
> UNION  
> {  
> GRAPH virtual://tw\_mockdb2 {  
> ?a ?b ?c.  
> }  
> }  
> }  
> However, if I attempt to run the query without the union, using the following format, no results are returned (nor is there an error):  
> SELECT \*  
> FROM virtual://tw\_mockdb2  
> FROM virtual://aiw  
> WHERE  
> {  
> GRAPH ?g {  
> ?a ?b ?c.  
> }  
> }

I came across an earlier, similar topic ([Combining virtual graphs and the other graphs](https://community.stardog.com/t/combining-virtual-graphs-and-the-other-graphs/1758)) and the response indicates that the issue would be corrected in a 2019 release however it doesn't seem to be working.

---

<div class="post-metadata">

**Author:** ![serge](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/serge/32/376_2.png) [@serge](https://community.stardog.com/u/serge)\
**Post date:** [May 19, 2021, 6:11pm UTC](https://community.stardog.com/t/error-on-query-against-multiple-virtual-graphs/3051/2 "2021-05-19T18:11:23Z")

</div>

This is working as expected. If you change your line from 'FROM' to 'FROM NAMED' it should work.

To help understand the disctinction, please refer to slide 54-56 of our [Getting Started with RDF and SPARQL](https://www.stardog.com/trainings/getting-started-with-rdf-sparql/) from our [Stardog University](https://www.stardog.com/trainings/) series.

---

<div class="post-metadata">

**Author:** ![mkatsumi](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@mkatsumi](https://community.stardog.com/u/mkatsumi)\
**Post date:** [May 19, 2021, 7:35pm UTC](https://community.stardog.com/t/error-on-query-against-multiple-virtual-graphs/3051/3 "2021-05-19T19:35:13Z")

</div>

Hello,  
Thank you for the quick response. I also tried using "FROM NAMED" in the query, (as below) however no results are returned.

> SELECT \*  
> FROM NAMED virtual://tw\_mockdb2  
> FROM NAMED virtual://aiw  
> WHERE  
> {  
> GRAPH ?g {  
> ?a ?b ?c.  
> }  
> }

---

<div class="post-metadata">

**Author:** ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)\
**Post date:** [May 19, 2021, 7:38pm UTC](https://community.stardog.com/t/error-on-query-against-multiple-virtual-graphs/3051/4 "2021-05-19T19:38:01Z")

</div>

Hi Megan,

Currently it is required to enable the "Virtual Transparency" database option to use virtual graphs in the dataset (FROM and FROM NAMED).

Jess

---

<div class="post-metadata">

**Author:** ![mkatsumi](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@mkatsumi](https://community.stardog.com/u/mkatsumi)\
**Post date:** [May 19, 2021, 8:42pm UTC](https://community.stardog.com/t/error-on-query-against-multiple-virtual-graphs/3051/5 "2021-05-19T20:42:20Z")

</div>

Hi Jess,  
Thank you! Found the option and it works perfectly!

Megan
