You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Erich Bremer <er...@ebremer.com> on 2017/12/09 20:30:12 UTC

sparql update on FusekiEmbeddedServer

I'm trying to do a "insert data {}" command on the following end-point for
FusekiEmbeddedServer.

        DataService dataService = new DataService(ds.asDatasetGraph());
        dataService.addEndpoint(OperationName.Quads_RW, "");
        dataService.addEndpoint(OperationName.Query, "");
        dataService.addEndpoint(OperationName.Update, "");
        FusekiEmbeddedServer fs = FusekiEmbeddedServer.create()
            .setPort(8888)
            .add("/ds", dataService)
            .build();
        fs.start();

I get an error of:

Error 400: Parse error:
prefix : <http://www.ebremer.com/pred/>
insert data {<http://www.ebremer.com/test123> :name "Erich Bremer"}

Encountered " <INSERT_DATA> "insert data "" at line 2, column 1.
Was expecting one of:
    "base" ...
    "prefix" ...
    "select" ...
    "describe" ...
    "construct" ...
    "ask" ...


What am I doing wrong or not understanding?  - Erich

Re: sparql update on FusekiEmbeddedServer

Posted by Erich Bremer <er...@ebremer.com>.
The version is 2.6.0,  and yes,  that was the trick was to specify the
content type as "application/sparql-update".  Thanks! - Erich

On Sat, Dec 9, 2017 at 3:52 PM, ajs6f <aj...@apache.org> wrote:

> From memory, SPARQL Query and SPARQL Update have different mimetypes for
> the request. Perhaps you are using the Query mimetype?
>
> ajs6f
>
> > On Dec 9, 2017, at 3:51 PM, Andy Seaborne <an...@apache.org> wrote:
> >
> > Erich,
> >
> > How are you sending the update? It looks like it is sent as a query ...
> because it is and parsed as a query.
> >
> >    Andy
> >
> > Which version?
> >
> > On 09/12/17 20:30, Erich Bremer wrote:
> >> I'm trying to do a "insert data {}" command on the following end-point
> for
> >> FusekiEmbeddedServer.
> >>         DataService dataService = new DataService(ds.asDatasetGraph());
> >>         dataService.addEndpoint(OperationName.Quads_RW, "");
> >>         dataService.addEndpoint(OperationName.Query, "");
> >>         dataService.addEndpoint(OperationName.Update, "");
> >>         FusekiEmbeddedServer fs = FusekiEmbeddedServer.create()
> >>             .setPort(8888)
> >>             .add("/ds", dataService)
> >>             .build();
> >>         fs.start();
> >> I get an error of:
> >> Error 400: Parse error:
> >> prefix : <http://www.ebremer.com/pred/>
> >> insert data {<http://www.ebremer.com/test123> :name "Erich Bremer"}
> >> Encountered " <INSERT_DATA> "insert data "" at line 2, column 1.
> >> Was expecting one of:
> >>     "base" ...
> >>     "prefix" ...
> >>     "select" ...
> >>     "describe" ...
> >>     "construct" ...
> >>     "ask" ...
> >> What am I doing wrong or not understanding?  - Erich
>
>

Re: sparql update on FusekiEmbeddedServer

Posted by ajs6f <aj...@apache.org>.
From memory, SPARQL Query and SPARQL Update have different mimetypes for the request. Perhaps you are using the Query mimetype?

ajs6f

> On Dec 9, 2017, at 3:51 PM, Andy Seaborne <an...@apache.org> wrote:
> 
> Erich,
> 
> How are you sending the update? It looks like it is sent as a query ... because it is and parsed as a query.
> 
>    Andy
> 
> Which version?
> 
> On 09/12/17 20:30, Erich Bremer wrote:
>> I'm trying to do a "insert data {}" command on the following end-point for
>> FusekiEmbeddedServer.
>>         DataService dataService = new DataService(ds.asDatasetGraph());
>>         dataService.addEndpoint(OperationName.Quads_RW, "");
>>         dataService.addEndpoint(OperationName.Query, "");
>>         dataService.addEndpoint(OperationName.Update, "");
>>         FusekiEmbeddedServer fs = FusekiEmbeddedServer.create()
>>             .setPort(8888)
>>             .add("/ds", dataService)
>>             .build();
>>         fs.start();
>> I get an error of:
>> Error 400: Parse error:
>> prefix : <http://www.ebremer.com/pred/>
>> insert data {<http://www.ebremer.com/test123> :name "Erich Bremer"}
>> Encountered " <INSERT_DATA> "insert data "" at line 2, column 1.
>> Was expecting one of:
>>     "base" ...
>>     "prefix" ...
>>     "select" ...
>>     "describe" ...
>>     "construct" ...
>>     "ask" ...
>> What am I doing wrong or not understanding?  - Erich


Re: sparql update on FusekiEmbeddedServer

Posted by Andy Seaborne <an...@apache.org>.
Erich,

How are you sending the update? It looks like it is sent as a query ... 
because it is and parsed as a query.

     Andy

Which version?

On 09/12/17 20:30, Erich Bremer wrote:
> I'm trying to do a "insert data {}" command on the following end-point for
> FusekiEmbeddedServer.
> 
>          DataService dataService = new DataService(ds.asDatasetGraph());
>          dataService.addEndpoint(OperationName.Quads_RW, "");
>          dataService.addEndpoint(OperationName.Query, "");
>          dataService.addEndpoint(OperationName.Update, "");
>          FusekiEmbeddedServer fs = FusekiEmbeddedServer.create()
>              .setPort(8888)
>              .add("/ds", dataService)
>              .build();
>          fs.start();
> 
> I get an error of:
> 
> Error 400: Parse error:
> prefix : <http://www.ebremer.com/pred/>
> insert data {<http://www.ebremer.com/test123> :name "Erich Bremer"}
> 
> Encountered " <INSERT_DATA> "insert data "" at line 2, column 1.
> Was expecting one of:
>      "base" ...
>      "prefix" ...
>      "select" ...
>      "describe" ...
>      "construct" ...
>      "ask" ...
> 
> 
> What am I doing wrong or not understanding?  - Erich
>