# Variable GRAPH + VALUES asignment is broken

**URL:** https://community.stardog.com/t/variable-graph-values-asignment-is-broken/1409
**Category:** Bug
**Created:** [December 3, 2018, 3:26pm UTC](https://community.stardog.com/t/variable-graph-values-asignment-is-broken/1409 "2018-12-03T15:26:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rnavarropiris](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/rnavarropiris/32/44_2.png) [@rnavarropiris](https://community.stardog.com/u/rnavarropiris)
#### Post date: [December 3, 2018, 3:26pm UTC](https://community.stardog.com/t/variable-graph-values-asignment-is-broken/1409/1 "2018-12-03T15:26:15Z")

</div>

Given this test dataset:

```auto
GRAPH <urn:graph:X> {
  <urn:resource:subject> <urn:resource:predicate> <urn:resource:objectX> .
}
GRAPH <urn:graph:Y> {
  <urn:resource:subject> <urn:resource:predicate> <urn:resource:objectY> .
}

```

The following queries:

```auto
SELECT DISTINCT ?g
FROM NAMED <urn:graph:X> 
FROM NAMED <urn:graph:Y> 
{
  BIND (<urn:graph:X> as ?g )
  GRAPH ?g {
  	?s ?p ?o
  }
}
ORDER BY ?g

```

```auto
SELECT DISTINCT ?g
FROM NAMED <urn:graph:X> 
FROM NAMED <urn:graph:Y> 
{
  
  GRAPH ?g {
  	?s ?p ?o
        FILTER (?g = <urn:graph:X>)
  }
}
ORDER BY ?g

```

return the expected result:

```auto
g
urn:graph:X

```

This query, however, does not:

```auto
SELECT DISTINCT ?g
FROM NAMED <urn:graph:X> 
FROM NAMED <urn:graph:Y> 
{
  GRAPH ?g {
  	?s ?p ?o
    VALUES (?g) {(<urn:graph:X>)}
  }
}
ORDER BY ?g

```

as both graphs are returned:

```auto
g
urn:graph:X
urn:graph:Y

```

The problem was reproduced with Stardog 5.3.6 and Stardog 6.0.1

---

<div class="post-metadata">

### Author: ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)
#### Post date: [December 3, 2018, 4:51pm UTC](https://community.stardog.com/t/variable-graph-values-asignment-is-broken/1409/2 "2018-12-03T16:51:27Z")

</div>

Hi Ruben,

Thanks for the great bug report. I confirm the behavior is present in Stardog 6 as well. I created ticket #6607 to track it and we will get it fixed for Stardog 6.0.2 (tentatively scheduled before Christmas).

One possible temporary workaround would be to add the following to your `$STARDOG_SERVER_JAVA_ARGS`: `-Dcom.complexible.stardog.plan.optimizer.from_named_expansion_limit=0`

Best,  
Pavel

---

<div class="post-metadata">

### Author: ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)
#### Post date: [January 17, 2019, 8:33am UTC](https://community.stardog.com/t/variable-graph-values-asignment-is-broken/1409/3 "2019-01-17T08:33:44Z")

</div>

This is fixed in Stardog 6.1 which was released yesterday.

Thanks,  
Pavel
