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 2014/11/01 22:34:29 UTC
HttpAuthenticator and Virtuoso
Hi,
I have been using jena 2.12.1 and sparql on a virtuoso 7.1 server with
success for various select queries. I'm now trying to perform sparql
updates using sparql-auth on the same server with:
ParameterizedSparqlString pss2 = new ParameterizedSparqlString("random
sparql update query");
UpdateRequest request = UpdateFactory.create(pss2.toString());
UpdateProcessor ue = UpdateExecutionFactory.createRemote(request,
Settings.SPARQLEndpoint, Settings.authenticator);
ue.execute();
where the authenticator is defined elsewhere as:
public final static HttpAuthenticator authenticator = new
SimpleAuthenticator("dba", "dba".toCharArray());
with a simple SPARQL as
insert data { graph <g1> {<s> <p> <o>}} (shorten URIs for brevity)
but, the above jena code fails.
Enabling debugging on Jena and HTTP recording on Virtuoso shows that
Virtuoso receives the query but doesn't insert the triple. However, the
same sparql command works via the sparql-auth html interface with the
same credentials.
In looking through the debug output, it looks like authentication
between jena and virtuoso is sorted out, but the differences between the
success via the sparql-auth html page and the failed jena attempt is
that the default sparql-auth web pages does a GET to the server while
Jena is doing a post. Any thoughts? -= Erich
Erich Bremer
http://www.ebremer.com
Re: HttpAuthenticator and Virtuoso
Posted by Andy Seaborne <an...@apache.org>.
On 09/11/14 00:25, Erich Bremer wrote:
>
> On Sun, 02 Nov 2014 16:39:33 +0000
> Andy Seaborne <an...@apache.org> wrote:
>> On 01/11/14 21:34, Erich Bremer wrote:
>>> Hi,
>>>
>>> I have been using jena 2.12.1 and sparql on a virtuoso 7.1 server with
>>> success for various select queries. I'm now trying to perform sparql
>>> updates using sparql-auth on the same server with:
>>>
>>> ParameterizedSparqlString pss2 = new ParameterizedSparqlString("random
>>> sparql update query");
>>> UpdateRequest request = UpdateFactory.create(pss2.toString());
>>> UpdateProcessor ue = UpdateExecutionFactory.createRemote(request,
>>> Settings.SPARQLEndpoint, Settings.authenticator);
>>> ue.execute();
>>>
>>> where the authenticator is defined elsewhere as:
>>> public final static HttpAuthenticator authenticator = new
>>> SimpleAuthenticator("dba", "dba".toCharArray());
>>>
>>> with a simple SPARQL as
>>>
>>> insert data { graph <g1> {<s> <p> <o>}} (shorten URIs for brevity)
>>>
>>> but, the above jena code fails.
>>>
>>> Enabling debugging on Jena and HTTP recording on Virtuoso shows that
>>> Virtuoso receives the query but doesn't insert the triple. However, the
>>> same sparql command works via the sparql-auth html interface with the
>>> same credentials.
>>> In looking through the debug output, it looks like authentication
>>> between jena and virtuoso is sorted out, but the differences between the
>>> success via the sparql-auth html page and the failed jena attempt is
>>> that the default sparql-auth web pages does a GET to the server while
>>> Jena is doing a post. Any thoughts? -= Erich
>>> Erich Bremer
>>> http://www.ebremer.com
>>>
>> Erich,
>>
>> In the SPARQL protocol, queries and updates are considered different
>> languages and go to different endpoints (unlike SQL/JDBC, say).
>>
>> Also, updates always go by POST. HTTP GET is not suitable for
>> mutating operations - it may be cached for example.
>>
>> Andy
>>
> Hi Andy,
>
> I changed createRemote to createRemoteForm and it works fine now against
> Virtuoso's /sparql-auth endpoint.
> - Erich
Gald you got it working. It does suggest Virtuoso does not handle
content type application/sparql-update. That's a shame because HTML
forms by their very nature as forms are not as performant at either end
as streaming the update over the server.
Andy
>
>
Re: HttpAuthenticator and Virtuoso
Posted by Erich Bremer <er...@ebremer.com>.
On Sun, 02 Nov 2014 16:39:33 +0000
Andy Seaborne <an...@apache.org> wrote:
> On 01/11/14 21:34, Erich Bremer wrote:
>> Hi,
>>
>> I have been using jena 2.12.1 and sparql on a virtuoso
>>7.1 server with
>> success for various select queries. I'm now trying to
>>perform sparql
>> updates using sparql-auth on the same server with:
>>
>> ParameterizedSparqlString pss2 = new
>>ParameterizedSparqlString("random
>> sparql update query");
>> UpdateRequest request =
>>UpdateFactory.create(pss2.toString());
>> UpdateProcessor ue =
>>UpdateExecutionFactory.createRemote(request,
>> Settings.SPARQLEndpoint, Settings.authenticator);
>> ue.execute();
>>
>> where the authenticator is defined elsewhere as:
>> public final static HttpAuthenticator authenticator =
>>new
>> SimpleAuthenticator("dba", "dba".toCharArray());
>>
>> with a simple SPARQL as
>>
>> insert data { graph <g1> {<s> <p> <o>}} (shorten URIs
>>for brevity)
>>
>> but, the above jena code fails.
>>
>> Enabling debugging on Jena and HTTP recording on
>>Virtuoso shows that
>> Virtuoso receives the query but doesn't insert the
>>triple. However, the
>> same sparql command works via the sparql-auth html
>>interface with the
>> same credentials.
>> In looking through the debug output, it looks like
>>authentication
>> between jena and virtuoso is sorted out, but the
>>differences between the
>> success via the sparql-auth html page and the failed
>>jena attempt is
>> that the default sparql-auth web pages does a GET to the
>>server while
>> Jena is doing a post. Any thoughts? -= Erich
>> Erich Bremer
>> http://www.ebremer.com
>>
> Erich,
>
> In the SPARQL protocol, queries and updates are
>considered different languages and go to different
>endpoints (unlike SQL/JDBC, say).
>
> Also, updates always go by POST. HTTP GET is not
>suitable for mutating operations - it may be cached for
>example.
>
> Andy
>
Hi Andy,
I changed createRemote to createRemoteForm and it works fine now against
Virtuoso's /sparql-auth endpoint.
- Erich
Re: HttpAuthenticator and Virtuoso
Posted by Andy Seaborne <an...@apache.org>.
On 01/11/14 21:34, Erich Bremer wrote:
> Hi,
>
> I have been using jena 2.12.1 and sparql on a virtuoso 7.1 server with
> success for various select queries. I'm now trying to perform sparql
> updates using sparql-auth on the same server with:
>
> ParameterizedSparqlString pss2 = new ParameterizedSparqlString("random
> sparql update query");
> UpdateRequest request = UpdateFactory.create(pss2.toString());
> UpdateProcessor ue = UpdateExecutionFactory.createRemote(request,
> Settings.SPARQLEndpoint, Settings.authenticator);
> ue.execute();
>
> where the authenticator is defined elsewhere as:
> public final static HttpAuthenticator authenticator = new
> SimpleAuthenticator("dba", "dba".toCharArray());
>
> with a simple SPARQL as
>
> insert data { graph <g1> {<s> <p> <o>}} (shorten URIs for brevity)
>
> but, the above jena code fails.
>
> Enabling debugging on Jena and HTTP recording on Virtuoso shows that
> Virtuoso receives the query but doesn't insert the triple. However, the
> same sparql command works via the sparql-auth html interface with the
> same credentials.
> In looking through the debug output, it looks like authentication
> between jena and virtuoso is sorted out, but the differences between the
> success via the sparql-auth html page and the failed jena attempt is
> that the default sparql-auth web pages does a GET to the server while
> Jena is doing a post. Any thoughts? -= Erich
> Erich Bremer
> http://www.ebremer.com
>
Erich,
In the SPARQL protocol, queries and updates are considered different
languages and go to different endpoints (unlike SQL/JDBC, say).
Also, updates always go by POST. HTTP GET is not suitable for mutating
operations - it may be cached for example.
Andy