Re: Federated Query with credentials

2021-05-26 Thread Andy Seaborne




On 26/05/2021 18:08, Jens Zurawski wrote:

Hi Andy, hi list,

because I'm new to the list, I wasn't able to directly reply to the 
corresponding thread. I'm referring to the equal named thread "Federated 
Query with credentials" from the past days.


I am a good skilled Java developer, but my knowledge about Jena, Fuseki 
and SPARQL is quite limited, so please don't shoot me if I'm asking some 
obvious or silly questions. ;-)


Andy, from my understanding the solution you've outlined in your last 
reply to this thread is only working if the requester (aka the 
application) and the query executor (aka the fuseki server) is running 
in the same Java VM, right? It is not possible to pass an HttpClient 
instance from one JVM to another or even to another machine. So this 
will not work in our scenario.


We have an application separated from the fuseki server (we are using 
the binary pre build package). So with RDFConnectionRemoteBuilder it is 
no problem to create a normal Request with an customized HttpClient 
using our CredentialProvider. But in case the Query includes a SERVICE 
subquery to a different dataset or even a different host, from what I 
think, the request for this subquery is then initiated by fuseki, right?


For this to work we have to tell fuseki the credentials to use on one 
way or the other. In the past we've done that together with the IRI. 
It's not perfect but it worked until 4.0.0.


In your last reply you've said:

"In 4.0.0 it can be overzealous
It will remain a wanring, but be passed through."

Does that mean that in future versions the IRI method will work again 
but only put some warnings? Because 4.0.0 throws an HTTP 500 error and 
no warning.


Yes - you can try the development builds where it should be fixed.


Our needed SERVICE IRIs are somewhat static, so it would fully suffice 
if there would be a possibility to just configure the fuseki server with 
some credentials to some IRIs. Is this possible somehow? Or would we 
have to build our own fuseki with an enhacement to give an own 
CredentialsProvider to the default HttpClient?


Fuseki Main is more flexible and easier to add Java to. (No UI.) The CLI 
is driving the server builder.


A custom app can call the CLI as well - it's just a main function.

That makes setting up the SERVICE environment possible.

Andy



thanks in advance for some insigths
Jens



Re: Construct Quads on Apache Jena Fuseki

2021-05-26 Thread Andy Seaborne
It flags a warning; you can still send the query. Yasgui does not know
about extended syntax.

On Wed, 26 May 2021, 15:29 Mikael Pesonen, 
wrote:

>
> Thanks, that works. Gave up too easily since Fuseki web GUI shows error
> "This line is invalid" for line "{ GRAPH ?g { ?s  ?p ?o } } ".
>
> On 26/05/2021 17.24, Andy Seaborne wrote:
> > ARQ supports GRAPH in CONSTRUCT.
> >
> > Need to use for a suitable MIME type for quads.
> >
> > PREFIX : 
> >
> > CONSTRUCT
> > { GRAPH ?g { ?s  ?p ?o } }
> > WHERE
> > {
> >   VALUES ?g { :g1 :g2 }
> >   GRAPH ?g { ?s  ?p ?o }
> > }
> >
> > Andy
> >
> > On 26/05/2021 12:46, Mikael Pesonen wrote:
> >>
> >> Hi,
> >>
> >> sorry for replying to old thread. I would like to dump some graphs
> >> from corrupted db. Is there a way to dump them with one quad query
> >> instead of dumping each graph separately as triples?
> >>
> >> On 03/12/2020 16.23, Ahmed Helal wrote:
> >>> Hi,
> >>>
> >>> My query is:
> >>> CONSTRUCT {
> >>>graph ?g
> >>>  {?s ?p ?o}
> >>> }
> >>> WHERE{
> >>>GRAPH ?g { ?s ?p ?o }. values ?g {}
> >>> }
> >>>
> >>> The interface shows an error/message for the second line saying
> >>> (graph ?g): This line is invalid. Expected: VAR1, VAR2...
> >>>
> >>> This is the returned results:
> >>> {
> >>>"readyState": 4,
> >>>"responseText": "",
> >>>"status": 200,
> >>>"statusText": "OK"
> >>> }
> >>>
> >>>
> >>> Thank you,
> >>> Ahmed.
> >>>
> >>>
> >>>
> >>> 
> >>> From: Rob Vesse 
> >>> Sent: Thursday, December 3, 2020 4:00 AM
> >>> To: users@jena.apache.org 
> >>> Subject: Re: Construct Quads on Apache Jena Fuseki
> >>>
> >>> The list does not permit attachments so we cannot see screenshots.
> >>> Please provide the example query that is failing and the error/log
> >>> message(s) you see in relation to the failure
> >>>
> >>>
> >>>
> >>> Rob
> >>>
> >>>
> >>>
> >>> From: Ahmed Helal 
> >>> Reply to: 
> >>> Date: Thursday, 3 December 2020 at 06:26
> >>> To: "users@jena.apache.org" 
> >>> Subject: Construct Quads on Apache Jena Fuseki
> >>>
> >>>
> >>>
> >>> Hello everyone,
> >>>
> >>>
> >>>
> >>> I am trying to construct Quads following the documentation on this
> >>> page:
> >>>
> >>> https://jena.apache.org/documentation/query/construct-quad.html
> >>>
> >>>
> >>>
> >>> However, when I write my script on Apache Jena Fuseki, it complains.
> >>> I have attached a screenshot below
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> Thank you,
> >>>
> >>> Ahmed Helal.
> >>>
> >>>
> >>>
> >>> Note: The script in the screenshot is just for the sake of the example
> >>>
> >>>
> >>
>
>


Federated Query with credentials

2021-05-26 Thread Jens Zurawski

Hi Andy, hi list,

because I'm new to the list, I wasn't able to directly reply to the 
corresponding thread. I'm referring to the equal named thread "Federated 
Query with credentials" from the past days.


I am a good skilled Java developer, but my knowledge about Jena, Fuseki 
and SPARQL is quite limited, so please don't shoot me if I'm asking some 
obvious or silly questions. ;-)


Andy, from my understanding the solution you've outlined in your last 
reply to this thread is only working if the requester (aka the 
application) and the query executor (aka the fuseki server) is running 
in the same Java VM, right? It is not possible to pass an HttpClient 
instance from one JVM to another or even to another machine. So this 
will not work in our scenario.


We have an application separated from the fuseki server (we are using 
the binary pre build package). So with RDFConnectionRemoteBuilder it is 
no problem to create a normal Request with an customized HttpClient 
using our CredentialProvider. But in case the Query includes a SERVICE 
subquery to a different dataset or even a different host, from what I 
think, the request for this subquery is then initiated by fuseki, right?


For this to work we have to tell fuseki the credentials to use on one 
way or the other. In the past we've done that together with the IRI. 
It's not perfect but it worked until 4.0.0.


In your last reply you've said:

"In 4.0.0 it can be overzealous
It will remain a wanring, but be passed through."

Does that mean that in future versions the IRI method will work again 
but only put some warnings? Because 4.0.0 throws an HTTP 500 error and 
no warning.


Our needed SERVICE IRIs are somewhat static, so it would fully suffice 
if there would be a possibility to just configure the fuseki server with 
some credentials to some IRIs. Is this possible somehow? Or would we 
have to build our own fuseki with an enhacement to give an own 
CredentialsProvider to the default HttpClient?


thanks in advance for some insigths
Jens



Re: Construct Quads on Apache Jena Fuseki

2021-05-26 Thread Mikael Pesonen



Thanks, that works. Gave up too easily since Fuseki web GUI shows error 
"This line is invalid" for line "{ GRAPH ?g { ?s  ?p ?o } } ".


On 26/05/2021 17.24, Andy Seaborne wrote:

ARQ supports GRAPH in CONSTRUCT.

Need to use for a suitable MIME type for quads.

PREFIX : 

CONSTRUCT
{ GRAPH ?g { ?s  ?p ?o } }
WHERE
{
  VALUES ?g { :g1 :g2 }
  GRAPH ?g { ?s  ?p ?o }
}

    Andy

On 26/05/2021 12:46, Mikael Pesonen wrote:


Hi,

sorry for replying to old thread. I would like to dump some graphs 
from corrupted db. Is there a way to dump them with one quad query 
instead of dumping each graph separately as triples?


On 03/12/2020 16.23, Ahmed Helal wrote:

Hi,

My query is:
CONSTRUCT {
   graph ?g
 {?s ?p ?o}
}
WHERE{
   GRAPH ?g { ?s ?p ?o }. values ?g {}
}

The interface shows an error/message for the second line saying 
(graph ?g): This line is invalid. Expected: VAR1, VAR2...


This is the returned results:
{
   "readyState": 4,
   "responseText": "",
   "status": 200,
   "statusText": "OK"
}


Thank you,
Ahmed.




From: Rob Vesse 
Sent: Thursday, December 3, 2020 4:00 AM
To: users@jena.apache.org 
Subject: Re: Construct Quads on Apache Jena Fuseki

The list does not permit attachments so we cannot see screenshots.  
Please provide the example query that is failing and the error/log 
message(s) you see in relation to the failure




Rob



From: Ahmed Helal 
Reply to: 
Date: Thursday, 3 December 2020 at 06:26
To: "users@jena.apache.org" 
Subject: Construct Quads on Apache Jena Fuseki



Hello everyone,



I am trying to construct Quads following the documentation on this 
page:


https://jena.apache.org/documentation/query/construct-quad.html



However, when I write my script on Apache Jena Fuseki, it complains. 
I have attached a screenshot below






Thank you,

Ahmed Helal.



Note: The script in the screenshot is just for the sake of the example








Re: Construct Quads on Apache Jena Fuseki

2021-05-26 Thread Andy Seaborne

ARQ supports GRAPH in CONSTRUCT.

Need to use for a suitable MIME type for quads.

PREFIX : 

CONSTRUCT
{ GRAPH ?g { ?s  ?p ?o } }
WHERE
{
  VALUES ?g { :g1 :g2 }
  GRAPH ?g { ?s  ?p ?o }
}

Andy

On 26/05/2021 12:46, Mikael Pesonen wrote:


Hi,

sorry for replying to old thread. I would like to dump some graphs from 
corrupted db. Is there a way to dump them with one quad query instead of 
dumping each graph separately as triples?


On 03/12/2020 16.23, Ahmed Helal wrote:

Hi,

My query is:
CONSTRUCT {
   graph ?g
 {?s ?p ?o}
}
WHERE{
   GRAPH ?g { ?s ?p ?o }. values ?g {}
}

The interface shows an error/message for the second line saying (graph 
?g): This line is invalid. Expected: VAR1, VAR2...


This is the returned results:
{
   "readyState": 4,
   "responseText": "",
   "status": 200,
   "statusText": "OK"
}


Thank you,
Ahmed.




From: Rob Vesse 
Sent: Thursday, December 3, 2020 4:00 AM
To: users@jena.apache.org 
Subject: Re: Construct Quads on Apache Jena Fuseki

The list does not permit attachments so we cannot see screenshots.  
Please provide the example query that is failing and the error/log 
message(s) you see in relation to the failure




Rob



From: Ahmed Helal 
Reply to: 
Date: Thursday, 3 December 2020 at 06:26
To: "users@jena.apache.org" 
Subject: Construct Quads on Apache Jena Fuseki



Hello everyone,



I am trying to construct Quads following the documentation on this page:

https://jena.apache.org/documentation/query/construct-quad.html



However, when I write my script on Apache Jena Fuseki, it complains. I 
have attached a screenshot below






Thank you,

Ahmed Helal.



Note: The script in the screenshot is just for the sake of the example






Re: Construct Quads on Apache Jena Fuseki

2021-05-26 Thread Mikael Pesonen



Hi,

sorry for replying to old thread. I would like to dump some graphs from 
corrupted db. Is there a way to dump them with one quad query instead of 
dumping each graph separately as triples?


On 03/12/2020 16.23, Ahmed Helal wrote:

Hi,

My query is:
CONSTRUCT {
   graph ?g
 {?s ?p ?o}
}
WHERE{
   GRAPH ?g { ?s ?p ?o }. values ?g {}
}

The interface shows an error/message for the second line saying (graph ?g): 
This line is invalid. Expected: VAR1, VAR2...

This is the returned results:
{
   "readyState": 4,
   "responseText": "",
   "status": 200,
   "statusText": "OK"
}


Thank you,
Ahmed.




From: Rob Vesse 
Sent: Thursday, December 3, 2020 4:00 AM
To: users@jena.apache.org 
Subject: Re: Construct Quads on Apache Jena Fuseki

The list does not permit attachments so we cannot see screenshots.  Please 
provide the example query that is failing and the error/log message(s) you see 
in relation to the failure



Rob



From: Ahmed Helal 
Reply to: 
Date: Thursday, 3 December 2020 at 06:26
To: "users@jena.apache.org" 
Subject: Construct Quads on Apache Jena Fuseki



Hello everyone,



I am trying to construct Quads following the documentation on this page:

https://jena.apache.org/documentation/query/construct-quad.html



However, when I write my script on Apache Jena Fuseki, it complains. I have 
attached a screenshot below





Thank you,

Ahmed Helal.



Note: The script in the screenshot is just for the sake of the example