The error from Jena when I try to reproduce is fairly clear:

@Test
public void testGraphBinding() {
    MarkLogicDatasetGraph dsg = getMarkLogicDatasetGraph();
    String updateQuery = "WITH ?g INSERT { <http://example.org/a> 
<http://example.org/p> \"1\" }";
    BindingMap updateBindings = new BindingHashMap();
    updateBindings.add(Var.alloc("g"),
            NodeFactory.createURI("http://example.org/g";));
    UpdateRequest update = new UpdateRequest();
    update.add(updateQuery);
    UpdateAction.execute(update, dsg, updateBindings);
}



org.apache.jena.query.QueryParseException: Encountered " <VAR1> "?g "" at line 
1, column 6.
Was expecting one of:
    <IRIref> ...
    <PNAME_NS> ...
    <PNAME_LN> ...



So I guess to reframe my question -- given that the expectation of this 
customer is that ?g should be bindable here,

can I give them a rationale?  Sometimes "the spec prohibits it" is not what 
people want to hear.




Charles Greer
Lead Engineer
MarkLogic Corporation
[email protected]
@grechaw
www.marklogic.com

________________________________
From: james anderson <[email protected]>
Sent: Wednesday, October 25, 2017 9:59:14 AM
To: [email protected]
Subject: Re: Binding graph names for WITH and USING

good evening;


> On 2017-10-25, at 18:48, Charles Greer <[email protected]> wrote:
>
> Hi jena folks, I was surprised recently with a customer who was surprised 
> that my jena connector did not properly
>
> bind graph names as variables after WITH.
>
>
> WITH ?g
>
> INSERT ...
>
> DELETE ...
>
>
> When I looked back at the SPARQL specs, it looks indeed true that variables 
> are inadmissable after WITH or USING.
>
> I am curious about how to write a workaround, short of putting a literal in 
> for ?g

do you have a concrete example which you are in a position to share?

where did the customer express a binding for the ?g of which they thought the 
‘with’ clause was in its scope?

best regards, from berlin,

Reply via email to