Issue using variable binding for named graph via CLI based query

Hi community,

I am trying to insert data from one named graph into another via the CLI. Minimal example:

Create Data:

INSERT DATA {GRAPH <global:temp> {
:_A :has_value 2 .
:_B :has_value "hello" .
}
}

test.sparql:

INSERT {GRAPH ?g1{?s ?p ?o}}  WHERE {GRAPH ?g2{?s ?p ?o}}

CLI command:

stardog query -v -b g1="<global:target>" g2="<global:temp>" -- xyz test.sparql
stardog query -g global:target xyz "SELECT * WHERE {?s ?p ?o}"

Unfortunately, not getting any results. Am I doing something wrong here?

Note: I am using Stardog 8.0

This is a known issue, Query parameters apply only to the WHERE clause. So you can rewrite your query as

INSERT {GRAPH ?g1_{?s ?p ?o}}  WHERE {BIND(?g1 AS ?g1_) GRAPH ?g2{?s ?p ?o}}

Best,
Evren

Thanks, Evren. Does work as expected.