How to insert data into named graph using SPARQL where the named graph is given as variable?

109 Views Asked by At

I want to insert data into the named graph called as the ?author variable. How could I achieve this?

PREFIX dcterms: <http://purl.org/dc/terms/>
INSERT
{
  GRAPH ?author {
    ?book dcterms:provenance <http://example/shelf_A> 
  } 
}
WHERE
{
  ?book dcterms:author ?author .
}

Initial data:


PREFIX dcterms: <http://purl.org/dc/terms/>

INSERT DATA {
        <http://example/author> dcterms:name "author" .
        <http://example/book> dcterms:title "book" ;
                              dcterms:author "authorName" .  
    } 


Data still got inserted into the bd:nullGraph, not the authorName graph. How to solve this issue?

0

There are 0 best solutions below