title: Converting RDFConnection.load(String graphName, Model model) into SPARQL Update notation while specifying named graph
body: <p>I am working on a code base that uses Apache Jena (3.14.0) to save triples into either Anzo or Fuseki (for local testing).</p>
  <p>I am trying to adapt the code to support AWS Neptune - see related <a href="https://stackoverflow.com/questions/67077733/load-data-into-aws-neptune-via-apache-jena-missing-query-or-update-param?noredirect=1#comment118572622_67077733">question</a>.</p>
  <p>A fellow SO user brought my attention to the fact that Neptune does not support GSP.</p>
  <p>The code I'm looking at persists triples with the <a href="http://localhost:63342/digital-twin-parent/jena-rdfconnection-3.14.0-javadoc.jar/org/apache/jena/rdfconnection/RDFConnection.html#load-java.lang.String-org.apache.jena.rdf.model.Model-" rel="nofollow noreferrer">RDFConnection.load(String graphName, Model model)</a> notation.</p>
  <p>My idea was to convert it to <a href="http://localhost:63342/digital-twin-parent/jena-rdfconnection-3.14.0-javadoc.jar/org/apache/jena/rdfconnection/RDFConnection.html#update-org.apache.jena.update.Update-" rel="nofollow noreferrer">RDFConnection.update(Update update)</a>.</p>
  <p>In other words:</p>
  <pre><code>myRdfConnectionInstance.load( myGraphNameString, myJenaModel )
  </code></pre>
  <p>... would become something in the lines of:</p>
  <pre><code>myRdfConnectionInstance.update(
      new UpdateBuilder()
          .addInsert( myGraphNameString, myJenaModel )
          .build()
  );
  </code></pre>
  <p>(<code>myGraphNameString</code> represents a URN)</p>
  <p>My take was that this notation would employ the SPARQL update protocol as opposed to GSP, hence enabling persisting the triples in Neptune.</p>
  <p>I was comforted in that regard by the fact that, if I omitted the named graph parameter and just invoked <code>.addInsert( myJenaModel )</code>, the request would be valid with all triple stores I tried it with.</p>
  <p>Unfortunately the same parametrized with a named graph fails not only with Neptune, but also with my local Fuseki store.</p>
  <p>The <a href="http://localhost:63342/digital-twin-parent/jena-querybuilder-3.14.0-javadoc.jar/org/apache/jena/arq/querybuilder/UpdateBuilder.html#addInsert-java.lang.Object-org.apache.jena.rdf.model.Model-" rel="nofollow noreferrer">javadoc</a> states:</p>
  <blockquote>
  <p>Add all the statements in the model a specified graph to the insert statement.[...]</p>
  </blockquote>
  <p>... which was confusing in terms of English, but seemed to lean towards what I wanted.</p>
  <p>I suspect the second part of the description:</p>
  <blockquote>
  <p>The graph object is converted by a call to makeNode().</p>
  </blockquote>
  <p>... is where I'm messing up.</p>
  <p>Unfortunately I happen to be neither too familiar with triple stores in depth, nor with Jena, so I don't know where to chase next.</p>
  <p><strong>Questions</strong></p>
  <ul>
  <li>Is <code>RDFConnection#update</code> the right direction to convert the write notation to SPARQL update, hence preparing for compatibility with Neptune?</li>
  <li>If so, what am I missing about the parametrization of the graph name?</li>
  <li>If there any additional documentation that would be relevant, aside from the APIs quoted here?</li>
  </ul>
  <p><strong>Some error messages</strong></p>
  <p>The response I get from Neptune looks like (formatting added for clarity):</p>
  <pre><code>Http exception response 
  {
  &quot;detailedMessage&quot;:&quot;Malformed query: Illegal subject value: 
      \&quot;urn:[my URN]\&quot;^^&lt;http://www.w3.org/2001/XMLSchema#string&gt; [line 2]&quot;,
  &quot;code&quot;:&quot;MalformedQueryException&quot;,&quot;requestId&quot;:&quot;[some UUID]&quot;
  }
  </code></pre>
  <p>No explicit error message from Fuseki, just the HTTP 400.</p>
  <p>The stack trace looks like:</p>
  <pre><code>org.apache.jena.atlas.web.HttpException: 400 - Bad Request
      at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1091)
      at org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:721)
      at org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:517)
      at org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:473)
      at org.apache.jena.rdfconnection.RDFConnectionRemote.lambda$updateExec$6(RDFConnectionRemote.java:324)
      at org.apache.jena.rdfconnection.RDFConnectionRemote.exec(RDFConnectionRemote.java:668)
      at org.apache.jena.rdfconnection.RDFConnectionRemote.updateExec(RDFConnectionRemote.java:324)
      at org.apache.jena.rdfconnection.RDFConnectionRemote.update(RDFConnectionRemote.java:311)
      at org.apache.jena.rdfconnection.RDFConnection.update(RDFConnection.java:250)
      at [my code]
  </code></pre>