1

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?

Ian Kurtis
  • 137
  • 7
  • 2
    the issue is that your `?author` is a string literal according to your `INSERT DATA` statement: `dcterms:author "authorName" .` - that obviously doesn't work as the graph variable has be an IRI. So the issue here is in your `INSERT DATA` command, it should be `dcterms:author ` - otherwise book and author wouldn't be connected anyways. – UninformedUser Nov 05 '21 at 19:16

0 Answers0