sparql expecting one of “where”, “using”

前端 未结 1 864
情书的邮戳
情书的邮戳 2021-01-25 00:26

I am trying to do a simple insert query in the web interface of Fuseki server. I have set the endpoint to /update (instead of the default /sparql). I h

相关标签:
1条回答
  • 2021-01-25 00:53

    The document you're referencing is the 2008 SPARQL Update submission, not the actual 2013 SPARQL 1.1 recommendation. The recommendation is the actual standard, the submission is not.

    An update (insert or delete) isn't a query (select, ask, construct), and the syntax for the two kinds of query aren't necessarily the same. You note (correctly) that WHERE is optional in a select query, but that doesn't mean that it's optional in an insert. There are two forms of insert. There's INSERT DATA which has the syntax:

    INSERT DATA  QuadData  
    

    and there's DELETE/INSERT which has the syntax:

    ( WITH IRIref )?
    ( ( DeleteClause InsertClause? ) | InsertClause )
    ( USING ( NAMED )? IRIref )*
    WHERE GroupGraphPattern
    
    DeleteClause ::= DELETE  QuadPattern 
    InsertClause ::= INSERT  QuadPattern 
    

    So if you're using INSERT { … }, then that's the InsertClause of a DELETE/INSERT form, and you need to follow it with WHERE …. Since you're using static data, you should probably just use the INSERT DATA form:

    PREFIX dc: <http://purl.org/dc/elements/1.1/>
    INSERT DATA { <http://example/egbook3> dc:title  "This is an example title" }
    
    0 讨论(0)
提交回复
热议问题